quotebot-go

command module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

QuoteBot

QuoteBot is a Discord bot that allows users to add and retrieve quotes. It is built using Go and the Disgo library.

Features

  • Add quotes via a modal interaction, optionally with who said it and when (2020, 2020-03 or 2020-03-14). Quotes then show a -- Ethan, March 2020 line.
  • Retrieve and display quotes
  • Edit (/edit-quote id:) and delete (/delete-quote id:) quotes. Get a quote's ID with /quote show-id:true.

The bot also records who added each quote and when (not shown). Quotes added before this existed don't have that information.

Who can edit and delete quotes

/edit-quote and /delete-quote are admin-only by default. To let another role use them, go to Server Settings → Integrations → Quote Bot, pick the command and add the role. Deleting is permanent, so run /export first if you want a backup.

Prerequisites

  • Docker
  • A Discord bot token

Getting Started

Clone the Repository
git clone https://github.com/yourusername/quotebot-go.git
cd quotebot-go

Running with Docker Compose / Portainer

docker-compose.yml runs the bot together with its own Postgres database. The database is set up and connected automatically and isn't exposed outside the stack, so you only need to provide the Discord settings:

Variable Required Description
TOKEN yes Discord bot token
GUILD_ID yes ID of the server the bot runs in
OWNER_ID for /export and /import Your Discord user ID
NEW_QUOTE_WEBHOOK no Webhook URL that new quotes are posted to
ALLOWED_CHANNELS no command:channelID pairs, comma separated
COOLDOWN_DURATION no Per-user command cooldown, default 60s
ENABLE_TRANSFER_COMMANDS no true registers /export and /import, default false
PG_DB_PASS no Database password inside the stack, default quotebot
  • Docker Compose: copy .env.sample to .env, fill it in, and run docker compose up -d.
  • Portainer: create a stack from docker-compose.yml and set the variables above in the stack's environment variables.

To find your user ID, turn on Developer Mode in Discord (Settings → Advanced), then right-click your name and choose Copy User ID.

Moving the bot to a new host

/export and /import copy every quote from one instance to another. They only exist while ENABLE_TRANSFER_COMMANDS=true, and only the user in OWNER_ID can run them.

  1. Publish a GitHub release first. That builds the :latest image that contains these commands.
  2. On the old instance, set OWNER_ID and ENABLE_TRANSFER_COMMANDS=true and redeploy with the latest image. In Portainer, Recreate keeps the old settings, so use one of these instead:
    • Deployed as a stack: open the stack, add the two variables under Environment variables, then Update the stack with Re-pull image turned on.
    • Deployed as a single container: open the container, choose Duplicate/Edit, add the two variables under Advanced container settings → Env, turn on Always pull the image, then Deploy the container and confirm replacing the old one.
  3. Run /export. The bot DMs you quotebot-export-YYYY-MM-DD.json. Save it.
  4. Stop the old container. Never run two instances with the same token at once: both would answer every command.
  5. Start the new instance (for example the compose stack above) with the same OWNER_ID and ENABLE_TRANSFER_COMMANDS=true. Run /import and attach the file. Quotes that already exist are skipped, so running it twice is harmless.
  6. Turn ENABLE_TRANSFER_COMMANDS off (or remove it) and restart. The commands disappear from Discord.

You can turn the switch on at any time and run /export to take a backup.

TODO List

  • Add Quote Command: Implement the command to add quotes via a modal interaction.
    • Display UUID: add ability to show id for the quote.
  • Database Integration: Set up and integrate a database to store quotes.
  • Error Handling: Improve error handling and logging throughout the application.
  • Edit Quote Command: Edit a quote's text, who said it and when.
  • Delete Quote Command: Delete a quote after confirming.
  • Retrieve Quote Command: Implement the command to retrieve and display quotes based off of id.
  • Multi Quote Command: Implement the command to retrieve and display multiple quotes.
  • Unit Tests: Write unit tests for the commands and database interactions.
  • Docker Compose: Create a Docker Compose file to simplify the setup of the development environment.

Feel free to contribute by opening an issue or submitting a pull request!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
accessors

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址