Skip to main content

A simple tabletop RPG dice bot for Discord.

Project description

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.)

  1. Install from PyPI using pip install requiembot
  2. Set environment variable TOKEN to your Discord bot token
  3. 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 + 3 or simply d20+3
  • D&D 5E attribute: 4d6k3 or 4d6d1 (or simply 4d6d)
  • Advantage: 2d20k1
  • Disadvantage: 2d20kl1
  • Fudge/Fate: 4df
  • Wild Die (Savage Worlds or Open D6): 1d6!

Details

  • Dice are expressed in the form XdY where 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 f to 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 )
  • Whitespace (spaces etc.) is completely ignored between symbols. For example, (5d6kl3!k3dh1+2)*5 and ( 5 d 6 kl 3 ! k 3 dh 1 + 2) * 5 will 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/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requiembot-0.2.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

requiembot-0.2.1-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file requiembot-0.2.1.tar.gz.

File metadata

  • Download URL: requiembot-0.2.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for requiembot-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6c71988da512ce4484d0f9a7b856261d99beeda6bffadbdd48bd687964f24e00
MD5 b09509522b190aaf7d83a22aebd53388
BLAKE2b-256 ac489d3764e29574b2b157c2c5d5343bac55438e397bf13778182b32602f5b24

See more details on using hashes here.

File details

Details for the file requiembot-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: requiembot-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for requiembot-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39930eed9cc323995b4008b0073d931622932baf35ba012f8b83ed4546682535
MD5 5453cbaac091df3b1e7c18fe2cb5bebe
BLAKE2b-256 c5909156167a4bc9a0231167a684c9f1f9bad5e8a81a16dcd8e6a0b1d8f3d2c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page