RequiemBot
This is a Discord bot for rolling dice (such as in tabletop RPGs) and optionally doing math on the results. Written in Python using discord.py.
Usage
Invite to your server:
I am currently testing the bot with a small group of people, and will make an invite link publicly available when I've received enough feedback.
Run locally:
(Requires Python ≥ 3.10. The GUILD_MEMBERS privileged intent is required for /stats to work properly.)
- Install from PyPI using
pip install requiembot - Set environment variable
TOKENto your Discord bot token - Run
python -m requiembot
Details
Commands
/help: Display a simple help message with examples and a link to this GitHub repo./roll: Roll dice and/or do math, as described below. Options include:secret: If set to "true", the result of your roll will only be visible to you.repeat: Amount of times to roll the given input. Defaults to 1.compact: If set to "true", the response will be shortened by removing the details of each roll.
/stats: Display the number of Discord servers the bot is on, and the number of non-bot members across those servers.
Example Dice Rolls
- d20 ability check:
1d20 + 3or simplyd20+3 - D&D 5E attribute:
4d6k3or4d6d1(or simply4d6d) - Advantage:
2d20k1 - Disadvantage:
2d20kl1 - Fudge/Fate:
4df - Wild Die (Savage Worlds or Open D6):
1d6!
Details
- Dice are expressed in the form
XdYwhere X and Y are positive integers representing die count and size.- X is optional; if it is not present, the default is 1
- Y can instead be
fto use Fudge/FATE dice which range from -1 to 1
- Dice can be followed by modifiers. These consist of a one- or two- character symbol, and optionally a positive integer X as described below (otherwise using the default listed):
dX: Drop the lowest X dice. (Defaults to 1.)dhX: Drop the highest X dice. (Defaults to 1.)kX: Keep the highest X dice, and drop the rest. (Defaults to 1.)klX: Keep the lowest X dice, and drop the rest. (Defaults to 1.)!X: "Exploding" dice; for every dice resulting in X or above, add another die of the same type, and repeat for every added die resulting in X or above. (Defaults to the highest possible value on the die.)- (To avoid infinite loops, this is capped at 10 repeats.)
- The following math features are supported:
- addition
+, subtraction- - multiplication
*, division/- Note: The bot uses integer division. Results are rounded down and remainders are disregarded.
(grouping)
- addition
- Whitespace (spaces etc.) is completely ignored between symbols. For example,
(5d6kl3!k3dh1+2)*5and( 5 d 6 kl 3 ! k 3 dh 1 + 2) * 5will be interpreted as exactly the same.
Planned Additions
(in no particular order)
- Count successes/failures, like World of Darkness
- Reroll on nat 1 (or some other number)
- Highest/lowest of multiple different expressions
- Proper code comments/documentation
- Unit tests
Copyright Notice
Copyright (C) 2022 Michael Munzer
RequiemBot is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
RequiemBot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Release files for RequiemBot 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| requiembot-0.2.1.tar.gz | 20.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| requiembot-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.6 kB
Release files / requiembot-0.2.1.tar.gz
| Download URL | requiembot-0.2.1.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c71988da512ce4484d0f9a7b856261d99beeda6bffadbdd48bd687964f24e00
|
|
BLAKE2b-256 checksum How to use checksums |
ac489d3764e29574b2b157c2c5d5343bac55438e397bf13778182b32602f5b24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Release files / requiembot-0.2.1-py3-none-any.whl
| Download URL | requiembot-0.2.1-py3-none-any.whl |
|---|---|
| Size | 22.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39930eed9cc323995b4008b0073d931622932baf35ba012f8b83ed4546682535
|
|
BLAKE2b-256 checksum How to use checksums |
c5909156167a4bc9a0231167a684c9f1f9bad5e8a81a16dcd8e6a0b1d8f3d2c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|