Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Slack bot that can execute Rust code

License

NotificationsYou must be signed in to change notification settings

oren0e/rusty-slackbot

Repository files navigation

CI passing

Rusty Slackbot

Slack bot that can execute Rust code

Installation

Currently this is only supported for mac/linux based systems.

Slack Steps

  1. You'll have to create an app on slack website
  2. EnableSocket Mode and subscribe to the following bot events:message.channels andapp_mention. This will generate a bot token for you that typically starts withxoxb-. You will need it later.
  3. You should also generate anApp-Level token with the scopeconnections:write. The generated token will start withxapp-.

Repository Steps

Note: You'll have to have docker and docker-compose installed in order to run this in a container environment.

  1. Clone this repository to/opt/
  2. In the repository folder, create a file called.env which will contain 4 environment variables, each on its own line in the format ofkey=value:
  • RUSTY_LOG_LEVEL which controls the logs level. Set it to DEBUG as a default.
  • PLAYGROUND_URL which should be set to the rust playground current URL. Currently it'shttps://play.rust-lang.org
  • SLACK_BOT_TOKEN which is the bot token you've generated before.
  • SLACK_APP_TOKEN which is the app token you've generated before.
  1. From the repository folder enter:make install
  2. Finally start the bot withmake run

Bot Supported Commands

Currently the bot has the following commands supported:

  • !code: Entering this following a new line with formatted Rust code (using 3 backticks (`) in slack) will execute the code and will generatestdout andstderr along with a playground link to the code.
  • !eval: As with the previous command you should type it as!eval followed by new line with formatted rust code using 3 backticks. This is for code that can live insidemain() - so you don't have to type main's signature itself. It is intended for evaluating simple expressions that do not require extra functions/imports.
  • !help:
    • !help docs - will output a link for rust docs
    • !help book - will output a link for the rust book
    • !help <anything else> - typing anything other than [docs, books] will display the available commands
  • @<botname>: Will generate a nice response from the bot

Some examples:

code

eval

TODO

  • Add support for Windows

About

Slack bot that can execute Rust code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp