set default roll to 1d20

This commit is contained in:
Yannis Perrot 2024-02-19 16:51:01 +01:00
parent ed602b2643
commit e626f2ada5
2 changed files with 21 additions and 3 deletions

19
README.md Normal file
View File

@ -0,0 +1,19 @@
# Meridian Bot
This is a custom discord bot for the Meridian Corp community. Join us @ https://discord.gg/7YrtpSQvca.
The bot is auto-hosted on a physical machine at
## Features
- Rolling a or some dice(s) (hell yeah)
- Dofus Almanax offer
## Future Features
- Game mod file handling
- Audio Player
## Authors
- Yannis P https://git.meridian-corp.org/veko / veko@meridian-corp.org
- Martin G https://git.meridian-corp.org/obsidian / obsidian@meridian-corp.org

View File

@ -8,13 +8,12 @@ module.exports = {
.addStringOption(option => .addStringOption(option =>
option option
.setName('jet') .setName('jet')
.setDescription('Jet du dé (par ex: 2d6)') .setDescription('Jet du dé (par ex: 2d6, par défaut 1d20)')),
.setRequired(true)),
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply();
// dice argument // dice argument
let jet = interaction.options.getString('jet'); let jet = interaction.options.getString('jet') ?? '1d20';
// REGEX FORMAT DICE RULE (i.e. 4d6, 10d12, 9d10, 10d5...) // REGEX FORMAT DICE RULE (i.e. 4d6, 10d12, 9d10, 10d5...)
const diceRule = /^\d+d\d+$/; const diceRule = /^\d+d\d+$/;