From f032e0c1e9d1be82a263460603a6a6c4959f0c80 Mon Sep 17 00:00:00 2001 From: Terryiscool160 <48654513+Terryiscool160@users.noreply.github.com> Date: Tue, 10 Mar 2020 00:18:05 +0000 Subject: [PATCH] More stuff. Added a dice roll command. --- README.md | 8 ++++---- src/commands/diceroll.js | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 src/commands/diceroll.js diff --git a/README.md b/README.md index 693f553..c95b417 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # Woomy -Woomy is a all-purpose discord bot built off the [guidebot](https://github.com/AnIdiotsGuide/guidebot) base and coded in node.js using discord.js. +Woomy is a all-purpose discord bot built off the [guidebot](https://github.com/AnIdiotsGuide/guidebot) base and coded in node.js using discord.js. # How to use The easiest way to use Woomy is to invite it to your server with [this link.](https://discordapp.com/oauth2/authorize?client_id=435961704145485835&permissions=2134240503&scope=bot) It is hosted 24/7 and automatically updates itself when a new release is made available, making sure you always get the newest features. -Self hosting is generally not recommended, but instructions are provided below if you still wish to do so. Woomy's code will need to be modified before it will run on your machine. +You can also self-host! Some modificatiomns to the code will need to be made before Woomy will run on your machine, but anyone who can read errors will figure out what needs to be changed pretty quickly :P # Requirements - git - node.js v12.0.0 or higher - node-gyp build tools -- ffmpeg +- ffmpeg (or ffmpeg-static) # Installation - Clone Woomy to your machine @@ -18,4 +18,4 @@ Self hosting is generally not recommended, but instructions are provided below i - Open config.js in your code editor and insert all the required information # Contributing -If you wish to contribute to Woomy, please fork the repository and open a pull request. +If you wish to contribute to Woomy, please fork the repository and open a pull request. Any contribution is appreciated <3 \ No newline at end of file diff --git a/src/commands/diceroll.js b/src/commands/diceroll.js new file mode 100644 index 0000000..569f381 --- /dev/null +++ b/src/commands/diceroll.js @@ -0,0 +1,27 @@ +exports.run = async (bot, message, args) => { + if (args.length === 0) { + message.channel.send(`🎲 The dice landed on ${Array.from(Array(6).keys()).random() + 1}.`); + } else { + if (args[0].match(/^\d+$/)) { + message.channel.send(`🎲 The dice landed on ${Array.from(Array(parseInt(args[0])).keys()).random() + 1}.`); + } else { + message.channel.send(`🎲 The dice landed on ${Array.from(Array(6).keys()).random() + 1}.`); + } + } + }; + + exports.conf = { + enabled: true, + guildOnly: false, + aliases: ["diceroll"], + permLevel: "User", + requiredPerms: [] + }; + + exports.help = { + name: "dice", + category: "Fun", + description: "Rolls a dice.", + usage: "dice" + }; + \ No newline at end of file