- Python 99.8%
- Dockerfile 0.2%
| asqlite | ||
| cogs | ||
| utils | ||
| .dockerignore | ||
| .gitignore | ||
| docker-compose.yml | ||
| docker-compose_prometheus.yml | ||
| Dockerfile | ||
| LICENSE | ||
| main.py | ||
| prometheus.yml | ||
| README.md | ||
| requirements.txt | ||
SDG Helper
A helper for social-deduction games hosted on Discord
Support Server - Join for help with the bot!
This bot runs on discord.py
Invite this bot:
Invite Link, it's recommended to not remove any permissions, as some or all commands may stop working
Self-hosting guide (docker compose):
-
Create a bot account in the Discord Dev portal and invite it to your server. - Guide
-
Enable member and message intents - Example
-
Install Docker Engine + docker compose if you don't have it already - Docs
-
Use the
docker-compose.ymlfile as a template, and fill in theBOT_TOKENvariable with your bot token (or in a.envfile)
Self-hosting guide:
-
Create a bot account in the Discord Dev portal and invite it to your server. - Guide
-
Enable member and message intents - Example
-
Install the latest version of python if you don't have it already. - Download
-
Download the source code either by using the "Download ZIP" option or running
git clone https://github.com/DoggieLicc/discord-sdg-helper
- Open a terminal/command prompt in the
discord-sdg-helperfolder - Create a virtual environment:
python -m venv .venv - Activate the virtual environment:
.venv\Scripts\activate(command prompt) orsource ./.venv/bin/activate(linux) - Install requirements:
pip install -r requirements.txt - Create a file named
.env - Edit it and add
BOT_TOKEN=<token>where<token>is the bot's token you got from step 1, then save - Run the main script:
python main.pyorpython3 main.py - Sync the application commands by the text command
sdg.syncin a channel the bot has access to
Enviroment Variables:
BOT_TOKEN- The bot token to run on (Required)DO_FIRST_SYNC- If set to true, will run command sync on startupDEVELOPMENT_GUILD- ID of guild to sync commands toGUIDE_CHANNEL_ID- ID of forum to read guides fromPROMETHEUS_PORT- Port to serve Prometheus metrics onDISABLE_PROMETHEUS- Set totrueto disable Prometheus metricsDATABASE_FILENAME- Name of database file. Defaults toguild_info.db
How to use this bot:
This bot uses the slash commands system provided by Discord. Type / to see the available commands
Rolelist Generation
To use this function, right-click/tap on a message, and click "Generate Rolelist Roles" under Apps Before using this, make sure all your factions and subalignments are defined properly
Symbols:
Filters:
% - Role
$ - Faction (You can also use #forum)
(no symbol is for forum tags)
ANY - No filter, case-sensitive (dont combine with ! ...)
Logic:
& - Seperator
| - Union (Roles only have to be part of atleast one of the unioned filters)
! - Negation (Will negate the next filter's roles)
Global Filters:
Lines starting with + will apply to all slots, except slots starting with -
Examples:
%Jailor - Gets Jailor role
Town Killing - Gets role with the Town Killing forum tag
$Town - Gets role from the Town faction
!Dogflummery - Gets any role that doesnt have Dogflummery forum tag
$Coven&Balanced - Gets any Coven role with Balanced tag
Town Power|Town Killing!Dogflummery&Reworked - Get any role that has either the Town Power or Town Killing tag, and doesn't have Dogflummery tag, and has the Reworked tag
+!Dogflummery|!Cursed - Global filter that makes all slots generate roles that dont have the Doglummery or Cursed tag
-ANY - Get any role, without applying global filters
Modifiers
Modifiers change how all slots generate in unique ways.
Modifiers start with ? and can have arguments separated by :
- limit:filters:amount
Limits the amount of the filtered roles that can generate. If the filters correspond to multiple roles, the limit will be shared between them. If no amount is provided, it will be one by default
Examples:
?limit:$Coven:4 - Caps spawning of coven faction roles at 4
?limit:%Mayor - Caps spawning of Mayor at 1, the default. Essentially makes it unique
- individuality:filters
Makes it so that all filtered roles will only spawn a maximum of 1. If no filters are supplied, all roles become unique
Examples:
?individuality:Town Power - Makes all roles with Town Power tag unique
?individuality:$Mafia!%Consort - Makes all roles part of Mafia faction unique, except Consort
- exclusive:filters:filters2
Makes all filtered roles mutually exclusive to each other, meaning if one generates, the rest of them cant.
If two arguments are specified, the filtered roles will be mutually exclusive with the other filtered roles instead
Examples:
?exclusive:%Warlock|%Soul Collector - Makes Warlock and Soul Collector mutually exclusive
?exclusive:Town Power|Town Killing - Makes all roles with either Town Power tag or Town Killing tag mutually exclusive to each other
?exclusive:!$Town:%Atheist - Makes Atheist mutually exclusive with all non Town roles
Weights
You can change the weight of roles to make them more or less likely to spawn
For example, multiplying the weight of Sheriff by 10 will give it 10 times the chance to spawn in all slots it can generate in
Specifying a limit will disable the weight after the limit has been reached, by default weights have no limit.
The default weight for all roles is 10
Format: =filter:weight:limit
Examples:
=%Sheriff:x10 - Multiply weight of sheriff by 10 (100)
=$Town:/2 - Divide weight of all town roles by 2 (5)
=Cursed:-9 - Subtracts the weight of all roles with Cursed tag by 9 (1)
=Town Power:+40 - Adds the weight of all roles with Town Power tag by 40 (50)
=%Cleric:1000 - Sets weight of cleric spawning to 1000
=%Oracle:x20:1 - Multiply weight of Oracle spawning by 20, but when 1 Oracle generates, the weight will be normal again for future slots
If the filter matches no roles, or if the weight of a role <= 0, generation will fail.