Skip to content

robherley/reb-bot

Repository files navigation

reb-bot

🤖 Your friendly neighborhood discord bot.

Development

Dependencies:

  • ruby: obviously
  • imagemagick: for rendering pretty charts 📊

You'll need the following env vars (either .env or however you want to supply):

DISCORD_TOKEN= # discord bot token
FMP_APIKEY= # api key from https://financialmodelingprep.com
REDIS_URL= # redis:// style connection URL

Then setup:

rob@local$ script/setup

Then run:

rob@local$ script/run

Creating a new command

Use the generator script:

rob@local$ script/generate-command -n foobar
command file generated: /workspaces/reb-bot/lib/commands/foobar.rb

And add your changes to the generated file.

Registering commands

For bots that use slash commands, they must be registered with Discord. Commands can be registered globally, or to a specific server. During development, it's recommended to register to a specific server since it will update instantly, then register it globally when ready.

Open a debug console with script/console:

server_id = Rebbot::TEST_SERVER_ID # or nil for global

# clean up old commands
bot.delete_commands!(server_id)

# register new commands
bot.register_commands!(server_id)