Skip to content

Kardbord/Kard-bot

Repository files navigation

drawing

Kard-bot

Build CodeQL Docker Image Image Efficiency Go Report Card

A discord bot destined for greatness.

Table of Contents

Table of contents generated with markdown-toc

Features

  • Respond to user greetings and goodbyes
  • DnD dice roller
  • Copy-pastas
  • Reddit Roulette
  • Uwu-ifier
  • Print out a help message
  • Let users know when it is Wednesday
  • Daily compliments DM'd to users who opt in
  • Creepy DMs sent to users who opt in
  • Provide "odds" that a user specified event will occur
  • Build memes from provided templates and user provided text
  • Generate a story from a user's prompt
  • Allow server admins to generate and edit a role selection menu
  • Allow users to create embeds
  • Madlibs
  • Server Clock
  • User polls
  • AI text-to-image generation using DALL·E 2
  • Inform users when Kard-bot is updated
  • Mock certain questions or phrases
  • "Quack" any time a user types an expletive
  • Subscribe to social media accounts (maybe a webhook would be more appropriate?)
  • Play music via youtube à la rythm bot
  • Configurably replace words with other words
  • Search and link to DnD wiki articles
  • Allow users to query Google; provide direct links to top results and a link to all results
  • Youtube Roulette

User Guide

This bot is not publicly hosted anywhere. If you want to use it, you can always try hosting it yourself! :)

Hosting Installation

Hosting this bot requires a Discord Bot Token. You can generate one by visiting the Discord Developer Portal, and then creating a new application with an accompanying bot. Give the bot its needed permissions in the OAuth2 section (Be sure to tick the "applications.commands" box!), and then invite it to your server(s) using the link that is generated for you.

Now that the bot is invited, you should see it as an offline user in your server. Now you only need to start the bot backend to bring it online! You have three options:

  1. Using the provided Docker images
  2. Using a precompiled binary
  3. Building from source

Whichever you choose, you'll want to edit the included .env file to include the bot token you generated earlier. You'll also want to add any additional API tokens for functionality you plan on using, and set the time zone by setting the TZ variable.

KARDBOT_TOKEN="Your bot token here"
TZ="Your time zone here ex: America/Boise"

Host using Docker

Prerequisites

Instructions

Head over to the Releases page and download the kardbot-<TAG>.tar.gz tarball for the desired release. These tarballs contain everything needed to get an instance of the bot up and running, provided that the host machine has internet access. Untar it on the host machine.

With your token in place and your config updated, you can simply run docker-compose up -d from the untarred directory to get your bot started! The Docker daemon will automatically download the needed docker image from Docker Hub or the GitHub Container Registry. To check the status of the docker container, you can use docker ps -a or docker logs <CONTAINER-NAME>.

Precompiled Binaries

Prerequisites

  • Know your operating system and architecture.

Instructions

Head over to the Releases page and download the appropriate tarball for your operating system and architecture. Untar it on the host machine.

With your token in place and your config updated, you can simply run the Kard-bot binary to bring it to life! For a more robust running solution, consider creating a systemd service or using the provided Docker image.

Building from source

Prerequisites

  • The Go 1.18 runtime or later.

Instructions

Assuming you have the Go runtime installed, you can install Kard-bot with a simple set of shell commands.

go get github.com/Kardbord/Kard-bot
cd $GOPATH/src/github.com/Kardbord/Kard-bot
go build

With your token in place and your config updated, you can simply run the Kard-bot binary to bring it to life! For a more robust running solution, consider creating a systemd service or using the provided Docker image.

General Notes

Some commands are restricted so that only the bot owner can run them. The bot owner is specified by the KARDBOT_OWNER_ID environment variable. It can be set in the same manner as the KARDBOT_TOKEN variable. Its value should be the user ID of the bot owner. Note that this is not the same as the owner's username. The user ID is a unique ID assigned by Discord. You can retrieve it by enabling developer mode in your Discord client, right clicking a user, and selecting "Copy ID".

References

Useful resources for writing a Discord bot.

Discord API Wrappers

Documentation

Tutorials