Alliance Auth Discord Bot

5.0.0 · active · verified Fri Apr 17

allianceauth-discordbot is a modular Discord bot designed to integrate deeply with Alliance Auth, a Django-based authentication system for EVE Online alliances. It provides features like user lookup, permissions management, and custom commands, leveraging Django's ORM and authentication. The current version is 5.0.0, and it maintains an active release cadence, often pushing minor updates and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

To quickly get started with allianceauth-discordbot, you need a running Alliance Auth (Django) project. This example shows how to define a simple custom cog within one of your Django applications. This cog provides two basic commands: `!myhello` (requires Alliance Auth 'basic_access' permission) and `!myping`. The bot is then run using `python manage.py runbot` after configuring `AABOT_TOKEN` and `AABOT_COG_PATH` in your Django `settings.py`.

import discord
from discord.ext import commands
from aadiscordbot.cogs.utils.decorators import has_perm

# This cog should be placed within a Django app included in INSTALLED_APPS
# and its path added to AABOT_COG_PATH in your Django settings.

class MyCustomCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.hybrid_command(name="myhello")
    @has_perm("aadiscordbot.basic_access") # Requires 'Basic Access' permission in Alliance Auth
    async def my_hello_command(self, ctx: commands.Context):
        """Greets the user from Alliance Auth bot."""
        await ctx.send(f"Hello from your custom cog, {ctx.author.display_name}!", ephemeral=True)

    @commands.hybrid_command(name="myping")
    async def my_ping_command(self, ctx: commands.Context):
        """Responds with the bot's latency."""
        await ctx.send(f"Pong! {round(self.bot.latency * 1000)}ms", ephemeral=True)

async def setup(bot):
    # This 'setup' function is called by the bot to load the cog.
    await bot.add_cog(MyCustomCog(bot))

# To run the bot, ensure it's configured in your Django settings (settings.py):
# INSTALLED_APPS = [
#     ...,
#     'aadiscordbot',
#     'my_django_app' # Where your custom cogs reside
# ]
# 
# AABOT_TOKEN = os.environ.get('AABOT_TOKEN', 'YOUR_DISCORD_BOT_TOKEN')
# AABOT_PREFIX = '!'
# AABOT_COG_PATH = ['my_django_app.cogs'] # List of paths to your cog modules
#
# Then, from your Django project root:
# python manage.py runbot

view raw JSON →