effprime / BasementBot

Discord bot with a focus on creating your own plugins
GNU General Public License v3.0
2 stars 1 forks source link

BasementBot

BasementBot is a Dockerized Discord bot. Written on top of the Python Discord API, it provides the loading and unloading of custom extensions to extend and scale the bot as much as you want.

Setup

Note: this bot requires at minimum a MongoDB connection to maintain guild settings. If you wish to not use a MongoDB connection, check the base module for bots that don't rely on MongoDB.

Production

Development

Makefile

The Makefile offers shortcut commands for development.

Making extensions

On startup, the bot will load all extension files in the basement_bot/extensions/ directory. These files hold commands for the bot to use with its prefix. Each command is an async function decorated as a command, and each file must have an entrypoint function called setup, which tells the loading process how to add the extension file.

A (very) simple example:

import base
from discord.ext import commands

def setup(bot):
    bot.process_extension_setup(cogs=[Greeter])

class Greeter(base.BaseCog):
    @commands.command(
        name="hello",
        brief="Says hello to the bot",
        description="Says hello to the bot (because they are doing such a great job!)",
        usage="",
    )
    async def hello(self, ctx):
        # H, E, Y
        emojis = ["🇭", "🇪", "🇾"]
        for emoji in emojis:
            await ctx.message.add_reaction(emoji)

Extensions can be configured per-guild with settings saved on MongoDB. There are several extensions included in the main repo, so please reference them for more advanced examples.