Skip to content

Commit

Permalink
Add custom values to dice roll cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Blocksnmore committed Jul 28, 2024
1 parent 7b4d735 commit 045a1bd
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions commands/fun/dice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,34 @@ import {

export default class Dice extends Command {
name = "dice";
aliases = ["diceroll", "rolladice"];
aliases = ["diceroll", "rolladice", "roll"];
category = "fun";
usage = "Dice";
usage = "Dice [size]";
description = "Roll a Dice";
async execute(ctx: CommandContext) {
if (ctx.argString != "") {
const size = parseInt(ctx.argString);
if (!isNaN(size)) {
await ctx.message.reply(undefined, {
embeds: [
new Embed({
author: {
name: "Bidome bot",
icon_url: ctx.message.client.user!.avatarURL(),
},
title: "Dice roll",
description: `The dice rolled a \`${
Math.floor(Math.random() * (size - 1 + 1)) + 1
}\``,
}).setColor("random"),
],
components: [],
});

return;
}
}

const now = Date.now();
const message = await ctx.message.reply(undefined, {
embeds: [
Expand Down Expand Up @@ -54,7 +77,7 @@ export default class Dice extends Command {
isMessageComponentInteraction(i) &&
i.customID.endsWith(`-${now}`) &&
i.user.id === ctx.author.id,
30 * 1000,
30 * 1000
);
if (!selected[0]) {
await message.edit(undefined, {
Expand Down

0 comments on commit 045a1bd

Please sign in to comment.