From e2403b6cbec1a347aaf3eb18552c4e6616e3bad9 Mon Sep 17 00:00:00 2001 From: Terryiscool160 <48654513+Terryiscool160@users.noreply.github.com> Date: Tue, 10 Mar 2020 00:12:00 +0000 Subject: [PATCH 1/5] Fixes. Put CatFact and DogFact into the "Fun" category while also adding a discord disconnect and reconnect logger. --- src/commands/catfact.js | 4 ++-- src/commands/dicerole.js | 27 +++++++++++++++++++++++++++ src/commands/dogfact.js | 2 +- src/events/disconnect.js | 3 +++ src/events/reconnection.js | 3 +++ 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 src/commands/dicerole.js create mode 100644 src/events/disconnect.js create mode 100644 src/events/reconnection.js diff --git a/src/commands/catfact.js b/src/commands/catfact.js index 7505a1b..18fc87e 100644 --- a/src/commands/catfact.js +++ b/src/commands/catfact.js @@ -3,7 +3,7 @@ const request = require("request"); exports.run = async (bot, message, args) => { request({ uri: "https://catfact.ninja/facts", json: true }, (error, response, body) => { if (error) throw new Error(error); - message.channel.send(`**Did you know?**\n ${body.facts[0]}`); + message.channel.send(`**Did you know?**\n ${body.data[0].facts}`); }); }; @@ -17,7 +17,7 @@ exports.conf = { exports.help = { name: "catfact", - category: "User", + category: "Fun", description: "Sends a fun fact about a cat.", usage: "catfact/kittenfact" }; diff --git a/src/commands/dicerole.js b/src/commands/dicerole.js new file mode 100644 index 0000000..569f381 --- /dev/null +++ b/src/commands/dicerole.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 diff --git a/src/commands/dogfact.js b/src/commands/dogfact.js index ae0ef94..dc6bf7c 100644 --- a/src/commands/dogfact.js +++ b/src/commands/dogfact.js @@ -17,7 +17,7 @@ exports.conf = { exports.help = { name: "dogfact", - category: "User", + category: "Fun", description: "Sends a fun fact about a doggo.", usage: "dogfact/pupfact" }; diff --git a/src/events/disconnect.js b/src/events/disconnect.js new file mode 100644 index 0000000..932b5fd --- /dev/null +++ b/src/events/disconnect.js @@ -0,0 +1,3 @@ +module.exports = client => { // logs if the bot gets disconnected from discord. + client.logger.warn(`Bot disconnected at ${new Date()}`); +}; \ No newline at end of file diff --git a/src/events/reconnection.js b/src/events/reconnection.js new file mode 100644 index 0000000..d0a6fb2 --- /dev/null +++ b/src/events/reconnection.js @@ -0,0 +1,3 @@ +module.exports = client => { // logs when the bot reconnects to discord + client.logger.info(`Reconnecting at ${new Date()}`); +}; \ No newline at end of file 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 2/5] 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 From 0c377f6cce942925a45398d379259c3efce0d4ef Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Tue, 10 Mar 2020 00:35:38 +0000 Subject: [PATCH 3/5] Update dicerole.js --- src/commands/dicerole.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/dicerole.js b/src/commands/dicerole.js index 569f381..b307d4e 100644 --- a/src/commands/dicerole.js +++ b/src/commands/dicerole.js @@ -1,11 +1,11 @@ exports.run = async (bot, message, args) => { if (args.length === 0) { - message.channel.send(`🎲 The dice landed on ${Array.from(Array(6).keys()).random() + 1}.`); + message.channel.send(`🎲 You rolled a ${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}.`); + message.channel.send(`🎲 You rolled a ${Array.from(Array(parseInt(args[0])).keys()).random() + 1}!`); } else { - message.channel.send(`🎲 The dice landed on ${Array.from(Array(6).keys()).random() + 1}.`); + message.channel.send(`🎲 You rolled a ${Array.from(Array(6).keys()).random() + 1}!`); } } }; @@ -24,4 +24,4 @@ exports.run = async (bot, message, args) => { description: "Rolls a dice.", usage: "dice" }; - \ No newline at end of file + From 3fa96ca6f81dfad299d0ca1f8456109d83296fe6 Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Tue, 10 Mar 2020 00:41:59 +0000 Subject: [PATCH 4/5] Delete dicerole.js --- src/commands/dicerole.js | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 src/commands/dicerole.js diff --git a/src/commands/dicerole.js b/src/commands/dicerole.js deleted file mode 100644 index b307d4e..0000000 --- a/src/commands/dicerole.js +++ /dev/null @@ -1,27 +0,0 @@ -exports.run = async (bot, message, args) => { - if (args.length === 0) { - message.channel.send(`🎲 You rolled a ${Array.from(Array(6).keys()).random() + 1}!`); - } else { - if (args[0].match(/^\d+$/)) { - message.channel.send(`🎲 You rolled a ${Array.from(Array(parseInt(args[0])).keys()).random() + 1}!`); - } else { - message.channel.send(`🎲 You rolled a ${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" - }; - From 76d6230e97777e6b00dc33ba2e8ea6da957bc1a0 Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Tue, 10 Mar 2020 00:42:20 +0000 Subject: [PATCH 5/5] Update diceroll.js --- src/commands/diceroll.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/diceroll.js b/src/commands/diceroll.js index 569f381..b307d4e 100644 --- a/src/commands/diceroll.js +++ b/src/commands/diceroll.js @@ -1,11 +1,11 @@ exports.run = async (bot, message, args) => { if (args.length === 0) { - message.channel.send(`🎲 The dice landed on ${Array.from(Array(6).keys()).random() + 1}.`); + message.channel.send(`🎲 You rolled a ${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}.`); + message.channel.send(`🎲 You rolled a ${Array.from(Array(parseInt(args[0])).keys()).random() + 1}!`); } else { - message.channel.send(`🎲 The dice landed on ${Array.from(Array(6).keys()).random() + 1}.`); + message.channel.send(`🎲 You rolled a ${Array.from(Array(6).keys()).random() + 1}!`); } } }; @@ -24,4 +24,4 @@ exports.run = async (bot, message, args) => { description: "Rolls a dice.", usage: "dice" }; - \ No newline at end of file +