Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/0xb01u/denede
Discord bot for generating D&D dice rolls.
https://github.com/0xb01u/denede
bot discord dnd dnd-tools dungeons-and-dragons rust
Last synced: about 2 months ago
JSON representation
Discord bot for generating D&D dice rolls.
- Host: GitHub
- URL: https://github.com/0xb01u/denede
- Owner: 0xb01u
- License: agpl-3.0
- Created: 2023-10-14T10:21:37.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-10T21:32:32.000Z (4 months ago)
- Last Synced: 2024-09-11T01:46:51.387Z (4 months ago)
- Topics: bot, discord, dnd, dnd-tools, dungeons-and-dragons, rust
- Language: Rust
- Homepage:
- Size: 146 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Denedé -- Dice roller bot for Discord
Denedé is a minimalistic Discord bot written in Rust 🦀 for generating dice rolls for D&D games. It uses Rust's [Serenity](https://github.com/serenity-rs/serenity) library. Therefore, it is speedily swift 🔥, slight of weight and mindful of memory!Denedé supports [MapTool](https://github.com/RPTools/maptool)'s notation for dice rolls. Specifically:
* [NdM] will generate a roll of N M-sided dice. E.g.: [1d20].
* [NdM+B] will generate a roll of N M-sided dice, and add B as a bonus. E.g.: [1d20+2]. B can be a negative number.
* [NdM-B] will generate a roll of N M-sided dice, and subtract B as a penalty. E.g.: [1d20-2]. B cannot be a negative number, only positive (no sign specified).On a technical level, it supports dice rolls that follow one of the following regular expressions:
* `\[\d+d\d+\]` for rolls without an added bonus.
* `\[\d+d\d+ ?\+ ?-?\d+\]` for rolls with an added bonus (positive or negative).
* `\[\d+d\d+ ?- ?\d+\]` for rolls with an added negative bonus, a.k.a. penalty.
Denedé will read the entirety of the non-bot messages it receives, looking for dice roll patterns, and reply if it finds at least one pattern anywhere in a message. This means that your messages do not have to start with any special character for the bot to trigger. They just have to contain a dice roll in them! For example, the bot will reply to any of the following messages with the requested roll result:
* "[1d20]"
* "Flogg takes [2d8+2] dmg"
* "Charisma check: [1d20+4]"The maximum number of rolls the bot will generate for a single query is of 20; and the maximum dice size for any roll is of 1000. The maximum bonus supported for a given query is equal to (number of rolls) * (dice size) * 10, to keep everything a reasonable size. It supports trivial rolls of 0 dice, as well as 1-sided and 0-sided dice, if for any reason you want them (although Denedé will note something isn't right about those kinds of rolls).
Also, Denedé uses [RANDOM.ORG](https://www.random.org)'s truly random number generator to resolve the dice rolls. So you can rest assured your rolls are truly random and not pseudo-random!
**Note:** Denedé has a fallback in case RANDOM.ORG's API does not work properly for some reason (e.g.: because it is performing a secure connection / anti-abuse check before serving the random sequence request; it has happened before). In those cases, Denedé will use a pseudo-random number generator from Rust's Random number library instead, to generate the dice rolls. When this occurs, Denedé's response will indicate that the rolls were generated pseudo-randomly by appending `[pseudo-random]` after the roll's result.