allianceauth-discordbot


Nameallianceauth-discordbot JSON
Version 3.8.2 PyPI version JSON
download
home_pageNone
SummaryAlliance Auth Modular Discord Bot
upload_time2024-08-03 00:36:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords allianceauth eveonline
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # AA-Discordbot

AA-Discordbot for [Alliance Auth](https://gitlab.com/allianceauth/allianceauth).

[![PyPi](https://img.shields.io/pypi/v/allianceauth-discordbot?color=green)](https://pypi.org/project/allianceauth-discordbot/)

## Features

* Bot Framework, easily extensible with more Cogs
* Integration with Alliance Auth, able to fetch data directly from its django project.
* Channel/Direct messaging feature, with Tasks and a Queue/Consumer
* Current Cogs
  * About
    * !about - Bot Information and Statistics
  * Auth
    * !auth or /auth - A direct link to the Auth Install to catch users familiar with other bots.
  * Members
    * !lookup [search string] - Fetch a users Main, Affiliation, State, Groups and linked characters from any character.
    * !altcorp [search string] - search for users with characters in an altcorp
  * Remind
    * !remindme [5s/m/h/d text] - Sets a simple non-persistent reminder timer when the bot will respond with the text
  * Sov
    * !vuln [context] - Returns a list of Vulnerable sov structures for a Region/Constellation/Solar_System or alliance
    * !sov [context] - Returns a list of _all_ sov structures for a Region/Constellation/Solar_System or alliance
    * !lowadm - Lists sov in need of ADM-ing, context provided in settings.
  * Time
    * !time or /time - Returns the current EVE Time.
  * Timers
    * !timer - Returns the next Structure timer from allianceauth.timerboard.
  * Ticket
    * /help and Message context command to create private support threads
  * PriceCheck:
    * amarr - Check an item price on Amarr market
    * jita -  Check an item price on Jita market
    * price - Check an item price on Jita and Amarr market
  * Easter Eggs,
    * !happybirthday [text] - Wishes the text a happy birthday, works with user mentions
  * WelcomeGoodbye
    * Welcome - Responds to user join events with predefined messages.
    * Goodbye - Responds to user leave events with predefined messages.
  * Admin
    * Slash commands to help with setting up a discord server when you are not admin or owner.
    * accessed via `/admin [command]`
    * add_role / add_role_read / rem_role - add/remove a role to a channel
    * new_channel - create a new channel and assign it a role for read access
    * promote_role_to_god/demote_role_to_god - promote/demote a role to/from full admin so for when you need it
    * empty_roles - list all roles on server with no members
    * clear_empty_roles - remove all empty roles from the server
    * orphans - find any user in discord with no auth user attached
    * get_webhooks - returns any webhooks setup in this current channel, or creates one for you and returns that
    * uptime - how long the bot has been up for

## Installation

* Ensure you have installed and configured the Alliance Auth Discord Service, <https://allianceauth.readthedocs.io/en/latest/features/services/discord.html>

* Update your [Discord Developer Application](https://discord.com/developers/applications) to include the Privileged Intents that we call. Please enable all intents.

![screenshot](https://i.imgur.com/A1yA24P.png)

* Install the app with your venv active

```bash
pip install allianceauth-discordbot
```

* Add `'aadiscordbot',` and  `'solo',` to your INSTALLED_APPS list in local.py.

* Add the below lines to your `local.py` settings file, Changing the contexts to yours.

```python
## Settings for Allianceauth-Discordbot
# Admin Commands
ADMIN_DISCORD_BOT_CHANNELS = [111, 222, 333]
# Sov Commands
SOV_DISCORD_BOT_CHANNELS = [111, 222, 333]
# Adm Commands
ADM_DISCORD_BOT_CHANNELS = [111, 222, 333]

DISCORD_BOT_SOV_STRUCTURE_OWNER_IDS = [1000169] # Centre for Advanced Studies example
DISCORD_BOT_MEMBER_ALLIANCES = [111, 222, 333] # A list of alliances to be considered "Mains"

DISCORD_BOT_ADM_REGIONS = [10000002] # The Forge Example
DISCORD_BOT_ADM_SYSTEMS = [30000142] # Jita Example
DISCORD_BOT_ADM_CONSTELLATIONS = [20000020] # Kimitoro Example

PRICE_CHECK_HOSTNAME = "evepraisal.com" # Point to your favorite evepraisal
```

```python
## Insert AADiscordBot's logging into Django Logging config
LOGGING['handlers']['bot_log_file']= {
            'level': 'INFO',
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': os.path.join(BASE_DIR, 'log/discord_bot.log'),
            'formatter': 'verbose',
            'maxBytes': 1024 * 1024 * 5,
            'backupCount': 5,
        }
LOGGING['loggers']['aadiscordbot'] = {'handlers': ['bot_log_file'],'level': 'DEBUG'}
```

* Add the below lines to `myauth/celery.py` somewhere above the `app.autodiscover_tasks...` line

```python

## Route AA Discord bot tasks away from AllianceAuth
app.conf.task_routes = {'aadiscordbot.tasks.*': {'queue': 'aadiscordbot'}}
```

* Run migrations `python manage.py migrate` (There should be none from this app)
* Gather your static files `python manage.py collectstatic` (There should be none from this app)

* Fetch `bot_conf.py` from the Git Repo into the root of your AA install, beside `manage.py`

```bash
wget https://raw.githubusercontent.com/pvyParts/allianceauth-discordbot/master/bot_conf.py
```

## Running Discordbot with Docker

* To download the `bot_conf.py` file into your `conf/` folder, run the following from your aa-docker folder
```bash
wget https://raw.githubusercontent.com/pvyParts/allianceauth-discordbot/master/bot_conf.py -O conf/bot_conf.py
```
* Update base image to have bot_conf.py mapped

```dockerfile
x-allianceauth-base:

# image: ${AA_DOCKER_TAG?err}

  &allianceauth-base
  build:
    context: .
    dockerfile: custom.dockerfile
    args:
      AA_DOCKER_TAG: ${AA_DOCKER_TAG?err}
  restart: always
  env_file:
    - ./.env
  volumes:
...
    - ./conf/bot_conf.py:/home/allianceauth/myauth/bot_conf.py
...
```

Add a service to run the Discordbot

```dockerfile
  allianceauth_discordbot:
    container_name: allianceauth_discordbot
    <<: [ *allianceauth-base ]
    restart: on-failure:1
    entrypoint: [ "python", "/home/allianceauth/myauth/bot_conf.py" ]
```

## Running DiscordBot with Supervisor

* Amend your supervisor.conf, correcting paths as required and add `authbot` to the launch group at the end of the conf

```ini
[program:authbot]
command=/home/allianceserver/venv/auth/bin/python /home/allianceserver/myauth/bot_conf.py
directory=/home/allianceserver/myauth
user=allianceserver
numprocs=1
autostart=true
autorestart=true
stopwaitsecs=600
stdout_logfile=/home/allianceserver/myauth/log/authbot.log
stderr_logfile=/home/allianceserver/myauth/log/authbot.log
```

```ini
#This block should already exist, add authbot to it
[group:myauth]
programs=beat,worker,gunicorn,authbot
priority=999
```

Go to admin and configure your admin users in the bot config model.

> Enable groups/states/users to utilize the lookup command by adding permissions under **corputils | corp stats |**

```ini
corputils.view_alliance_corpstats
```

## Optional Settings

### Built in Cogs
```python
# Change the bots default Cogs, add or remove if you want to use any of the extra cogs.

DISCORD_BOT_COGS = [
  "aadiscordbot.cogs.about", # about the bot
  "aadiscordbot.cogs.admin", # Discord server admin helpers
  "aadiscordbot.cogs.members", # Member lookup commands
  "aadiscordbot.cogs.timers", # timer board integration
  "aadiscordbot.cogs.auth", # return auth url
  "aadiscordbot.cogs.sov", # some sov helpers
  "aadiscordbot.cogs.time", # whats the time Mr Eve Server
  "aadiscordbot.cogs.eastereggs", # some "fun" commands from ariel...
  "aadiscordbot.cogs.remind", # very Basic in memory reminder tool
  "aadiscordbot.cogs.reaction_roles", # auth group integrated reaction roles
  "aadiscordbot.cogs.services", # service activation data
  "aadiscordbot.cogs.price_check", # Price Checks
  "aadiscordbot.cogs.eightball", # 8ball should i install this cog
  "aadiscordbot.cogs.welcomegoodbye", # Customizable user join/leave messages
  "aadiscordbot.cogs.models", # Populate and Maintain Django Models for Channels and Servers
  "aadiscordbot.cogs.quote", # Save and recall messages
  "aadiscordbot.cogs.prom_export", # Admin Level Logging cog
  "aadiscordbot.cogs.tickets", # Private thread ticket system with pingable groups.
  "aadiscordbot.cogs.recruit_me", # Private thread recruitment ticket system.
  ]
```

### Additional Rate Limiting

```python
# configure the optional rate limited
# this is a bot_task function and how many / time period
# 100/s equates to 100 per second max
# 10/m equates to 10 per minute or 1 every 6 seconds max
# 60/h equates to 60 per hour or one per minute max
DISCORD_BOT_TASK_RATE_LIMITS = {
        "send_channel_message_by_discord_id": "100/s",
        "send_direct_message_by_discord_id": "1/s",
        "send_direct_message_by_user_id": "1/s"
        }
```

## Reaction Roles
>
> ❗❗❗ **This will bypass the Group Leadership/Join Request System**: This is intended for open groups but not limited to it! ❗❗❗

The bot is able to run a reaction roles system that is compatible with auth and public users on a discord.

* If a member is part of auth it will do auth syncing of roles
* If a member is not found in auth and the reaction role message has the public flag set it will assign roles to anyone who reacts

### How To Reaction Role

 1. Setup the inital Message you wish to use buy using the command `!rr`

    * _Optional_ Edit the name and settings of this message in `Admin > Discord Bot > Reaction Role Messages`

 2. React to the message with the reactions you wish to use.
 3. The bot will counter react to the reactions when it creates the binding in auth.
 4. Goto `Admin > Discord Bot > Reaction Role Bindings`
 5. Assign the groups you want for each reaction

#### Messages Admin

![https://cdn.discordapp.com/attachments/639369068930924546/936082605156237332/unknown.png](https://cdn.discordapp.com/attachments/639369068930924546/936082605156237332/unknown.png)

#### Reactions Admin

![https://cdn.discordapp.com/attachments/639369068930924546/936084126379962378/unknown.png](https://cdn.discordapp.com/attachments/639369068930924546/936084126379962378/unknown.png)

## Integrations

* [Statistics](https://github.com/pvyParts/aa-statistics)
  * Adds zkill Monthly/Yearly stats to !lookup
* [timezones](https://github.com/ppfeufer/aa-timezones)
  * Updates the `time` command to have all timezones configured in auth.

## Welcome Messaages

`
With the WelcomeGoodbye Cog activated, Discordbot will grab a random message from the Welcome or Goodbye Message Model and send it to the Guild System channel

These can be configured in admin under `/admin/aadiscordbot/welcomemessage/` and `/admin/aadiscordbot/goodbyemessage/`

The messages support some string formatting

* `{user_mention} - A Discord @ Mention
* `{guild_name} - The name of the Discord Server
* `{auth_url} - A link to Auth

```text
Welcome {user_mention} to {guild_name}, I hope you enjoy your stay.

You can Authenticate for more access {auth_url}
```

## Private Thread Ticket System

> ❗❗❗ **While this is fully functional, this is still in early stages of development, Please report any issues you find!** ❗❗❗

With the `aadiscordbot.cogs.tickets` Cog activated, users wll be able to issue the `/help` command to pick a group to get help from.

The groups available for selection are configurable in the site admin under
`Discord Bot > Ticket Cog Configuration`

You also need to choose a channel to create the threads in from the site admin `Discord Bot > Ticket Cog Configuration`:

* Anyone who can use the `/help` command must have View and Send Message permissions on this channel otherwise they will not be able to see the tickets authbot creates for them
* Authbot must have the permissions to create private threads in this channel
* Authbot must have the permissions to send messages to this channel

## Using AA-Discordbot from my project

### Send Messages

You can use the send_message helper to send a message with text/embed to:

* Discord user_id
* Discord channel_id
* Auth User Model Object
* Auth user_pk

[aadiscordbot/tasks.py](https://github.com/pvyParts/allianceauth-discordbot/blob/master/aadiscordbot/tasks.py)

### Example Usage

```python
from django.contrib.auth.models import User
from django.apps import apps

## Use a small helper to check if AA-Discordbot is installs
def discord_bot_active():
    return apps.is_installed('aadiscordbot')

## Only import it, if it is installed
if discord_bot_active():
    from aadiscordbot.tasks import send_message
    # if you want to send discord embed import them too.
    from discord import Embed, Color

## this helper can be called to Queue up a Message
## AA Should not act on these, only AA-DiscordBot will consume them
if discord_bot_active():
    usr = User.objects.get(pk=1)

    # discord ID of user
    msg = "Channel ID Tests"
    e = Embed(title="Channel ID Tests!",
              description="This is a Test Embed.\n\n```Discord Channel ID```",
              color=Color.yellow())
    e.add_field(name="Test Field 1", value="Value of some kind goes here")
    send_message(channel_id=639252062818926642, embed=e) # Embed
    send_message(channel_id=639252062818926642, message=msg) # Message
    send_message(channel_id=639252062818926642, message=msg, embed=e) # Both

    # Discord ID of channel
    msg = "User ID Tests"
    e = Embed(title="User ID Tests!",
              description="This is a Test Embed.\n\n```Discord User ID```",
              color=Color.nitro_pink())
    e.add_field(name="Test Field 1", value="Value of some kind goes here")

    send_message(user_id=318309023478972417, embed=e) # Embed
    send_message(user_id=318309023478972417, message=msg) # Message
    send_message(user_id=318309023478972417, message=msg, embed=e) # Both

    # User model
    msg = "Auth User Model Tests"
    e = Embed(title="Auth User Model Tests!",
              description="This is a Test Embed.\n\n```Auth User Model```",
              color=Color.dark_orange())
    e.add_field(name="Test Field 1", value="Value of some kind goes here")
    send_message(user=usr, embed=e) # Embed
    send_message(user=usr, message=msg) # Message
    send_message(user=usr, message=msg, embed=e) # Both

    # User PK id
    msg = "Auth User PK Tests"
    e = Embed(title="Auth User PK Tests!",
              description="This is a Test Embed.\n\n```Auth User PK```",
              color=Color.brand_green())
    e.add_field(name="Test Field 1", value="Value of some kind goes here")
    send_message(user_pk=1, embed=e) # Embed
    send_message(user_pk=1, message=msg) # Message
    send_message(user_pk=1, message=msg, embed=e) # Both

    # Mixture of all of the above
    msg = "All Together Tests"
    e = Embed(title="All Together Tests!",
              description="This is a Test Embed.\n\n```All Together```",
              color=Color.blurple())
    e.add_field(name="Test Field 1", value="Value of some kind goes here")
    send_message(channel_id=639252062818926642,
                user_id=318309023478972417,
                user=User.objects.get(pk=1),
                message=msg,
                embed=e)
```

### Registering 3rd Party Cogs (Handling Commands)

In `auth_hooks.py`, define a function that returns an array of cog modules, and register it as a `discord_cogs_hook`:

```python
@hooks.register('discord_cogs_hook')
def register_cogs():
    return ["yourapp.cogs.cog_a", "yourapp.cogs.cog_b"]
```

## Optional Settings continued

### Isolate AuthBot from Auth's Discord Service

```python
AUTHBOT_DISCORD_APP_ID = 'App ID for dedicated bot'
AUTHBOT_DISCORD_BOT_TOKEN = 'Token for dedicated bot'
```

## Issues

Please remember to report any aa-discordbot related issues using the issues on **this** repository.

## Troubleshooting

### Py-Cord and discord.py fighting in venv

**Problem:**

Something has gone funny with my venv after i installed another app that wanted `discord.py`

**Reason:**

This is due to the Py-cord lib sharing the `discord` namespace. Py-Cord is however a drop in replacement. So no issues should arise from using it over the now legacy discord.py lib. **YMMV**

**Fix:**

 1. Uninstall `discord.py` by running `pip uninstall discord.py` with your venv active.
 2. Reinstall `py-cord` by running `pip install -U py-cord==2.0.0b3` with your venv active.
 3. Approach the dev from the app that overrode your py-cord to update to a maintained lib.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "allianceauth-discordbot",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "allianceauth, eveonline",
    "author": null,
    "author_email": "AaronKable <aaronkable@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/21/dc/b8ad3bd2f725ba03c4ed1feb07014763fa5adf484598f64dad2e48267246/allianceauth_discordbot-3.8.2.tar.gz",
    "platform": null,
    "description": "# AA-Discordbot\n\nAA-Discordbot for [Alliance Auth](https://gitlab.com/allianceauth/allianceauth).\n\n[![PyPi](https://img.shields.io/pypi/v/allianceauth-discordbot?color=green)](https://pypi.org/project/allianceauth-discordbot/)\n\n## Features\n\n* Bot Framework, easily extensible with more Cogs\n* Integration with Alliance Auth, able to fetch data directly from its django project.\n* Channel/Direct messaging feature, with Tasks and a Queue/Consumer\n* Current Cogs\n  * About\n    * !about - Bot Information and Statistics\n  * Auth\n    * !auth or /auth - A direct link to the Auth Install to catch users familiar with other bots.\n  * Members\n    * !lookup [search string] - Fetch a users Main, Affiliation, State, Groups and linked characters from any character.\n    * !altcorp [search string] - search for users with characters in an altcorp\n  * Remind\n    * !remindme [5s/m/h/d text] - Sets a simple non-persistent reminder timer when the bot will respond with the text\n  * Sov\n    * !vuln [context] - Returns a list of Vulnerable sov structures for a Region/Constellation/Solar_System or alliance\n    * !sov [context] - Returns a list of _all_ sov structures for a Region/Constellation/Solar_System or alliance\n    * !lowadm - Lists sov in need of ADM-ing, context provided in settings.\n  * Time\n    * !time or /time - Returns the current EVE Time.\n  * Timers\n    * !timer - Returns the next Structure timer from allianceauth.timerboard.\n  * Ticket\n    * /help and Message context command to create private support threads\n  * PriceCheck:\n    * amarr - Check an item price on Amarr market\n    * jita -  Check an item price on Jita market\n    * price - Check an item price on Jita and Amarr market\n  * Easter Eggs,\n    * !happybirthday [text] - Wishes the text a happy birthday, works with user mentions\n  * WelcomeGoodbye\n    * Welcome - Responds to user join events with predefined messages.\n    * Goodbye - Responds to user leave events with predefined messages.\n  * Admin\n    * Slash commands to help with setting up a discord server when you are not admin or owner.\n    * accessed via `/admin [command]`\n    * add_role / add_role_read / rem_role - add/remove a role to a channel\n    * new_channel - create a new channel and assign it a role for read access\n    * promote_role_to_god/demote_role_to_god - promote/demote a role to/from full admin so for when you need it\n    * empty_roles - list all roles on server with no members\n    * clear_empty_roles - remove all empty roles from the server\n    * orphans - find any user in discord with no auth user attached\n    * get_webhooks - returns any webhooks setup in this current channel, or creates one for you and returns that\n    * uptime - how long the bot has been up for\n\n## Installation\n\n* Ensure you have installed and configured the Alliance Auth Discord Service, <https://allianceauth.readthedocs.io/en/latest/features/services/discord.html>\n\n* Update your [Discord Developer Application](https://discord.com/developers/applications) to include the Privileged Intents that we call. Please enable all intents.\n\n![screenshot](https://i.imgur.com/A1yA24P.png)\n\n* Install the app with your venv active\n\n```bash\npip install allianceauth-discordbot\n```\n\n* Add `'aadiscordbot',` and  `'solo',` to your INSTALLED_APPS list in local.py.\n\n* Add the below lines to your `local.py` settings file, Changing the contexts to yours.\n\n```python\n## Settings for Allianceauth-Discordbot\n# Admin Commands\nADMIN_DISCORD_BOT_CHANNELS = [111, 222, 333]\n# Sov Commands\nSOV_DISCORD_BOT_CHANNELS = [111, 222, 333]\n# Adm Commands\nADM_DISCORD_BOT_CHANNELS = [111, 222, 333]\n\nDISCORD_BOT_SOV_STRUCTURE_OWNER_IDS = [1000169] # Centre for Advanced Studies example\nDISCORD_BOT_MEMBER_ALLIANCES = [111, 222, 333] # A list of alliances to be considered \"Mains\"\n\nDISCORD_BOT_ADM_REGIONS = [10000002] # The Forge Example\nDISCORD_BOT_ADM_SYSTEMS = [30000142] # Jita Example\nDISCORD_BOT_ADM_CONSTELLATIONS = [20000020] # Kimitoro Example\n\nPRICE_CHECK_HOSTNAME = \"evepraisal.com\" # Point to your favorite evepraisal\n```\n\n```python\n## Insert AADiscordBot's logging into Django Logging config\nLOGGING['handlers']['bot_log_file']= {\n            'level': 'INFO',\n            'class': 'logging.handlers.RotatingFileHandler',\n            'filename': os.path.join(BASE_DIR, 'log/discord_bot.log'),\n            'formatter': 'verbose',\n            'maxBytes': 1024 * 1024 * 5,\n            'backupCount': 5,\n        }\nLOGGING['loggers']['aadiscordbot'] = {'handlers': ['bot_log_file'],'level': 'DEBUG'}\n```\n\n* Add the below lines to `myauth/celery.py` somewhere above the `app.autodiscover_tasks...` line\n\n```python\n\n## Route AA Discord bot tasks away from AllianceAuth\napp.conf.task_routes = {'aadiscordbot.tasks.*': {'queue': 'aadiscordbot'}}\n```\n\n* Run migrations `python manage.py migrate` (There should be none from this app)\n* Gather your static files `python manage.py collectstatic` (There should be none from this app)\n\n* Fetch `bot_conf.py` from the Git Repo into the root of your AA install, beside `manage.py`\n\n```bash\nwget https://raw.githubusercontent.com/pvyParts/allianceauth-discordbot/master/bot_conf.py\n```\n\n## Running Discordbot with Docker\n\n* To download the `bot_conf.py` file into your `conf/` folder, run the following from your aa-docker folder\n```bash\nwget https://raw.githubusercontent.com/pvyParts/allianceauth-discordbot/master/bot_conf.py -O conf/bot_conf.py\n```\n* Update base image to have bot_conf.py mapped\n\n```dockerfile\nx-allianceauth-base:\n\n# image: ${AA_DOCKER_TAG?err}\n\n  &allianceauth-base\n  build:\n    context: .\n    dockerfile: custom.dockerfile\n    args:\n      AA_DOCKER_TAG: ${AA_DOCKER_TAG?err}\n  restart: always\n  env_file:\n    - ./.env\n  volumes:\n...\n    - ./conf/bot_conf.py:/home/allianceauth/myauth/bot_conf.py\n...\n```\n\nAdd a service to run the Discordbot\n\n```dockerfile\n  allianceauth_discordbot:\n    container_name: allianceauth_discordbot\n    <<: [ *allianceauth-base ]\n    restart: on-failure:1\n    entrypoint: [ \"python\", \"/home/allianceauth/myauth/bot_conf.py\" ]\n```\n\n## Running DiscordBot with Supervisor\n\n* Amend your supervisor.conf, correcting paths as required and add `authbot` to the launch group at the end of the conf\n\n```ini\n[program:authbot]\ncommand=/home/allianceserver/venv/auth/bin/python /home/allianceserver/myauth/bot_conf.py\ndirectory=/home/allianceserver/myauth\nuser=allianceserver\nnumprocs=1\nautostart=true\nautorestart=true\nstopwaitsecs=600\nstdout_logfile=/home/allianceserver/myauth/log/authbot.log\nstderr_logfile=/home/allianceserver/myauth/log/authbot.log\n```\n\n```ini\n#This block should already exist, add authbot to it\n[group:myauth]\nprograms=beat,worker,gunicorn,authbot\npriority=999\n```\n\nGo to admin and configure your admin users in the bot config model.\n\n> Enable groups/states/users to utilize the lookup command by adding permissions under **corputils | corp stats |**\n\n```ini\ncorputils.view_alliance_corpstats\n```\n\n## Optional Settings\n\n### Built in Cogs\n```python\n# Change the bots default Cogs, add or remove if you want to use any of the extra cogs.\n\nDISCORD_BOT_COGS = [\n  \"aadiscordbot.cogs.about\", # about the bot\n  \"aadiscordbot.cogs.admin\", # Discord server admin helpers\n  \"aadiscordbot.cogs.members\", # Member lookup commands\n  \"aadiscordbot.cogs.timers\", # timer board integration\n  \"aadiscordbot.cogs.auth\", # return auth url\n  \"aadiscordbot.cogs.sov\", # some sov helpers\n  \"aadiscordbot.cogs.time\", # whats the time Mr Eve Server\n  \"aadiscordbot.cogs.eastereggs\", # some \"fun\" commands from ariel...\n  \"aadiscordbot.cogs.remind\", # very Basic in memory reminder tool\n  \"aadiscordbot.cogs.reaction_roles\", # auth group integrated reaction roles\n  \"aadiscordbot.cogs.services\", # service activation data\n  \"aadiscordbot.cogs.price_check\", # Price Checks\n  \"aadiscordbot.cogs.eightball\", # 8ball should i install this cog\n  \"aadiscordbot.cogs.welcomegoodbye\", # Customizable user join/leave messages\n  \"aadiscordbot.cogs.models\", # Populate and Maintain Django Models for Channels and Servers\n  \"aadiscordbot.cogs.quote\", # Save and recall messages\n  \"aadiscordbot.cogs.prom_export\", # Admin Level Logging cog\n  \"aadiscordbot.cogs.tickets\", # Private thread ticket system with pingable groups.\n  \"aadiscordbot.cogs.recruit_me\", # Private thread recruitment ticket system.\n  ]\n```\n\n### Additional Rate Limiting\n\n```python\n# configure the optional rate limited\n# this is a bot_task function and how many / time period\n# 100/s equates to 100 per second max\n# 10/m equates to 10 per minute or 1 every 6 seconds max\n# 60/h equates to 60 per hour or one per minute max\nDISCORD_BOT_TASK_RATE_LIMITS = {\n        \"send_channel_message_by_discord_id\": \"100/s\",\n        \"send_direct_message_by_discord_id\": \"1/s\",\n        \"send_direct_message_by_user_id\": \"1/s\"\n        }\n```\n\n## Reaction Roles\n>\n> \u2757\u2757\u2757 **This will bypass the Group Leadership/Join Request System**: This is intended for open groups but not limited to it! \u2757\u2757\u2757\n\nThe bot is able to run a reaction roles system that is compatible with auth and public users on a discord.\n\n* If a member is part of auth it will do auth syncing of roles\n* If a member is not found in auth and the reaction role message has the public flag set it will assign roles to anyone who reacts\n\n### How To Reaction Role\n\n 1. Setup the inital Message you wish to use buy using the command `!rr`\n\n    * _Optional_ Edit the name and settings of this message in `Admin > Discord Bot > Reaction Role Messages`\n\n 2. React to the message with the reactions you wish to use.\n 3. The bot will counter react to the reactions when it creates the binding in auth.\n 4. Goto `Admin > Discord Bot > Reaction Role Bindings`\n 5. Assign the groups you want for each reaction\n\n#### Messages Admin\n\n![https://cdn.discordapp.com/attachments/639369068930924546/936082605156237332/unknown.png](https://cdn.discordapp.com/attachments/639369068930924546/936082605156237332/unknown.png)\n\n#### Reactions Admin\n\n![https://cdn.discordapp.com/attachments/639369068930924546/936084126379962378/unknown.png](https://cdn.discordapp.com/attachments/639369068930924546/936084126379962378/unknown.png)\n\n## Integrations\n\n* [Statistics](https://github.com/pvyParts/aa-statistics)\n  * Adds zkill Monthly/Yearly stats to !lookup\n* [timezones](https://github.com/ppfeufer/aa-timezones)\n  * Updates the `time` command to have all timezones configured in auth.\n\n## Welcome Messaages\n\n`\nWith the WelcomeGoodbye Cog activated, Discordbot will grab a random message from the Welcome or Goodbye Message Model and send it to the Guild System channel\n\nThese can be configured in admin under `/admin/aadiscordbot/welcomemessage/` and `/admin/aadiscordbot/goodbyemessage/`\n\nThe messages support some string formatting\n\n* `{user_mention} - A Discord @ Mention\n* `{guild_name} - The name of the Discord Server\n* `{auth_url} - A link to Auth\n\n```text\nWelcome {user_mention} to {guild_name}, I hope you enjoy your stay.\n\nYou can Authenticate for more access {auth_url}\n```\n\n## Private Thread Ticket System\n\n> \u2757\u2757\u2757 **While this is fully functional, this is still in early stages of development, Please report any issues you find!** \u2757\u2757\u2757\n\nWith the `aadiscordbot.cogs.tickets` Cog activated, users wll be able to issue the `/help` command to pick a group to get help from.\n\nThe groups available for selection are configurable in the site admin under\n`Discord Bot > Ticket Cog Configuration`\n\nYou also need to choose a channel to create the threads in from the site admin `Discord Bot > Ticket Cog Configuration`:\n\n* Anyone who can use the `/help` command must have View and Send Message permissions on this channel otherwise they will not be able to see the tickets authbot creates for them\n* Authbot must have the permissions to create private threads in this channel\n* Authbot must have the permissions to send messages to this channel\n\n## Using AA-Discordbot from my project\n\n### Send Messages\n\nYou can use the send_message helper to send a message with text/embed to:\n\n* Discord user_id\n* Discord channel_id\n* Auth User Model Object\n* Auth user_pk\n\n[aadiscordbot/tasks.py](https://github.com/pvyParts/allianceauth-discordbot/blob/master/aadiscordbot/tasks.py)\n\n### Example Usage\n\n```python\nfrom django.contrib.auth.models import User\nfrom django.apps import apps\n\n## Use a small helper to check if AA-Discordbot is installs\ndef discord_bot_active():\n    return apps.is_installed('aadiscordbot')\n\n## Only import it, if it is installed\nif discord_bot_active():\n    from aadiscordbot.tasks import send_message\n    # if you want to send discord embed import them too.\n    from discord import Embed, Color\n\n## this helper can be called to Queue up a Message\n## AA Should not act on these, only AA-DiscordBot will consume them\nif discord_bot_active():\n    usr = User.objects.get(pk=1)\n\n    # discord ID of user\n    msg = \"Channel ID Tests\"\n    e = Embed(title=\"Channel ID Tests!\",\n              description=\"This is a Test Embed.\\n\\n```Discord Channel ID```\",\n              color=Color.yellow())\n    e.add_field(name=\"Test Field 1\", value=\"Value of some kind goes here\")\n    send_message(channel_id=639252062818926642, embed=e) # Embed\n    send_message(channel_id=639252062818926642, message=msg) # Message\n    send_message(channel_id=639252062818926642, message=msg, embed=e) # Both\n\n    # Discord ID of channel\n    msg = \"User ID Tests\"\n    e = Embed(title=\"User ID Tests!\",\n              description=\"This is a Test Embed.\\n\\n```Discord User ID```\",\n              color=Color.nitro_pink())\n    e.add_field(name=\"Test Field 1\", value=\"Value of some kind goes here\")\n\n    send_message(user_id=318309023478972417, embed=e) # Embed\n    send_message(user_id=318309023478972417, message=msg) # Message\n    send_message(user_id=318309023478972417, message=msg, embed=e) # Both\n\n    # User model\n    msg = \"Auth User Model Tests\"\n    e = Embed(title=\"Auth User Model Tests!\",\n              description=\"This is a Test Embed.\\n\\n```Auth User Model```\",\n              color=Color.dark_orange())\n    e.add_field(name=\"Test Field 1\", value=\"Value of some kind goes here\")\n    send_message(user=usr, embed=e) # Embed\n    send_message(user=usr, message=msg) # Message\n    send_message(user=usr, message=msg, embed=e) # Both\n\n    # User PK id\n    msg = \"Auth User PK Tests\"\n    e = Embed(title=\"Auth User PK Tests!\",\n              description=\"This is a Test Embed.\\n\\n```Auth User PK```\",\n              color=Color.brand_green())\n    e.add_field(name=\"Test Field 1\", value=\"Value of some kind goes here\")\n    send_message(user_pk=1, embed=e) # Embed\n    send_message(user_pk=1, message=msg) # Message\n    send_message(user_pk=1, message=msg, embed=e) # Both\n\n    # Mixture of all of the above\n    msg = \"All Together Tests\"\n    e = Embed(title=\"All Together Tests!\",\n              description=\"This is a Test Embed.\\n\\n```All Together```\",\n              color=Color.blurple())\n    e.add_field(name=\"Test Field 1\", value=\"Value of some kind goes here\")\n    send_message(channel_id=639252062818926642,\n                user_id=318309023478972417,\n                user=User.objects.get(pk=1),\n                message=msg,\n                embed=e)\n```\n\n### Registering 3rd Party Cogs (Handling Commands)\n\nIn `auth_hooks.py`, define a function that returns an array of cog modules, and register it as a `discord_cogs_hook`:\n\n```python\n@hooks.register('discord_cogs_hook')\ndef register_cogs():\n    return [\"yourapp.cogs.cog_a\", \"yourapp.cogs.cog_b\"]\n```\n\n## Optional Settings continued\n\n### Isolate AuthBot from Auth's Discord Service\n\n```python\nAUTHBOT_DISCORD_APP_ID = 'App ID for dedicated bot'\nAUTHBOT_DISCORD_BOT_TOKEN = 'Token for dedicated bot'\n```\n\n## Issues\n\nPlease remember to report any aa-discordbot related issues using the issues on **this** repository.\n\n## Troubleshooting\n\n### Py-Cord and discord.py fighting in venv\n\n**Problem:**\n\nSomething has gone funny with my venv after i installed another app that wanted `discord.py`\n\n**Reason:**\n\nThis is due to the Py-cord lib sharing the `discord` namespace. Py-Cord is however a drop in replacement. So no issues should arise from using it over the now legacy discord.py lib. **YMMV**\n\n**Fix:**\n\n 1. Uninstall `discord.py` by running `pip uninstall discord.py` with your venv active.\n 2. Reinstall `py-cord` by running `pip install -U py-cord==2.0.0b3` with your venv active.\n 3. Approach the dev from the app that overrode your py-cord to update to a maintained lib.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Alliance Auth Modular Discord Bot",
    "version": "3.8.2",
    "project_urls": {
        "Home": "https://github.com/Solar-Helix-Independent-Transport/allianceauth-discordbot",
        "Source": "https://github.com/Solar-Helix-Independent-Transport/allianceauth-discordbot",
        "Tracker": "https://github.com/Solar-Helix-Independent-Transport/allianceauth-discordbot/issues"
    },
    "split_keywords": [
        "allianceauth",
        " eveonline"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "010938e824f276621a3a5bf878e566533904aed6603b9b0966800d7f3a974129",
                "md5": "e345f1f0908949dddbbb32a1a758d47a",
                "sha256": "76fdcbabffe78e09eba047fc8fdbb3fb0136687d1c5c50552dad7c4bd4e0ad6d"
            },
            "downloads": -1,
            "filename": "allianceauth_discordbot-3.8.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e345f1f0908949dddbbb32a1a758d47a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 69662,
            "upload_time": "2024-08-03T00:36:18",
            "upload_time_iso_8601": "2024-08-03T00:36:18.530355Z",
            "url": "https://files.pythonhosted.org/packages/01/09/38e824f276621a3a5bf878e566533904aed6603b9b0966800d7f3a974129/allianceauth_discordbot-3.8.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "21dcb8ad3bd2f725ba03c4ed1feb07014763fa5adf484598f64dad2e48267246",
                "md5": "7f804a05c907107b1c4faf59e4a6a01e",
                "sha256": "c52ab66c9e5225379c05995c23797885a3efbaa8ec184ddbfe8828ee2e76d4eb"
            },
            "downloads": -1,
            "filename": "allianceauth_discordbot-3.8.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7f804a05c907107b1c4faf59e4a6a01e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 58468,
            "upload_time": "2024-08-03T00:36:20",
            "upload_time_iso_8601": "2024-08-03T00:36:20.098817Z",
            "url": "https://files.pythonhosted.org/packages/21/dc/b8ad3bd2f725ba03c4ed1feb07014763fa5adf484598f64dad2e48267246/allianceauth_discordbot-3.8.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-03 00:36:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Solar-Helix-Independent-Transport",
    "github_project": "allianceauth-discordbot",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "allianceauth-discordbot"
}
        
Elapsed time: 0.27530s