Skip to content

A Discord bot created to help me through my day. Its current focus is to handle "Pomodoro Technique"-style timeboxing notification.

License

Notifications You must be signed in to change notification settings

seanpfeifer/coffeebeanbot

Repository files navigation

CoffeeBeanBot

Discord Invite GoDoc Go Report Card Build Status

coffeebeanbot is a coffee bean inspired Discord bot created to help me through my day. Its current focus is to handle "Pomodoro Technique"-style timeboxing notification.

If you simply want to use the bot, and not run your own or customize it, you can invite it to your Discord server using this link.

  • /pomstart: Starts a pomodoro
  • /pomcancel: Cancels the pomodoro

Getting Started

Running using Docker

For Linux, assuming your discord.toml lives at ./secrets:

docker run -v $(pwd)/secrets:/secrets docker.pkg.github.com/seanpfeifer/coffeebeanbot/cbb:2.1.0

For Windows PowerShell, assuming your discord.toml lives at ./secrets:

docker run -v ${PWD}\secrets:/secrets docker.pkg.github.com/seanpfeifer/coffeebeanbot/cbb:2.1.0

Metrics are disabled by default (see Metrics below). If you want your container to report to Stackdriver, you need to override the Docker container's parameters to add -stackdriver:

docker run -v $(pwd)/secrets:/secrets docker.pkg.github.com/seanpfeifer/coffeebeanbot/cbb:2.1.0 -cfg /bot/cfg.toml -secrets /secrets/discord.toml -stackdriver

Installation

If you simply want to build + install the cbb binary on your own, run the following:

go get github.com/seanpfeifer/coffeebeanbot/cmd/cbb

Retrieve the package using:

go get github.com/seanpfeifer/coffeebeanbot

Build and install the cbb bot binary using:

go install github.com/seanpfeifer/coffeebeanbot/cmd/cbb

Configuration

Two files are used for configuration:

  • cfg.toml - general bot config
  • discord.toml - bot secrets that shouldn't be shared with others

Create a cfg.toml file that exists wherever you want to run the bot from.

Sample cfg.toml:

workEndAudio =  "audio/airhorn.dca"

Sample discord.toml:

authToken = "PASTE_AUTH_TOKEN_HERE"
appID = "PASTE_APPLICATION_ID_HERE"

The authToken and appID values can be found at https://discordapp.com/developers/applications/me

  • Create your App and copy the Application ID into your discord.toml.
  • Click Create a Bot User.
  • Under "App Bot User" click "click to reveal" on Token and copy the value into your discord.toml.
  • Save Changes.
  • Ensure your bot's Public Bot setting is what you want it to be.

Usage

Run the bot's cbb executable from the directory containing your cfg.toml and ./secrets/discord.toml. See the output of cbb -h for details.

Invite the bot to one of your servers via the URL https://discordapp.com/api/oauth2/authorize?client_id=CLIENT_ID_HERE&scope=bot%20applications.commands, replacing CLIENT_ID_HERE with your client ID shown in your config.

To show the current list of commands (and your bot's invite button), use the bot's profile in Discord.

Metrics

The following aggregated metrics can be recorded so you can tell how your service is performing:

  • connected_servers - the current number of connected servers (Discord Guilds)
  • pomodoros_running - the current number of Pomodoros actively running
  • pomodoros_started - the count of Pomodoros started

Aggregated metrics for your running servers are only ever sent to either standard output, or to your Stackdriver if you have it configured. No personal information is ever sent from this service.

To enable sending metrics to stdout, use the command-line parameter -stdoutMetrics

To enable sending metrics to your configured Stackdriver, use the command-line parameter -stackdriver