Skip to content

MY Open Source Community Discord Bot, HARDBOT

Behind the scenes, there's always been a Discord server that alerts moderators when someone posts on the board.

Keeping up with a small web site that's occasionally active where anyone can post without an account is something you can easily just forget about for long periods of time. Getting logs of what's going on there in third party apps is the main way I always know when someone has posted and quickly popped on to reply to their posts. Making sure that anyone who uses the site gets engaged with and isn't ignored has been the most useful thing about it.

And now you can join HARDCORD Community on Discord

I've open sourced my bot and made the server public. You can join us to chat, to keep up with the feeds and respond to board posts the same way I do, or to contribute with and play with the bot.

About the Bot

What features does the bot have?

Most of it is admin stuff. Logging, give users ability to provision other users with roles (to open other more exclusive channels and provide a vibe check layer) and other management tasks: deleting large number of posts, stuff like that.

It occurred to me that I need to start thinking about fun features, so I started a neocities integration.

For example anyone can do:

!neocities get dann

This will fetch the latest update from neocities and embed it into the channel.

At this early stage, the best thing the bot has going for it is the ease of contribution provided by the project structure and documentation.

Project Structure

HARDBOT uses a project structure using discord.py cogs that makes it easily extendable to a contributor. By following detailed instructions in the project README you could be up and running with development environment for the bot and a test guild to play with it in minutes.

Just save this in cogs/whatever.py:

import discord
from constants import role_names
from discord.ext import commands
from mixins import CommonCogMixin


class MyCog(commands.Cog, CommonCogMixin):
    """
    Handle Whatever
    """
    def __init__(self, bot):
        self.bot = bot

    # Add any methods, event listeners, or commands that go with your cog.

    async def handle_whatever(self, message):
        """
        Define Any Methods You Need
        """
        pass

    @commands.Cog.listener()
    async def on_message(self, message):
        """
        Register Event Listeners if you need them
        """
        await self.handle_whatever(message)

    @commands.command(name="whatever")
    @commands.has_role(role_names.member)  # Only VIP members
    async def do_whatever(self, ctx, whatever: str):
        """
        Provide commands
        """
        await ctx.send(f"Whatever man! {whatever}", delete_after=5)

async def setup(bot):
    await bot.add_cog(MyCog(bot))

Then register the cog in bot.py:

bot_extensions = [
    "cogs.logging",
    "cogs.administration",
    "cogs.neocities",
    "cogs.whatever", # Add yours to the bottom.
]

And it's pretty simple. The discord API is annoying as hell but it's as simple as it could possibly be to collaborate on it with this structure and (again) following these instructions to get set up.

Where is the Code That Integrates the Board?

This is actually accomplished using a webhook. The actual code lives on the board itself which is not currently open source, though I wonder sometimes if others would actually contribute if it was. The board is a much bigger and more difficult project to understand and work with if you're not completely familiar with its tech stack, whereas with HARDBOT, you can pretty easily jump right in.

What kind of PRs will be accepted?

Basically anything you want to do that sounds fun and won't break anything else or cause problems. Try anything once right? If you have an idea, put it together and I'll probably merge it.

Why do a Discord after all this time?

Always having had logs for the board coming to me on Discord naturally led me to consider, "What if I integrated the board with a Discord community," a long time ago. However I was always resistant to doing it. I didn't want the board to become Discord-like for lack of a better way to explain it. I also believed that encouraging users to participate in a Discord community would bring them away from my site. I also believed that the type of people who use Discord wouldn't commonly engage with independent sites anyway.

A couple of reasons I've changed my mind: It's a bit of hypocrisy on my part; I'm a prolific user of alternative sites and I'm on Discord. Additionally, the fate of the board no longer weighs heavily on me. It will live being whatever it is and it will die being whatever it is. There's no longer any will for me to shape it into something specific. It's just there. I have no horse in the race anymore.

And whether you want to use Discord or you don't -- and trust me, I don't blame you if you don't, I'm using the app frequently. And there's no reason not to have it be a point of contact for others since I'm already on it, whether it helps me find users who are interested in writing guest posts on the blog or who will engage with the board more often in the same way I do as a result.

Join HARDCORD