diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 1ecc378..44ec32a 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -8,19 +8,19 @@ jobs: format: runs-on: ubuntu-latest steps: - - name: "Checkout Repository" + - name: 'Checkout Repository' uses: actions/checkout@v2 - - name: "Setup Node.js" + - name: 'Setup Node.js' uses: actions/setup-node@v1 with: - node-version: "16.x" + node-version: '16.x' - - name: "Install Dependencies" - run: "corepack enable; yarn; yarn install" + - name: 'Install Dependencies' + run: 'corepack enable; yarn; yarn install' - - name: "Format Code" - run: "yarn format" + - name: 'Format Code' + run: 'yarn format' - name: Create pull request uses: peter-evans/create-pull-request@v3.1.0 @@ -28,13 +28,13 @@ jobs: ACTIONS_ALLOW_UNSECURE_COMMANDS: true with: token: ${{ secrets.WORKFLOW_TOKEN }} - commit-message: "style: auto format" - committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" - author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" - + commit-message: 'style: auto format' + committer: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' + author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' + title: Format Code body: | This PR was created by the `format` workflow. It has formatted the code using the `yarn format` command. Please review the changes and merge the PR if everything looks good. - labels: "format" + labels: 'format' diff --git a/.github/workflows/yarn_bump.yml b/.github/workflows/yarn_bump.yml index ec7b67a..e8ab617 100644 --- a/.github/workflows/yarn_bump.yml +++ b/.github/workflows/yarn_bump.yml @@ -2,25 +2,25 @@ name: Bump Yarn Dependencies on: schedule: - - cron: "0 9 * * *" + - cron: '0 9 * * *' workflow_dispatch: jobs: yarn_bump: runs-on: ubuntu-latest steps: - - name: "Checkout Repository" + - name: 'Checkout Repository' uses: actions/checkout@v2 - - name: "Setup nodejs" + - name: 'Setup nodejs' uses: actions/setup-node@v1 with: - node-version: "16.x" + node-version: '16.x' - - name: "Enable Yarn" - run: "corepack enable" + - name: 'Enable Yarn' + run: 'corepack enable' - - name: "Update Yarn Dependencies" + - name: 'Update Yarn Dependencies' run: "yarn up '*'" - name: Create pull request @@ -34,4 +34,4 @@ jobs: This PR was created by the yarn_bump workflow. It has updated all dependencies using yarn up '*' command. Please review the changes and merge the PR if everything looks good. - labels: "dependencies" + labels: 'dependencies' diff --git a/.prettierrc.json b/.prettierrc.json index 7d625bb..e63fa60 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,5 +1,5 @@ { - "trailingComma": "all", - "semi": false, - "singleQuote": true - } \ No newline at end of file + "trailingComma": "all", + "semi": false, + "singleQuote": true +} diff --git a/commands/Activities/awkword.js b/commands/Activities/awkword.js index ea308ea..b8cda04 100644 --- a/commands/Activities/awkword.js +++ b/commands/Activities/awkword.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "awkword", - category: "Activities", + name: 'awkword', + category: 'Activities', aliases: [], - cooldown: "", - usage: "awkword", + cooldown: '', + usage: 'awkword', description: 'Play "Awkword" together with your friends on Discord!', memberpermissions: [], requiredroles: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to play Awkword!" - ); + 'You must join a voice channel to play Awkword!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.channel.send("Please Wait..."); + const msg = await message.channel.send('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "awkword") + .createTogetherCode(channel.id, 'awkword') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Awkword!") + .setColor('RED') + .setTitle('Awkword!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png" + 'https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/betrayal.js b/commands/Activities/betrayal.js index 6d9fe83..68dcf8c 100644 --- a/commands/Activities/betrayal.js +++ b/commands/Activities/betrayal.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "betrayal", - category: "Activities", + name: 'betrayal', + category: 'Activities', aliases: [], - cooldown: "", - usage: "betrayal", - description: "Play betrayal with your friends on Discord!", + cooldown: '', + usage: 'betrayal', + description: 'Play betrayal with your friends on Discord!', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to join activity!" - ); + 'You must join a voice channel to join activity!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.reply("Please Wait..."); + const msg = await message.reply('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "betrayal") + .createTogetherCode(channel.id, 'betrayal') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Betrayal!") + .setColor('RED') + .setTitle('Betrayal!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://images.crazygames.com/games/betrayal-io/cover-1615286192675.png" + 'https://images.crazygames.com/games/betrayal-io/cover-1615286192675.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/checkers.js b/commands/Activities/checkers.js index 75686ff..2fac79d 100644 --- a/commands/Activities/checkers.js +++ b/commands/Activities/checkers.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "checkers", - category: "Activities", - aliases: ["checkersinthepark"], - cooldown: "", - usage: "checkers", + name: 'checkers', + category: 'Activities', + aliases: ['checkersinthepark'], + cooldown: '', + usage: 'checkers', description: 'Play "Checkers together in the park" together with your friends on Discord!', memberpermissions: [], @@ -16,44 +16,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - 'You must join a voice channel to play "Checkers in the park"!' - ); + 'You must join a voice channel to play "Checkers in the park"!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.channel.send("Please Wait..."); + const msg = await message.channel.send('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "checkers") + .createTogetherCode(channel.id, 'checkers') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Checkers in the Park!") + .setColor('RED') + .setTitle('Checkers in the Park!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://images.chesscomfiles.com/uploads/v1/images_users/tiny_mce/SamCopeland/phpmeXx6V.png" + 'https://images.chesscomfiles.com/uploads/v1/images_users/tiny_mce/SamCopeland/phpmeXx6V.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/chess.js b/commands/Activities/chess.js index e8f5a1f..c7fc31c 100644 --- a/commands/Activities/chess.js +++ b/commands/Activities/chess.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "chess", - category: "Activities", + name: 'chess', + category: 'Activities', aliases: [], - cooldown: "", - usage: "chess", - description: "Play chess together with your friends on Discord!", + cooldown: '', + usage: 'chess', + description: 'Play chess together with your friends on Discord!', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to play chess!" - ); + 'You must join a voice channel to play chess!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.channel.send("Please Wait..."); + const msg = await message.channel.send('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "chess") + .createTogetherCode(channel.id, 'chess') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Chess!") + .setColor('RED') + .setTitle('Chess!') .setDescription( - `[Click Here to start the activity! (Both You and your oponent have to join)](${invite.code})` + `[Click Here to start the activity! (Both You and your oponent have to join)](${invite.code})`, ) .setThumbnail( - "https://images.chesscomfiles.com/uploads/v1/images_users/tiny_mce/SamCopeland/phpmeXx6V.png" + 'https://images.chesscomfiles.com/uploads/v1/images_users/tiny_mce/SamCopeland/phpmeXx6V.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/doodlecrew.js b/commands/Activities/doodlecrew.js index 0619daf..923c033 100644 --- a/commands/Activities/doodlecrew.js +++ b/commands/Activities/doodlecrew.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "doodlecrew", - category: "Activities", - aliases: ["dcrew"], - cooldown: "", - usage: "doodlecrew", - description: "Play Doodle Crew with your friends on Discord!", + name: 'doodlecrew', + category: 'Activities', + aliases: ['dcrew'], + cooldown: '', + usage: 'doodlecrew', + description: 'Play Doodle Crew with your friends on Discord!', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to join activity!" - ); + 'You must join a voice channel to join activity!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.reply("Please Wait..."); + const msg = await message.reply('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "doodlecrew") + .createTogetherCode(channel.id, 'doodlecrew') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Doodle Crew!") + .setColor('RED') + .setTitle('Doodle Crew!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png" + 'https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/fishington.js b/commands/Activities/fishington.js index edb7c38..f3ad977 100644 --- a/commands/Activities/fishington.js +++ b/commands/Activities/fishington.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "fishington", - category: "Activities", - aliases: ["fishing"], - cooldown: "", - usage: "fishing", - description: "Fish together with your friends on Discord!", + name: 'fishington', + category: 'Activities', + aliases: ['fishing'], + cooldown: '', + usage: 'fishing', + description: 'Fish together with your friends on Discord!', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to play fishington!" - ); + 'You must join a voice channel to play fishington!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.reply("Please Wait..."); + const msg = await message.reply('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "fishing") + .createTogetherCode(channel.id, 'fishing') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Fishington!") + .setColor('RED') + .setTitle('Fishington!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://images.crazygames.com/games/fishington-io/cover-1615371400662.png" + 'https://images.crazygames.com/games/fishington-io/cover-1615371400662.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/lettertile.js b/commands/Activities/lettertile.js index fbe7276..7e63496 100644 --- a/commands/Activities/lettertile.js +++ b/commands/Activities/lettertile.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "lettertile", - category: "Activities", - aliases: ["lttile"], - cooldown: "", - usage: "lettertile", - description: "Play Letter Tile with your friends on Discord!", + name: 'lettertile', + category: 'Activities', + aliases: ['lttile'], + cooldown: '', + usage: 'lettertile', + description: 'Play Letter Tile with your friends on Discord!', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to join activity!" - ); + 'You must join a voice channel to join activity!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.reply("Please Wait..."); + const msg = await message.reply('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "lettertile") + .createTogetherCode(channel.id, 'lettertile') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Letter Tile!") + .setColor('RED') + .setTitle('Letter Tile!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png" + 'https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/ocho.js b/commands/Activities/ocho.js index 92110ab..22ed06e 100644 --- a/commands/Activities/ocho.js +++ b/commands/Activities/ocho.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "ocho", - category: "Activities", + name: 'ocho', + category: 'Activities', aliases: [], - cooldown: "", - usage: "ocho", + cooldown: '', + usage: 'ocho', description: 'Play "Ocho" together with your friends on Discord!', memberpermissions: [], requiredroles: [], @@ -15,44 +15,42 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) - return message.channel.send( - "You must join a voice channel to play Ocho!" - ); + return message.channel.send('You must join a voice channel to play Ocho!') - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.channel.send("Please Wait..."); + const msg = await message.channel.send('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "ocho") + .createTogetherCode(channel.id, 'ocho') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Ocho!") + .setColor('RED') + .setTitle('Ocho!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png" + 'https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/poker.js b/commands/Activities/poker.js index 737eca7..1368dbd 100644 --- a/commands/Activities/poker.js +++ b/commands/Activities/poker.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "poker", - category: "Activities", + name: 'poker', + category: 'Activities', aliases: [], - cooldown: "", - usage: "poker", - description: "Play poker with your friends on Discord!", + cooldown: '', + usage: 'poker', + description: 'Play poker with your friends on Discord!', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to play poker!" - ); + 'You must join a voice channel to play poker!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.reply("Please Wait..."); + const msg = await message.reply('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "poker") + .createTogetherCode(channel.id, 'poker') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Poker!") + .setColor('RED') + .setTitle('Poker!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://logos.textgiraffe.com/logos/logo-name/Poker-designstyle-poker-m.png" + 'https://logos.textgiraffe.com/logos/logo-name/Poker-designstyle-poker-m.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/puttparty.js b/commands/Activities/puttparty.js index 6e709c2..08531ad 100644 --- a/commands/Activities/puttparty.js +++ b/commands/Activities/puttparty.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "puttparty", - category: "Activities", + name: 'puttparty', + category: 'Activities', aliases: [], - cooldown: "", - usage: "puttparty", + cooldown: '', + usage: 'puttparty', description: 'Play "Puttparty" together with your friends on Discord!', memberpermissions: [], requiredroles: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to play Puttparty!" - ); + 'You must join a voice channel to play Puttparty!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.channel.send("Please Wait..."); + const msg = await message.channel.send('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "puttparty") + .createTogetherCode(channel.id, 'puttparty') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Puttparty!") + .setColor('RED') + .setTitle('Puttparty!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png" + 'https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/sketchheads.js b/commands/Activities/sketchheads.js index f3fee77..ea4c15b 100644 --- a/commands/Activities/sketchheads.js +++ b/commands/Activities/sketchheads.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "sketchheads", - category: "Activities", + name: 'sketchheads', + category: 'Activities', aliases: [], - cooldown: "", - usage: "sketchheads", + cooldown: '', + usage: 'sketchheads', description: 'Play "Sketchheads" together with your friends on Discord!', memberpermissions: [], requiredroles: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to play Sketchheads!" - ); + 'You must join a voice channel to play Sketchheads!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.channel.send("Please Wait..."); + const msg = await message.channel.send('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "sketchheads") + .createTogetherCode(channel.id, 'sketchheads') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Sketchheads!") + .setColor('RED') + .setTitle('Sketchheads!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png" + 'https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/spellcast.js b/commands/Activities/spellcast.js index 6e8ace3..f651796 100644 --- a/commands/Activities/spellcast.js +++ b/commands/Activities/spellcast.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "spellcast", - category: "Activities", + name: 'spellcast', + category: 'Activities', aliases: [], - cooldown: "", - usage: "spellcast", + cooldown: '', + usage: 'spellcast', description: 'Play "SpellCast" together with your friends on Discord!', memberpermissions: [], requiredroles: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to play SpellCast!" - ); + 'You must join a voice channel to play SpellCast!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.channel.send("Please Wait..."); + const msg = await message.channel.send('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "spellcast") + .createTogetherCode(channel.id, 'spellcast') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("SpellCast!") + .setColor('RED') + .setTitle('SpellCast!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png" + 'https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/wordssnack.js b/commands/Activities/wordssnack.js index 07642c9..1cf1a66 100644 --- a/commands/Activities/wordssnack.js +++ b/commands/Activities/wordssnack.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "wordssnack", - category: "Activities", - aliases: ["wordsk", "wordsnack"], - cooldown: "", - usage: "wordssnack", - description: "Play Words Snack with your friends on Discord!", + name: 'wordssnack', + category: 'Activities', + aliases: ['wordsk', 'wordsnack'], + cooldown: '', + usage: 'wordssnack', + description: 'Play Words Snack with your friends on Discord!', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,44 +15,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - "You must join a voice channel to join activity!" - ); + 'You must join a voice channel to join activity!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.reply("Please Wait..."); + const msg = await message.reply('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "wordsnack") + .createTogetherCode(channel.id, 'wordsnack') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("Words Snack!") + .setColor('RED') + .setTitle('Words Snack!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png" + 'https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Activities/ytt.js b/commands/Activities/ytt.js index 88953ca..093099a 100644 --- a/commands/Activities/ytt.js +++ b/commands/Activities/ytt.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "ytt", - category: "Activities", - aliases: ["youtube-together"], - cooldown: "", - usage: "ytt", + name: 'ytt', + category: 'Activities', + aliases: ['youtube-together'], + cooldown: '', + usage: 'ytt', description: 'Watch "YouTube Together" together with your friends on Discord!', memberpermissions: [], @@ -16,44 +16,44 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const channel = message.member.voice.channel; + const channel = message.member.voice.channel if (!channel) return message.channel.send( - 'You must join a voice channel to watch "YouTube Together"!' - ); + 'You must join a voice channel to watch "YouTube Together"!', + ) - if (!channel.permissionsFor(message.client.user).has("CONNECT")) + if (!channel.permissionsFor(message.client.user).has('CONNECT')) return message.channel.send( - "I don't have permission to join the voice channel" - ); + "I don't have permission to join the voice channel", + ) - if (!channel.permissionsFor(message.client.user).has("SPEAK")) + if (!channel.permissionsFor(message.client.user).has('SPEAK')) return message.channel.send( - "I don't have permission to speak in the voice channel" - ); + "I don't have permission to speak in the voice channel", + ) - const msg = await message.channel.send("Please Wait..."); + const msg = await message.channel.send('Please Wait...') client.discordTogether - .createTogetherCode(channel.id, "youtube") + .createTogetherCode(channel.id, 'youtube') .then(async (invite) => { - msg.delete(); + msg.delete() return message.reply({ embeds: [ new MessageEmbed() - .setColor("RED") - .setTitle("YouTube Together!") + .setColor('RED') + .setTitle('YouTube Together!') .setDescription( - `[Click Here to start the activity!](${invite.code})` + `[Click Here to start the activity!](${invite.code})`, ) .setThumbnail( - "https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png" + 'https://www.graphicsprings.com/filestorage/stencils/084a905bb0bb38fedf776f5f0c5f66b8.png', ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Fun/8ball.js b/commands/Fun/8ball.js index 72385ac..946702a 100644 --- a/commands/Fun/8ball.js +++ b/commands/Fun/8ball.js @@ -1,21 +1,21 @@ -const { MessageEmbed } = require("discord.js"); -const axios = require("axios"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const axios = require('axios') +const ee = require('../../botconfig/embed.json') const Thumbnail = [ - "https://www.lcmb.co.uk/wp-content/uploads/Crystal-ball.png", - "https://emojipedia-us.s3.amazonaws.com/source/skype/289/crystal-ball_1f52e.png", - "https://www.pikpng.com/pngl/b/576-5768393_transparent-clipart-crystal-ball-png-download.png", - "http://assets.stickpng.com/thumbs/5e91d91ad083e200047f0606.png", - "https://cdn4.iconfinder.com/data/icons/carnival-and-amusement-filled-outline/64/crystal_fortune-512.png", - "https://creazilla-store.fra1.digitaloceanspaces.com/emojis/47211/crystal-ball-emoji-clipart-md.png", -]; + 'https://www.lcmb.co.uk/wp-content/uploads/Crystal-ball.png', + 'https://emojipedia-us.s3.amazonaws.com/source/skype/289/crystal-ball_1f52e.png', + 'https://www.pikpng.com/pngl/b/576-5768393_transparent-clipart-crystal-ball-png-download.png', + 'http://assets.stickpng.com/thumbs/5e91d91ad083e200047f0606.png', + 'https://cdn4.iconfinder.com/data/icons/carnival-and-amusement-filled-outline/64/crystal_fortune-512.png', + 'https://creazilla-store.fra1.digitaloceanspaces.com/emojis/47211/crystal-ball-emoji-clipart-md.png', +] module.exports = { - name: "8ball", - category: "Fun", - aliases: ["8b"], - cooldown: "", - usage: "8ball ", - description: "Get to know your fortune :)", + name: '8ball', + category: 'Fun', + aliases: ['8b'], + cooldown: '', + usage: '8ball ', + description: 'Get to know your fortune :)', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -23,36 +23,36 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - if (!args[0]) return message.reply("Please ask a question!"); + if (!args[0]) return message.reply('Please ask a question!') const randomThumbnail = - Thumbnail[Math.floor(Math.random() * Thumbnail.length)]; - await message.reply("Loading! Please wait...").then(async (msg) => { - let url = `https://8ball.delegator.com/magic/JSON/${args.join("+")}`; + Thumbnail[Math.floor(Math.random() * Thumbnail.length)] + await message.reply('Loading! Please wait...').then(async (msg) => { + let url = `https://8ball.delegator.com/magic/JSON/${args.join('+')}` await axios.get(url).then(async (res) => { - json = res.data; + json = res.data let embed = new MessageEmbed() - .setColor("RANDOM") - .setTitle("🎱 8ball") + .setColor('RANDOM') + .setTitle('🎱 8ball') .addFields( { - name: "Question:", - value: `${args.join(" ")}`, + name: 'Question:', + value: `${args.join(' ')}`, inline: true, }, { - name: "Answer:", + name: 'Answer:', value: `${json.magic.answer}`, inline: true, }, - { name: "Type:", value: `${json.magic.type}`, inline: true } + { name: 'Type:', value: `${json.magic.type}`, inline: true }, ) .setThumbnail(randomThumbnail) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - await msg.edit({ content: "​", embeds: [embed] }); - }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + await msg.edit({ content: '​', embeds: [embed] }) + }) + }) }, -}; +} diff --git a/commands/Fun/embed.js b/commands/Fun/embed.js index b757829..df51dcf 100644 --- a/commands/Fun/embed.js +++ b/commands/Fun/embed.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "embed", - category: "Fun", + name: 'embed', + category: 'Fun', aliases: [], - cooldown: "", - usage: "embed { - let embed = new MessageEmbed(); - let embed_args = args.join(" ").split("|"); - embed.setTitle(embed_args[0]); - embed_args[1] ? embed.setDescription(embed_args[1]) : null; - embed_args[2] ? embed.setImage(embed_args[2]) : null; - embed.setColor(ee.color); + let embed = new MessageEmbed() + let embed_args = args.join(' ').split('|') + embed.setTitle(embed_args[0]) + embed_args[1] ? embed.setDescription(embed_args[1]) : null + embed_args[2] ? embed.setImage(embed_args[2]) : null + embed.setColor(ee.color) embed.setFooter({ text: `${message.guild.name}`, iconURL: `${message.guild.iconURL()}`, - }); + }) embed.setAuthor({ name: message.author.tag, iconURL: message.author.displayAvatarURL(), - }); + }) message.channel.send({ embeds: [embed] }).catch((err) => { - message.reply(`Oops! An Error Occured!\n\`\`\`js\n${err}\n\`\`\`\``); - }); + message.reply(`Oops! An Error Occured!\n\`\`\`js\n${err}\n\`\`\`\``) + }) }, -}; +} diff --git a/commands/Fun/emojify.js b/commands/Fun/emojify.js index 337d244..9849f52 100644 --- a/commands/Fun/emojify.js +++ b/commands/Fun/emojify.js @@ -1,10 +1,10 @@ module.exports = { - name: "emojify", - category: "Fun", + name: 'emojify', + category: 'Fun', aliases: [], - cooldown: "", - usage: "emojify ", - description: "Convert your text to emojis", + cooldown: '', + usage: 'emojify ', + description: 'Convert your text to emojis', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -12,43 +12,43 @@ module.exports = { maxargs: 0, minplusargs: 1, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, prefix) => { const specialCodes = { - 0: ":zero:", - 1: ":one:", - 2: ":two:", - 3: ":three:", - 4: ":four:", - 5: ":five:", - 6: ":six:", - 7: ":seven:", - 8: ":eight:", - 9: ":nine:", - "#": ":hash:", - "*": ":asterisk:", - "?": ":grey_question:", - "!": ":grey_exclamation:", - ".": ":white_small_square:", - ",": "<:comma:935046155203649557>", - " ": " ", - }; + 0: ':zero:', + 1: ':one:', + 2: ':two:', + 3: ':three:', + 4: ':four:', + 5: ':five:', + 6: ':six:', + 7: ':seven:', + 8: ':eight:', + 9: ':nine:', + '#': ':hash:', + '*': ':asterisk:', + '?': ':grey_question:', + '!': ':grey_exclamation:', + '.': ':white_small_square:', + ',': '<:comma:935046155203649557>', + ' ': ' ', + } const text = args - .join(" ") + .join(' ') .toLowerCase() - .split("") + .split('') .map((letter) => { if (/[a-z]/g.test(letter)) { - return `:regional_indicator_${letter}:`; + return `:regional_indicator_${letter}:` } else if (specialCodes[letter]) { - return `${specialCodes[letter]}`; + return `${specialCodes[letter]}` } - return letter; + return letter }) - .join(""); + .join('') message.channel.send(text).catch((err) => { - message.reply(`Oops! An Error Occured!\n\`\`\`js\n${err}\n\`\`\`\``); - }); + message.reply(`Oops! An Error Occured!\n\`\`\`js\n${err}\n\`\`\`\``) + }) }, -}; +} diff --git a/commands/Fun/httpcat.js b/commands/Fun/httpcat.js index 4f00849..a15a96f 100644 --- a/commands/Fun/httpcat.js +++ b/commands/Fun/httpcat.js @@ -1,81 +1,81 @@ -const axios = require("axios"); +const axios = require('axios') const acceptedcodes = [ - "100", - "101", - "102", - "200", - "201", - "202", - "203", - "204", - "206", - "207", - "300", - "301", - "302", - "303", - "304", - "305", - "307", - "308", - "400", - "401", - "402", - "403", - "404", - "405", - "406", - "407", - "408", - "409", - "410", - "411", - "412", - "413", - "414", - "415", - "416", - "417", - "418", - "420", - "421", - "422", - "423", - "424", - "425", - "426", - "429", - "431", - "444", - "450", - "451", - "497", - "498", - "499", - "500", - "501", - "502", - "503", - "504", - "506", - "507", - "508", - "509", - "510", - "511", - "521", - "523", - "525", - "599", -]; + '100', + '101', + '102', + '200', + '201', + '202', + '203', + '204', + '206', + '207', + '300', + '301', + '302', + '303', + '304', + '305', + '307', + '308', + '400', + '401', + '402', + '403', + '404', + '405', + '406', + '407', + '408', + '409', + '410', + '411', + '412', + '413', + '414', + '415', + '416', + '417', + '418', + '420', + '421', + '422', + '423', + '424', + '425', + '426', + '429', + '431', + '444', + '450', + '451', + '497', + '498', + '499', + '500', + '501', + '502', + '503', + '504', + '506', + '507', + '508', + '509', + '510', + '511', + '521', + '523', + '525', + '599', +] module.exports = { - name: "httpcat", - category: "Fun", + name: 'httpcat', + category: 'Fun', aliases: [], - cooldown: "", - usage: "httpcat ", - description: "Send httpcat link of given status code", + cooldown: '', + usage: 'httpcat ', + description: 'Send httpcat link of given status code', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -83,21 +83,21 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text) => { - let userinput = args.join(" "); + let userinput = args.join(' ') if (!userinput) { return message.reply( `No status code specified!\nAvailable codes: \`\`\`${acceptedcodes.join( - `, ` - )}\`\`\`` - ); + `, `, + )}\`\`\``, + ) } - if (!acceptedcodes.includes(userinput.split(" ")[0])) { - message.reply("Invalid staus code!"); - return; + if (!acceptedcodes.includes(userinput.split(' ')[0])) { + message.reply('Invalid staus code!') + return } - message.reply(`https://http.cat/${userinput ? userinput : "200"}.jpg`); + message.reply(`https://http.cat/${userinput ? userinput : '200'}.jpg`) }, -}; +} diff --git a/commands/Fun/lyrics.js b/commands/Fun/lyrics.js index cbe5bdd..7f4706e 100644 --- a/commands/Fun/lyrics.js +++ b/commands/Fun/lyrics.js @@ -1,16 +1,16 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const Genius = require("genius-lyrics"); -const Client = new Genius.Client(process.env.GENIUS_TOKEN); -const { swap_pages } = require("../../handlers/functions"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const Genius = require('genius-lyrics') +const Client = new Genius.Client(process.env.GENIUS_TOKEN) +const { swap_pages } = require('../../handlers/functions') module.exports = { - name: "lyrics", - category: "Fun", + name: 'lyrics', + category: 'Fun', aliases: [], - cooldown: "", - usage: "lyrics ", - description: "Get the lyrics of any song.", + cooldown: '', + usage: 'lyrics ', + description: 'Get the lyrics of any song.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,16 +18,16 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const searches = await Client.songs.search(text); - const firstSong = searches[0]; - const song_title = firstSong.fullTitle; - const image = firstSong.image; - const artist = firstSong.artist.name || "Unknown"; - const artist_image = firstSong.artist.image; - const lyrics = await firstSong.lyrics(); - swap_pages(client, message, lyrics, song_title, 700); + const searches = await Client.songs.search(text) + const firstSong = searches[0] + const song_title = firstSong.fullTitle + const image = firstSong.image + const artist = firstSong.artist.name || 'Unknown' + const artist_image = firstSong.artist.image + const lyrics = await firstSong.lyrics() + swap_pages(client, message, lyrics, song_title, 700) }, -}; +} diff --git a/commands/Fun/meme.js b/commands/Fun/meme.js index 65433c9..a371aed 100644 --- a/commands/Fun/meme.js +++ b/commands/Fun/meme.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "meme", - category: "Fun", + name: 'meme', + category: 'Fun', aliases: [], - cooldown: "", - usage: "meme", - description: "Shows a meme (Make sure not to run it in #general 😂)", + cooldown: '', + usage: 'meme', + description: 'Shows a meme (Make sure not to run it in #general 😂)', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,26 +16,26 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - await message.reply("Loading! Please Wait...").then(async (msg) => { - let url = `https://meme-api.herokuapp.com/gimme`; + await message.reply('Loading! Please Wait...').then(async (msg) => { + let url = `https://meme-api.herokuapp.com/gimme` axios.get(url).then(async (response) => { - json = response.data; + json = response.data msg.edit({ - content: "​", + content: '​', embeds: [ new MessageEmbed() - .setColor("RANDOM") + .setColor('RANDOM') .setTitle(`${json.title}`) .setAuthor({ name: `${json.author}` }) .setDescription(`Upvotes: ${json.ups}`) .setImage(`${json.url}`) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - }); - }); + }) + }) + }) }, -}; +} diff --git a/commands/Fun/ocr.js b/commands/Fun/ocr.js index f74632d..c231f83 100644 --- a/commands/Fun/ocr.js +++ b/commands/Fun/ocr.js @@ -1,15 +1,15 @@ -const tesseract = require("node-tesseract-ocr"); -const https = require("https"); -const fs = require("fs"); -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const tesseract = require('node-tesseract-ocr') +const https = require('https') +const fs = require('fs') +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "ocr", - category: "Fun", + name: 'ocr', + category: 'Fun', aliases: [], - cooldown: "", - usage: "ocr [lang] ", - description: "Extract text from image", + cooldown: '', + usage: 'ocr [lang] ', + description: 'Extract text from image', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -17,50 +17,50 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, prefix) => { const config = { - lang: args[0] || "eng", + lang: args[0] || 'eng', oem: 3, psm: 3, - }; - const attachment = message.attachments.first(); + } + const attachment = message.attachments.first() if (!attachment) { - return message.reply("Please attach an image!"); + return message.reply('Please attach an image!') } https.get(attachment.url, (res) => { - const path = `${__dirname}/../../downloads/${message.author.id}-ocrimage.png`; - const filePath = fs.createWriteStream(path); - res.pipe(filePath); - filePath.on("finish", () => { - filePath.close(); + const path = `${__dirname}/../../downloads/${message.author.id}-ocrimage.png` + const filePath = fs.createWriteStream(path) + res.pipe(filePath) + filePath.on('finish', () => { + filePath.close() tesseract .recognize(path, config) .then((text) => { if (!text) { - return message.reply("Could not extract text from image!"); + return message.reply('Could not extract text from image!') } if (text.length > 2000) { - text = text.substring(0, 2000); + text = text.substring(0, 2000) } const embed = new MessageEmbed() - .setColor("#0099ff") - .setTitle("Extracted Text Successfully!") + .setColor('#0099ff') + .setTitle('Extracted Text Successfully!') .setDescription(`\`\`\`${text}\`\`\``) .setFooter({ text: ee.footertext, iconURL: ee.footericon, - }); - message.reply({ embeds: [embed] }); + }) + message.reply({ embeds: [embed] }) setTimeout(function () { - fs.unlinkSync(`./downloads/${message.author.id}-ocrimage.png`); - }, 5000); + fs.unlinkSync(`./downloads/${message.author.id}-ocrimage.png`) + }, 5000) }) .catch((err) => { - message.reply(`Oops! An error occured!\n\`\`\`js\n${err}\`\`\``); - }); - }); - }); + message.reply(`Oops! An error occured!\n\`\`\`js\n${err}\`\`\``) + }) + }) + }) }, -}; +} diff --git a/commands/Fun/poll.js b/commands/Fun/poll.js index 5eec7b5..d7c6c80 100644 --- a/commands/Fun/poll.js +++ b/commands/Fun/poll.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "poll", - category: "Fun", + name: 'poll', + category: 'Fun', aliases: [], - cooldown: "", + cooldown: '', usage: - "poll <#channel> | | | | | ", - description: "Send a poll in the mentioned channel", + 'poll <#channel> | | | | | ', + description: 'Send a poll in the mentioned channel', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,34 +16,34 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mentionedchannel = message.mentions.channels.first(); + const mentionedchannel = message.mentions.channels.first() if (!mentionedchannel) { - return message.reply("Please mention a channel!"); + return message.reply('Please mention a channel!') } - const polltitle = args.slice(1).join(" ").split("|")[0]; - const polloption1 = args.slice(1).join(" ").split("|")[1]; - const polloption2 = args.slice(1).join(" ").split("|")[2]; - const polloption3 = args.slice(1).join(" ").split("|")[3] || ""; - const polloption4 = args.slice(1).join(" ").split("|")[4] || ""; - const polloption5 = args.slice(1).join(" ").split("|")[5] || ""; + const polltitle = args.slice(1).join(' ').split('|')[0] + const polloption1 = args.slice(1).join(' ').split('|')[1] + const polloption2 = args.slice(1).join(' ').split('|')[2] + const polloption3 = args.slice(1).join(' ').split('|')[3] || '' + const polloption4 = args.slice(1).join(' ').split('|')[4] || '' + const polloption5 = args.slice(1).join(' ').split('|')[5] || '' - if (args.slice(1).join(" ").split("|").length < 3) { - return message.reply("Please enter a poll title and at least 2 options"); + if (args.slice(1).join(' ').split('|').length < 3) { + return message.reply('Please enter a poll title and at least 2 options') } - if (args.slice(1).join(" ").split("|").length > 6) { - return message.reply("You can only have 5 options in a poll"); + if (args.slice(1).join(' ').split('|').length > 6) { + return message.reply('You can only have 5 options in a poll') } - let option1, option2, option3, option4, option5; - option1 = "🇦"; - option2 = "🇧"; - if (polloption3) option3 = "🇨"; - if (polloption4) option4 = "🇩"; - if (polloption5) option5 = "🇪"; + let option1, option2, option3, option4, option5 + option1 = '🇦' + option2 = '🇧' + if (polloption3) option3 = '🇨' + if (polloption4) option4 = '🇩' + if (polloption5) option5 = '🇪' const embed = new MessageEmbed() .setColor(ee.color) @@ -53,23 +53,23 @@ module.exports = { }) .setTitle(`${polltitle}`) .setDescription( - `${option1 || ""} ${polloption1} \n${option2 || ""} ${polloption2} \n${ - option3 || "" - } ${polloption3} \n${option4 || ""} ${polloption4} \n${ - option5 || "" - } ${polloption5}` + `${option1 || ''} ${polloption1} \n${option2 || ''} ${polloption2} \n${ + option3 || '' + } ${polloption3} \n${option4 || ''} ${polloption4} \n${ + option5 || '' + } ${polloption5}`, ) .setFooter({ text: ee.footertext, iconURL: ee.footericon, - }); + }) mentionedchannel.send({ embeds: [embed] }).then(async (msg) => { - await msg.react(option1); - await msg.react(option2); - if (polloption3) await msg.react(option3); - if (polloption4) await msg.react(option4); - if (polloption5) await msg.react(option5); - }); + await msg.react(option1) + await msg.react(option2) + if (polloption3) await msg.react(option3) + if (polloption4) await msg.react(option4) + if (polloption5) await msg.react(option5) + }) }, -}; +} diff --git a/commands/Fun/qrdecode.js b/commands/Fun/qrdecode.js index c7571ee..74d55f7 100644 --- a/commands/Fun/qrdecode.js +++ b/commands/Fun/qrdecode.js @@ -1,11 +1,11 @@ -const axios = require("axios"); +const axios = require('axios') module.exports = { - name: "qrdecode", - category: "Fun", + name: 'qrdecode', + category: 'Fun', aliases: [], - cooldown: "", - usage: "qrdecode ", - description: "Decode the given qrcode", + cooldown: '', + usage: 'qrdecode ', + description: 'Decode the given qrcode', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -13,27 +13,27 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, prefix) => { try { - const attachment = message.attachments.first(); - const text = attachment ? attachment.url : args[0]; - await message.reply("Decoding...").then(async (msg) => { + const attachment = message.attachments.first() + const text = attachment ? attachment.url : args[0] + await message.reply('Decoding...').then(async (msg) => { axios .get(`https://api.qrserver.com/v1/read-qr-code/?fileurl=${text}`) .then(async (response) => { - json = response.data; - let qr = json[0].symbol[0].data; - msg.edit("QR Code Decoded: `" + qr + "`"); + json = response.data + let qr = json[0].symbol[0].data + msg.edit('QR Code Decoded: `' + qr + '`') }) .catch((err) => { - msg.edit(`Oops! An Error Occured.\n\`\`\`js\n${err}\n\`\`\``); - }); - }); + msg.edit(`Oops! An Error Occured.\n\`\`\`js\n${err}\n\`\`\``) + }) + }) } catch (err) { - message.reply("An Error Occured!"); - console.log(err); + message.reply('An Error Occured!') + console.log(err) } }, -}; +} diff --git a/commands/Fun/say.js b/commands/Fun/say.js index 4cc7ce4..b68513a 100644 --- a/commands/Fun/say.js +++ b/commands/Fun/say.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "say", - category: "Fun", + name: 'say', + category: 'Fun', aliases: [], - cooldown: "", - usage: "say ", - description: "Resends your Text", + cooldown: '', + usage: 'say ', + description: 'Resends your Text', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -14,8 +14,8 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "You are missing the text you wanna add to the message!", - argstoomany_message: "You are having too many arguments for this Command!", + argsmissing_message: 'You are missing the text you wanna add to the message!', + argstoomany_message: 'You are having too many arguments for this Command!', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { if (!args[0]) @@ -27,26 +27,26 @@ module.exports = { .setTitle(`❌ ERROR | You didn't provided a Text`) .setDescription(`Usage: \`${prefix}say \``), ], - }); - const replacedword = replaced(text); + }) + const replacedword = replaced(text) message.channel.send( - replacedword.substr(0, 2000) + `\n- Said by ${message.author.tag}` - ); + replacedword.substr(0, 2000) + `\n- Said by ${message.author.tag}`, + ) } catch (e) { - message.reply(`Oops! An Error Occured!\n\`\`\`js\n" + e + "\n\`\`\``); + message.reply(`Oops! An Error Occured!\n\`\`\`js\n" + e + "\n\`\`\``) } }, -}; +} function replaced(string) { return string .replace( /(?everyone" + '<:attherate:899514552029438012>everyone', ) .replace( /(?here" + '<:attherate:899514552029438012>here', ) - .replace(/(?"); + .replace(/(?') } diff --git a/commands/Fun/snipe.js b/commands/Fun/snipe.js index 42b198c..402ae8b 100644 --- a/commands/Fun/snipe.js +++ b/commands/Fun/snipe.js @@ -1,11 +1,11 @@ -const { MessageEmbed } = require("discord.js"); +const { MessageEmbed } = require('discord.js') module.exports = { - name: "snipe", - category: "Fun", + name: 'snipe', + category: 'Fun', aliases: [], - cooldown: "", - usage: "", - description: "Shows a previously deleted/edited message", + cooldown: '', + usage: '', + description: 'Shows a previously deleted/edited message', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -13,23 +13,23 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const snipe = client.snipes[message.channel.id]; - if (!snipe) return message.reply("There's nothing to snipe!"); + const snipe = client.snipes[message.channel.id] + if (!snipe) return message.reply("There's nothing to snipe!") const embed = new MessageEmbed() .setAuthor({ name: snipe.author.tag }) .setFooter({ text: `#${message.channel.name}` }) .setTimestamp(snipe.createdAt) - .setColor("RANDOM"); + .setColor('RANDOM') snipe.content - ? embed.addField("Original Message", `${snipe.content}`, true) - : null; - snipe.image ? embed.setImage(snipe.image) : null; + ? embed.addField('Original Message', `${snipe.content}`, true) + : null + snipe.image ? embed.setImage(snipe.image) : null snipe.newcontent - ? embed.addField("New Message", `${snipe.newcontent}`, true) - : null; - await message.reply({ embeds: [embed] }); + ? embed.addField('New Message', `${snipe.newcontent}`, true) + : null + await message.reply({ embeds: [embed] }) }, -}; +} diff --git a/commands/Fun/translate.js b/commands/Fun/translate.js index 4f5f77f..8c0936a 100644 --- a/commands/Fun/translate.js +++ b/commands/Fun/translate.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const translate = require("@vitalets/google-translate-api"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const translate = require('@vitalets/google-translate-api') module.exports = { - name: "translate", - category: "Fun", + name: 'translate', + category: 'Fun', aliases: [], - cooldown: "", - usage: "translate lang: text:", - description: "Translate any text from auto detect to specified language.", + cooldown: '', + usage: 'translate lang: text:', + description: 'Translate any text from auto detect to specified language.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,14 +15,14 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - var X = args.join(" "); - var lang = X.replace(new RegExp(".*" + "lang:"), ""); - var user_text = lang.replace(new RegExp(".*" + "text:"), ""); - lang = lang.replace(user_text, "").replace("text:", ""); - lang = lang.replace(/ /g, ""); + var X = args.join(' ') + var lang = X.replace(new RegExp('.*' + 'lang:'), '') + var user_text = lang.replace(new RegExp('.*' + 'text:'), '') + lang = lang.replace(user_text, '').replace('text:', '') + lang = lang.replace(/ /g, '') translate(`${user_text}`, { to: `${lang}` }) .then((res) => { const embed = new MessageEmbed() @@ -30,11 +30,11 @@ module.exports = { .setTitle(`Translated Text`) .addField(`Original Text (${res.from.language.iso})`, `${user_text}`) .addField(`Translated Text (${lang}) `, `${res.text}`) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) }) .catch((err) => { - message.reply(`An Error Occured!\n\`\`\`js\n${err}\`\`\``); - }); + message.reply(`An Error Occured!\n\`\`\`js\n${err}\`\`\``) + }) }, -}; +} diff --git a/commands/Fun/youtube.js b/commands/Fun/youtube.js index f595703..a85367e 100644 --- a/commands/Fun/youtube.js +++ b/commands/Fun/youtube.js @@ -1,20 +1,20 @@ -const { MessageEmbed, MessageButton, MessageActionRow } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const search = require("youtube-search"); +const { MessageEmbed, MessageButton, MessageActionRow } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const search = require('youtube-search') const opts = { maxResults: 1, key: process.env.youtube_token, - type: "video", -}; -const deepai = require("deepai"); -const he = require("he"); + type: 'video', +} +const deepai = require('deepai') +const he = require('he') module.exports = { - name: "youtube", - category: "Fun", + name: 'youtube', + category: 'Fun', aliases: [], - cooldown: "", - usage: "youtube ", - description: "Search a video on YouTube!", + cooldown: '', + usage: 'youtube ', + description: 'Search a video on YouTube!', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -22,51 +22,51 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text) => { - const searchtext = text.replace(/[^\w\s]/gi, "").replace(/\s+/g, "+"); + const searchtext = text.replace(/[^\w\s]/gi, '').replace(/\s+/g, '+') search(searchtext, opts, function (err, results) { if (err) { - message.reply(`Oops, An Error Occured!\n\`\`\`js\n${err}\n\`\`\``); + message.reply(`Oops, An Error Occured!\n\`\`\`js\n${err}\n\`\`\``) } else { - deepai.setApiKey(process.env.DEEPAI_TOKEN); - (async function () { - var resp = await deepai.callStandardApi("nsfw-detector", { + deepai.setApiKey(process.env.DEEPAI_TOKEN) + ;(async function () { + var resp = await deepai.callStandardApi('nsfw-detector', { image: results[0].thumbnails.high.url, - }); + }) if (resp.output.nsfw_score > 0.1) { - message.reply("This is NSFW!"); + message.reply('This is NSFW!') } else { const ytlinks = new MessageActionRow().addComponents( new MessageButton() - .setLabel("Watch Video") - .setStyle("LINK") - .setEmoji("▶️") + .setLabel('Watch Video') + .setStyle('LINK') + .setEmoji('▶️') .setURL(results[0].link), new MessageButton() - .setLabel("Search More Videos") - .setStyle("LINK") - .setEmoji("🔎") + .setLabel('Search More Videos') + .setStyle('LINK') + .setEmoji('🔎') .setURL( - "https://www.youtube.com/results?search_query=" + - searchtext.replace(/\s+/g, "+") - ) - ); + 'https://www.youtube.com/results?search_query=' + + searchtext.replace(/\s+/g, '+'), + ), + ) const embed = new MessageEmbed() - .setColor("RANDOM") + .setColor('RANDOM') .setAuthor({ name: results[0].channelTitle }) .setTitle(he.decode(results[0].title)) .setURL(results[0].link) .setDescription( - `${results[0].description}\n\nPublished on: ${results[0].publishedAt}` + `${results[0].description}\n\nPublished on: ${results[0].publishedAt}`, ) .setImage(results[0].thumbnails.high.url) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed], components: [ytlinks] }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed], components: [ytlinks] }) } - })(); + })() } - }); + }) }, -}; +} diff --git a/commands/ImageGen/awooify.js b/commands/ImageGen/awooify.js index c5a1445..ddd56f8 100644 --- a/commands/ImageGen/awooify.js +++ b/commands/ImageGen/awooify.js @@ -1,16 +1,16 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "awooify", - category: "ImageGen", + name: 'awooify', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "awooify [@USER]", - description: "AwOOOOify a user/yourself", + cooldown: '', + usage: 'awooify [@USER]', + description: 'AwOOOOify a user/yourself', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,14 +18,14 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { @@ -33,63 +33,63 @@ module.exports = { .get( `https://nekobot.xyz/api/imagegen?type=awooify&url=${mention.displayAvatarURL( { - format: "png", + format: 'png', size: 1024, - } - )}` + }, + )}`, ) .then(async (res) => { - const url = res.data.message; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-awooify.png`; - const writer = fs.createWriteStream(path); + const url = res.data.message + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-awooify.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Awooified <@!${mention.id}>!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); - }); + }) + fs.unlinkSync(path) + }) + }) + }) }, -}; +} diff --git a/commands/ImageGen/blurpify.js b/commands/ImageGen/blurpify.js index 6e0b467..789728f 100644 --- a/commands/ImageGen/blurpify.js +++ b/commands/ImageGen/blurpify.js @@ -1,16 +1,16 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "blurpify", - category: "ImageGen", + name: 'blurpify', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "blurpify [@USER]", - description: "Blurpify a user/yourself.", + cooldown: '', + usage: 'blurpify [@USER]', + description: 'Blurpify a user/yourself.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,14 +18,14 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { @@ -33,63 +33,63 @@ module.exports = { .get( `https://nekobot.xyz/api/imagegen?type=blurpify&image=${mention.displayAvatarURL( { - format: "png", + format: 'png', size: 1024, - } - )}` + }, + )}`, ) .then(async (res) => { - const url = res.data.message; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-blurpify.png`; - const writer = fs.createWriteStream(path); + const url = res.data.message + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-blurpify.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Blurpified <@!${mention.id}>!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); - }); + }) + fs.unlinkSync(path) + }) + }) + }) }, -}; +} diff --git a/commands/ImageGen/caution.js b/commands/ImageGen/caution.js index 6e0b467..789728f 100644 --- a/commands/ImageGen/caution.js +++ b/commands/ImageGen/caution.js @@ -1,16 +1,16 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "blurpify", - category: "ImageGen", + name: 'blurpify', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "blurpify [@USER]", - description: "Blurpify a user/yourself.", + cooldown: '', + usage: 'blurpify [@USER]', + description: 'Blurpify a user/yourself.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,14 +18,14 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { @@ -33,63 +33,63 @@ module.exports = { .get( `https://nekobot.xyz/api/imagegen?type=blurpify&image=${mention.displayAvatarURL( { - format: "png", + format: 'png', size: 1024, - } - )}` + }, + )}`, ) .then(async (res) => { - const url = res.data.message; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-blurpify.png`; - const writer = fs.createWriteStream(path); + const url = res.data.message + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-blurpify.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Blurpified <@!${mention.id}>!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); - }); + }) + fs.unlinkSync(path) + }) + }) + }) }, -}; +} diff --git a/commands/ImageGen/changemymind.js b/commands/ImageGen/changemymind.js index 06edd0f..7030351 100644 --- a/commands/ImageGen/changemymind.js +++ b/commands/ImageGen/changemymind.js @@ -30,18 +30,18 @@ // }, // }; -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "changemymind", - category: "ImageGen", + name: 'changemymind', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "changemymind ", + cooldown: '', + usage: 'changemymind ', description: "Creates an image with custom text saying 'Change My Mind'", memberpermissions: [], requiredroles: [], @@ -50,74 +50,74 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { await axios .get( `https://nekobot.xyz/api/imagegen?type=changemymind&text=${args.join( - "%20" - )}` + '%20', + )}`, ) .then(async (res) => { - const url = res.data.message; - const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-changemymind.png`; - const writer = fs.createWriteStream(path); + const url = res.data.message + const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-changemymind.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Generated the Image!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); - }); + }) + fs.unlinkSync(path) + }) + }) + }) }, -}; +} diff --git a/commands/ImageGen/deepfry.js b/commands/ImageGen/deepfry.js index 843342b..9540b08 100644 --- a/commands/ImageGen/deepfry.js +++ b/commands/ImageGen/deepfry.js @@ -1,16 +1,16 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "deepfry", - category: "ImageGen", + name: 'deepfry', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "deepfry [@USER]", - description: "Deepfry a user/yourself.", + cooldown: '', + usage: 'deepfry [@USER]', + description: 'Deepfry a user/yourself.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,15 +18,15 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { @@ -34,64 +34,64 @@ module.exports = { .get( `https://nekobot.xyz/api/imagegen?type=deepfry&image=${mention.displayAvatarURL( { - format: "png", + format: 'png', size: 1024, - } - )}` + }, + )}`, ) .then(async (res) => { - const url = res.data.message; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-deepfry.png`; - const writer = fs.createWriteStream(path); + const url = res.data.message + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-deepfry.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Generated the Image!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); - }); + }) + fs.unlinkSync(path) + }) + }) + }) }, -}; +} diff --git a/commands/ImageGen/delete.js b/commands/ImageGen/delete.js index f046464..032cef6 100644 --- a/commands/ImageGen/delete.js +++ b/commands/ImageGen/delete.js @@ -25,18 +25,18 @@ // }, // }; -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "delete", - category: "ImageGen", - aliases: ["del"], - cooldown: "", - usage: "delete [@User]", - description: "Delete a mentioned user / yourself", + name: 'delete', + category: 'ImageGen', + aliases: ['del'], + cooldown: '', + usage: 'delete [@User]', + description: 'Delete a mentioned user / yourself', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -44,69 +44,69 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { const url = `https://pixel-api-production.up.railway.app/image/trash/?image=${mention.displayAvatarURL( - { format: "png", size: 1024 } - )}`; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-delete.png`; - const writer = fs.createWriteStream(path); + { format: 'png', size: 1024 }, + )}` + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-delete.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Generated the Image!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/commands/ImageGen/iphonex.js b/commands/ImageGen/iphonex.js index 7e1f347..df31fed 100644 --- a/commands/ImageGen/iphonex.js +++ b/commands/ImageGen/iphonex.js @@ -1,16 +1,16 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "iphonex", - category: "ImageGen", + name: 'iphonex', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "iphonex ", - description: "Fill an Image into an iPhone X", + cooldown: '', + usage: 'iphonex ', + description: 'Fill an Image into an iPhone X', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,79 +18,79 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const attachment = message.attachments.first(); - const urlofimage = attachment ? attachment.url : args[0]; - if (!urlofimage || !urlofimage.startsWith("http")) { + const attachment = message.attachments.first() + const urlofimage = attachment ? attachment.url : args[0] + if (!urlofimage || !urlofimage.startsWith('http')) { return message.reply( - "Please provide a valid image url/attach a valid image" - ); + 'Please provide a valid image url/attach a valid image', + ) } const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { await axios .get( - `https://nekobot.xyz/api/imagegen?type=iphonex&url=${urlofimage}` + `https://nekobot.xyz/api/imagegen?type=iphonex&url=${urlofimage}`, ) .then(async (res) => { - const url = res.data.message; - const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-iphonex.png`; - const writer = fs.createWriteStream(path); + const url = res.data.message + const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-iphonex.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Generated the Image!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); - }); + }) + fs.unlinkSync(path) + }) + }) + }) }, -}; +} diff --git a/commands/ImageGen/jail.js b/commands/ImageGen/jail.js index 56886de..289c3f4 100644 --- a/commands/ImageGen/jail.js +++ b/commands/ImageGen/jail.js @@ -1,15 +1,15 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "jail", - category: "ImageGen", + name: 'jail', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "jail [@User]", - description: "Jail a mentioned user / yourself", + cooldown: '', + usage: 'jail [@User]', + description: 'Jail a mentioned user / yourself', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -17,69 +17,69 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { const url = `https://some-random-api.ml/canvas/jail?avatar=${mention.displayAvatarURL( - { format: "png", size: 1024 } - )}`; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-jail.png`; - const writer = fs.createWriteStream(path); + { format: 'png', size: 1024 }, + )}` + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-jail.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Generated the Image!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/commands/ImageGen/magik.js b/commands/ImageGen/magik.js index 023f609..abc483f 100644 --- a/commands/ImageGen/magik.js +++ b/commands/ImageGen/magik.js @@ -1,14 +1,14 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "magik", - category: "ImageGen", + name: 'magik', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "magik [@USER]", + cooldown: '', + usage: 'magik [@USER]', description: "Convert a user's profile pik into magik", memberpermissions: [], requiredroles: [], @@ -17,14 +17,14 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { @@ -32,64 +32,64 @@ module.exports = { .get( `https://nekobot.xyz/api/imagegen?type=magik&image=${mention.displayAvatarURL( { - format: "png", + format: 'png', size: 1024, - } - )}` + }, + )}`, ) .then(async (res) => { - const url = res.data.message; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-magik.png`; - const writer = fs.createWriteStream(path); + const url = res.data.message + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-magik.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Generated the Image!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); - }); + }) + fs.unlinkSync(path) + }) + }) + }) }, -}; +} diff --git a/commands/ImageGen/mask.js b/commands/ImageGen/mask.js index 9e318a4..2f68770 100644 --- a/commands/ImageGen/mask.js +++ b/commands/ImageGen/mask.js @@ -1,16 +1,16 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "mask", - category: "ImageGen", + name: 'mask', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "mask [@USER]", - description: "Dude Why do you wear that mask all the time?", + cooldown: '', + usage: 'mask [@USER]', + description: 'Dude Why do you wear that mask all the time?', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,69 +18,69 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { const url = `https://api.weky.xyz/canvas/mask?image=${mention.displayAvatarURL( - { format: "png", size: 1024 } - )}`; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-mask.png`; - const writer = fs.createWriteStream(path); + { format: 'png', size: 1024 }, + )}` + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-mask.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Generated the Image!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/commands/ImageGen/neontxt.js b/commands/ImageGen/neontxt.js index 2661f26..81e84e8 100644 --- a/commands/ImageGen/neontxt.js +++ b/commands/ImageGen/neontxt.js @@ -1,16 +1,16 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "neontxt", - category: "ImageGen", - aliases: ["neontext"], - cooldown: "", - usage: "neontxt ", - description: "Creates a Neon Style Text Image of the text written", + name: 'neontxt', + category: 'ImageGen', + aliases: ['neontext'], + cooldown: '', + usage: 'neontxt ', + description: 'Creates a Neon Style Text Image of the text written', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,67 +18,67 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const usertext = args.join("+"); + const usertext = args.join('+') const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { - const url = `https://flamingtext.com/net-fu/proxy_form.cgi?imageoutput=true&script=alien-glow-anim-logo&text=${usertext}`; - const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-neontxt.gif`; - const writer = fs.createWriteStream(path); + const url = `https://flamingtext.com/net-fu/proxy_form.cgi?imageoutput=true&script=alien-glow-anim-logo&text=${usertext}` + const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-neontxt.gif` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Generated the Image!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/commands/ImageGen/qrcode.js b/commands/ImageGen/qrcode.js index 1ee3edc..ee34360 100644 --- a/commands/ImageGen/qrcode.js +++ b/commands/ImageGen/qrcode.js @@ -1,14 +1,14 @@ -const { MessageAttachment } = require("discord.js"); -const fs = require("fs"); -var QRCode = require("qrcode"); +const { MessageAttachment } = require('discord.js') +const fs = require('fs') +var QRCode = require('qrcode') module.exports = { - name: "qrcode", - category: "ImageGen", + name: 'qrcode', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "qrcode ", - description: "Generate a qrcode of the given text.", + cooldown: '', + usage: 'qrcode ', + description: 'Generate a qrcode of the given text.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,32 +16,32 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const path = `${__dirname}/../../downloads/${message.author.id}-qrcode.png`; + const path = `${__dirname}/../../downloads/${message.author.id}-qrcode.png` await message - .reply(" Generating QR Code...") + .reply(' Generating QR Code...') .then(async (msg) => { - QRCode.toDataURL(`${text}`, { width: "200" }, function (err, url) { - let base64Image = url.split(";base64,").pop(); + QRCode.toDataURL(`${text}`, { width: '200' }, function (err, url) { + let base64Image = url.split(';base64,').pop() fs.writeFile( path, base64Image, - { encoding: "base64" }, + { encoding: 'base64' }, function (err) { - if (err) throw err; - const attachment = new MessageAttachment(path); + if (err) throw err + const attachment = new MessageAttachment(path) msg.edit({ - content: "Here is the QR Code.", + content: 'Here is the QR Code.', files: [attachment], - }); - } - ); + }) + }, + ) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); - }); - }); + fs.unlinkSync(path) + }, 5000) + }) + }) }, -}; +} diff --git a/commands/ImageGen/trigger.js b/commands/ImageGen/trigger.js index eec1dc1..ca86ba6 100644 --- a/commands/ImageGen/trigger.js +++ b/commands/ImageGen/trigger.js @@ -1,15 +1,15 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "trigger", - category: "ImageGen", - aliases: ["triggered"], - cooldown: "", - usage: "trigger [@User]", - description: "Trigger a mentioned user / yourself", + name: 'trigger', + category: 'ImageGen', + aliases: ['triggered'], + cooldown: '', + usage: 'trigger [@User]', + description: 'Trigger a mentioned user / yourself', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -17,69 +17,69 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { const url = `https://some-random-api.ml/canvas/triggered?avatar=${mention.displayAvatarURL( - { format: "png", size: 1024 } - )}`; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-triggered.gif`; - const writer = fs.createWriteStream(path); + { format: 'png', size: 1024 }, + )}` + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-triggered.gif` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Triggered <@!${mention.id}>!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/commands/ImageGen/wasted.js b/commands/ImageGen/wasted.js index 6fdc928..138b5db 100644 --- a/commands/ImageGen/wasted.js +++ b/commands/ImageGen/wasted.js @@ -1,15 +1,15 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "wasted", - category: "ImageGen", + name: 'wasted', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "wasted [@User]", - description: "Oh no, A guy here got wasted 😳", + cooldown: '', + usage: 'wasted [@User]', + description: 'Oh no, A guy here got wasted 😳', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -17,69 +17,69 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { const url = `https://some-random-api.ml/canvas/wasted?avatar=${mention.displayAvatarURL( - { format: "png", size: 1024 } - )}`; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-wasted.png`; - const writer = fs.createWriteStream(path); + { format: 'png', size: 1024 }, + )}` + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-wasted.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `<@!${mention.id}> got wasted!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/commands/ImageGen/whodidthis.js b/commands/ImageGen/whodidthis.js index ba0c2ab..7cfc38e 100644 --- a/commands/ImageGen/whodidthis.js +++ b/commands/ImageGen/whodidthis.js @@ -1,14 +1,14 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "whodidthis", - category: "ImageGen", + name: 'whodidthis', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "whodidthis [@USER]", + cooldown: '', + usage: 'whodidthis [@USER]', description: "Create an image showing 'Who did this' of either the mentioned user or yourself", memberpermissions: [], @@ -18,69 +18,69 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const mention = message.mentions.users.first() || message.author; + const mention = message.mentions.users.first() || message.author const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { const url = `https://api.weky.xyz/canvas/whodidthis?image=${mention.displayAvatarURL( - { format: "png", size: 1024 } - )}`; - const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-whodidthis.png`; - const writer = fs.createWriteStream(path); + { format: 'png', size: 1024 }, + )}` + const path = `${__dirname}/../../downloads/${mention.id}-${randomchar}-whodidthis.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `<@!${mention.id}> got wasted!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/commands/ImageGen/whowouldwin.js b/commands/ImageGen/whowouldwin.js index d647f5c..99edde6 100644 --- a/commands/ImageGen/whowouldwin.js +++ b/commands/ImageGen/whowouldwin.js @@ -1,16 +1,16 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "whowouldwin", - category: "ImageGen", + name: 'whowouldwin', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "whowouldwin <@USER1> <@USER2>", - description: "Who would win!?", + cooldown: '', + usage: 'whowouldwin <@USER1> <@USER2>', + description: 'Who would win!?', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,15 +18,15 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const firstuser = message.mentions.users.first(); - const seconduser = message.mentions.users.last(); + const firstuser = message.mentions.users.first() + const seconduser = message.mentions.users.last() const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { @@ -34,66 +34,66 @@ module.exports = { .get( `https://nekobot.xyz/api/imagegen?type=whowouldwin&user1=${firstuser.displayAvatarURL( { - format: "png", + format: 'png', size: 1024, - } + }, )}&user2=${seconduser.displayAvatarURL({ - format: "png", + format: 'png', size: 1024, - })}` + })}`, ) .then(async (res) => { - const url = res.data.message; - const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-whowouldwin.png`; - const writer = fs.createWriteStream(path); + const url = res.data.message + const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-whowouldwin.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Who would win!?`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); - }); + }) + fs.unlinkSync(path) + }) + }) + }) }, -}; +} diff --git a/commands/ImageGen/write.js b/commands/ImageGen/write.js index cdb1ee6..21c61f7 100644 --- a/commands/ImageGen/write.js +++ b/commands/ImageGen/write.js @@ -1,15 +1,15 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "write", - category: "ImageGen", + name: 'write', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "write ", - description: "Write text on an image [Use `\n` to create a new line]", + cooldown: '', + usage: 'write ', + description: 'Write text on an image [Use `\n` to create a new line]', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -17,72 +17,72 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const usertext = args.join("%20"); - const userinput = usertext.replace(/\\n/g, "%0A"); + const usertext = args.join('%20') + const userinput = usertext.replace(/\\n/g, '%0A') if (userinput.length > 2000 || userinput.length < 1) return message.reply( - ` The text must be between 1 and 2000 characters!` - ); + ` The text must be between 1 and 2000 characters!`, + ) const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { - const url = `https://apis.xditya.me/write?text=${userinput}`; - const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-write.png`; - const writer = fs.createWriteStream(path); + const url = `https://apis.xditya.me/write?text=${userinput}` + const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-write.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Written by <@!${message.author.id}>!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/commands/ImageGen/ytcomment.js b/commands/ImageGen/ytcomment.js index 475241b..e288c35 100644 --- a/commands/ImageGen/ytcomment.js +++ b/commands/ImageGen/ytcomment.js @@ -1,15 +1,15 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "ytcomment", - category: "ImageGen", + name: 'ytcomment', + category: 'ImageGen', aliases: [], - cooldown: "", - usage: "ytcomment ", - description: "Generate a fake youtube comment", + cooldown: '', + usage: 'ytcomment ', + description: 'Generate a fake youtube comment', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -17,68 +17,68 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); + charset: 'alphabetic', + }) await message .reply(` Please Wait...`) .then(async (msg) => { const url = `https://some-random-api.ml/canvas/youtube-comment?avatar=${message.author.displayAvatarURL( - { format: "png", size: 1024 } - )}&comment=${args.join("%20")}&username=${message.author.username}`; - const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-ytcomment.png`; - const writer = fs.createWriteStream(path); + { format: 'png', size: 1024 }, + )}&comment=${args.join('%20')}&username=${message.author.username}` + const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-ytcomment.png` + const writer = fs.createWriteStream(path) const download = await axios({ url: url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `A new comment on YouTube by <@!${message.author.id}>!`, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/commands/Information/about.js b/commands/Information/about.js index 67fa7a0..7139e68 100644 --- a/commands/Information/about.js +++ b/commands/Information/about.js @@ -1,14 +1,14 @@ -const Discord = require("discord.js"); -var ee = require("../../botconfig/embed.json"); -const package = require("../../package.json"); -const os = require("os"); +const Discord = require('discord.js') +var ee = require('../../botconfig/embed.json') +const package = require('../../package.json') +const os = require('os') module.exports = { - name: "about", - category: "Information", - aliases: ["info"], - cooldown: "", - usage: "about", - description: "About CannyBot", + name: 'about', + category: 'Information', + aliases: ['info'], + cooldown: '', + usage: 'about', + description: 'About CannyBot', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,35 +16,35 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { const embed = new Discord.MessageEmbed() .setColor(ee.color) - .setTitle("CannyBot") + .setTitle('CannyBot') .setThumbnail( - client.user.avatarURL({ format: "png", dynamic: true, size: 1024 }) + client.user.avatarURL({ format: 'png', dynamic: true, size: 1024 }), ) .setDescription( - "Canny bot is a nice and cool bot which has many features like Image Generation, Fun commands, Tech commands, Some Moderation commands and many more! More commands are being added daily and its in continuous development! Coded in discord.js v13 with hardwork of a single developer. This bot is being improved a lot and suggestions always accepted :D" + 'Canny bot is a nice and cool bot which has many features like Image Generation, Fun commands, Tech commands, Some Moderation commands and many more! More commands are being added daily and its in continuous development! Coded in discord.js v13 with hardwork of a single developer. This bot is being improved a lot and suggestions always accepted :D', ) - .addField("Version", package.version, true) - .addField("Author", "agam778#9486", true) - .addField("Discord.js", "v13", true) - .addField("Node.js", process.version, true) - .addField("CPU", `${os.cpus()[0].model}`, true) - .addField("RAM", `${Math.round(os.totalmem() / 1000000000)} GB`, true) - .addField("OS", `${os.platform()}`, true) - .addField("Arch", `${os.arch()}`, true) + .addField('Version', package.version, true) + .addField('Author', 'agam778#9486', true) + .addField('Discord.js', 'v13', true) + .addField('Node.js', process.version, true) + .addField('CPU', `${os.cpus()[0].model}`, true) + .addField('RAM', `${Math.round(os.totalmem() / 1000000000)} GB`, true) + .addField('OS', `${os.platform()}`, true) + .addField('Arch', `${os.arch()}`, true) .addField( - "Uptime", + 'Uptime', `${Math.floor(client.uptime / 1000 / 60 / 60)} hours, ${Math.floor( - (client.uptime / 1000 / 60) % 60 + (client.uptime / 1000 / 60) % 60, )} minutes and ${Math.floor((client.uptime / 1000) % 60)} seconds`, - true + true, ) - .addField("Hostname", `${os.hostname()}`, true) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); + .addField('Hostname', `${os.hostname()}`, true) + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) }, -}; +} diff --git a/commands/Information/avatar.js b/commands/Information/avatar.js index 865ab6d..c367333 100644 --- a/commands/Information/avatar.js +++ b/commands/Information/avatar.js @@ -1,16 +1,16 @@ -const Discord = require("discord.js"); -const { MessageEmbed } = require("discord.js"); -const config = require("../../botconfig/config.json"); -var ee = require("../../botconfig/embed.json"); -const { GetUser, GetGlobalUser } = require("../../handlers/functions"); -const settings = require("../../botconfig/settings.json"); +const Discord = require('discord.js') +const { MessageEmbed } = require('discord.js') +const config = require('../../botconfig/config.json') +var ee = require('../../botconfig/embed.json') +const { GetUser, GetGlobalUser } = require('../../handlers/functions') +const settings = require('../../botconfig/settings.json') module.exports = { - name: "avatar", - category: "Information", - aliases: ["useravatar"], - cooldown: "", - usage: "avatar [@USER] [global]", - description: "Shows the Avatar of a User", + name: 'avatar', + category: 'Information', + aliases: ['useravatar'], + cooldown: '', + usage: 'avatar [@USER] [global]', + description: 'Shows the Avatar of a User', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,20 +18,20 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { - var user; + var user try { - if (args[1] && args[1].toLowerCase() == "global") { - args.pop(); - user = await GetGlobalUser(message, args); + if (args[1] && args[1].toLowerCase() == 'global') { + args.pop() + user = await GetGlobalUser(message, args) } else { - user = await GetUser(message, args); + user = await GetUser(message, args) } } catch (e) { - return message.reply(e); + return message.reply(e) } message.reply({ embeds: [ @@ -42,36 +42,36 @@ module.exports = { }) .setColor(ee.color) .addField( - "-> PNG", - `[\`LINK\`](${user.displayAvatarURL({ format: "png" })})`, - true + '-> PNG', + `[\`LINK\`](${user.displayAvatarURL({ format: 'png' })})`, + true, ) .addField( - "-> JPEG", - `[\`LINK\`](${user.displayAvatarURL({ format: "jpg" })})`, - true + '-> JPEG', + `[\`LINK\`](${user.displayAvatarURL({ format: 'jpg' })})`, + true, ) .addField( - "-> WEBP", - `[\`LINK\`](${user.displayAvatarURL({ format: "webp" })})`, - true + '-> WEBP', + `[\`LINK\`](${user.displayAvatarURL({ format: 'webp' })})`, + true, ) .setURL( user.displayAvatarURL({ dynamic: true, - }) + }), ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setImage( user.displayAvatarURL({ dynamic: true, size: 512, - }) + }), ), ], - }); + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -83,10 +83,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/commandcount.js b/commands/Information/commandcount.js index d1bebe7..5be6740 100644 --- a/commands/Information/commandcount.js +++ b/commands/Information/commandcount.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -var ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +var ee = require('../../botconfig/embed.json') module.exports = { - name: "commandcount", - category: "Information", - aliases: ["cmdcount", "commandamount", "cmdamount"], - cooldown: "", - usage: "commandcount", - description: "Shows the Amount of Commands an Categories", + name: 'commandcount', + category: 'Information', + aliases: ['cmdcount', 'commandamount', 'cmdamount'], + cooldown: '', + usage: 'commandcount', + description: 'Shows the Amount of Commands an Categories', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -14,8 +14,8 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { message.reply({ @@ -25,12 +25,12 @@ module.exports = { .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle(`:gear: **[${client.commands.size}] Commands**`) .setDescription( - `:gear: **[${client.categories.length}] Categories**` + `:gear: **[${client.categories.length}] Categories**`, ), ], - }); + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -42,10 +42,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/help.js b/commands/Information/help.js index cfc3b65..431f65b 100644 --- a/commands/Information/help.js +++ b/commands/Information/help.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const settings = require("../../botconfig/settings.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const settings = require('../../botconfig/settings.json') module.exports = { - name: "help", - category: "Information", - aliases: ["h", "commandinfo", "cmds", "cmd", "halp"], - cooldown: "", - usage: "help [Commandname]", - description: "Returns all Commmands, or one specific command", + name: 'help', + category: 'Information', + aliases: ['h', 'commandinfo', 'cmds', 'cmd', 'halp'], + cooldown: '', + usage: 'help [Commandname]', + description: 'Returns all Commmands, or one specific command', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,80 +15,80 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { if (args[0]) { - const embed = new MessageEmbed(); + const embed = new MessageEmbed() const cmd = client.commands.get(args[0].toLowerCase()) || - client.commands.get(client.aliases.get(args[0].toLowerCase())); + client.commands.get(client.aliases.get(args[0].toLowerCase())) if (!cmd) { return message.reply({ embeds: [ embed .setColor(ee.wrongcolor) .setDescription( - `No Information found for command **${args[0].toLowerCase()}**` + `No Information found for command **${args[0].toLowerCase()}**`, ), ], - }); + }) } - if (cmd.name) embed.addField("**Command name**", `\`${cmd.name}\``); + if (cmd.name) embed.addField('**Command name**', `\`${cmd.name}\``) if (cmd.name) - embed.setTitle(`Detailed Information about:\`${cmd.name}\``); + embed.setTitle(`Detailed Information about:\`${cmd.name}\``) if (cmd.description) - embed.addField("**Description**", `\`${cmd.description}\``); + embed.addField('**Description**', `\`${cmd.description}\``) if (cmd.aliases) embed.addField( - "**Aliases**", - `\`${cmd.aliases.map((a) => `${a}`).join("`, `")}\`` - ); + '**Aliases**', + `\`${cmd.aliases.map((a) => `${a}`).join('`, `')}\``, + ) if (cmd.cooldown) - embed.addField("**Cooldown**", `\`${cmd.cooldown} Seconds\``); + embed.addField('**Cooldown**', `\`${cmd.cooldown} Seconds\``) else embed.addField( - "**Cooldown**", - `\`${settings.default_cooldown_in_sec} Second\`` - ); + '**Cooldown**', + `\`${settings.default_cooldown_in_sec} Second\``, + ) if (cmd.usage) { - embed.addField("**Usage**", `\`${prefix}${cmd.usage}\``); - embed.setFooter({ text: "Syntax: <> = required, [] = optional" }); + embed.addField('**Usage**', `\`${prefix}${cmd.usage}\``) + embed.setFooter({ text: 'Syntax: <> = required, [] = optional' }) } - return message.reply({ embeds: [embed.setColor(ee.color)] }); + return message.reply({ embeds: [embed.setColor(ee.color)] }) } else { const embed = new MessageEmbed() .setColor(ee.color) .setThumbnail( - "https://cdn.discordapp.com/emojis/748654505029009479.png" + 'https://cdn.discordapp.com/emojis/748654505029009479.png', ) - .setTitle("Help Menu:") + .setTitle('Help Menu:') .setFooter({ text: `To see command Descriptions and Information, type: ${prefix}help [CMD NAME]`, iconURL: client.user.displayAvatarURL(), - }); + }) const commands = (category) => { return client.commands .filter((cmd) => cmd.category === category) - .map((cmd) => `\`${cmd.name}\``); - }; + .map((cmd) => `\`${cmd.name}\``) + } try { for (let i = 0; i < client.categories.length; i += 1) { - const current = client.categories[i]; - const items = commands(current); + const current = client.categories[i] + const items = commands(current) embed.addField( `**${current.toUpperCase()} [${items.length}]**`, - `| ${items.join(", ")}` - ); + `| ${items.join(', ')}`, + ) } } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } - message.reply({ embeds: [embed] }); + message.reply({ embeds: [embed] }) } } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -100,10 +100,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/invite.js b/commands/Information/invite.js index e54f05d..2d2c221 100644 --- a/commands/Information/invite.js +++ b/commands/Information/invite.js @@ -1,12 +1,12 @@ -const { MessageEmbed, MessageButton, MessageActionRow } = require("discord.js"); -var ee = require("../../botconfig/embed.json"); +const { MessageEmbed, MessageButton, MessageActionRow } = require('discord.js') +var ee = require('../../botconfig/embed.json') module.exports = { - name: "invite", - category: "Information", - aliases: ["add"], - cooldown: "", - usage: "invite", - description: "Sends you an invite link", + name: 'invite', + category: 'Information', + aliases: ['add'], + cooldown: '', + usage: 'invite', + description: 'Sends you an invite link', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -14,42 +14,42 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { const invitelinks = new MessageActionRow().addComponents( new MessageButton() - .setLabel("Administrator Invite") - .setStyle("LINK") - .setEmoji("") + .setLabel('Administrator Invite') + .setStyle('LINK') + .setEmoji('') .setURL( - "https://discord.com/api/oauth2/authorize?client_id=869085787310932060&permissions=8&scope=applications.commands%20bot" + 'https://discord.com/api/oauth2/authorize?client_id=869085787310932060&permissions=8&scope=applications.commands%20bot', ), new MessageButton() - .setLabel("Non-Administrator Invite") - .setStyle("LINK") - .setEmoji("") + .setLabel('Non-Administrator Invite') + .setStyle('LINK') + .setEmoji('') .setURL( - "https://discord.com/api/oauth2/authorize?client_id=869085787310932060&permissions=1257889000519&scope=applications.commands%20bot" - ) - ); + 'https://discord.com/api/oauth2/authorize?client_id=869085787310932060&permissions=1257889000519&scope=applications.commands%20bot', + ), + ) try { message.reply({ embeds: [ new MessageEmbed() - .setTitle("Hey!") + .setTitle('Hey!') .setDescription( - "Wow! Looks like you want to invite me ❤️, To do so, click the button below accordingly" + 'Wow! Looks like you want to invite me ❤️, To do so, click the button below accordingly', ) .setThumbnail(ee.footericon) .setColor(ee.color) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], components: [invitelinks], - }); + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -61,10 +61,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/permissions.js b/commands/Information/permissions.js index 8260e29..0983b57 100644 --- a/commands/Information/permissions.js +++ b/commands/Information/permissions.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -var ee = require("../../botconfig/embed.json"); -const { GetUser } = require("../../handlers/functions"); +const { MessageEmbed } = require('discord.js') +var ee = require('../../botconfig/embed.json') +const { GetUser } = require('../../handlers/functions') module.exports = { - name: "permissions", - category: "Information", - aliases: ["perms"], - cooldown: "", - usage: "permissions [@USER]", - description: "Shows the Permissions of a Member", + name: 'permissions', + category: 'Information', + aliases: ['perms'], + cooldown: '', + usage: 'permissions [@USER]', + description: 'Shows the Permissions of a Member', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,81 +15,81 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { - var user; + var user if (args[0]) { try { - user = await GetUser(message, args); + user = await GetUser(message, args) } catch (e) { - if (!e) return message.reply("UNABLE TO FIND THE USER"); - return message.reply(e); + if (!e) return message.reply('UNABLE TO FIND THE USER') + return message.reply(e) } } else { - user = message.author; + user = message.author } if (!user || user == null || user.id == null || !user.id) - message.reply("❌ Could not find the USER"); + message.reply('❌ Could not find the USER') try { - const member = message.guild.members.cache.get(user.id); + const member = message.guild.members.cache.get(user.id) //create the EMBED - const embeduserinfo = new MessageEmbed(); + const embeduserinfo = new MessageEmbed() embeduserinfo.setThumbnail( - member.user.displayAvatarURL({ dynamic: true, size: 512 }) - ); + member.user.displayAvatarURL({ dynamic: true, size: 512 }), + ) embeduserinfo.setAuthor({ name: - "Permissions from: " + + 'Permissions from: ' + member.user.username + - "#" + + '#' + member.user.discriminator, iconURL: member.user.displayAvatarURL({ dynamic: true }), - }); + }) embeduserinfo.addField( - "**❱ Permissions:**", + '**❱ Permissions:**', `${message.member.permissions .toArray() .map((p) => `\`${p}\``) - .join(", ")}` - ); - embeduserinfo.setColor(ee.color); + .join(', ')}`, + ) + embeduserinfo.setColor(ee.color) embeduserinfo.setFooter({ text: ee.footertext, iconURL: ee.footericon, - }); + }) //send the EMBED - message.reply({ embeds: [embeduserinfo] }); + message.reply({ embeds: [embeduserinfo] }) } catch (e) { - console.log(e); + console.log(e) //create the EMBED - const embeduserinfo = new MessageEmbed(); + const embeduserinfo = new MessageEmbed() embeduserinfo.setThumbnail( - user.displayAvatarURL({ dynamic: true, size: 512 }) - ); + user.displayAvatarURL({ dynamic: true, size: 512 }), + ) embeduserinfo.setAuthor({ name: - "Permissions from: " + user.username + "#" + user.discriminator, + 'Permissions from: ' + user.username + '#' + user.discriminator, iconURL: user.displayAvatarURL({ dynamic: true }), - }); + }) embeduserinfo.addField( - "**❱ Permissions:**", + '**❱ Permissions:**', `${message.member.permissions .toArray() .map((p) => `\`${p}\``) - .join(", ")}` - ); - embeduserinfo.setColor(ee.color); + .join(', ')}`, + ) + embeduserinfo.setColor(ee.color) embeduserinfo.setFooter({ text: ee.footertext, iconURL: ee.footericon, - }); + }) //send the EMBED - message.reply({ embeds: [embeduserinfo] }); + message.reply({ embeds: [embeduserinfo] }) } } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -101,10 +101,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/ping.js b/commands/Information/ping.js index 7e8787f..6e08e09 100644 --- a/commands/Information/ping.js +++ b/commands/Information/ping.js @@ -1,12 +1,12 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "ping", - category: "Information", - aliases: ["latency"], - cooldown: "", - usage: "ping", - description: "Gives u information on how fast the Bot is", + name: 'ping', + category: 'Information', + aliases: ['latency'], + cooldown: '', + usage: 'ping', + description: 'Gives u information on how fast the Bot is', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -14,28 +14,28 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { - var date = Date.now(); + var date = Date.now() message.reply({ embeds: [ new MessageEmbed() .setColor(ee.color) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) - .setThumbnail("https://i.gifer.com/8158.gif") - .setTitle("Hey! Why Ping?") + .setThumbnail('https://i.gifer.com/8158.gif') + .setTitle('Hey! Why Ping?') .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .addFields({ - name: "Btw Pong!", + name: 'Btw Pong!', value: `\`${client.ws.ping}ms\``, inline: true, }), ], - }); + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -47,10 +47,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/roleinfo.js b/commands/Information/roleinfo.js index 39a4cb0..ef0fca7 100644 --- a/commands/Information/roleinfo.js +++ b/commands/Information/roleinfo.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -var ee = require("../../botconfig/embed.json"); -const moment = require("moment"); -const { GetRole } = require("../../handlers/functions"); +const { MessageEmbed } = require('discord.js') +var ee = require('../../botconfig/embed.json') +const moment = require('moment') +const { GetRole } = require('../../handlers/functions') module.exports = { - name: "roleinfo", - category: "Information", - aliases: ["rinfo"], - cooldown: "", - usage: "roleinfo <@ROLE>", - description: "Shows Information about a role", + name: 'roleinfo', + category: 'Information', + aliases: ['rinfo'], + cooldown: '', + usage: 'roleinfo <@ROLE>', + description: 'Shows Information about a role', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,78 +16,78 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { - var role; + var role if (args[0]) { try { - role = await GetRole(message, args); + role = await GetRole(message, args) } catch (e) { - if (!e) return message.reply("UNABLE TO FIND THE ROLE"); - return message.reply(e); + if (!e) return message.reply('UNABLE TO FIND THE ROLE') + return message.reply(e) } } else { - return message.reply("❌ Please retry but add a Role/Rolename/Roleid"); + return message.reply('❌ Please retry but add a Role/Rolename/Roleid') } if (!role || role == null || role.id == null || !role.id) - message.reply("❌ Could not find the ROLE"); + message.reply('❌ Could not find the ROLE') //create the EMBED - const embeduserinfo = new MessageEmbed(); + const embeduserinfo = new MessageEmbed() embeduserinfo.setThumbnail( - message.guild.iconURL({ dynamic: true, size: 512 }) - ); + message.guild.iconURL({ dynamic: true, size: 512 }), + ) embeduserinfo.setAuthor({ - name: "Information about: " + role.name, + name: 'Information about: ' + role.name, iconURL: message.guild.iconURL({ dynamic: true }), - }); - embeduserinfo.addField("**❱ Name:**", `\`${role.name}\``, true); - embeduserinfo.addField("**❱ ID:**", `\`${role.id}\``, true); - embeduserinfo.addField("**❱ Color:**", `\`${role.hexColor}\``, true); + }) + embeduserinfo.addField('**❱ Name:**', `\`${role.name}\``, true) + embeduserinfo.addField('**❱ ID:**', `\`${role.id}\``, true) + embeduserinfo.addField('**❱ Color:**', `\`${role.hexColor}\``, true) embeduserinfo.addField( - "**・ Date Created:**", - "`" + - moment(role.createdAt).format("DD/MM/YYYY") + - "`\n" + - "`" + - moment(role.createdAt).format("hh:mm:ss") + - "`", - true - ); + '**・ Date Created:**', + '`' + + moment(role.createdAt).format('DD/MM/YYYY') + + '`\n' + + '`' + + moment(role.createdAt).format('hh:mm:ss') + + '`', + true, + ) embeduserinfo.addField( - "**・ Position:**", + '**・ Position:**', `\`${role.rawPosition}\``, - true - ); + true, + ) embeduserinfo.addField( - "**・ MemberCount:**", + '**・ MemberCount:**', `\`${role.members.size} Members have it\``, - true - ); + true, + ) embeduserinfo.addField( - "**・ Hoisted:**", - `\`${role.hoist ? "✔️" : "❌"}\``, - true - ); + '**・ Hoisted:**', + `\`${role.hoist ? '✔️' : '❌'}\``, + true, + ) embeduserinfo.addField( - "**・ Mentionable:**", - `\`${role.mentionable ? "✔️" : "❌"}\``, - true - ); + '**・ Mentionable:**', + `\`${role.mentionable ? '✔️' : '❌'}\``, + true, + ) embeduserinfo.addField( - "**・ Permissions:**", + '**・ Permissions:**', `${role.permissions .toArray() .map((p) => `\`${p}\``) - .join(", ")}` - ); - embeduserinfo.setColor(role.hexColor); - embeduserinfo.setFooter({ text: ee.footertext, iconURL: ee.footericon }); + .join(', ')}`, + ) + embeduserinfo.setColor(role.hexColor) + embeduserinfo.setFooter({ text: ee.footertext, iconURL: ee.footericon }) //send the EMBED - message.reply({ embeds: [embeduserinfo] }); + message.reply({ embeds: [embeduserinfo] }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -99,10 +99,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/servericon.js b/commands/Information/servericon.js index 6bdcada..1f941ac 100644 --- a/commands/Information/servericon.js +++ b/commands/Information/servericon.js @@ -1,13 +1,13 @@ -const Discord = require("discord.js"); -const { MessageEmbed } = require("discord.js"); -var ee = require("../../botconfig/embed.json"); +const Discord = require('discord.js') +const { MessageEmbed } = require('discord.js') +var ee = require('../../botconfig/embed.json') module.exports = { - name: "servericon", - category: "Information", - aliases: ["serveravatar"], - cooldown: "", - usage: "servericon", - description: "Shows the Server Icon", + name: 'servericon', + category: 'Information', + aliases: ['serveravatar'], + cooldown: '', + usage: 'servericon', + description: 'Shows the Server Icon', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,8 +15,8 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { message.reply({ @@ -28,41 +28,41 @@ module.exports = { }) .setColor(ee.color) .addField( - "❱ PNG", - `[\`LINK\`](${message.guild.iconURL({ format: "png" })})`, - true + '❱ PNG', + `[\`LINK\`](${message.guild.iconURL({ format: 'png' })})`, + true, ) .addField( - "❱ JPEG", - `[\`LINK\`](${message.guild.iconURL({ format: "jpg" })})`, - true + '❱ JPEG', + `[\`LINK\`](${message.guild.iconURL({ format: 'jpg' })})`, + true, ) .addField( - "❱ WEBP", - `[\`LINK\`](${message.guild.iconURL({ format: "webp" })})`, - true + '❱ WEBP', + `[\`LINK\`](${message.guild.iconURL({ format: 'webp' })})`, + true, ) .addField( - "❱ GIF", - `[\`LINK\`](${message.guild.iconURL({ format: "gif" })})`, - true + '❱ GIF', + `[\`LINK\`](${message.guild.iconURL({ format: 'gif' })})`, + true, ) .setURL( message.guild.iconURL({ dynamic: true, - }) + }), ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setImage( message.guild.iconURL({ dynamic: true, size: 256, - }) + }), ), ], - }); + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -74,10 +74,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/servers.js b/commands/Information/servers.js index 7cf74e5..559e8ab 100644 --- a/commands/Information/servers.js +++ b/commands/Information/servers.js @@ -1,12 +1,12 @@ -const { MessageActionRow, MessageButton, MessageEmbed } = require("discord.js"); -var ee = require("../../botconfig/embed.json"); +const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js') +var ee = require('../../botconfig/embed.json') module.exports = { - name: "servers", - category: "Information", - aliases: ["servername"], - cooldown: "", - usage: "avatar [@USER] [global]", - description: "Shows the Avatar of a User", + name: 'servers', + category: 'Information', + aliases: ['servername'], + cooldown: '', + usage: 'avatar [@USER] [global]', + description: 'Shows the Avatar of a User', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -14,28 +14,28 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - const backId = "back"; - const forwardId = "forward"; + const backId = 'back' + const forwardId = 'forward' const backButton = new MessageButton({ - style: "SECONDARY", - label: "Back", - emoji: "⬅️", + style: 'SECONDARY', + label: 'Back', + emoji: '⬅️', customId: backId, - }); + }) const forwardButton = new MessageButton({ - style: "SECONDARY", - label: "Forward", - emoji: "➡️", + style: 'SECONDARY', + label: 'Forward', + emoji: '➡️', customId: forwardId, - }); + }) // Put the following code wherever you want to send the embed pages: - const { author, channel } = message; - const guilds = [...client.guilds.cache.values()]; + const { author, channel } = message + const guilds = [...client.guilds.cache.values()] /** * Creates an embed with guilds starting from an index. @@ -43,7 +43,7 @@ module.exports = { * @returns {Promise} */ const generateEmbed = async (start) => { - const current = guilds.slice(start, start + 8); + const current = guilds.slice(start, start + 8) // You can of course customise this embed however you want return new MessageEmbed({ @@ -60,34 +60,34 @@ module.exports = { }`, footertext: ee.footertext, footericon: ee.xfootericon, - })) + })), ), - }); - }; + }) + } // Send the embed with the first 8 guilds - const canFitOnOnePage = guilds.length <= 8; + const canFitOnOnePage = guilds.length <= 8 const embedMessage = await channel.send({ embeds: [await generateEmbed(0)], components: canFitOnOnePage ? [] : [new MessageActionRow({ components: [forwardButton] })], - }); + }) // Exit if there is only one page of guilds (no need for all of this) - if (canFitOnOnePage) return; + if (canFitOnOnePage) return // Collect button interactions (when a user clicks a button), // but only when the button as clicked by the original message author const collector = embedMessage.createMessageComponentCollector({ filter: ({ user }) => user.id === author.id, - }); + }) - let currentIndex = 0; - collector.on("collect", async (interaction) => { + let currentIndex = 0 + collector.on('collect', async (interaction) => { // Increase/decrease index interaction.customId === backId ? (currentIndex -= 8) - : (currentIndex += 8); + : (currentIndex += 8) // Respond to interaction by updating message with new embed await interaction.update({ embeds: [await generateEmbed(currentIndex)], @@ -101,7 +101,7 @@ module.exports = { ], }), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Information/setprefix.js b/commands/Information/setprefix.js index 6688aa2..34bbe01 100644 --- a/commands/Information/setprefix.js +++ b/commands/Information/setprefix.js @@ -1,50 +1,50 @@ -const prefixModel = require("../../models/prefix"); +const prefixModel = require('../../models/prefix') module.exports = { - name: "setprefix", - category: "Information", + name: 'setprefix', + category: 'Information', aliases: [], - cooldown: "", - usage: "setprefix ", - description: "Set a custom prefix for your server", - memberpermissions: ["ADMINISTRATOR"], + cooldown: '', + usage: 'setprefix ', + description: 'Set a custom prefix for your server', + memberpermissions: ['ADMINISTRATOR'], requiredroles: [], alloweduserids: [], minargs: 1, maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { const data = await prefixModel.findOne({ GuildID: message.guild.id, - }); + }) if (!args[0]) - return message.channel.send("You must provide a **new prefix**!"); + return message.channel.send('You must provide a **new prefix**!') if (args[0].length > 5) return message.channel.send( - "Your new prefix must be under `5` characters!" - ); + 'Your new prefix must be under `5` characters!', + ) if (data) { await prefixModel.findOneAndRemove({ GuildID: message.guild.id, - }); + }) - message.channel.send(`The new prefix is now **\`${args[0]}\`**`); + message.channel.send(`The new prefix is now **\`${args[0]}\`**`) let newData = new prefixModel({ Prefix: args[0], GuildID: message.guild.id, - }); - newData.save(); + }) + newData.save() } else if (!data) { - message.channel.send(`The new prefix is now **\`${args[0]}\`**`); + message.channel.send(`The new prefix is now **\`${args[0]}\`**`) let newData = new prefixModel({ Prefix: args[0], GuildID: message.guild.id, - }); - newData.save(); + }) + newData.save() } }, -}; +} diff --git a/commands/Information/showprefix.js b/commands/Information/showprefix.js index 50cda1f..d09f812 100644 --- a/commands/Information/showprefix.js +++ b/commands/Information/showprefix.js @@ -1,11 +1,11 @@ -const prefixModel = require("../../models/prefix"); +const prefixModel = require('../../models/prefix') module.exports = { - name: "showprefix", - category: "Information", + name: 'showprefix', + category: 'Information', aliases: [], - cooldown: "", - usage: "showprefix", - description: "Show the current prefix of your server", + cooldown: '', + usage: 'showprefix', + description: 'Show the current prefix of your server', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -13,20 +13,20 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { const data = await prefixModel.findOne({ GuildID: message.guild.id, - }); + }) if (data) { message.reply( - `The current prefixes are:\n1: **\`${data.Prefix}\`**\n2. <@${client.user.id}>` - ); + `The current prefixes are:\n1: **\`${data.Prefix}\`**\n2. <@${client.user.id}>`, + ) } else if (!data) { message.reply( - `The current prefixes are:\n1: **\`${process.env.PREFIX}\`**\n2. <@${client.user.id}>` - ); + `The current prefixes are:\n1: **\`${process.env.PREFIX}\`**\n2. <@${client.user.id}>`, + ) } }, -}; +} diff --git a/commands/Information/source.js b/commands/Information/source.js index 5c4551c..fe438a9 100644 --- a/commands/Information/source.js +++ b/commands/Information/source.js @@ -1,13 +1,13 @@ -const { MessageEmbed, MessageButton, MessageActionRow } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const package = require("../../package.json"); +const { MessageEmbed, MessageButton, MessageActionRow } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const package = require('../../package.json') module.exports = { - name: "source", - category: "Information", - aliases: ["sourcecode"], - cooldown: "", - usage: "source", - description: "Get the Source Code of CannyBot", + name: 'source', + category: 'Information', + aliases: ['sourcecode'], + cooldown: '', + usage: 'source', + description: 'Get the Source Code of CannyBot', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,23 +15,23 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { const sourcecode = new MessageActionRow().addComponents( new MessageButton() - .setLabel("Source Code") - .setStyle("LINK") - .setEmoji("📝") - .setURL(package.repository.url) - ); + .setLabel('Source Code') + .setStyle('LINK') + .setEmoji('📝') + .setURL(package.repository.url), + ) const embed = new MessageEmbed() - .setTitle("Source Code") - .setDescription("You can get the Source Code of CannyBot here:") + .setTitle('Source Code') + .setDescription('You can get the Source Code of CannyBot here:') .setThumbnail( - client.user.displayAvatarURL({ format: "png", dynamic: true }) + client.user.displayAvatarURL({ format: 'png', dynamic: true }), ) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed], components: [sourcecode] }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed], components: [sourcecode] }) }, -}; +} diff --git a/commands/Information/support.js b/commands/Information/support.js index 87866b7..3eaf487 100644 --- a/commands/Information/support.js +++ b/commands/Information/support.js @@ -1,12 +1,12 @@ -const { MessageEmbed, MessageActionRow, MessageButton } = require("discord.js"); -var ee = require("../../botconfig/embed.json"); +const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js') +var ee = require('../../botconfig/embed.json') module.exports = { - name: "support", - category: "Information", + name: 'support', + category: 'Information', aliases: {}, - cooldown: "", - usage: "support", - description: "Sends a Link of the Support Server", + cooldown: '', + usage: 'support', + description: 'Sends a Link of the Support Server', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -14,31 +14,31 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { const invitelinks = new MessageActionRow().addComponents( new MessageButton() - .setLabel("Join Server") - .setStyle("LINK") - .setEmoji("<:AgamTechTricks:904619535368351764>") - .setURL("https://discord.gg/c8aAV4cARB") - ); + .setLabel('Join Server') + .setStyle('LINK') + .setEmoji('<:AgamTechTricks:904619535368351764>') + .setURL('https://discord.gg/c8aAV4cARB'), + ) try { message.reply({ embeds: [ new MessageEmbed() - .setTitle("Looks like you want support") + .setTitle('Looks like you want support') .setDescription( - "Looks like you want support. You can join my server and ask support from the developer directly! Click the button below to Join" + 'Looks like you want support. You can join my server and ask support from the developer directly! Click the button below to Join', ) .setThumbnail(ee.footericon) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], components: [invitelinks], - }); + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -50,10 +50,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/uptime.js b/commands/Information/uptime.js index 2247678..5fc0c1d 100644 --- a/commands/Information/uptime.js +++ b/commands/Information/uptime.js @@ -1,13 +1,13 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const { duration } = require("../../handlers/functions"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const { duration } = require('../../handlers/functions') module.exports = { - name: "uptime", - category: "Information", + name: 'uptime', + category: 'Information', aliases: [], - cooldown: "", - usage: "uptime", - description: "Returns the duration on how long the Bot is online", + cooldown: '', + usage: 'uptime', + description: 'Returns the duration on how long the Bot is online', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -15,8 +15,8 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { message.reply({ @@ -27,12 +27,12 @@ module.exports = { .setTitle( `:white_check_mark: **${ client.user.username - }** is online since:\n \`${duration(client.uptime)}\`` + }** is online since:\n \`${duration(client.uptime)}\``, ), ], - }); + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -44,10 +44,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Information/userinfo.js b/commands/Information/userinfo.js index 040b15d..f7a1a6e 100644 --- a/commands/Information/userinfo.js +++ b/commands/Information/userinfo.js @@ -1,46 +1,46 @@ -const { MessageEmbed } = require("discord.js"); -var ee = require("../../botconfig/embed.json"); -const moment = require("moment"); -const { GetUser, GetGlobalUser } = require("../../handlers/functions"); +const { MessageEmbed } = require('discord.js') +var ee = require('../../botconfig/embed.json') +const moment = require('moment') +const { GetUser, GetGlobalUser } = require('../../handlers/functions') const flags = { - DISCORD_EMPLOYEE: "Discord Employee", - DISCORD_PARTNER: "Discord Partner", - BUGHUNTER_LEVEL_1: "Bug Hunter (Level 1)", - BUGHUNTER_LEVEL_2: "Bug Hunter (Level 2)", - HYPESQUAD_EVENTS: "HypeSquad Events", - HOUSE_BRAVERY: "House of Bravery", - HOUSE_BRILLIANCE: "House of Brilliance", - HOUSE_BALANCE: "House of Balance", - EARLY_SUPPORTER: "Early Supporter", - TEAM_USER: "Team User", - SYSTEM: "System", - VERIFIED_BOT: "Verified Bot", - VERIFIED_DEVELOPER: "Verified Bot Developer", -}; + DISCORD_EMPLOYEE: 'Discord Employee', + DISCORD_PARTNER: 'Discord Partner', + BUGHUNTER_LEVEL_1: 'Bug Hunter (Level 1)', + BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)', + HYPESQUAD_EVENTS: 'HypeSquad Events', + HOUSE_BRAVERY: 'House of Bravery', + HOUSE_BRILLIANCE: 'House of Brilliance', + HOUSE_BALANCE: 'House of Balance', + EARLY_SUPPORTER: 'Early Supporter', + TEAM_USER: 'Team User', + SYSTEM: 'System', + VERIFIED_BOT: 'Verified Bot', + VERIFIED_DEVELOPER: 'Verified Bot Developer', +} function trimArray(arr, maxLen = 25) { if (Array.from(arr.values()).length > maxLen) { - const len = Array.from(arr.values()).length - maxLen; + const len = Array.from(arr.values()).length - maxLen arr = Array.from(arr.values()) .sort((a, b) => b.rawPosition - a.rawPosition) - .slice(0, maxLen); - arr.map((role) => `<@&${role.id}>`); - arr.push(`${len} more...`); + .slice(0, maxLen) + arr.map((role) => `<@&${role.id}>`) + arr.push(`${len} more...`) } - return arr.join(", "); + return arr.join(', ') } const statuses = { - online: "🟢", - idle: "🟠", - dnd: "🔴", - offline: "⚫️", -}; + online: '🟢', + idle: '🟠', + dnd: '🔴', + offline: '⚫️', +} module.exports = { - name: "userinfo", - category: "Information", - aliases: ["uinfo", "whoami"], - cooldown: "", - usage: "userinfo [@USER] [global]", - description: "Shows Information of a User", + name: 'userinfo', + category: 'Information', + aliases: ['uinfo', 'whoami'], + cooldown: '', + usage: 'userinfo [@USER] [global]', + description: 'Shows Information of a User', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -48,181 +48,181 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { - var user; + var user if (args[0]) { try { - if (args[1] && args[1].toLowerCase() == "global") { - args.pop(); - user = await GetGlobalUser(message, args); + if (args[1] && args[1].toLowerCase() == 'global') { + args.pop() + user = await GetGlobalUser(message, args) } else { - user = await GetUser(message, args); + user = await GetUser(message, args) } } catch (e) { - if (!e) return message.reply("UNABLE TO FIND THE USER"); - return message.reply(e); + if (!e) return message.reply('UNABLE TO FIND THE USER') + return message.reply(e) } } else { - user = message.author; + user = message.author } if (!user || user == null || user.id == null || !user.id) - return message.reply("❌ Could not find the USER"); + return message.reply('❌ Could not find the USER') try { - const member = message.guild.members.cache.get(user.id); - const roles = member.roles; - const userFlags = member.user.flags.toArray(); + const member = message.guild.members.cache.get(user.id) + const roles = member.roles + const userFlags = member.user.flags.toArray() //create the EMBED - const embeduserinfo = new MessageEmbed(); + const embeduserinfo = new MessageEmbed() embeduserinfo.setThumbnail( - member.user.displayAvatarURL({ dynamic: true, size: 512 }) - ); + member.user.displayAvatarURL({ dynamic: true, size: 512 }), + ) embeduserinfo.setAuthor({ name: - "Information about: " + + 'Information about: ' + member.user.username + - "#" + + '#' + member.user.discriminator, iconURL: member.user.displayAvatarURL({ dynamic: true }), - }); + }) embeduserinfo.addField( - "**・ Username:**", + '**・ Username:**', `<@${member.user.id}>\n\`${member.user.tag}\``, - true - ); - embeduserinfo.addField("**・ ID:**", `\`${member.id}\``, true); + true, + ) + embeduserinfo.addField('**・ ID:**', `\`${member.id}\``, true) embeduserinfo.addField( - "**・ Avatar:**", + '**・ Avatar:**', `[\`Link to avatar\`](${member.user.displayAvatarURL({ - format: "png", + format: 'png', })})`, - true - ); + true, + ) embeduserinfo.addField( - "**・ Date Join DC:**", - "`" + - moment(member.user.createdTimestamp).format("DD/MM/YYYY") + - "`\n" + - "`" + - moment(member.user.createdTimestamp).format("hh:mm:ss") + - "`", - true - ); + '**・ Date Join DC:**', + '`' + + moment(member.user.createdTimestamp).format('DD/MM/YYYY') + + '`\n' + + '`' + + moment(member.user.createdTimestamp).format('hh:mm:ss') + + '`', + true, + ) embeduserinfo.addField( - "**・ Date Join Guild:**", - "`" + - moment(member.joinedTimestamp).format("DD/MM/YYYY") + - "`\n" + - "`" + - moment(member.joinedTimestamp).format("hh:mm:ss") + - "`", - true - ); + '**・ Date Join Guild:**', + '`' + + moment(member.joinedTimestamp).format('DD/MM/YYYY') + + '`\n' + + '`' + + moment(member.joinedTimestamp).format('hh:mm:ss') + + '`', + true, + ) embeduserinfo.addField( - "**・ Flags:**", + '**・ Flags:**', `\`${ userFlags.length - ? userFlags.map((flag) => flags[flag]).join(", ") - : "None" + ? userFlags.map((flag) => flags[flag]).join(', ') + : 'None' }\``, - true - ); + true, + ) embeduserinfo.addField( - "**・ Highest Role:**", + '**・ Highest Role:**', `${ member.roles.highest.id === message.guild.id - ? "None" + ? 'None' : member.roles.highest }`, - true - ); + true, + ) embeduserinfo.addField( - "**・ Is a Bot:**", - `\`${member.user.bot ? "✔️" : "❌"}\``, - true - ); + '**・ Is a Bot:**', + `\`${member.user.bot ? '✔️' : '❌'}\``, + true, + ) embeduserinfo.addField( - "**・ Permissions:**", + '**・ Permissions:**', `${member.permissions .toArray() .map((p) => `\`${p}\``) - .join(", ")}` - ); + .join(', ')}`, + ) embeduserinfo.addField( `❱ [${roles.cache.size}] Roles: `, roles.cache.size < 25 ? Array.from(roles.cache.values()) .sort((a, b) => b.rawPosition - a.rawPosition) .map((role) => `<@&${role.id}>`) - .join(", ") + .join(', ') : roles.cache.size > 25 ? trimArray(roles.cache) - : "None" - ); - embeduserinfo.setColor(ee.color); + : 'None', + ) + embeduserinfo.setColor(ee.color) embeduserinfo.setFooter({ text: ee.footertext, iconURL: ee.footericon, - }); + }) //send the EMBED - message.reply({ embeds: [embeduserinfo] }); + message.reply({ embeds: [embeduserinfo] }) } catch (e) { - console.log(e); - const userFlags = user.flags.toArray(); + console.log(e) + const userFlags = user.flags.toArray() //create the EMBED - const embeduserinfo = new MessageEmbed(); + const embeduserinfo = new MessageEmbed() embeduserinfo.setThumbnail( - user.displayAvatarURL({ dynamic: true, size: 512 }) - ); + user.displayAvatarURL({ dynamic: true, size: 512 }), + ) embeduserinfo.setAuthor({ name: - "Information about: " + user.username + "#" + user.discriminator, + 'Information about: ' + user.username + '#' + user.discriminator, iconURL: user.displayAvatarURL({ dynamic: true }), - }); + }) embeduserinfo.addField( - "**・ Username:**", + '**・ Username:**', `<@${user.id}>\n\`${user.tag}\``, - true - ); - embeduserinfo.addField("**・ ID:**", `\`${user.id}\``, true); + true, + ) + embeduserinfo.addField('**・ ID:**', `\`${user.id}\``, true) embeduserinfo.addField( - "**・ Avatar:**", - `[\`Link to avatar\`](${user.displayAvatarURL({ format: "png" })})`, - true - ); + '**・ Avatar:**', + `[\`Link to avatar\`](${user.displayAvatarURL({ format: 'png' })})`, + true, + ) embeduserinfo.addField( - "**・ Flags:**", + '**・ Flags:**', `\`${ userFlags.length - ? userFlags.map((flag) => flags[flag]).join(", ") - : "None" + ? userFlags.map((flag) => flags[flag]).join(', ') + : 'None' }\``, - true - ); + true, + ) embeduserinfo.addField( - "**・ Is a Bot:**", - `\`${user.bot ? "✔️" : "❌"}\``, - true - ); + '**・ Is a Bot:**', + `\`${user.bot ? '✔️' : '❌'}\``, + true, + ) embeduserinfo.addField( - "**・ Permissions:**", + '**・ Permissions:**', `${member.permissions .toArray() .map((p) => `\`${p}\``) - .join(", ")}` - ); - embeduserinfo.setColor(ee.color); + .join(', ')}`, + ) + embeduserinfo.setColor(ee.color) embeduserinfo.setFooter({ text: ee.footertext, iconURL: ee.footericon, - }); + }) //send the EMBED - message.reply({ embeds: [embeduserinfo] }); + message.reply({ embeds: [embeduserinfo] }) } } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -234,10 +234,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Moderation/ban.js b/commands/Moderation/ban.js index 59ce9ab..489f2ec 100644 --- a/commands/Moderation/ban.js +++ b/commands/Moderation/ban.js @@ -1,53 +1,53 @@ -const Discord = require("discord.js"); -var ee = require("../../botconfig/embed.json"); +const Discord = require('discord.js') +var ee = require('../../botconfig/embed.json') module.exports = { - name: "ban", - category: "Moderation", + name: 'ban', + category: 'Moderation', aliases: [], - cooldown: "", - usage: "ban <@USER> [REASON]", - description: "Bans a user from the server", - memberpermissions: ["BAN_MEMBERS"], + cooldown: '', + usage: 'ban <@USER> [REASON]', + description: 'Bans a user from the server', + memberpermissions: ['BAN_MEMBERS'], requiredroles: [], alloweduserids: [], minargs: 0, maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { let banMember = message.mentions.members.first() || - message.guild.members.cache.get(args[0]); + message.guild.members.cache.get(args[0]) if (!banMember) return message.channel.send( - "Please mention a valid member of this server" - ); - if (banMember.permissions.has("BAN_MEMBERS")) - return message.channel.send("I cannot ban this user!"); - let reason = args.slice(1).join(" "); - if (!reason) reason = "No reason provided"; - if (!message.guild.me.permissions.has("BAN_MEMBERS")) + 'Please mention a valid member of this server', + ) + if (banMember.permissions.has('BAN_MEMBERS')) + return message.channel.send('I cannot ban this user!') + let reason = args.slice(1).join(' ') + if (!reason) reason = 'No reason provided' + if (!message.guild.me.permissions.has('BAN_MEMBERS')) return message.channel.send( - "I do not have the permission to ban members!" - ); + 'I do not have the permission to ban members!', + ) banMember .send( - "You have been banned from " + message.guild.name + " for: " + reason + 'You have been banned from ' + message.guild.name + ' for: ' + reason, ) .then(() => { - setTimeout(() => {}, 2000); - }); - message.guild.members.ban(banMember, { reason: reason }); + setTimeout(() => {}, 2000) + }) + message.guild.members.ban(banMember, { reason: reason }) var embed = new Discord.MessageEmbed() - .setColor("RANDOM") - .setTitle("Member banned successfully!") - .setImage("https://media1.giphy.com/media/hIgJpsDOgQQ2hsNpuT/giphy.gif") + .setColor('RANDOM') + .setTitle('Member banned successfully!') + .setImage('https://media1.giphy.com/media/hIgJpsDOgQQ2hsNpuT/giphy.gif') .setDescription( - `**${banMember.user.username}** has been banned for - ${reason}` + `**${banMember.user.username}** has been banned for - ${reason}`, ) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.channel.send({ embeds: [embed] }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.channel.send({ embeds: [embed] }) }, -}; +} diff --git a/commands/Moderation/kick.js b/commands/Moderation/kick.js index d63f1dc..a3b2146 100644 --- a/commands/Moderation/kick.js +++ b/commands/Moderation/kick.js @@ -1,56 +1,56 @@ -const Discord = require("discord.js"); -var ee = require("../../botconfig/embed.json"); +const Discord = require('discord.js') +var ee = require('../../botconfig/embed.json') module.exports = { - name: "kick", - category: "Moderation", + name: 'kick', + category: 'Moderation', aliases: [], - cooldown: "", - usage: "kick <@USER> [REASON]", - description: "Kicks a user from the server", - memberpermissions: ["KICK_MEMBERS"], + cooldown: '', + usage: 'kick <@USER> [REASON]', + description: 'Kicks a user from the server', + memberpermissions: ['KICK_MEMBERS'], requiredroles: [], alloweduserids: [], minargs: 0, maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { let kickMember = message.mentions.members.first() || - message.guild.members.cache.get(args[0]); + message.guild.members.cache.get(args[0]) if (!kickMember) return message.channel.send( - "Please mention a valid member of this server" - ); - if (kickMember.permissions.has("KICK_MEMBERS")) - return message.channel.send("I cannot kick this user!"); - let reason = args.slice(1).join(" "); - if (!reason) reason = "No reason provided"; - if (!message.guild.me.permissions.has("KICK_MEMBERS")) + 'Please mention a valid member of this server', + ) + if (kickMember.permissions.has('KICK_MEMBERS')) + return message.channel.send('I cannot kick this user!') + let reason = args.slice(1).join(' ') + if (!reason) reason = 'No reason provided' + if (!message.guild.me.permissions.has('KICK_MEMBERS')) return message.channel.send( - "I do not have the permission to kick members!" - ); + 'I do not have the permission to kick members!', + ) kickMember .send( - "You have been kicked from " + message.guild.name + " for: " + reason + 'You have been kicked from ' + message.guild.name + ' for: ' + reason, ) .then(() => { - setTimeout(() => {}, 3000); - kickMember.kick(reason); - }); + setTimeout(() => {}, 3000) + kickMember.kick(reason) + }) const embed = new Discord.MessageEmbed() - .setColor("RANDOM") - .setTitle("Member kicked successfully!") + .setColor('RANDOM') + .setTitle('Member kicked successfully!') .setImage( - "https://c.tenor.com/esCHs7tm78UAAAAC/spongebob-squarepants-get-out.gif" + 'https://c.tenor.com/esCHs7tm78UAAAAC/spongebob-squarepants-get-out.gif', ) .setDescription( - `**${kickMember.user.username}** has been kick for - ${reason}` + `**${kickMember.user.username}** has been kick for - ${reason}`, ) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.channel.send({ embeds: [embed] }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.channel.send({ embeds: [embed] }) }, -}; +} diff --git a/commands/Moderation/purge.js b/commands/Moderation/purge.js index 2b16ca2..afcec59 100644 --- a/commands/Moderation/purge.js +++ b/commands/Moderation/purge.js @@ -1,49 +1,49 @@ -const { MessageEmbed } = require("discord.js"); -var ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +var ee = require('../../botconfig/embed.json') module.exports = { - name: "purge", - category: "Moderation", - aliases: ["delete", "clean"], - cooldown: "", - usage: "purge ", - description: "Purges the number of messages given in the channel.", - memberpermissions: ["MANAGE_MESSAGES"], + name: 'purge', + category: 'Moderation', + aliases: ['delete', 'clean'], + cooldown: '', + usage: 'purge ', + description: 'Purges the number of messages given in the channel.', + memberpermissions: ['MANAGE_MESSAGES'], requiredroles: [], alloweduserids: [], minargs: 0, maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - var amount = Number(args[0]); - var adding = 1; - var newamount = amount + adding; + var amount = Number(args[0]) + var adding = 1 + var newamount = amount + adding if (newamount > 100) { - return message.channel.send("Please give a number less than 100!"); + return message.channel.send('Please give a number less than 100!') } if (newamount < 1) { - return message.channel.send("Please give a number greater than 0!"); + return message.channel.send('Please give a number greater than 0!') } message.channel .bulkDelete(newamount) .then((messages) => { - var number = messages.size; - var subtracting = 1; - var newnumber = number - subtracting; + var number = messages.size + var subtracting = 1 + var newnumber = number - subtracting message.channel .send( - `Purged \`${newnumber}\` messages ` + `Purged \`${newnumber}\` messages `, ) .then((msg) => { setTimeout(function () { - msg.delete(); - }, 3000); - }); + msg.delete() + }, 3000) + }) }) .catch((e) => { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -55,10 +55,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); - }); + }) + }) }, -}; +} diff --git a/commands/Moderation/timeout.js b/commands/Moderation/timeout.js index f881c8d..9309333 100644 --- a/commands/Moderation/timeout.js +++ b/commands/Moderation/timeout.js @@ -1,65 +1,65 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const ms = require("ms"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const ms = require('ms') module.exports = { - name: "timeout", - category: "Moderation", - aliases: ["mute"], - cooldown: "", - usage: "timeout <@USER> [TIME] [REASON]", - description: "Timeout a user for a specified time", - memberpermissions: ["BAN_MEMBERS"], + name: 'timeout', + category: 'Moderation', + aliases: ['mute'], + cooldown: '', + usage: 'timeout <@USER> [TIME] [REASON]', + description: 'Timeout a user for a specified time', + memberpermissions: ['BAN_MEMBERS'], requiredroles: [], alloweduserids: [], minargs: 0, maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { const member = message.mentions.members.first() || - message.guild.members.cache.get(args[0]); - const giventime = ms(args[1]); - let reason = args.slice(2).join(" "); + message.guild.members.cache.get(args[0]) + const giventime = ms(args[1]) + let reason = args.slice(2).join(' ') if (!member) - return message.reply("Please mention a valid member of this server"); - if (!giventime) return message.reply("Please specify a valid time"); - if (!reason) reason = "No reason provided"; + return message.reply('Please mention a valid member of this server') + if (!giventime) return message.reply('Please specify a valid time') + if (!reason) reason = 'No reason provided' - const time = giventime; - if (giventime > ms("1w") || giventime < ms("1s") || isNaN(time)) - return message.reply("Please specify a valid time"); + const time = giventime + if (giventime > ms('1w') || giventime < ms('1s') || isNaN(time)) + return message.reply('Please specify a valid time') const timeoutuser = await member.timeout(time, reason).catch((err) => { - return message.reply(`An error occured! \`\`\`js\n${err}\`\`\``); - }); + return message.reply(`An error occured! \`\`\`js\n${err}\`\`\``) + }) - if (!timeoutuser) return message.reply("I cannot timeout this user!"); + if (!timeoutuser) return message.reply('I cannot timeout this user!') const embed = new MessageEmbed() - .setColor("RANDOM") - .setTitle("Member timed out successfully!") - .setImage("https://c.tenor.com/v8JBsczVfD4AAAAC/timeout.gif") + .setColor('RANDOM') + .setTitle('Member timed out successfully!') + .setImage('https://c.tenor.com/v8JBsczVfD4AAAAC/timeout.gif') .setDescription( `**${member.user.username}** has been timed out for ${msToTime( - time - )}!\nReason: ${reason}` + time, + )}!\nReason: ${reason}`, ) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) return message.reply({ embeds: [embed], - }); + }) }, -}; +} function msToTime(ms) { - let seconds = (ms / 1000).toFixed(1); - let minutes = (ms / (1000 * 60)).toFixed(1); - let hours = (ms / (1000 * 60 * 60)).toFixed(1); - let days = (ms / (1000 * 60 * 60 * 24)).toFixed(1); - if (seconds < 60) return seconds + " Sec"; - else if (minutes < 60) return minutes + " Min"; - else if (hours < 24) return hours + " Hrs"; - else return days + " Days"; + let seconds = (ms / 1000).toFixed(1) + let minutes = (ms / (1000 * 60)).toFixed(1) + let hours = (ms / (1000 * 60 * 60)).toFixed(1) + let days = (ms / (1000 * 60 * 60 * 24)).toFixed(1) + if (seconds < 60) return seconds + ' Sec' + else if (minutes < 60) return minutes + ' Min' + else if (hours < 24) return hours + ' Hrs' + else return days + ' Days' } diff --git a/commands/Owner/changename.js b/commands/Owner/changename.js index a49c638..eb9412c 100644 --- a/commands/Owner/changename.js +++ b/commands/Owner/changename.js @@ -1,12 +1,12 @@ -var { MessageEmbed } = require(`discord.js`); -var ee = require(`../../botconfig/embed.json`); +var { MessageEmbed } = require(`discord.js`) +var ee = require(`../../botconfig/embed.json`) module.exports = { - name: "changename", - category: "Owner", - aliases: ["changebotname", "botname"], - cooldown: "", - usage: "changename ", - description: "Changes the Name of the BOT", + name: 'changename', + category: 'Owner', + aliases: ['changebotname', 'botname'], + cooldown: '', + usage: 'changename ', + description: 'Changes the Name of the BOT', memberpermissions: [], requiredroles: [], alloweduserids: process.env.ownerID, @@ -14,24 +14,24 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { - if (args.join(" ").length > 32) { + if (args.join(' ').length > 32) { return message.reply({ embeds: [ new MessageEmbed() .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle( - `:x: Bot Name too long, can't have more then 32 Letters!` + `:x: Bot Name too long, can't have more then 32 Letters!`, ), ], - }); + }) } client.user - .setUsername(args.join(" ")) + .setUsername(args.join(' ')) .then((user) => { return message.reply({ embeds: [ @@ -40,7 +40,7 @@ module.exports = { .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle(`Changed my Name to: \`${user.username}\``), ], - }); + }) }) .catch((e) => { return message.reply({ @@ -50,13 +50,13 @@ module.exports = { .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle(`:x: Something went Wrong`) .setDescription( - `\`\`\`${String(JSON.stringify(e)).substr(0, 2000)}\`\`\`` + `\`\`\`${String(JSON.stringify(e)).substr(0, 2000)}\`\`\``, ), ], - }); - }); + }) + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -68,10 +68,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Owner/cmdreload.js b/commands/Owner/cmdreload.js index 4ead4c5..2b8ef0e 100644 --- a/commands/Owner/cmdreload.js +++ b/commands/Owner/cmdreload.js @@ -1,5 +1,5 @@ -var { MessageEmbed } = require(`discord.js`); -var ee = require(`../../botconfig/embed.json`); +var { MessageEmbed } = require(`discord.js`) +var ee = require(`../../botconfig/embed.json`) module.exports = { name: `cmdreload`, category: `Owner`, @@ -13,23 +13,23 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { let thecmd = client.commands.get(args[0].toLowerCase()) || - client.commands.get(client.aliases.get(args[0].toLowerCase())); + client.commands.get(client.aliases.get(args[0].toLowerCase())) if (thecmd) { try { delete require.cache[ require.resolve( - `../../commands/${thecmd.category}/${thecmd.name}.js` + `../../commands/${thecmd.category}/${thecmd.name}.js`, ) - ]; - client.commands.delete(thecmd.name); - const pull = require(`../../commands/${thecmd.category}/${thecmd.name}.js`); - client.commands.set(thecmd.name, pull); + ] + client.commands.delete(thecmd.name) + const pull = require(`../../commands/${thecmd.category}/${thecmd.name}.js`) + client.commands.set(thecmd.name, pull) return message.reply({ embeds: [ new MessageEmbed() @@ -37,7 +37,7 @@ module.exports = { .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle(`Reloaded: \`${args[0]}\``), ], - }); + }) } catch (e) { return message.reply({ embeds: [ @@ -52,10 +52,10 @@ module.exports = { : e.stack ? String(e.stack).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } } else { return message.reply({ @@ -65,10 +65,10 @@ module.exports = { .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle(`:x: Could not find: \`${args[0]}\``), ], - }); + }) } } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) return message.reply({ embeds: [ new MessageEmbed() @@ -80,10 +80,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Owner/detailedeval.js b/commands/Owner/detailedeval.js index a0e44ae..181ab3c 100644 --- a/commands/Owner/detailedeval.js +++ b/commands/Owner/detailedeval.js @@ -1,6 +1,6 @@ -const { MessageEmbed } = require(`discord.js`); -const { inspect } = require(`util`); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require(`discord.js`) +const { inspect } = require(`util`) +const ee = require('../../botconfig/embed.json') module.exports = { name: `detailedeval`, category: `Owner`, @@ -14,37 +14,37 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { - let evaled; + let evaled if ( args.join(` `).includes(`token`) || args.join(` `).includes(`TOKEN`) || args.join(` `).includes(`BOT_TOKEN`) ) { - return message.reply("Yeah, and?"); + return message.reply('Yeah, and?') } - evaled = await eval(args.join(` `)); - let string = inspect(evaled); + evaled = await eval(args.join(` `)) + let string = inspect(evaled) if ( string.includes(client.token) || string.includes(`BOT_TOKEN`) || string.includes(`TOKEN`) || string.includes(`token`) ) { - return message.reply("Yeah, and?"); + return message.reply('Yeah, and?') } if (string.length > 2000) { - string = string.substring(0, 2000); + string = string.substring(0, 2000) } const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`${client.user.username} | Eval`) .setDescription(`\`\`\`js\n${string.substring(0, 2000)}\`\`\``) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) } catch (e) { return message.reply({ embeds: [ @@ -57,10 +57,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Owner/dm.js b/commands/Owner/dm.js index b596605..5b61a4f 100644 --- a/commands/Owner/dm.js +++ b/commands/Owner/dm.js @@ -1,10 +1,10 @@ module.exports = { - name: "dm", - category: "Owner", - aliases: ["senddm"], + name: 'dm', + category: 'Owner', + aliases: ['senddm'], cooldown: 5, - usage: "dm <@USER> ", - description: "Sends a direct message to a specified member", + usage: 'dm <@USER> ', + description: 'Sends a direct message to a specified member', memberpermissions: [], requiredroles: [], alloweduserids: process.env.ownerID, @@ -12,14 +12,14 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - let sendmsguser = message.mentions.users.first(); - let givenmsg = args.slice(1).join(" "); + let sendmsguser = message.mentions.users.first() + let givenmsg = args.slice(1).join(' ') if (!givenmsg) - return message.channel.send("Kek you forgot to tell what to send"); - sendmsguser.send(givenmsg); - message.react("✅"); + return message.channel.send('Kek you forgot to tell what to send') + sendmsguser.send(givenmsg) + message.react('✅') }, -}; +} diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js index 1221f8c..4fb4e7a 100644 --- a/commands/Owner/eval.js +++ b/commands/Owner/eval.js @@ -1,10 +1,10 @@ -const { MessageEmbed } = require(`discord.js`); -const { inspect } = require(`util`); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require(`discord.js`) +const { inspect } = require(`util`) +const ee = require('../../botconfig/embed.json') module.exports = { name: `eval`, category: `Owner`, - aliases: [`evaluate`, "evaluate", "eval"], + aliases: [`evaluate`, 'evaluate', 'eval'], description: `Eval a Command!`, usage: `eval `, memberpermissions: [], @@ -14,27 +14,27 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { try { - let evaled; + let evaled if ( args.join(` `).includes(`token`) || args.join(` `).includes(`TOKEN`) || args.join(` `).includes(`BOT_TOKEN`) ) { - return message.reply("Yeah, and?"); + return message.reply('Yeah, and?') } - evaled = await eval(args.join(` `)); - let string = inspect(evaled); + evaled = await eval(args.join(` `)) + let string = inspect(evaled) if ( string.includes(client.token) || string.includes(`BOT_TOKEN`) || string.includes(`TOKEN`) || string.includes(`token`) ) { - return message.reply("Yeah, and?"); + return message.reply('Yeah, and?') } } catch (e) { return message.reply({ @@ -48,10 +48,10 @@ module.exports = { e.message ? String(e.message).substr(0, 2000) : String(e).substr(0, 2000) - }\`\`\`` + }\`\`\``, ), ], - }); + }) } }, -}; +} diff --git a/commands/Random/bird.js b/commands/Random/bird.js index 90a9660..d6a0831 100644 --- a/commands/Random/bird.js +++ b/commands/Random/bird.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "bird", - category: "Random", - aliases: ["randombird"], - cooldown: "", - usage: "bird", - description: "Get a random bird image.", + name: 'bird', + category: 'Random', + aliases: ['randombird'], + cooldown: '', + usage: 'bird', + description: 'Get a random bird image.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,17 +16,17 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { axios.get(`https://some-random-api.ml/img/birb`).then(async (response) => { - json = response.data; + json = response.data const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`Here is a Bird!`) .setImage(json.link) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) + }) }, -}; +} diff --git a/commands/Random/cat.js b/commands/Random/cat.js index 121ebdd..e9cecf7 100644 --- a/commands/Random/cat.js +++ b/commands/Random/cat.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "cat", - category: "Random", - aliases: ["randomcat"], - cooldown: "", - usage: "cat", - description: "Get a random cat image.", + name: 'cat', + category: 'Random', + aliases: ['randomcat'], + cooldown: '', + usage: 'cat', + description: 'Get a random cat image.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,19 +16,19 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { axios .get(`https://api.thecatapi.com/v1/images/search?mime_types=gif,png`) .then(async (response) => { - json = response.data; + json = response.data const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`Here is a cat. Meow!`) .setImage(json[0].url) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) + }) }, -}; +} diff --git a/commands/Random/dog.js b/commands/Random/dog.js index 2e9763e..1860232 100644 --- a/commands/Random/dog.js +++ b/commands/Random/dog.js @@ -1,14 +1,14 @@ -const { MessageEmbed, MessageAttachment } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed, MessageAttachment } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "dog", - category: "Random", - aliases: ["randomdog"], - cooldown: "", - usage: "dog", - description: "Get a random dog image.", + name: 'dog', + category: 'Random', + aliases: ['randomdog'], + cooldown: '', + usage: 'dog', + description: 'Get a random dog image.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,19 +16,19 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { axios .get(`https://dog.ceo/api/breeds/image/random`) .then(async (response) => { - json = response.data; + json = response.data const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`Here is a dog. Woof!`) .setImage(json.message) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) + }) }, -}; +} diff --git a/commands/Random/fact.js b/commands/Random/fact.js index 3bf39a5..1a41773 100644 --- a/commands/Random/fact.js +++ b/commands/Random/fact.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "fact", - category: "Random", - aliases: ["randomfact"], - cooldown: "", - usage: "fact", - description: "Get a random fact.", + name: 'fact', + category: 'Random', + aliases: ['randomfact'], + cooldown: '', + usage: 'fact', + description: 'Get a random fact.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,19 +16,19 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { axios .get(`https://uselessfacts.jsph.pl/random.json?language=en`) .then(async (response) => { - json = response.data; + json = response.data const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`Here is a fact.`) .setDescription(json.text) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) + }) }, -}; +} diff --git a/commands/Random/fox.js b/commands/Random/fox.js index f6c745d..41b21b4 100644 --- a/commands/Random/fox.js +++ b/commands/Random/fox.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "fox", - category: "Random", - aliases: ["randomfox"], - cooldown: "", - usage: "fox", - description: "Get a random fox image.", + name: 'fox', + category: 'Random', + aliases: ['randomfox'], + cooldown: '', + usage: 'fox', + description: 'Get a random fox image.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,17 +16,17 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { axios.get(`https://some-random-api.ml/img/fox`).then(async (response) => { - json = response.data; + json = response.data const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`Here is a Fox!`) .setImage(json.link) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) + }) }, -}; +} diff --git a/commands/Random/koala.js b/commands/Random/koala.js index 327cc53..8c5b57f 100644 --- a/commands/Random/koala.js +++ b/commands/Random/koala.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "koala", - category: "Random", - aliases: ["randomkoala"], - cooldown: "", - usage: "koala", - description: "Get a random koala image.", + name: 'koala', + category: 'Random', + aliases: ['randomkoala'], + cooldown: '', + usage: 'koala', + description: 'Get a random koala image.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,17 +16,17 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { axios.get(`https://some-random-api.ml/img/koala`).then(async (response) => { - json = response.data; + json = response.data const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`Here is a Koala!`) .setImage(json.link) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) + }) }, -}; +} diff --git a/commands/Random/panda.js b/commands/Random/panda.js index 13be8b4..97ead5c 100644 --- a/commands/Random/panda.js +++ b/commands/Random/panda.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "panda", - category: "Random", - aliases: ["randompanda"], - cooldown: "", - usage: "panda", - description: "Get a random panda image.", + name: 'panda', + category: 'Random', + aliases: ['randompanda'], + cooldown: '', + usage: 'panda', + description: 'Get a random panda image.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,17 +16,17 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { axios.get(`https://some-random-api.ml/img/panda`).then(async (response) => { - json = response.data; + json = response.data const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`Here is a Panda!`) .setImage(json.link) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) + }) }, -}; +} diff --git a/commands/Random/randompic.js b/commands/Random/randompic.js index 39f353d..daa97f8 100644 --- a/commands/Random/randompic.js +++ b/commands/Random/randompic.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "randompic", - category: "Random", - aliases: ["randomimage"], - cooldown: "", - usage: "randompic", - description: "Get a random image.", + name: 'randompic', + category: 'Random', + aliases: ['randomimage'], + cooldown: '', + usage: 'randompic', + description: 'Get a random image.', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,23 +16,23 @@ module.exports = { maxargs: 0, minplusargs: 0, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { axios .get( `https://picsum.photos/v2/list?page=${Math.floor( - Math.random() * 100 - )}&limit=1` + Math.random() * 100, + )}&limit=1`, ) .then(async (response) => { - json = response.data; + json = response.data const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`Random Image`) .setImage(json[0].download_url) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - message.reply({ embeds: [embed] }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + message.reply({ embeds: [embed] }) + }) }, -}; +} diff --git a/commands/Tech/latest-useragent.js b/commands/Tech/latest-useragent.js index d23e8de..5196612 100644 --- a/commands/Tech/latest-useragent.js +++ b/commands/Tech/latest-useragent.js @@ -1,14 +1,14 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); -const axios = require("axios"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') +const axios = require('axios') module.exports = { - name: "latest-useragent", - category: "Tech", - aliases: ["latest-ua", "l-useragent", "l-ua", "useragent", "ua"], - cooldown: "", - usage: "latest-useragent windows/macos/linux/android/chromos/ios", - description: "Shows the latest user agent of different browsers and devices", + name: 'latest-useragent', + category: 'Tech', + aliases: ['latest-ua', 'l-useragent', 'l-ua', 'useragent', 'ua'], + cooldown: '', + usage: 'latest-useragent windows/macos/linux/android/chromos/ios', + description: 'Shows the latest user agent of different browsers and devices', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,182 +16,182 @@ module.exports = { maxargs: 0, minplusargs: 1, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - await message.reply("Loading! Please wait...").then(async (msg) => { - let url = `https://useragent.deta.dev/`; + await message.reply('Loading! Please wait...').then(async (msg) => { + let url = `https://useragent.deta.dev/` axios.get(url).then(async (response) => { - json = response.data; - msg.delete(); - if (text === "windows") { + json = response.data + msg.delete() + if (text === 'windows') { message.reply({ embeds: [ new MessageEmbed() - .setColor("RANDOM") + .setColor('RANDOM') .setTitle('Latest "Windows" User Agents:') .addFields( { - name: "Chrome", + name: 'Chrome', value: `\`${json.windows.chrome}\``, }, { - name: "Firefox", + name: 'Firefox', value: `\`${json.windows.firefox}\``, }, { - name: "Edge", + name: 'Edge', value: `\`${json.windows.edge}\``, }, { - name: "Opera", + name: 'Opera', value: `\`${json.windows.opera}\``, }, { - name: "Vivaldi", + name: 'Vivaldi', value: `\`${json.windows.vivaldi}\``, - } + }, ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - } else if (text === "macos") { + }) + } else if (text === 'macos') { message.reply({ embeds: [ new MessageEmbed() - .setColor("RANDOM") + .setColor('RANDOM') .setTitle('Latest "Mac OS" User Agents:') .addFields( { - name: "Chrome", + name: 'Chrome', value: `\`${json.macos.chrome}\``, }, { - name: "Firefox", + name: 'Firefox', value: `\`${json.macos.firefox}\``, }, { - name: "Safari", + name: 'Safari', value: `\`${json.macos.safari}\``, }, { - name: "Edge", + name: 'Edge', value: `\`${json.macos.edge}\``, }, { - name: "Opera", + name: 'Opera', value: `\`${json.macos.opera}\``, }, { - name: "Vivaldi", + name: 'Vivaldi', value: `\`${json.macos.vivaldi}\``, - } + }, ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - } else if (text === "linux") { + }) + } else if (text === 'linux') { message.reply({ embeds: [ new MessageEmbed() - .setColor("RANDOM") + .setColor('RANDOM') .setTitle('Latest "Linux" User Agents:') .addFields( { - name: "Chrome", + name: 'Chrome', value: `\`${json.linux.chrome}\``, }, { - name: "Firefox", + name: 'Firefox', value: `\`${json.linux.firefox}\``, }, { - name: "Opera", + name: 'Opera', value: `\`${json.linux.opera}\``, }, { - name: "Vivaldi", + name: 'Vivaldi', value: `\`${json.linux.vivaldi}\``, - } + }, ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - } else if (text === "android") { + }) + } else if (text === 'android') { message.reply({ embeds: [ new MessageEmbed() - .setColor("RANDOM") + .setColor('RANDOM') .setTitle('Latest "Android" User Agents:') .addFields( { - name: "Chrome", + name: 'Chrome', value: `\`${json.android.android12.chrome}\``, }, { - name: "Firefox", + name: 'Firefox', value: `\`${json.android.android12.firefox}\``, }, { - name: "Edge", + name: 'Edge', value: `\`${json.android.android12.edge}\``, }, { - name: "Opera", + name: 'Opera', value: `\`${json.android.android12.opera}\``, - } + }, ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - } else if (text === "chromeos") { + }) + } else if (text === 'chromeos') { message.reply({ embeds: [ new MessageEmbed() - .setColor("RANDOM") + .setColor('RANDOM') .setTitle('Latest "Chrome OS" User Agents:') .addFields( { - name: "x86_64", + name: 'x86_64', value: `\`${json.chromeos.x86_64}\``, }, { - name: "armv7l", + name: 'armv7l', value: `\`${json.chromeos.armv7l}\``, }, { - name: "aarch64", + name: 'aarch64', value: `\`${json.chromeos.aarch64}\``, - } + }, ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); - } else if (text === "ios") { + }) + } else if (text === 'ios') { message.reply({ embeds: [ new MessageEmbed() - .setColor("RANDOM") + .setColor('RANDOM') .setTitle('Latest "iOS" User Agents:') .addFields( { - name: "Chrome", + name: 'Chrome', value: `\`${json.ios.chrome}\``, }, { - name: "Firefox", + name: 'Firefox', value: `\`${json.ios.firefox}\``, }, { - name: "Safari", + name: 'Safari', value: `\`${json.ios.safari}\``, - } + }, ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], - }); + }) } - }); - }); + }) + }) }, -}; +} diff --git a/commands/Tech/logo.js b/commands/Tech/logo.js index c2b2963..92ba134 100644 --- a/commands/Tech/logo.js +++ b/commands/Tech/logo.js @@ -1,14 +1,14 @@ -const { MessageAttachment } = require("discord.js"); -const http = require("http"); -const fs = require("fs"); +const { MessageAttachment } = require('discord.js') +const http = require('http') +const fs = require('fs') module.exports = { - name: "logo", - category: "Tech", + name: 'logo', + category: 'Tech', aliases: [], - cooldown: "", - usage: "logo google.com (or other domain)", - description: "Get the logo of mentioned company", + cooldown: '', + usage: 'logo google.com (or other domain)', + description: 'Get the logo of mentioned company', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -16,40 +16,40 @@ module.exports = { maxargs: 0, minplusargs: 1, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - msg = await message.channel.send(`Loading! Please Wait...`); - var randomstring = require("randomstring"); - let randomchar = randomstring.generate(5); - let domain = args.join(" "); + msg = await message.channel.send(`Loading! Please Wait...`) + var randomstring = require('randomstring') + let randomchar = randomstring.generate(5) + let domain = args.join(' ') if (!domain) { return message.channel.send( - `Please specify a domain!\nUsage: ${prefix}logo google.com` - ); + `Please specify a domain!\nUsage: ${prefix}logo google.com`, + ) } http.get( `http://logo.clearbit.com/${domain}?format=png&size=512`, (res) => { if (res.statusCode === 404) { - return message.channel.send(`Couldn't find a logo for ${domain}!`); + return message.channel.send(`Couldn't find a logo for ${domain}!`) } else { - const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-logo.png`; - const filePath = fs.createWriteStream(path); - res.pipe(filePath); - filePath.on("finish", async () => { - filePath.close(); - const attachment = new MessageAttachment(`${path}`); - message.reply({ files: [attachment] }); + const path = `${__dirname}/../../downloads/${message.author.id}-${randomchar}-logo.png` + const filePath = fs.createWriteStream(path) + res.pipe(filePath) + filePath.on('finish', async () => { + filePath.close() + const attachment = new MessageAttachment(`${path}`) + message.reply({ files: [attachment] }) setTimeout(function () { - msg.delete(); + msg.delete() fs.unlinkSync( - `./downloads/${message.author.id}-${randomchar}-logo.png` - ); - }, 5000); - }); + `./downloads/${message.author.id}-${randomchar}-logo.png`, + ) + }, 5000) + }) } - } - ); + }, + ) }, -}; +} diff --git a/commands/Tech/npm.js b/commands/Tech/npm.js index 14c42a6..4c8a9c8 100644 --- a/commands/Tech/npm.js +++ b/commands/Tech/npm.js @@ -1,15 +1,15 @@ -const { MessageEmbed } = require("discord.js"); -const axios = require("axios"); -const fs = require("fs"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const axios = require('axios') +const fs = require('fs') +const ee = require('../../botconfig/embed.json') module.exports = { - name: "npm", - category: "Tech", + name: 'npm', + category: 'Tech', aliases: [], - cooldown: "", - usage: "npm ", - description: "Get info about a npm package", + cooldown: '', + usage: 'npm ', + description: 'Get info about a npm package', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -17,55 +17,55 @@ module.exports = { maxargs: 0, minplusargs: 1, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - let npmpackage = args.join("+"); + let npmpackage = args.join('+') if (!npmpackage) { - return message.reply(`Please specify a npm package!`); + return message.reply(`Please specify a npm package!`) } await message.reply(`Loading! Please Wait...`).then((msg) => { axios .get(`https://api.npms.io/v2/package/${npmpackage}`) .then((res) => { - let data = res.data; + let data = res.data let embed = new MessageEmbed() - .setColor("RED") + .setColor('RED') .setTitle(`${data.collected.metadata.name}`) .setURL(`${data.collected.metadata.links.npm}`) .setDescription(`${data.collected.metadata.description}`) .addField( `Version`, `${data.collected.metadata.version}`, - (inline = true) + (inline = true), ) .addField( `Author`, `${data.collected.metadata.author.name}`, - (inline = true) + (inline = true), ) .addField( `License`, `${data.collected.metadata.license}`, - (inline = true) + (inline = true), ) .addField( `Github`, `${data.collected.metadata.links.repository}`, - (inline = true) + (inline = true), ) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setThumbnail( - "https://upload.wikimedia.org/wikipedia/commons/thumb/d/db/Npm-logo.svg/540px-Npm-logo.svg.png" - ); + 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/db/Npm-logo.svg/540px-Npm-logo.svg.png', + ) msg.edit({ content: "Here's the info!", embeds: [embed], - }); + }) }) .catch((err) => { - return msg.edit(`An error occured! \`\`\`js\n${err}\`\`\``); - }); - }); + return msg.edit(`An error occured! \`\`\`js\n${err}\`\`\``) + }) + }) }, -}; +} diff --git a/commands/Tech/webshot.js b/commands/Tech/webshot.js index 897ed31..9c59da5 100644 --- a/commands/Tech/webshot.js +++ b/commands/Tech/webshot.js @@ -1,16 +1,16 @@ -const { MessageAttachment } = require("discord.js"); -const { validateMIMEType } = require("validate-image-type"); -const fs = require("fs"); -const axios = require("axios"); -const randomstring = require("randomstring"); +const { MessageAttachment } = require('discord.js') +const { validateMIMEType } = require('validate-image-type') +const fs = require('fs') +const axios = require('axios') +const randomstring = require('randomstring') module.exports = { - name: "webshot", - category: "Tech", + name: 'webshot', + category: 'Tech', aliases: [], - cooldown: "", - usage: "webshot google.com (or other website)", - description: "Get a screenshot of a website", + cooldown: '', + usage: 'webshot google.com (or other website)', + description: 'Get a screenshot of a website', memberpermissions: [], requiredroles: [], alloweduserids: [], @@ -18,76 +18,76 @@ module.exports = { maxargs: 0, minplusargs: 1, maxplusargs: 0, - argsmissing_message: "", - argstoomany_message: "", + argsmissing_message: '', + argstoomany_message: '', run: async (client, message, args, plusArgs, cmdUser, text, prefix) => { - let website = args.join(" "); + let website = args.join(' ') if (!website) { - return message.channel.send(`Please specify a website!`); + return message.channel.send(`Please specify a website!`) } const randomchar = randomstring.generate({ length: 5, - charset: "alphabetic", - }); - const url = `https://api.popcat.xyz/screenshot?url=${website}`; - const path = `${__dirname}/../../downloads/${randomchar}-webshot.png`; + charset: 'alphabetic', + }) + const url = `https://api.popcat.xyz/screenshot?url=${website}` + const path = `${__dirname}/../../downloads/${randomchar}-webshot.png` await message .reply(` Please Wait...`) .then(async (msg) => { - const writer = fs.createWriteStream(path); + const writer = fs.createWriteStream(path) const download = await axios({ url, - method: "GET", - responseType: "stream", + method: 'GET', + responseType: 'stream', }) .then(async (response, err) => { if (err) return msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - response.data.pipe(writer); + }) + response.data.pipe(writer) return new Promise((resolve, reject) => { - writer.on("finish", resolve); - writer.on("error", reject); - }); + writer.on('finish', resolve) + writer.on('error', reject) + }) }) .then(() => { const result = validateMIMEType(path, { allowMimeTypes: [ - "image/jpeg", - "image/gif", - "image/png", - "image/svg+xml", + 'image/jpeg', + 'image/gif', + 'image/png', + 'image/svg+xml', ], - }); + }) if (!result.ok) { msg.edit({ content: ` An error occured!`, files: [ new MessageAttachment( `${__dirname}/../../downloads/${randomchar}-webshot.png`, - `error.txt` + `error.txt`, ), ], - }); - fs.unlinkSync(path); - return; + }) + fs.unlinkSync(path) + return } - const attachment = new MessageAttachment(`${path}`); + const attachment = new MessageAttachment(`${path}`) msg.edit({ content: `Screenshot of: \`${website}\``, files: [attachment], - }); + }) setTimeout(function () { - fs.unlinkSync(path); - }, 5000); + fs.unlinkSync(path) + }, 5000) }) .catch((err) => { msg.edit({ content: ` An error occured!\n\`\`\`js\n${err}\`\`\``, - }); - fs.unlinkSync(path); - }); - }); + }) + fs.unlinkSync(path) + }) + }) }, -}; +} diff --git a/events/client/debug.js b/events/client/debug.js index 5624146..26c801b 100644 --- a/events/client/debug.js +++ b/events/client/debug.js @@ -1,3 +1,3 @@ module.exports = (client, info) => { //console.log(String(info)); -}; +} diff --git a/events/client/disconnect.js b/events/client/disconnect.js index 65a9215..46c784f 100644 --- a/events/client/disconnect.js +++ b/events/client/disconnect.js @@ -1,3 +1,3 @@ module.exports = (client) => { - console.log(`You have been disconnected at ${new Date()}.`); -}; + console.log(`You have been disconnected at ${new Date()}.`) +} diff --git a/events/client/error.js b/events/client/error.js index f0c459d..17d9a16 100644 --- a/events/client/error.js +++ b/events/client/error.js @@ -1,4 +1,4 @@ //here the event starts module.exports = (client, error) => { - console.log(String(error)); -}; + console.log(String(error)) +} diff --git a/events/client/guildCreate.js b/events/client/guildCreate.js index a72148a..f735f89 100644 --- a/events/client/guildCreate.js +++ b/events/client/guildCreate.js @@ -1,33 +1,33 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../../botconfig/embed.json') module.exports = (client, message) => { if (process.env.EVENT_LOG_CHANNEL) { - client.on("guildCreate", async (guild) => { + client.on('guildCreate', async (guild) => { const guildcreateembed = new MessageEmbed() - .setColor("#22bb33") + .setColor('#22bb33') .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle(`${client.user.username} has been added to a new guild!`) .addFields( { - name: "Guild Name", + name: 'Guild Name', value: `\`${guild.name}\``, inline: true, }, { - name: "Guild ID", + name: 'Guild ID', value: `\`${guild.id}\``, inline: true, - } + }, ) - .setTimestamp(); + .setTimestamp() try { client.channels.cache .get(process.env.EVENT_LOG_CHANNEL) - .send({ embeds: [guildcreateembed] }); + .send({ embeds: [guildcreateembed] }) } catch (err) { - console.log(err); + console.log(err) } - }); + }) } -}; +} diff --git a/events/client/rateLimit.js b/events/client/rateLimit.js index b614db8..9fb6a53 100644 --- a/events/client/rateLimit.js +++ b/events/client/rateLimit.js @@ -1,3 +1,3 @@ module.exports = (client, rateLimitData) => { - console.log(JSON.stringify(rateLimitData)); -}; + console.log(JSON.stringify(rateLimitData)) +} diff --git a/events/client/ready.js b/events/client/ready.js index fddd920..bd07bd0 100644 --- a/events/client/ready.js +++ b/events/client/ready.js @@ -1,19 +1,19 @@ -const config = require("../../botconfig/config.json"); -const { change_status } = require("../../handlers/functions"); +const config = require('../../botconfig/config.json') +const { change_status } = require('../../handlers/functions') module.exports = (client) => { try { try { console.log( - `\n${client.user.tag} is ready to serve in ${client.guilds.cache.size} servers.\n` - ); + `\n${client.user.tag} is ready to serve in ${client.guilds.cache.size} servers.\n`, + ) } catch { /* */ } - change_status(client); + change_status(client) setInterval(() => { - change_status(client); - }, 15 * 1000); + change_status(client) + }, 15 * 1000) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } -}; +} diff --git a/events/client/reconnecting.js b/events/client/reconnecting.js index 6f32a29..4562d50 100644 --- a/events/client/reconnecting.js +++ b/events/client/reconnecting.js @@ -1,3 +1,3 @@ module.exports = (client) => { - console.log(`Reconnecting at ${new Date()}.`); -}; + console.log(`Reconnecting at ${new Date()}.`) +} diff --git a/events/client/shardDisconnect.js b/events/client/shardDisconnect.js index e693ef6..6724442 100644 --- a/events/client/shardDisconnect.js +++ b/events/client/shardDisconnect.js @@ -1,7 +1,7 @@ module.exports = (client, event, id) => { console.log( ` || <==> || [${String(new Date()) - .split(" ", 5) - .join(" ")}] || <==> || Shard #${id} Disconnected || <==> ||` - ); -}; + .split(' ', 5) + .join(' ')}] || <==> || Shard #${id} Disconnected || <==> ||`, + ) +} diff --git a/events/client/shardError.js b/events/client/shardError.js index 915eadf..fc715b6 100644 --- a/events/client/shardError.js +++ b/events/client/shardError.js @@ -1,7 +1,7 @@ module.exports = (client, error, id) => { console.log( ` || <==> || [${String(new Date()) - .split(" ", 5) - .join(" ")}] || <==> || Shard #${id} Errored || <==> ||` - ); -}; + .split(' ', 5) + .join(' ')}] || <==> || Shard #${id} Errored || <==> ||`, + ) +} diff --git a/events/client/shardReady.js b/events/client/shardReady.js index 869c5ec..d5951c8 100644 --- a/events/client/shardReady.js +++ b/events/client/shardReady.js @@ -1,7 +1,7 @@ module.exports = (client, id) => { console.log( ` || <==> || [${String(new Date()) - .split(" ", 5) - .join(" ")}] || <==> || Shard #${id} Ready || <==> ||` - ); -}; + .split(' ', 5) + .join(' ')}] || <==> || Shard #${id} Ready || <==> ||`, + ) +} diff --git a/events/client/shardReconnecting.js b/events/client/shardReconnecting.js index 9ded2bc..d2499b2 100644 --- a/events/client/shardReconnecting.js +++ b/events/client/shardReconnecting.js @@ -1,7 +1,7 @@ module.exports = (client, id) => { console.log( ` || <==> || [${String(new Date()) - .split(" ", 5) - .join(" ")}] || <==> || Shard #${id} Reconnecting || <==> ||` - ); -}; + .split(' ', 5) + .join(' ')}] || <==> || Shard #${id} Reconnecting || <==> ||`, + ) +} diff --git a/events/client/shardResume.js b/events/client/shardResume.js index ed50bc7..4f88798 100644 --- a/events/client/shardResume.js +++ b/events/client/shardResume.js @@ -1,7 +1,7 @@ module.exports = (client, id, replayedEvents) => { console.log( ` || <==> || [${String(new Date()) - .split(" ", 5) - .join(" ")}] || <==> || Shard #${id} Resumed || <==> ||` - ); -}; + .split(' ', 5) + .join(' ')}] || <==> || Shard #${id} Resumed || <==> ||`, + ) +} diff --git a/events/client/warn.js b/events/client/warn.js index 499f7a0..eb74c1f 100644 --- a/events/client/warn.js +++ b/events/client/warn.js @@ -1,3 +1,3 @@ module.exports = (client, error) => { - console.log(String(error)); -}; + console.log(String(error)) +} diff --git a/events/guild/guildMemberAdd.js b/events/guild/guildMemberAdd.js index 8cbb7fe..249a9b7 100644 --- a/events/guild/guildMemberAdd.js +++ b/events/guild/guildMemberAdd.js @@ -2,11 +2,11 @@ * @INFO * Loading all needed File Information Parameters */ -const config = require("../../botconfig/config.json"); //loading config file with token and prefix -const settings = require("../../botconfig/settings.json"); //loading settings file with the settings -const ee = require("../../botconfig/embed.json"); //Loading all embed settings like color footertext and icon ... -const Discord = require("discord.js"); //this is the official discord.js wrapper for the Discord Api, which we use! +const config = require('../../botconfig/config.json') //loading config file with token and prefix +const settings = require('../../botconfig/settings.json') //loading settings file with the settings +const ee = require('../../botconfig/embed.json') //Loading all embed settings like color footertext and icon ... +const Discord = require('discord.js') //this is the official discord.js wrapper for the Discord Api, which we use! //here the event starts module.exports = (client, member) => { //Do some code, once the Bot joined the Server -}; +} diff --git a/events/guild/interactionCreate.js b/events/guild/interactionCreate.js index d8efe48..0871ffb 100644 --- a/events/guild/interactionCreate.js +++ b/events/guild/interactionCreate.js @@ -1,35 +1,35 @@ //Import Modules -const mongoose = require("mongoose"); -const mongoprefix = require("../../models/prefix"); -const config = require(`../../botconfig/config.json`); -const ee = require(`../../botconfig/embed.json`); -const settings = require(`../../botconfig/settings.json`); -const { onCoolDown, replacemsg } = require("../../handlers/functions"); -const Discord = require("discord.js"); +const mongoose = require('mongoose') +const mongoprefix = require('../../models/prefix') +const config = require(`../../botconfig/config.json`) +const ee = require(`../../botconfig/embed.json`) +const settings = require(`../../botconfig/settings.json`) +const { onCoolDown, replacemsg } = require('../../handlers/functions') +const Discord = require('discord.js') module.exports = async (client, interaction) => { const prefix = await mongoprefix .findOne({ GuildID: interaction.guild.id, }) .then((res) => { - if (res) return res.Prefix; - else return process.env.PREFIX; - }); - const CategoryName = interaction.commandName; - let command = false; + if (res) return res.Prefix + else return process.env.PREFIX + }) + const CategoryName = interaction.commandName + let command = false try { if ( client.slashCommands.has( - CategoryName + interaction.options.getSubcommand() + CategoryName + interaction.options.getSubcommand(), ) ) { command = client.slashCommands.get( - CategoryName + interaction.options.getSubcommand() - ); + CategoryName + interaction.options.getSubcommand(), + ) } } catch { - if (client.slashCommands.has("normal" + CategoryName)) { - command = client.slashCommands.get("normal" + CategoryName); + if (client.slashCommands.has('normal' + CategoryName)) { + command = client.slashCommands.get('normal' + CategoryName) } } if (command) { @@ -45,10 +45,10 @@ module.exports = async (client, interaction) => { prefix: prefix, command: command, timeLeft: onCoolDown(interaction, command), - }) + }), ), ], - }); + }) } //if Command has specific permission return error if ( @@ -63,7 +63,7 @@ module.exports = async (client, interaction) => { .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle( - replacemsg(settings.messages.notallowed_to_exec_cmd.title) + replacemsg(settings.messages.notallowed_to_exec_cmd.title), ) .setDescription( replacemsg( @@ -72,11 +72,11 @@ module.exports = async (client, interaction) => { { command: command, prefix: prefix, - } - ) + }, + ), ), ], - }); + }) } //if Command has specific needed roles return error if ( @@ -84,7 +84,7 @@ module.exports = async (client, interaction) => { command.requiredroles.length > 0 && interaction.member.roles.cache.size > 0 && !interaction.member.roles.cache.some((r) => - command.requiredroles.includes(r.id) + command.requiredroles.includes(r.id), ) ) { return interaction.reply({ @@ -94,7 +94,7 @@ module.exports = async (client, interaction) => { .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle( - replacemsg(settings.messages.notallowed_to_exec_cmd.title) + replacemsg(settings.messages.notallowed_to_exec_cmd.title), ) .setDescription( replacemsg( @@ -103,11 +103,11 @@ module.exports = async (client, interaction) => { { command: command, prefix: prefix, - } - ) + }, + ), ), ], - }); + }) } //if Command has specific users return error if ( @@ -122,7 +122,7 @@ module.exports = async (client, interaction) => { .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle( - replacemsg(settings.messages.notallowed_to_exec_cmd.title) + replacemsg(settings.messages.notallowed_to_exec_cmd.title), ) .setDescription( replacemsg( @@ -131,13 +131,13 @@ module.exports = async (client, interaction) => { { command: command, prefix: prefix, - } - ) + }, + ), ), ], - }); + }) } //execute the Command - command.run(client, interaction, interaction.member, interaction.guild); + command.run(client, interaction, interaction.member, interaction.guild) } -}; +} diff --git a/events/guild/messageCreate.js b/events/guild/messageCreate.js index 6e24134..5c5a397 100644 --- a/events/guild/messageCreate.js +++ b/events/guild/messageCreate.js @@ -1,36 +1,36 @@ //Import Modules -const config = require(`../../botconfig/config.json`); -const ee = require(`../../botconfig/embed.json`); -const settings = require(`../../botconfig/settings.json`); -const { onCoolDown, replacemsg } = require("../../handlers/functions"); -const Discord = require("discord.js"); -const mongoose = require("mongoose"); -const mongoprefix = require("../../models/prefix"); +const config = require(`../../botconfig/config.json`) +const ee = require(`../../botconfig/embed.json`) +const settings = require(`../../botconfig/settings.json`) +const { onCoolDown, replacemsg } = require('../../handlers/functions') +const Discord = require('discord.js') +const mongoose = require('mongoose') +const mongoprefix = require('../../models/prefix') module.exports = async (client, message) => { - if (!message.guild || !message.channel || message.author.bot) return; - if (message.channel.partial) await message.channel.fetch(); - if (message.partial) await message.fetch(); + if (!message.guild || !message.channel || message.author.bot) return + if (message.channel.partial) await message.channel.fetch() + if (message.partial) await message.fetch() // now if prefix is in db, we will use that otherwise we will use the default prefix const prefix = await mongoprefix .findOne({ GuildID: message.guild.id, }) .then((res) => { - if (res) return res.Prefix; - else return process.env.PREFIX; - }); + if (res) return res.Prefix + else return process.env.PREFIX + }) const prefixRegex = new RegExp( - `^(<@!?${client.user.id}>|${escapeRegex(prefix)})` - ); - if (!prefixRegex.test(message.content)) return; - const [, mPrefix] = message.content.match(prefixRegex); + `^(<@!?${client.user.id}>|${escapeRegex(prefix)})`, + ) + if (!prefixRegex.test(message.content)) return + const [, mPrefix] = message.content.match(prefixRegex) const args = message.content .slice(mPrefix.length) .trim() .split(/ +/) - .filter(Boolean); - const cmd = args.length > 0 ? args.shift().toLowerCase() : null; + .filter(Boolean) + const cmd = args.length > 0 ? args.shift().toLowerCase() : null if (cmd.length == 0) { if (mPrefix.includes(client.user.id)) { message.reply({ @@ -40,12 +40,12 @@ module.exports = async (client, message) => { .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle(`:thumbsup: **My Prefix here, is __\`${prefix}\`__**`), ], - }); + }) } - return; + return } - let command = client.commands.get(cmd); - if (!command) command = client.commands.get(client.aliases.get(cmd)); + let command = client.commands.get(cmd) + if (!command) command = client.commands.get(client.aliases.get(cmd)) if (command) { if (onCoolDown(message, command)) { return message.reply({ @@ -58,10 +58,10 @@ module.exports = async (client, message) => { prefix: prefix, command: command, timeLeft: onCoolDown(message, command), - }) + }), ), ], - }); + }) } try { //if Command has specific permission return error @@ -77,7 +77,7 @@ module.exports = async (client, message) => { .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle( - replacemsg(settings.messages.notallowed_to_exec_cmd.title) + replacemsg(settings.messages.notallowed_to_exec_cmd.title), ) .setDescription( replacemsg( @@ -86,21 +86,21 @@ module.exports = async (client, message) => { { command: command, prefix: prefix, - } - ) + }, + ), ), ], }) .then((msg) => { setTimeout(() => { msg.delete().catch((e) => { - console.log(String(e)); - }); - }, settings.timeout.notallowed_to_exec_cmd.memberpermissions); + console.log(String(e)) + }) + }, settings.timeout.notallowed_to_exec_cmd.memberpermissions) }) .catch((e) => { - console.log(String(e)); - }); + console.log(String(e)) + }) } //if Command has specific needed roles return error if ( @@ -108,7 +108,7 @@ module.exports = async (client, message) => { command.requiredroles.length > 0 && message.member.roles.cache.size > 0 && !message.member.roles.cache.some((r) => - command.requiredroles.includes(r.id) + command.requiredroles.includes(r.id), ) ) { return message @@ -118,7 +118,7 @@ module.exports = async (client, message) => { .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle( - replacemsg(settings.messages.notallowed_to_exec_cmd.title) + replacemsg(settings.messages.notallowed_to_exec_cmd.title), ) .setDescription( replacemsg( @@ -127,21 +127,21 @@ module.exports = async (client, message) => { { command: command, prefix: prefix, - } - ) + }, + ), ), ], }) .then((msg) => { setTimeout(() => { msg.delete().catch((e) => { - console.log(String(e)); - }); - }, settings.timeout.notallowed_to_exec_cmd.requiredroles); + console.log(String(e)) + }) + }, settings.timeout.notallowed_to_exec_cmd.requiredroles) }) .catch((e) => { - console.log(String(e)); - }); + console.log(String(e)) + }) } //if Command has specific users return error if ( @@ -156,7 +156,7 @@ module.exports = async (client, message) => { .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) .setTitle( - replacemsg(settings.messages.notallowed_to_exec_cmd.title) + replacemsg(settings.messages.notallowed_to_exec_cmd.title), ) .setDescription( replacemsg( @@ -165,21 +165,21 @@ module.exports = async (client, message) => { { command: command, prefix: prefix, - } - ) + }, + ), ), ], }) .then((msg) => { setTimeout(() => { msg.delete().catch((e) => { - console.log(String(e)); - }); - }, settings.timeout.notallowed_to_exec_cmd.alloweduserids); + console.log(String(e)) + }) + }, settings.timeout.notallowed_to_exec_cmd.alloweduserids) }) .catch((e) => { - console.log(String(e)); - }); + console.log(String(e)) + }) } //if command has minimum args, and user dont entered enough, return error if ( @@ -193,27 +193,27 @@ module.exports = async (client, message) => { new Discord.MessageEmbed() .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) - .setTitle(":x: Wrong Command Usage!") + .setTitle(':x: Wrong Command Usage!') .setDescription( command.argsmissing_message && command.argsmissing_message.trim().length > 0 ? command.argsmissing_message : command.usage - ? "Usage: " + command.usage - : "Wrong Command Usage" + ? 'Usage: ' + command.usage + : 'Wrong Command Usage', ), ], }) .then((msg) => { setTimeout(() => { msg.delete().catch((e) => { - console.log(String(e)); - }); - }, settings.timeout.minargs); + console.log(String(e)) + }) + }, settings.timeout.minargs) }) .catch((e) => { - console.log(String(e)); - }); + console.log(String(e)) + }) } //if command has maximum args, and user enters too many, return error if ( @@ -227,34 +227,34 @@ module.exports = async (client, message) => { new Discord.MessageEmbed() .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) - .setTitle(":x: Wrong Command Usage!") + .setTitle(':x: Wrong Command Usage!') .setDescription( command.argstoomany_message && command.argstoomany_message.trim().length > 0 ? command.argstoomany_message : command.usage - ? "Usage: " + command.usage - : "Wrong Command Usage" + ? 'Usage: ' + command.usage + : 'Wrong Command Usage', ), ], }) .then((msg) => { setTimeout(() => { msg.delete().catch((e) => { - console.log(String(e)); - }); - }, settings.timeout.maxargs); + console.log(String(e)) + }) + }, settings.timeout.maxargs) }) .catch((e) => { - console.log(String(e)); - }); + console.log(String(e)) + }) } //if command has minimum args (splitted with "++"), and user dont entered enough, return error if ( command.minplusargs && command.minplusargs > 0 && - args.join(" ").split("++").filter(Boolean).length < command.minplusargs + args.join(' ').split('++').filter(Boolean).length < command.minplusargs ) { return message .reply({ @@ -262,33 +262,33 @@ module.exports = async (client, message) => { new Discord.MessageEmbed() .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) - .setTitle(":x: Wrong Command Usage!") + .setTitle(':x: Wrong Command Usage!') .setDescription( command.argsmissing_message && command.argsmissing_message.trim().length > 0 ? command.argsmissing_message : command.usage - ? "Usage: " + command.usage - : "Wrong Command Usage" + ? 'Usage: ' + command.usage + : 'Wrong Command Usage', ), ], }) .then((msg) => { setTimeout(() => { msg.delete().catch((e) => { - console.log(String(e)); - }); - }, settings.timeout.minplusargs); + console.log(String(e)) + }) + }, settings.timeout.minplusargs) }) .catch((e) => { - console.log(String(e)); - }); + console.log(String(e)) + }) } //if command has maximum args (splitted with "++"), and user enters too many, return error if ( command.maxplusargs && command.maxplusargs > 0 && - args.join(" ").split("++").filter(Boolean).length > command.maxplusargs + args.join(' ').split('++').filter(Boolean).length > command.maxplusargs ) { return message .reply({ @@ -296,73 +296,73 @@ module.exports = async (client, message) => { new Discord.MessageEmbed() .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }) - .setTitle(":x: Wrong Command Usage!") + .setTitle(':x: Wrong Command Usage!') .setDescription( command.argstoomany_message && command.argstoomany_message.trim().length > 0 ? command.argsmissing_message : command.usage - ? "Usage: " + command.usage - : "Wrong Command Usage" + ? 'Usage: ' + command.usage + : 'Wrong Command Usage', ), ], }) .then((msg) => { setTimeout(() => { msg.delete().catch((e) => { - console.log(String(e)); - }); - }, settings.timeout.maxplusargs); + console.log(String(e)) + }) + }, settings.timeout.maxplusargs) }) .catch((e) => { - console.log(String(e)); - }); + console.log(String(e)) + }) } //run the command with the parameters: client, message, args, Cmduser, text, prefix, command.run( client, message, args, - args.join(" ").split("++").filter(Boolean), + args.join(' ').split('++').filter(Boolean), message.member, - args.join(" "), - prefix - ); + args.join(' '), + prefix, + ) // send the log to event log channel if (process.env.EVENT_LOG_CHANNEL) { const eventlogembed = new Discord.MessageEmbed() - .setColor("#22bb33") + .setColor('#22bb33') .setFooter({ text: ee.footertext, iconURL: ee.footericon }) - .setTitle(":white_check_mark: Command Executed!") + .setTitle(':white_check_mark: Command Executed!') .addFields( { - name: "Command", - value: `\`${prefix + command.name + " " + args.join(" ")}\``, + name: 'Command', + value: `\`${prefix + command.name + ' ' + args.join(' ')}\``, inline: true, }, { - name: "User", + name: 'User', value: `\`${message.author.tag}\``, inline: true, }, { - name: "Channel", + name: 'Channel', value: `\`#${message.channel.name}\``, inline: false, }, { - name: "Guild", + name: 'Guild', value: `\`${message.guild.name}\``, inline: true, - } + }, ) - .setTimestamp(); + .setTimestamp() try { client.channels.cache .get(process.env.EVENT_LOG_CHANNEL) - .send({ embeds: [eventlogembed] }); + .send({ embeds: [eventlogembed] }) } catch (error) { - console.log(error); + console.log(error) } } } catch (error) { @@ -377,7 +377,7 @@ module.exports = async (client, message) => { replacemsg(settings.messages.somethingwentwrong_cmd.title, { prefix: prefix, command: command, - }) + }), ) .setDescription( replacemsg( @@ -386,21 +386,21 @@ module.exports = async (client, message) => { error: error, prefix: prefix, command: command, - } - ) + }, + ), ), ], }) .then((msg) => { setTimeout(() => { msg.delete().catch((e) => { - console.log(String(e)); - }); - }, 4000); + console.log(String(e)) + }) + }, 4000) }) .catch((e) => { - console.log(String(e)); - }); + console.log(String(e)) + }) } } } //if the command is not found send an info msg @@ -414,22 +414,22 @@ module.exports = async (client, message) => { .setTitle( replacemsg(settings.messages.unknown_cmd, { prefix: prefix, - }) + }), ), ], }) .then((msg) => { setTimeout(() => { msg.delete().catch((e) => { - console.log(String(e)); - }); - }, 4000); + console.log(String(e)) + }) + }, 4000) }) .catch((e) => { - console.log(String(e)); - }); -}; + console.log(String(e)) + }) +} function escapeRegex(str) { - return str.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`); + return str.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`) } diff --git a/events/guild/messageDelete.js b/events/guild/messageDelete.js index ab071aa..b7d5015 100644 --- a/events/guild/messageDelete.js +++ b/events/guild/messageDelete.js @@ -1,12 +1,12 @@ //Import Modules -const config = require(`../../botconfig/config.json`); -const ee = require(`../../botconfig/embed.json`); -const settings = require(`../../botconfig/settings.json`); -const { onCoolDown, replacemsg } = require("../../handlers/functions"); -const Discord = require("discord.js"); +const config = require(`../../botconfig/config.json`) +const ee = require(`../../botconfig/embed.json`) +const settings = require(`../../botconfig/settings.json`) +const { onCoolDown, replacemsg } = require('../../handlers/functions') +const Discord = require('discord.js') module.exports = async (client, message) => { - if (message.partial || (message.embeds.length && !message.content)) return; // content is null or deleted embed + if (message.partial || (message.embeds.length && !message.content)) return // content is null or deleted embed client.snipes[message.channel.id] = { author: message.author, @@ -15,5 +15,5 @@ module.exports = async (client, message) => { image: message.attachments.first() ? message.attachments.first().proxyURL : null, - }; -}; + } +} diff --git a/events/guild/messageReactionAdd.js b/events/guild/messageReactionAdd.js index 127dba7..704b7ef 100644 --- a/events/guild/messageReactionAdd.js +++ b/events/guild/messageReactionAdd.js @@ -5,8 +5,8 @@ //here the event starts module.exports = async (client, reaction, user) => { //logs when a reaction appears - if (reaction.message.partial) await reaction.message.fetch(); - if (reaction.partial) await reaction.fetch(); - if (user.bot) return; - if (!reaction.message.guild) console.log(); -}; + if (reaction.message.partial) await reaction.message.fetch() + if (reaction.partial) await reaction.fetch() + if (user.bot) return + if (!reaction.message.guild) console.log() +} diff --git a/events/guild/messageReactionRemove.js b/events/guild/messageReactionRemove.js index 44e03c3..b7bc166 100644 --- a/events/guild/messageReactionRemove.js +++ b/events/guild/messageReactionRemove.js @@ -5,10 +5,10 @@ //here the event starts module.exports = async (client, reaction, user) => { //logs when a reaction appears - if (reaction.message.partial) await reaction.message.fetch(); - if (reaction.partial) await reaction.fetch(); - if (user.bot) return; + if (reaction.message.partial) await reaction.message.fetch() + if (reaction.partial) await reaction.fetch() + if (user.bot) return if (!reaction.message.guild) //REST OF THE CODE HERE - console.log(); -}; + console.log() +} diff --git a/events/guild/messageUpdate.js b/events/guild/messageUpdate.js index c763ac6..3a35f77 100644 --- a/events/guild/messageUpdate.js +++ b/events/guild/messageUpdate.js @@ -1,17 +1,17 @@ //Import Modules -const config = require(`../../botconfig/config.json`); -const ee = require(`../../botconfig/embed.json`); -const settings = require(`../../botconfig/settings.json`); -const { onCoolDown, replacemsg } = require("../../handlers/functions"); -const Discord = require("discord.js"); +const config = require(`../../botconfig/config.json`) +const ee = require(`../../botconfig/embed.json`) +const settings = require(`../../botconfig/settings.json`) +const { onCoolDown, replacemsg } = require('../../handlers/functions') +const Discord = require('discord.js') module.exports = async (client, oldMessage, newMessage) => { - if (oldMessage.partial) return; // content is null + if (oldMessage.partial) return // content is null client.snipes[oldMessage.channel.id] = { author: oldMessage.author, content: oldMessage.content, newcontent: newMessage.content, createdAt: newMessage.editedTimestamp, - }; -}; + } +} diff --git a/events/guild/threadCreate.js b/events/guild/threadCreate.js index 63f57cf..e095dfb 100644 --- a/events/guild/threadCreate.js +++ b/events/guild/threadCreate.js @@ -1,9 +1,9 @@ module.exports = async (client, thread) => { if (thread.joinable) { try { - await thread.join(); + await thread.join() } catch (e) { - console.log(e); + console.log(e) } } -}; +} diff --git a/events/guild/voiceStateUpdate.js b/events/guild/voiceStateUpdate.js index 83723a8..04af986 100644 --- a/events/guild/voiceStateUpdate.js +++ b/events/guild/voiceStateUpdate.js @@ -15,30 +15,30 @@ module.exports = async (client, oldState, newState) => { ) if (!oldState.channelId && newState.channelId) { if ( - newState.channel.type == "GUILD_STAGE_VOICE" && + newState.channel.type == 'GUILD_STAGE_VOICE' && newState.guild.me.voice.suppress ) { try { - await newState.guild.me.voice.setSuppressed(false); + await newState.guild.me.voice.setSuppressed(false) } catch (e) { - console.log(String(e)); + console.log(String(e)) } } - return; + return } if (oldState.channelId && !newState.channelId) { - return; + return } if (oldState.channelId && newState.channelId) { if ( - newState.channel.type == "GUILD_STAGE_VOICE" && + newState.channel.type == 'GUILD_STAGE_VOICE' && newState.guild.me.voice.suppress ) { try { - await newState.guild.me.voice.setSuppressed(false); + await newState.guild.me.voice.setSuppressed(false) } catch (e) { - console.log(String(e)); + console.log(String(e)) } } } -}; +} diff --git a/handlers/antiCrash.js b/handlers/antiCrash.js index 55a70d1..644c152 100644 --- a/handlers/antiCrash.js +++ b/handlers/antiCrash.js @@ -1,18 +1,18 @@ module.exports = (client) => { - process.on("unhandledRejection", (reason, p) => { - console.log(" [antiCrash] :: Unhandled Rejection/Catch"); - console.log(reason, p); - }); - process.on("uncaughtException", (err, origin) => { - console.log(" [antiCrash] :: Uncaught Exception/Catch"); - console.log(err, origin); - }); - process.on("uncaughtExceptionMonitor", (err, origin) => { - console.log(" [antiCrash] :: Uncaught Exception/Catch (MONITOR)"); - console.log(err, origin); - }); - process.on("multipleResolves", (type, promise, reason) => { - console.log(" [antiCrash] :: Multiple Resolves"); - console.log(type, promise, reason); - }); -}; + process.on('unhandledRejection', (reason, p) => { + console.log(' [antiCrash] :: Unhandled Rejection/Catch') + console.log(reason, p) + }) + process.on('uncaughtException', (err, origin) => { + console.log(' [antiCrash] :: Uncaught Exception/Catch') + console.log(err, origin) + }) + process.on('uncaughtExceptionMonitor', (err, origin) => { + console.log(' [antiCrash] :: Uncaught Exception/Catch (MONITOR)') + console.log(err, origin) + }) + process.on('multipleResolves', (type, promise, reason) => { + console.log(' [antiCrash] :: Multiple Resolves') + console.log(type, promise, reason) + }) +} diff --git a/handlers/commands.js b/handlers/commands.js index 6062c00..aa49317 100644 --- a/handlers/commands.js +++ b/handlers/commands.js @@ -1,29 +1,29 @@ -const { readdirSync } = require("fs"); +const { readdirSync } = require('fs') module.exports = (client) => { try { - let amount = 0; - readdirSync("./commands/").forEach((dir) => { + let amount = 0 + readdirSync('./commands/').forEach((dir) => { const commands = readdirSync(`./commands/${dir}/`).filter((file) => - file.endsWith(".js") - ); + file.endsWith('.js'), + ) for (let file of commands) { - let pull = require(`../commands/${dir}/${file}`); + let pull = require(`../commands/${dir}/${file}`) if (pull.name) { - client.commands.set(pull.name, pull); - amount++; + client.commands.set(pull.name, pull) + amount++ } else { console.log( file, - `error -> missing a help.name, or help.name is not a string.` - ); - continue; + `error -> missing a help.name, or help.name is not a string.`, + ) + continue } if (pull.aliases && Array.isArray(pull.aliases)) - pull.aliases.forEach((alias) => client.aliases.set(alias, pull.name)); + pull.aliases.forEach((alias) => client.aliases.set(alias, pull.name)) } - }); - console.log(`${amount} Commands Loaded`); + }) + console.log(`${amount} Commands Loaded`) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } -}; +} diff --git a/handlers/events.js b/handlers/events.js index 6301f0e..4d12243 100644 --- a/handlers/events.js +++ b/handlers/events.js @@ -1,37 +1,37 @@ -const fs = require("fs"); -const allevents = []; +const fs = require('fs') +const allevents = [] module.exports = async (client) => { try { try { - console.log("Starting to load..."); + console.log('Starting to load...') } catch { /* */ } - let amount = 0; + let amount = 0 const load_dir = (dir) => { const event_files = fs .readdirSync(`./events/${dir}`) - .filter((file) => file.endsWith(".js")); + .filter((file) => file.endsWith('.js')) for (const file of event_files) { try { - const event = require(`../events/${dir}/${file}`); - let eventName = file.split(".")[0]; - allevents.push(eventName); - client.on(eventName, event.bind(null, client)); - amount++; + const event = require(`../events/${dir}/${file}`) + let eventName = file.split('.')[0] + allevents.push(eventName) + client.on(eventName, event.bind(null, client)) + amount++ } catch (e) { - console.log(e); + console.log(e) } } - }; - await ["client", "guild"].forEach((e) => load_dir(e)); - console.log(`${amount} Events Loaded`); + } + await ['client', 'guild'].forEach((e) => load_dir(e)) + console.log(`${amount} Events Loaded`) try { - console.log("Logging into the bot..."); + console.log('Logging into the bot...') } catch { /* */ } } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } -}; +} diff --git a/handlers/functions.js b/handlers/functions.js index e114bfa..e702445 100644 --- a/handlers/functions.js +++ b/handlers/functions.js @@ -1,32 +1,32 @@ -const { MessageEmbed, Collection } = require("discord.js"); -const config = require("../botconfig/config.json"); -const ee = require("../botconfig/embed.json"); -const settings = require("../botconfig/settings.json"); -const mongoose = require("mongoose"); -const mongoprefix = require("../models/prefix"); +const { MessageEmbed, Collection } = require('discord.js') +const config = require('../botconfig/config.json') +const ee = require('../botconfig/embed.json') +const settings = require('../botconfig/settings.json') +const mongoose = require('mongoose') +const mongoprefix = require('../models/prefix') //EXPORT ALL FUNCTIONS -module.exports.nFormatter = nFormatter; -module.exports.change_status = change_status; -module.exports.shuffle = shuffle; -module.exports.formatDate = formatDate; -module.exports.delay = delay; -module.exports.getRandomInt = getRandomInt; -module.exports.duration = duration; -module.exports.getRandomNum = getRandomNum; -module.exports.createBar = createBar; -module.exports.format = format; -module.exports.swap_pages = swap_pages; -module.exports.swap_pages2 = swap_pages2; -module.exports.escapeRegex = escapeRegex; -module.exports.arrayMove = arrayMove; -module.exports.isValidURL = isValidURL; -module.exports.GetUser = GetUser; -module.exports.GetRole = GetRole; -module.exports.GetGlobalUser = GetGlobalUser; -module.exports.parseMilliseconds = parseMilliseconds; -module.exports.onCoolDown = onCoolDown; +module.exports.nFormatter = nFormatter +module.exports.change_status = change_status +module.exports.shuffle = shuffle +module.exports.formatDate = formatDate +module.exports.delay = delay +module.exports.getRandomInt = getRandomInt +module.exports.duration = duration +module.exports.getRandomNum = getRandomNum +module.exports.createBar = createBar +module.exports.format = format +module.exports.swap_pages = swap_pages +module.exports.swap_pages2 = swap_pages2 +module.exports.escapeRegex = escapeRegex +module.exports.arrayMove = arrayMove +module.exports.isValidURL = isValidURL +module.exports.GetUser = GetUser +module.exports.GetRole = GetRole +module.exports.GetGlobalUser = GetGlobalUser +module.exports.parseMilliseconds = parseMilliseconds +module.exports.onCoolDown = onCoolDown -module.exports.replacemsg = replacedefaultmessages; +module.exports.replacemsg = replacedefaultmessages /** * * @param {*} text The Text that should be replaced, usually from /botconfig/settings.json @@ -46,47 +46,49 @@ module.exports.replacemsg = replacedefaultmessages; */ function replacedefaultmessages(text, o = {}) { if (!text || text == undefined || text == null) - throw "No Text for the replacedefault message added as First Parameter"; - const options = Object(o); - if (!options || options == undefined || options == null) return String(text); + throw 'No Text for the replacedefault message added as First Parameter' + const options = Object(o) + if (!options || options == undefined || options == null) return String(text) return String(text) .replace( /%{timeleft}%/gi, - options && options.timeLeft ? options.timeLeft.toFixed(1) : "%{timeleft}%" + options && options.timeLeft + ? options.timeLeft.toFixed(1) + : '%{timeleft}%', ) .replace( /%{commandname}%/gi, options && options.command && options.command.name ? options.command.name - : "%{commandname}%" + : '%{commandname}%', ) .replace( /%{commandaliases}%/gi, options && options.command && options.command.aliases - ? options.command.aliases.map((v) => `\`${v}\``).join(",") - : "%{commandaliases}%" + ? options.command.aliases.map((v) => `\`${v}\``).join(',') + : '%{commandaliases}%', ) .replace( /%{prefix}%/gi, - options && options.prefix ? options.prefix : "%{prefix}%" + options && options.prefix ? options.prefix : '%{prefix}%', ) .replace( /%{commandmemberpermissions}%/gi, options && options.command && options.command.memberpermissions - ? options.command.memberpermissions.map((v) => `\`${v}\``).join(",") - : "%{commandmemberpermissions}%" + ? options.command.memberpermissions.map((v) => `\`${v}\``).join(',') + : '%{commandmemberpermissions}%', ) .replace( /%{commandalloweduserids}%/gi, options && options.command && options.command.alloweduserids - ? options.command.alloweduserids.map((v) => `<@${v}>`).join(",") - : "%{commandalloweduserids}%" + ? options.command.alloweduserids.map((v) => `<@${v}>`).join(',') + : '%{commandalloweduserids}%', ) .replace( /%{commandrequiredroles}%/gi, options && options.command && options.command.requiredroles - ? options.command.requiredroles.map((v) => `<@&${v}>`).join(",") - : "%{commandrequiredroles}%" + ? options.command.requiredroles.map((v) => `<@&${v}>`).join(',') + : '%{commandrequiredroles}%', ) .replace( /%{errormessage}%/gi, @@ -94,7 +96,7 @@ function replacedefaultmessages(text, o = {}) { ? options.error.message : options && options.error ? options.error - : "%{errormessage}%" + : '%{errormessage}%', ) .replace( /%{errorstack}%/gi, @@ -104,12 +106,12 @@ function replacedefaultmessages(text, o = {}) { ? options.error.message : options && options.error ? options.error - : "%{errorstack}%" + : '%{errorstack}%', ) .replace( /%{error}%/gi, - options && options.error ? options.error : "%{error}%" - ); + options && options.error ? options.error : '%{error}%', + ) } /** @@ -121,41 +123,41 @@ function replacedefaultmessages(text, o = {}) { function onCoolDown(message, command) { if (!message || !message.client) - throw "No Message with a valid DiscordClient granted as First Parameter"; + throw 'No Message with a valid DiscordClient granted as First Parameter' if (!command || !command.name) - throw "No Command with a valid Name granted as Second Parameter"; - const client = message.client; + throw 'No Command with a valid Name granted as Second Parameter' + const client = message.client if (!client.cooldowns.has(command.name)) { //if its not in the cooldown, set it too there - client.cooldowns.set(command.name, new Collection()); + client.cooldowns.set(command.name, new Collection()) } - const now = Date.now(); //get the current time - const timestamps = client.cooldowns.get(command.name); //get the timestamp of the last used commands + const now = Date.now() //get the current time + const timestamps = client.cooldowns.get(command.name) //get the timestamp of the last used commands const cooldownAmount = - (command.cooldown || settings.default_cooldown_in_sec) * 1000; //get the cooldownamount of the command, if there is no cooldown there will be automatically 1 sec cooldown, so you cannot spam it^^ + (command.cooldown || settings.default_cooldown_in_sec) * 1000 //get the cooldownamount of the command, if there is no cooldown there will be automatically 1 sec cooldown, so you cannot spam it^^ if (timestamps.has(message.member.id)) { //if the user is on cooldown - const expirationTime = timestamps.get(message.member.id) + cooldownAmount; //get the amount of time he needs to wait until he can run the cmd again + const expirationTime = timestamps.get(message.member.id) + cooldownAmount //get the amount of time he needs to wait until he can run the cmd again if (now < expirationTime) { //if he is still on cooldonw - const timeLeft = (expirationTime - now) / 1000; //get the lefttime + const timeLeft = (expirationTime - now) / 1000 //get the lefttime //return true - return timeLeft; + return timeLeft } else { //if he is not on cooldown, set it to the cooldown - timestamps.set(message.member.id, now); + timestamps.set(message.member.id, now) //set a timeout function with the cooldown, so it gets deleted later on again - setTimeout(() => timestamps.delete(message.member.id), cooldownAmount); + setTimeout(() => timestamps.delete(message.member.id), cooldownAmount) //return false aka not on cooldown - return false; + return false } } else { //if he is not on cooldown, set it to the cooldown - timestamps.set(message.member.id, now); + timestamps.set(message.member.id, now) //set a timeout function with the cooldown, so it gets deleted later on again - setTimeout(() => timestamps.delete(message.member.id), cooldownAmount); + setTimeout(() => timestamps.delete(message.member.id), cooldownAmount) //return false aka not on cooldown - return false; + return false } } @@ -165,8 +167,8 @@ function onCoolDown(message, command) { * @returns Object of Formatted Time in Days to nanoseconds */ function parseMilliseconds(milliseconds) { - if (typeof milliseconds !== "number") { - throw new TypeError("Expected a number"); + if (typeof milliseconds !== 'number') { + throw new TypeError('Expected a number') } return { @@ -177,7 +179,7 @@ function parseMilliseconds(milliseconds) { milliseconds: Math.trunc(milliseconds) % 1000, microseconds: Math.trunc(milliseconds * 1000) % 1000, nanoseconds: Math.trunc(milliseconds * 1e6) % 1000, - }; + } } /** @@ -186,18 +188,18 @@ function parseMilliseconds(milliseconds) { * @returns BOOLEAN/THE URL */ function isValidURL(string) { - const args = string.split(" "); - let url; + const args = string.split(' ') + let url for (const arg of args) { try { - url = new URL(arg); - url = url.protocol === "http:" || url.protocol === "https:"; - break; + url = new URL(arg) + url = url.protocol === 'http:' || url.protocol === 'https:' + break } catch (_) { - url = false; + url = false } } - return url; + return url } /** @@ -207,53 +209,53 @@ function isValidURL(string) { * @returns BOOLEAN/DISCORDUSER */ function GetUser(message, arg) { - var errormessage = ":x: I failed finding that User..."; + var errormessage = ':x: I failed finding that User...' return new Promise(async (resolve, reject) => { var args = arg, - client = message.client; - if (!client || !message) return reject("CLIENT IS NOT DEFINED"); + client = message.client + if (!client || !message) return reject('CLIENT IS NOT DEFINED') if (!args || args == null || args == undefined) - args = message.content.trim().split(/ +/).slice(1); - let user = message.mentions.users.first(); + args = message.content.trim().split(/ +/).slice(1) + let user = message.mentions.users.first() if (!user && args[0] && args[0].length == 18) { - user = await client.users.fetch(args[0]); - if (!user) return reject(errormessage); - return resolve(user); + user = await client.users.fetch(args[0]) + if (!user) return reject(errormessage) + return resolve(user) } else if (!user && args[0]) { let alluser = message.guild.members.cache.map((member) => - String(member.user.tag).toLowerCase() - ); + String(member.user.tag).toLowerCase(), + ) user = alluser.find((user) => - user.startsWith(args.join(" ").toLowerCase()) - ); + user.startsWith(args.join(' ').toLowerCase()), + ) user = message.guild.members.cache.find( - (me) => String(me.user.tag).toLowerCase() == user - ); + (me) => String(me.user.tag).toLowerCase() == user, + ) if (!user || user == null || !user.id) { alluser = message.guild.members.cache.map((member) => String( - member.displayName + "#" + member.user.discriminator - ).toLowerCase() - ); + member.displayName + '#' + member.user.discriminator, + ).toLowerCase(), + ) user = alluser.find((user) => - user.startsWith(args.join(" ").toLowerCase()) - ); + user.startsWith(args.join(' ').toLowerCase()), + ) user = message.guild.members.cache.find( (me) => String( - me.displayName + "#" + me.user.discriminator - ).toLowerCase() == user - ); - if (!user || user == null || !user.id) return reject(errormessage); + me.displayName + '#' + me.user.discriminator, + ).toLowerCase() == user, + ) + if (!user || user == null || !user.id) return reject(errormessage) } - user = await client.users.fetch(user.user.id); - if (!user) return reject(errormessage); - return resolve(user); + user = await client.users.fetch(user.user.id) + if (!user) return reject(errormessage) + return resolve(user) } else { - user = message.mentions.users.first() || message.author; - return resolve(user); + user = message.mentions.users.first() || message.author + return resolve(user) } - }); + }) } /** @@ -263,40 +265,40 @@ function GetUser(message, arg) { * @returns BOOLEAN/GUILDROLE */ function GetRole(message, arg) { - var errormessage = ":x: I failed finding that Role..."; + var errormessage = ':x: I failed finding that Role...' return new Promise(async (resolve, reject) => { var args = arg, - client = message.client; - if (!client || !message) return reject("CLIENT IS NOT DEFINED"); + client = message.client + if (!client || !message) return reject('CLIENT IS NOT DEFINED') if (!args || args == null || args == undefined) - args = message.content.trim().split(/ +/).slice(1); + args = message.content.trim().split(/ +/).slice(1) let user = message.mentions.roles .filter((role) => role.guild.id == message.guild.id) - .first(); + .first() if (!user && args[0] && args[0].length == 18) { - user = message.guild.roles.cache.get(args[0]); - if (!user) return reject(errormessage); - return resolve(user); + user = message.guild.roles.cache.get(args[0]) + if (!user) return reject(errormessage) + return resolve(user) } else if (!user && args[0]) { let alluser = message.guild.roles.cache.map((role) => - String(role.name).toLowerCase() - ); + String(role.name).toLowerCase(), + ) user = alluser.find((r) => - r.split(" ").join("").includes(args.join("").toLowerCase()) - ); + r.split(' ').join('').includes(args.join('').toLowerCase()), + ) user = message.guild.roles.cache.find( - (role) => String(role.name).toLowerCase() === user - ); - if (!user) return reject(errormessage); - return resolve(user); + (role) => String(role.name).toLowerCase() === user, + ) + if (!user) return reject(errormessage) + return resolve(user) } else { user = message.mentions.roles .filter((role) => role.guild.id == message.guild.id) - .first(); - if (!user) return reject(errormessage); - return resolve(user); + .first() + if (!user) return reject(errormessage) + return resolve(user) } - }); + }) } /** @@ -306,53 +308,53 @@ function GetRole(message, arg) { * @returns BOOLEAN/DISCORDUSER */ function GetGlobalUser(message, arg) { - var errormessage = ":x: I failed finding that User..."; + var errormessage = ':x: I failed finding that User...' return new Promise(async (resolve, reject) => { var args = arg, - client = message.client; - if (!client || !message) return reject("CLIENT IS NOT DEFINED"); + client = message.client + if (!client || !message) return reject('CLIENT IS NOT DEFINED') if (!args || args == null || args == undefined) - args = message.content.trim().split(/ +/).slice(1); - let user = message.mentions.users.first(); + args = message.content.trim().split(/ +/).slice(1) + let user = message.mentions.users.first() if (!user && args[0] && args[0].length == 18) { - user = await client.users.fetch(args[0]); - if (!user) return reject(errormessage); - return resolve(user); + user = await client.users.fetch(args[0]) + if (!user) return reject(errormessage) + return resolve(user) } else if (!user && args[0]) { let alluser = [], - allmembers = []; - var guilds = Array.from(client.guilds.cache.values()); + allmembers = [] + var guilds = Array.from(client.guilds.cache.values()) for (const g of guilds) { - var members = Array.from(g.members.cache.values()); + var members = Array.from(g.members.cache.values()) for (const m of members) { - alluser.push(m.user.tag); - allmembers.push(m); + alluser.push(m.user.tag) + allmembers.push(m) } } user = alluser.find((user) => - user.startsWith(args.join(" ").toLowerCase()) - ); - user = allmembers.find((me) => String(me.user.tag).toLowerCase() == user); + user.startsWith(args.join(' ').toLowerCase()), + ) + user = allmembers.find((me) => String(me.user.tag).toLowerCase() == user) if (!user || user == null || !user.id) { user = alluser.find((user) => - user.startsWith(args.join(" ").toLowerCase()) - ); + user.startsWith(args.join(' ').toLowerCase()), + ) user = allmembers.find( (me) => String( - me.displayName + "#" + me.user.discriminator - ).toLowerCase() == user - ); - if (!user || user == null || !user.id) return reject(errormessage); + me.displayName + '#' + me.user.discriminator, + ).toLowerCase() == user, + ) + if (!user || user == null || !user.id) return reject(errormessage) } - user = await client.users.fetch(user.user.id); - if (!user) return reject(errormessage); - return resolve(user); + user = await client.users.fetch(user.user.id) + if (!user) return reject(errormessage) + return resolve(user) } else { - user = message.mentions.users.first() || message.author; - return resolve(user); + user = message.mentions.users.first() || message.author + return resolve(user) } - }); + }) } /** @@ -362,16 +364,16 @@ function GetGlobalUser(message, arg) { */ function shuffle(array) { try { - var j, x, i; + var j, x, i for (i = array.length - 1; i > 0; i--) { - j = Math.floor(Math.random() * (i + 1)); - x = array[i]; - array[i] = array[j]; - array[j] = x; + j = Math.floor(Math.random() * (i + 1)) + x = array[i] + array[i] = array[j] + array[j] = x } - return array; + return array } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } } @@ -382,10 +384,10 @@ function shuffle(array) { */ function formatDate(date) { try { - return new Intl.DateTimeFormat("en-US").format(date); + return new Intl.DateTimeFormat('en-US').format(date) } catch (e) { - console.log(String(e.stack)); - return false; + console.log(String(e.stack)) + return false } } @@ -395,20 +397,20 @@ function formatDate(date) { * @returns Object of Formatted Time in Days to milliseconds */ function parseDuration(duration) { - let remain = duration; - let days = Math.floor(remain / (1000 * 60 * 60 * 24)); - remain = remain % (1000 * 60 * 60 * 24); + let remain = duration + let days = Math.floor(remain / (1000 * 60 * 60 * 24)) + remain = remain % (1000 * 60 * 60 * 24) - let hours = Math.floor(remain / (1000 * 60 * 60)); - remain = remain % (1000 * 60 * 60); + let hours = Math.floor(remain / (1000 * 60 * 60)) + remain = remain % (1000 * 60 * 60) - let minutes = Math.floor(remain / (1000 * 60)); - remain = remain % (1000 * 60); + let minutes = Math.floor(remain / (1000 * 60)) + remain = remain % (1000 * 60) - let seconds = Math.floor(remain / 1000); - remain = remain % 1000; + let seconds = Math.floor(remain / 1000) + remain = remain % 1000 - let milliseconds = remain; + let milliseconds = remain return { days, @@ -416,7 +418,7 @@ function parseDuration(duration) { minutes, seconds, milliseconds, - }; + } } /** @@ -426,43 +428,43 @@ function parseDuration(duration) { * @returns Formatted Time */ function formatTime(o, useMilli = false) { - let parts = []; + let parts = [] if (o.days) { - let ret = o.days + " Day"; + let ret = o.days + ' Day' if (o.days !== 1) { - ret += "s"; + ret += 's' } - parts.push(ret); + parts.push(ret) } if (o.hours) { - let ret = o.hours + " Hr"; + let ret = o.hours + ' Hr' if (o.hours !== 1) { - ret += "s"; + ret += 's' } - parts.push(ret); + parts.push(ret) } if (o.minutes) { - let ret = o.minutes + " Min"; + let ret = o.minutes + ' Min' if (o.minutes !== 1) { - ret += "s"; + ret += 's' } - parts.push(ret); + parts.push(ret) } if (o.seconds) { - let ret = o.seconds + " Sec"; + let ret = o.seconds + ' Sec' if (o.seconds !== 1) { - ret += "s"; + ret += 's' } - parts.push(ret); + parts.push(ret) } if (useMilli && o.milliseconds) { - let ret = o.milliseconds + " ms"; - parts.push(ret); + let ret = o.milliseconds + ' ms' + parts.push(ret) } if (parts.length === 0) { - return "instantly"; + return 'instantly' } else { - return parts; + return parts } } @@ -473,8 +475,8 @@ function formatTime(o, useMilli = false) { * @returns Formatted Time */ function duration(duration, useMilli = false) { - let time = parseDuration(duration); - return formatTime(time, useMilli); + let time = parseDuration(duration) + return formatTime(time, useMilli) } /** @@ -486,11 +488,11 @@ function delay(delayInms) { try { return new Promise((resolve) => { setTimeout(() => { - resolve(2); - }, delayInms); - }); + resolve(2) + }, delayInms) + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } } @@ -501,9 +503,9 @@ function delay(delayInms) { */ function getRandomInt(max) { try { - return Math.floor(Math.random() * Math.floor(max)); + return Math.floor(Math.random() * Math.floor(max)) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } } @@ -515,9 +517,9 @@ function getRandomInt(max) { */ function getRandomNum(min, max) { try { - return Math.floor(Math.random() * Math.floor(max - min + min)); + return Math.floor(Math.random() * Math.floor(max - min + min)) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } } @@ -530,10 +532,10 @@ function getRandomNum(min, max) { * @param {*} slider EMOJI | the default slider is: "🔷" * @returns STRING a BAR [▬▬▬▬▬🔷▬▬▬▬▬▬▬▬] */ -function createBar(total, current, size = 25, line = "▬", slider = "🔷") { +function createBar(total, current, size = 25, line = '▬', slider = '🔷') { try { - if (!total) throw "MISSING MAX TIME"; - if (!current) return `**[${mover}${line.repeat(size - 1)}]**`; + if (!total) throw 'MISSING MAX TIME' + if (!current) return `**[${mover}${line.repeat(size - 1)}]**` let bar = current > total ? [line.repeat((size / 2) * 2), (current / total) * 100] @@ -543,14 +545,14 @@ function createBar(total, current, size = 25, line = "▬", slider = "🔷") { .replace(/.$/, slider) + line.repeat(size - Math.round(size * (current / total)) + 1), current / total, - ]; + ] if (!String(bar).includes(mover)) { - return `**[${mover}${line.repeat(size - 1)}]**`; + return `**[${mover}${line.repeat(size - 1)}]**` } else { - return `**[${bar[0]}]**`; + return `**[${bar[0]}]**` } } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } } @@ -563,34 +565,34 @@ function format(millis) { try { var h = Math.floor(millis / 3600000), m = Math.floor(millis / 60000), - s = ((millis % 60000) / 1000).toFixed(0); + s = ((millis % 60000) / 1000).toFixed(0) if (h < 1) return ( - (m < 10 ? "0" : "") + + (m < 10 ? '0' : '') + m + - ":" + - (s < 10 ? "0" : "") + + ':' + + (s < 10 ? '0' : '') + s + - " | " + + ' | ' + Math.floor(millis / 1000) + - " Seconds" - ); + ' Seconds' + ) else return ( - (h < 10 ? "0" : "") + + (h < 10 ? '0' : '') + h + - ":" + - (m < 10 ? "0" : "") + + ':' + + (m < 10 ? '0' : '') + m + - ":" + - (s < 10 ? "0" : "") + + ':' + + (s < 10 ? '0' : '') + s + - " | " + + ' | ' + Math.floor(millis / 1000) + - " Seconds" - ); + ' Seconds' + ) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } } @@ -601,9 +603,9 @@ function format(millis) { */ function escapeRegex(str) { try { - return str.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`); + return str.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } } @@ -616,16 +618,16 @@ function escapeRegex(str) { */ function arrayMove(array, from, to) { try { - array = [...array]; - const startIndex = from < 0 ? array.length + from : from; + array = [...array] + const startIndex = from < 0 ? array.length + from : from if (startIndex >= 0 && startIndex < array.length) { - const endIndex = to < 0 ? array.length + to : to; - const [item] = array.splice(from, 1); - array.splice(endIndex, 0, item); + const endIndex = to < 0 ? array.length + to : to + const [item] = array.splice(from, 1) + array.splice(endIndex, 0, item) } - return array; + return array } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } } @@ -637,24 +639,24 @@ function arrayMove(array, from, to) { */ function nFormatter(num, digits = 2) { const lookup = [ - { value: 1, symbol: "" }, - { value: 1e3, symbol: "k" }, - { value: 1e6, symbol: "M" }, - { value: 1e9, symbol: "G" }, - { value: 1e12, symbol: "T" }, - { value: 1e15, symbol: "P" }, - { value: 1e18, symbol: "E" }, - ]; - const rx = /\.0+$|(\.[0-9]*[1-9])0+$/; + { value: 1, symbol: '' }, + { value: 1e3, symbol: 'k' }, + { value: 1e6, symbol: 'M' }, + { value: 1e9, symbol: 'G' }, + { value: 1e12, symbol: 'T' }, + { value: 1e15, symbol: 'P' }, + { value: 1e18, symbol: 'E' }, + ] + const rx = /\.0+$|(\.[0-9]*[1-9])0+$/ var item = lookup .slice() .reverse() .find(function (item) { - return num >= item.value; - }); + return num >= item.value + }) return item - ? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol - : "0"; + ? (num / item.value).toFixed(digits).replace(rx, '$1') + item.symbol + : '0' } /** @@ -665,54 +667,54 @@ function nFormatter(num, digits = 2) { * @param {*} sliceamount If an Array is beeing used, it is the amount of items, per page, if a string then the amount of letters per page, Default Array: 15, Default String: 1000 | OPTIONAL * @returns VOID, works by itself */ -const { MessageButton, MessageActionRow } = require("discord.js"); +const { MessageButton, MessageActionRow } = require('discord.js') async function swap_pages(client, message, description, TITLE, sliceamount) { const data = mongoprefix.findOne({ GuildID: message.guild.id, - }); + }) const prefix = await mongoprefix .findOne({ GuildID: message.guild.id, }) .then((res) => { - if (res) return res.Prefix; - else return process.env.PREFIX; - }); - let cmduser = message.author; + if (res) return res.Prefix + else return process.env.PREFIX + }) + let cmduser = message.author - let currentPage = 0; + let currentPage = 0 //GET ALL EMBEDS - let embeds = []; + let embeds = [] //if input is an array if (Array.isArray(description)) { try { - let k = 20; + let k = 20 for (let i = 0; i < description.length; i += 20) { - const current = description.slice(i, k); - k += 20; + const current = description.slice(i, k) + k += 20 const embed = new MessageEmbed() .setDescription(current) .setTitle(TITLE) .setColor(ee.color) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - embeds.push(embed); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + embeds.push(embed) } - embeds; + embeds } catch {} } else { try { - let k = sliceamount || 1000; + let k = sliceamount || 1000 for (let i = 0; i < description.length; i += 1000) { - const current = description.slice(i, k); - k += 1000; + const current = description.slice(i, k) + k += 1000 const embed = new MessageEmbed() .setDescription(current) .setTitle(TITLE) .setColor(ee.color) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - embeds.push(embed); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + embeds.push(embed) } - embeds; + embeds } catch {} } if (embeds.length === 0) @@ -721,46 +723,46 @@ async function swap_pages(client, message, description, TITLE, sliceamount) { embeds: [ new MessageEmbed() .setTitle( - `${emoji.msg.ERROR} No Content added to the SWAP PAGES Function` + `${emoji.msg.ERROR} No Content added to the SWAP PAGES Function`, ) .setColor(ee.wrongcolor) .setFooter({ text: ee.footertext, iconURL: ee.footericon }), ], }) - .catch((e) => console.log("THIS IS TO PREVENT A CRASH")); + .catch((e) => console.log('THIS IS TO PREVENT A CRASH')) if (embeds.length === 1) return message.channel .send({ embeds: [embeds[0]] }) - .catch((e) => console.log("THIS IS TO PREVENT A CRASH")); + .catch((e) => console.log('THIS IS TO PREVENT A CRASH')) let button_back = new MessageButton() - .setStyle("SUCCESS") - .setCustomId("1") - .setEmoji("833802907509719130") - .setLabel("Back"); + .setStyle('SUCCESS') + .setCustomId('1') + .setEmoji('833802907509719130') + .setLabel('Back') let button_home = new MessageButton() - .setStyle("DANGER") - .setCustomId("2") - .setEmoji("🏠") - .setLabel("Home"); + .setStyle('DANGER') + .setCustomId('2') + .setEmoji('🏠') + .setLabel('Home') let button_forward = new MessageButton() - .setStyle("SUCCESS") - .setCustomId("3") - .setEmoji("832598861813776394") - .setLabel("Forward"); + .setStyle('SUCCESS') + .setCustomId('3') + .setEmoji('832598861813776394') + .setLabel('Forward') const allbuttons = [ new MessageActionRow().addComponents([ button_back, button_home, button_forward, ]), - ]; + ] //Send message with buttons let swapmsg = await message.channel.send({ content: `**Click on the __Buttons__ to swap the Pages**`, embeds: [embeds[0]], components: allbuttons, - }); + }) //create a collector for the thinggy const collector = swapmsg.createMessageComponentCollector({ filter: (i) => @@ -769,100 +771,100 @@ async function swap_pages(client, message, description, TITLE, sliceamount) { i.user.id == cmduser.id && i.message.author.id == client.user.id, time: 180e3, - }); //collector for 5 seconds + }) //collector for 5 seconds //array of all embeds, here simplified just 10 embeds with numbers 0 - 9 - collector.on("collect", async (b) => { + collector.on('collect', async (b) => { if (b.user.id !== message.author.id) return b.reply( `<:no:833101993668771842> **Only the one who typed ${prefix}help is allowed to react!**`, - true - ); + true, + ) //page forward - if (b.customId == "1") { + if (b.customId == '1') { //b.reply("***Swapping a PAGE FORWARD***, *please wait 2 Seconds for the next Input*", true) if (currentPage !== 0) { - currentPage -= 1; + currentPage -= 1 await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } else { - currentPage = embeds.length - 1; + currentPage = embeds.length - 1 await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } } //go home - else if (b.customId == "2") { + else if (b.customId == '2') { //b.reply("***Going Back home***, *please wait 2 Seconds for the next Input*", true) - currentPage = 0; + currentPage = 0 await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } //go forward - else if (b.customId == "3") { + else if (b.customId == '3') { //b.reply("***Swapping a PAGE BACK***, *please wait 2 Seconds for the next Input*", true) if (currentPage < embeds.length - 1) { - currentPage++; + currentPage++ await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } else { - currentPage = 0; + currentPage = 0 await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } } - }); + }) } async function swap_pages2(client, message, embeds) { - let currentPage = 0; - let cmduser = message.author; + let currentPage = 0 + let cmduser = message.author if (embeds.length === 1) return message.channel .send({ embeds: [embeds[0]] }) - .catch((e) => console.log("THIS IS TO PREVENT A CRASH")); + .catch((e) => console.log('THIS IS TO PREVENT A CRASH')) let button_back = new MessageButton() - .setStyle("SUCCESS") - .setCustomId("1") - .setEmoji("833802907509719130") - .setLabel("Back"); + .setStyle('SUCCESS') + .setCustomId('1') + .setEmoji('833802907509719130') + .setLabel('Back') let button_home = new MessageButton() - .setStyle("DANGER") - .setCustomId("2") - .setEmoji("🏠") - .setLabel("Home"); + .setStyle('DANGER') + .setCustomId('2') + .setEmoji('🏠') + .setLabel('Home') let button_forward = new MessageButton() - .setStyle("SUCCESS") - .setCustomId("3") - .setEmoji("832598861813776394") - .setLabel("Forward"); + .setStyle('SUCCESS') + .setCustomId('3') + .setEmoji('832598861813776394') + .setLabel('Forward') const allbuttons = [ new MessageActionRow().addComponents([ button_back, button_home, button_forward, ]), - ]; - let prefix = client.settings.get(message.guild.id, "prefix"); + ] + let prefix = client.settings.get(message.guild.id, 'prefix') //Send message with buttons let swapmsg = await message.channel.send({ content: `**Click on the __Buttons__ to swap the Pages**`, embeds: [embeds[0]], components: allbuttons, - }); + }) //create a collector for the thinggy const collector = swapmsg.createMessageComponentCollector({ filter: (i) => @@ -871,63 +873,63 @@ async function swap_pages2(client, message, embeds) { i.user.id == cmduser.id && i.message.author.id == client.user.id, time: 180e3, - }); //collector for 5 seconds + }) //collector for 5 seconds //array of all embeds, here simplified just 10 embeds with numbers 0 - 9 - collector.on("collect", async (b) => { + collector.on('collect', async (b) => { if (b.user.id !== message.author.id) return b.reply( `<:no:833101993668771842> **Only the one who typed ${prefix}help is allowed to react!**`, - true - ); + true, + ) //page forward - if (b.customId == "1") { + if (b.customId == '1') { //b.reply("***Swapping a PAGE FORWARD***, *please wait 2 Seconds for the next Input*", true) if (currentPage !== 0) { - currentPage -= 1; + currentPage -= 1 await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } else { - currentPage = embeds.length - 1; + currentPage = embeds.length - 1 await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } } //go home - else if (b.customId == "2") { + else if (b.customId == '2') { //b.reply("***Going Back home***, *please wait 2 Seconds for the next Input*", true) - currentPage = 0; + currentPage = 0 await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } //go forward - else if (b.customId == "3") { + else if (b.customId == '3') { //b.reply("***Swapping a PAGE BACK***, *please wait 2 Seconds for the next Input*", true) if (currentPage < embeds.length - 1) { - currentPage++; + currentPage++ await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } else { - currentPage = 0; + currentPage = 0 await swapmsg.edit({ embeds: [embeds[currentPage]], components: allbuttons, - }); - await b.deferUpdate(); + }) + await b.deferUpdate() } } - }); + }) } /** @@ -940,10 +942,10 @@ function change_status(client, message) { client.user.setActivity( `to ${process.env.PREFIX}help | ${client.guilds.cache.size} Guilds`, { - type: "LISTENING", - } - ); + type: 'LISTENING', + }, + ) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } } diff --git a/handlers/slashCommands.js b/handlers/slashCommands.js index 7505bf5..4500266 100644 --- a/handlers/slashCommands.js +++ b/handlers/slashCommands.js @@ -1,33 +1,33 @@ -const { readdirSync, lstatSync } = require("fs"); -const { SlashCommandBuilder } = require("@discordjs/builders"); -const config = require("../botconfig/config.json"); -const dirSetup = config.slashCommandsDirs; +const { readdirSync, lstatSync } = require('fs') +const { SlashCommandBuilder } = require('@discordjs/builders') +const config = require('../botconfig/config.json') +const dirSetup = config.slashCommandsDirs module.exports = (client) => { try { - let allCommands = []; - readdirSync("./slashCommands/").forEach((dir) => { + let allCommands = [] + readdirSync('./slashCommands/').forEach((dir) => { if (lstatSync(`./slashCommands/${dir}`).isDirectory()) { - const groupName = dir; - const cmdSetup = dirSetup.find((d) => d.Folder == dir); + const groupName = dir + const cmdSetup = dirSetup.find((d) => d.Folder == dir) //If its a valid cmdsetup if (cmdSetup && cmdSetup.Folder) { //Set the SubCommand as a Slash Builder const subCommand = new SlashCommandBuilder() .setName( - String(cmdSetup.CmdName).replace(/\s+/g, "_").toLowerCase() + String(cmdSetup.CmdName).replace(/\s+/g, '_').toLowerCase(), ) - .setDescription(String(cmdSetup.CmdDescription)); + .setDescription(String(cmdSetup.CmdDescription)) //Now for each file in that subcommand, add a command! const slashCommands = readdirSync(`./slashCommands/${dir}/`).filter( - (file) => file.endsWith(".js") - ); + (file) => file.endsWith('.js'), + ) for (let file of slashCommands) { - let pull = require(`../slashCommands/${dir}/${file}`); + let pull = require(`../slashCommands/${dir}/${file}`) if (pull.name && pull.description) { subCommand.addSubcommand((subcommand) => { subcommand .setName(String(pull.name).toLowerCase()) - .setDescription(pull.description); + .setDescription(pull.description) if (pull.options && pull.options.length > 0) { for (const option of pull.options) { if ( @@ -39,12 +39,12 @@ module.exports = (client) => { op .setName( String(option.User.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.User.description) - .setRequired(option.User.required) - ); + .setRequired(option.User.required), + ) } else if ( option.Integer && option.Integer.name && @@ -54,12 +54,12 @@ module.exports = (client) => { op .setName( String(option.Integer.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.Integer.description) - .setRequired(option.Integer.required) - ); + .setRequired(option.Integer.required), + ) } else if ( option.String && option.String.name && @@ -69,12 +69,12 @@ module.exports = (client) => { op .setName( String(option.String.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.String.description) - .setRequired(option.String.required) - ); + .setRequired(option.String.required), + ) } else if ( option.Channel && option.Channel.name && @@ -84,12 +84,12 @@ module.exports = (client) => { op .setName( String(option.Channel.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.Channel.description) - .setRequired(option.Channel.required) - ); + .setRequired(option.Channel.required), + ) } else if ( option.Role && option.Role.name && @@ -99,12 +99,12 @@ module.exports = (client) => { op .setName( String(option.Role.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.Role.description) - .setRequired(option.Role.required) - ); + .setRequired(option.Role.required), + ) } else if ( option.StringChoices && option.StringChoices.name && @@ -116,18 +116,18 @@ module.exports = (client) => { op .setName( String(option.StringChoices.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.StringChoices.description) .setRequired(option.StringChoices.required) .addChoices( option.StringChoices.choices.map((c) => [ - String(c[0]).replace(/\s+/g, "_").toLowerCase(), + String(c[0]).replace(/\s+/g, '_').toLowerCase(), String(c[1]), - ]) - ) - ); + ]), + ), + ) } else if ( option.IntChoices && option.IntChoices.name && @@ -139,52 +139,52 @@ module.exports = (client) => { op .setName( String(option.IntChoices.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.IntChoices.description) .setRequired(option.IntChoices.required) .addChoices( option.IntChoices.choices.map((c) => [ - String(c[0]).replace(/\s+/g, "_").toLowerCase(), + String(c[0]).replace(/\s+/g, '_').toLowerCase(), parseInt(c[1]), - ]) - ) - ); + ]), + ), + ) } else { console.log( - `A Option is missing the Name or/and the Description of ${pull.name}` - ); + `A Option is missing the Name or/and the Description of ${pull.name}`, + ) } } } - return subcommand; - }); + return subcommand + }) client.slashCommands.set( - String(cmdSetup.CmdName).replace(/\s+/g, "_").toLowerCase() + + String(cmdSetup.CmdName).replace(/\s+/g, '_').toLowerCase() + pull.name, - pull - ); + pull, + ) } else { console.log( file, - `error -> missing a help.name, or help.name is not a string.` - ); + `error -> missing a help.name, or help.name is not a string.`, + ) } } //add the subcommand to the array - allCommands.push(subCommand.toJSON()); + allCommands.push(subCommand.toJSON()) } else { return console.log( - `The Subcommand-Folder ${dir} is not in the dirSetup Configuration!` - ); + `The Subcommand-Folder ${dir} is not in the dirSetup Configuration!`, + ) } } else { - let pull = require(`../slashCommands/${dir}`); + let pull = require(`../slashCommands/${dir}`) if (pull.name && pull.description) { let Command = new SlashCommandBuilder() .setName(String(pull.name).toLowerCase()) - .setDescription(pull.description); + .setDescription(pull.description) if (pull.options && pull.options.length > 0) { for (const option of pull.options) { if (option.User && option.User.name && option.User.description) { @@ -192,12 +192,12 @@ module.exports = (client) => { op .setName( String(option.User.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.User.description) - .setRequired(option.User.required) - ); + .setRequired(option.User.required), + ) } else if ( option.Integer && option.Integer.name && @@ -207,12 +207,12 @@ module.exports = (client) => { op .setName( String(option.Integer.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.Integer.description) - .setRequired(option.Integer.required) - ); + .setRequired(option.Integer.required), + ) } else if ( option.String && option.String.name && @@ -222,12 +222,12 @@ module.exports = (client) => { op .setName( String(option.String.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.String.description) - .setRequired(option.String.required) - ); + .setRequired(option.String.required), + ) } else if ( option.Channel && option.Channel.name && @@ -237,12 +237,12 @@ module.exports = (client) => { op .setName( String(option.Channel.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.Channel.description) - .setRequired(option.Channel.required) - ); + .setRequired(option.Channel.required), + ) } else if ( option.Role && option.Role.name && @@ -252,12 +252,12 @@ module.exports = (client) => { op .setName( String(option.Role.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.Role.description) - .setRequired(option.Role.required) - ); + .setRequired(option.Role.required), + ) } else if ( option.StringChoices && option.StringChoices.name && @@ -269,18 +269,18 @@ module.exports = (client) => { op .setName( String(option.StringChoices.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.StringChoices.description) .setRequired(option.StringChoices.required) .addChoices( option.StringChoices.choices.map((c) => [ - String(c[0]).replace(/\s+/g, "_").toLowerCase(), + String(c[0]).replace(/\s+/g, '_').toLowerCase(), String(c[1]), - ]) - ) - ); + ]), + ), + ) } else if ( option.IntChoices && option.IntChoices.name && @@ -292,38 +292,38 @@ module.exports = (client) => { op .setName( String(option.IntChoices.name) - .replace(/\s+/g, "_") - .toLowerCase() + .replace(/\s+/g, '_') + .toLowerCase(), ) .setDescription(option.IntChoices.description) .setRequired(option.IntChoices.required) .addChoices( option.IntChoices.choices.map((c) => [ - String(c[0]).replace(/\s+/g, "_").toLowerCase(), + String(c[0]).replace(/\s+/g, '_').toLowerCase(), parseInt(c[1]), - ]) - ) - ); + ]), + ), + ) } else { console.log( - `A Option is missing the Name or/and the Description of ${pull.name}` - ); + `A Option is missing the Name or/and the Description of ${pull.name}`, + ) } } } - allCommands.push(Command.toJSON()); - client.slashCommands.set("normal" + pull.name, pull); + allCommands.push(Command.toJSON()) + client.slashCommands.set('normal' + pull.name, pull) } else { console.log( file, - `error -> missing a help.name, or help.name is not a string.` - ); + `error -> missing a help.name, or help.name is not a string.`, + ) } } - }); + }) //Once the Bot is ready, add all Slas Commands to each guild - client.on("ready", () => { + client.on('ready', () => { if (config.loadSlashsGlobal) { client.application.commands .set(allCommands) @@ -331,13 +331,13 @@ module.exports = (client) => { console.log( `${slashCommandsData.size} slashCommands ${`(With ${ slashCommandsData.map((d) => d.options).flat().length - } Subcommands)`} Loaded for all: ${`All possible Guilds`}` - ); + } Subcommands)`} Loaded for all: ${`All possible Guilds`}`, + ) console.log( - `Because u are Using Global Settings, it can take up to 1 hour until the Commands are changed!` - ); + `Because u are Using Global Settings, it can take up to 1 hour until the Commands are changed!`, + ) }) - .catch((e) => console.log(e)); + .catch((e) => console.log(e)) } else { client.guilds.cache .map((g) => g) @@ -349,18 +349,18 @@ module.exports = (client) => { console.log( `${slashCommandsData.size} slashCommands ${`(With ${ slashCommandsData.map((d) => d.options).flat().length - } Subcommands)`} Loaded for: ${`${guild.name}`}` - ); + } Subcommands)`} Loaded for: ${`${guild.name}`}`, + ) }) - .catch((e) => console.log(e)); + .catch((e) => console.log(e)) } catch (e) { - console.log(String(e)); + console.log(String(e)) } - }); + }) } - }); + }) //DISABLE WHEN USING GLOBAL! - client.on("guildCreate", (guild) => { + client.on('guildCreate', (guild) => { try { if (!config.loadSlashsGlobal) { guild.commands @@ -369,16 +369,16 @@ module.exports = (client) => { console.log( `${slashCommandsData.size} slashCommands ${`(With ${ slashCommandsData.map((d) => d.options).flat().length - } Subcommands)`} Loaded for: ${`${guild.name}`}` - ); + } Subcommands)`} Loaded for: ${`${guild.name}`}`, + ) }) - .catch((e) => console.log(e)); + .catch((e) => console.log(e)) } } catch (e) { - console.log(String(e)); + console.log(String(e)) } - }); + }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } -}; +} diff --git a/index.js b/index.js index 26dfe3f..4d3dd73 100644 --- a/index.js +++ b/index.js @@ -1,29 +1,29 @@ -const Discord = require("discord.js"); -const settings = require(`./botconfig/settings.json`); -const { DiscordTogether } = require("discord-together"); -const { NekoBot } = require("nekobot-api"); -const mongoose = require("mongoose"); -const axios = require("axios"); -const fs = require("fs"); -if (fs.existsSync(".env")) { - require("dotenv").config(); +const Discord = require('discord.js') +const settings = require(`./botconfig/settings.json`) +const { DiscordTogether } = require('discord-together') +const { NekoBot } = require('nekobot-api') +const mongoose = require('mongoose') +const axios = require('axios') +const fs = require('fs') +if (fs.existsSync('.env')) { + require('dotenv').config() } mongoose.connect(process.env.MONGO_URL, { useNewUrlParser: true, useUnifiedTopology: true, -}); +}) const client = new Discord.Client({ //fetchAllMembers: false, //restTimeOffset: 0, //restWsBridgetimeout: 100, - shards: "auto", + shards: 'auto', allowedMentions: { parse: [], repliedUser: false, }, - partials: ["MESSAGE", "CHANNEL", "REACTION"], + partials: ['MESSAGE', 'CHANNEL', 'REACTION'], intents: [ Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MEMBERS, @@ -44,38 +44,43 @@ const client = new Discord.Client({ presence: { activity: { name: `Music`, - type: "LISTENING", + type: 'LISTENING', }, - status: "online", + status: 'online', }, -}); +}) //Define some Global Collections -client.commands = new Discord.Collection(); -client.cooldowns = new Discord.Collection(); -client.slashCommands = new Discord.Collection(); -client.aliases = new Discord.Collection(); -client.discordTogether = new DiscordTogether(client); -client.nekobot = new NekoBot(); -client.snipes = {}; -client.categories = require("fs").readdirSync(`./commands`); +client.commands = new Discord.Collection() +client.cooldowns = new Discord.Collection() +client.slashCommands = new Discord.Collection() +client.aliases = new Discord.Collection() +client.discordTogether = new DiscordTogether(client) +client.nekobot = new NekoBot() +client.snipes = {} +client.categories = require('fs').readdirSync(`./commands`) //Require the Handlers Add the antiCrash file too, if its enabled -["events", "commands", "slashCommands", settings.antiCrash ? "antiCrash" : null] +;[ + 'events', + 'commands', + 'slashCommands', + settings.antiCrash ? 'antiCrash' : null, +] .filter(Boolean) .forEach((h) => { - require(`./handlers/${h}`)(client); - }); + require(`./handlers/${h}`)(client) + }) -client.login(process.env.BOT_TOKEN); -const express = require("express"); -const app = express(); -const port = process.env.PORT || 3000; +client.login(process.env.BOT_TOKEN) +const express = require('express') +const app = express() +const port = process.env.PORT || 3000 -app.get("/", (req, res) => { - res.send("CannyBot is Online!"); -}); +app.get('/', (req, res) => { + res.send('CannyBot is Online!') +}) app .listen(port, () => {}) - .on("error", (err) => { - console.log(err); - }); + .on('error', (err) => { + console.log(err) + }) diff --git a/models/prefix.js b/models/prefix.js index 6fc9665..b8c4502 100644 --- a/models/prefix.js +++ b/models/prefix.js @@ -1,13 +1,10 @@ -const mongoose = require("mongoose"); +const mongoose = require('mongoose') const PrefixSchema = new mongoose.Schema({ Prefix: { type: String, }, GuildID: String, -}); +}) -const MessageModel = (module.exports = mongoose.model( - "prefixes", - PrefixSchema -)); +const MessageModel = (module.exports = mongoose.model('prefixes', PrefixSchema)) diff --git a/slashCommands/ascii.js b/slashCommands/ascii.js index fc5b5fb..b53c7e8 100644 --- a/slashCommands/ascii.js +++ b/slashCommands/ascii.js @@ -1,8 +1,8 @@ -const axios = require("axios"); +const axios = require('axios') module.exports = { - name: "ascii", - description: "Convert text to ascii", //the command description for Slash Command Overview + name: 'ascii', + description: 'Convert text to ascii', //the command description for Slash Command Overview cooldown: [], memberpermissions: [], requiredroles: [], @@ -10,8 +10,8 @@ module.exports = { options: [ { String: { - name: "text", - description: "The text to convert.", + name: 'text', + description: 'The text to convert.', required: true, }, }, @@ -30,33 +30,33 @@ module.exports = { options, id, createdTimestamp, - } = interaction; - const text = interaction.options.getString("text"); + } = interaction + const text = interaction.options.getString('text') const encoded = text .replace(/[\u00A0-\u9999<>\&]/gim, function (i) { - return "&#" + i.charCodeAt(0) + ";"; + return '&#' + i.charCodeAt(0) + ';' }) - .replace(/\s/g, " "); + .replace(/\s/g, ' ') axios .get(`https://api.dhravya.me/ascii?font=standard&text=${encoded}`) .then((res) => { - json = res.data; - let textcontent = ""; + json = res.data + let textcontent = '' if (res.data.error) { return interaction.reply({ content: `An error occured!\n\`\`\`js\n${json.data.errorMessage}\`\`\``, ephemeral: true, - }); + }) } interaction.reply({ content: `${textcontent}\`\`\`${json.data.Ascii}\`\`\``, - }); - }); + }) + }) } catch (err) { return interaction.reply({ content: `An error occured!\n\`\`\`js\n${err}\`\`\``, ephemeral: true, - }); + }) } }, -}; +} diff --git a/slashCommands/ban.js b/slashCommands/ban.js index a2708a7..33e583a 100644 --- a/slashCommands/ban.js +++ b/slashCommands/ban.js @@ -1,35 +1,35 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../botconfig/embed.json') module.exports = { - name: "ban", - description: "Ban a user", //the command description for Slash Command Overview + name: 'ban', + description: 'Ban a user', //the command description for Slash Command Overview cooldown: [], - memberpermissions: ["KICK_MEMBERS"], + memberpermissions: ['KICK_MEMBERS'], requiredroles: [], alloweduserids: [], options: [ { User: { - name: "user", - description: "The user to ban", + name: 'user', + description: 'The user to ban', required: true, }, }, { StringChoices: { - name: "delete", - description: "Delete messages", + name: 'delete', + description: 'Delete messages', required: true, choices: [ - ["Don't Delete Messages", "0"], - ["Previous 7 Days", "7"], + ["Don't Delete Messages", '0'], + ['Previous 7 Days', '7'], ], }, }, { String: { - name: "reason", - description: "The reason for the ban", + name: 'reason', + description: 'The reason for the ban', required: false, }, }, @@ -48,20 +48,20 @@ module.exports = { options, id, createdTimestamp, - } = interaction; - const Target = interaction.options.getMember("user"); + } = interaction + const Target = interaction.options.getMember('user') if (Target.id === interaction.member.id) return interaction.reply({ content: ":x: You can't ban yourself!", ephemeral: true, - }); + }) - if (Target.permissions.has("ADMINISTRATOR")) + if (Target.permissions.has('ADMINISTRATOR')) return interaction.reply({ content: ":x: You can't ban an administrator!", ephemeral: true, - }); + }) if ( Target.roles.highest.position >= @@ -70,38 +70,38 @@ module.exports = { return interaction.followUp({ content: ":x: You can't ban someone with a higher role than you!", ephemeral: true, - }); + }) const Reason = - interaction.options.getString("reason") || "No reason given"; + interaction.options.getString('reason') || 'No reason given' if (Reason.length > 512) return interaction.reply({ content: ":x: The reason can't be longer than 512 characters!", ephemeral: true, - }); + }) - const Amount = interaction.options.getString("messages"); + const Amount = interaction.options.getString('messages') Target.send( - `You have been banned from ${interaction.guild.name} for: ${Reason}` + `You have been banned from ${interaction.guild.name} for: ${Reason}`, ).then(() => { - setTimeout(() => {}, 4000); - Target.ban({ reason: Reason, days: Amount }); - }); + setTimeout(() => {}, 4000) + Target.ban({ reason: Reason, days: Amount }) + }) const embed = new MessageEmbed() - .setColor("RANDOM") - .setTitle("Member banned successfully!") - .setImage("https://media1.giphy.com/media/hIgJpsDOgQQ2hsNpuT/giphy.gif") + .setColor('RANDOM') + .setTitle('Member banned successfully!') + .setImage('https://media1.giphy.com/media/hIgJpsDOgQQ2hsNpuT/giphy.gif') .setDescription( - `**${Target.user.username}** has been banned for - ${Reason}` + `**${Target.user.username}** has been banned for - ${Reason}`, ) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) - interaction.reply({ embeds: [embed] }); + interaction.reply({ embeds: [embed] }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } }, -}; +} diff --git a/slashCommands/embed.js b/slashCommands/embed.js index e95e039..4d50849 100644 --- a/slashCommands/embed.js +++ b/slashCommands/embed.js @@ -1,31 +1,31 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../botconfig/embed.json') module.exports = { - name: "embed", - description: "Generate an Embed", //the command description for Slash Command Overview + name: 'embed', + description: 'Generate an Embed', //the command description for Slash Command Overview cooldown: [], - memberpermissions: ["KICK_MEMBERS"], + memberpermissions: ['KICK_MEMBERS'], requiredroles: [], alloweduserids: [], options: [ { String: { - name: "title", - description: "The title of the embed", + name: 'title', + description: 'The title of the embed', required: true, }, }, { String: { - name: "description", - description: "The description of the embed", + name: 'description', + description: 'The description of the embed', required: true, }, }, { String: { - name: "imageurl", - description: "The image url of the embed", + name: 'imageurl', + description: 'The image url of the embed', required: false, }, }, @@ -43,34 +43,34 @@ module.exports = { options, id, createdTimestamp, - } = interaction; - const embed = new MessageEmbed(); - const title = options.getString("title"); - const description = options.getString("description"); - const imageurl = options.getString("imageurl"); + } = interaction + const embed = new MessageEmbed() + const title = options.getString('title') + const description = options.getString('description') + const imageurl = options.getString('imageurl') embed.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL(), - }); - embed.setTitle(title); - embed.setDescription(description); + }) + embed.setTitle(title) + embed.setDescription(description) - if (imageurl && !imageurl.startsWith("http")) { + if (imageurl && !imageurl.startsWith('http')) { return interaction.reply({ - content: "Image URL must start with http or https", + content: 'Image URL must start with http or https', ephemeral: true, - }); + }) } - imageurl ? embed.setImage(imageurl) : null; - embed.setColor(ee.color); + imageurl ? embed.setImage(imageurl) : null + embed.setColor(ee.color) embed.setFooter({ text: `${interaction.guild.name}`, iconURL: `${interaction.guild.iconURL()}`, - }); - interaction.channel.send({ embeds: [embed] }); + }) + interaction.channel.send({ embeds: [embed] }) interaction.reply({ - content: "Embed Sent! ✅", + content: 'Embed Sent! ✅', ephemeral: true, - }); + }) }, -}; +} diff --git a/slashCommands/kick.js b/slashCommands/kick.js index 42870cf..7246052 100644 --- a/slashCommands/kick.js +++ b/slashCommands/kick.js @@ -1,24 +1,24 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../botconfig/embed.json"); +const { MessageEmbed } = require('discord.js') +const ee = require('../botconfig/embed.json') module.exports = { - name: "kick", - description: "Kicks a user", + name: 'kick', + description: 'Kicks a user', cooldown: [], - memberpermissions: ["BAN_MEMBERS"], + memberpermissions: ['BAN_MEMBERS'], requiredroles: [], alloweduserids: [], options: [ { User: { - name: "user", - description: "The user to kick", + name: 'user', + description: 'The user to kick', required: true, }, }, { String: { - name: "reason", - description: "The reason for the ban", + name: 'reason', + description: 'The reason for the ban', required: false, }, }, @@ -37,20 +37,20 @@ module.exports = { options, id, createdTimestamp, - } = interaction; - const Target = interaction.options.getMember("user"); + } = interaction + const Target = interaction.options.getMember('user') if (Target.id === interaction.member.id) return interaction.reply({ content: ":x: You can't kick yourself!", ephemeral: true, - }); + }) - if (Target.permissions.has("ADMINISTRATOR")) + if (Target.permissions.has('ADMINISTRATOR')) return interaction.reply({ content: ":x: You can't kick an administrator!", ephemeral: true, - }); + }) if ( Target.roles.highest.position >= @@ -59,40 +59,40 @@ module.exports = { return interaction.followUp({ content: ":x: You can't kick someone with a higher role than you!", ephemeral: true, - }); + }) const Reason = - interaction.options.getString("reason") || "No reason given"; + interaction.options.getString('reason') || 'No reason given' if (Reason.length > 512) return interaction.reply({ content: ":x: The reason can't be longer than 512 characters!", ephemeral: true, - }); + }) - const Amount = interaction.options.getString("messages"); + const Amount = interaction.options.getString('messages') Target.send( - `You have been kicked from ${interaction.guild.name} for: ${Reason}` + `You have been kicked from ${interaction.guild.name} for: ${Reason}`, ).then(() => { - setTimeout(() => {}, 4000); - Target.kick(Reason); - }); + setTimeout(() => {}, 4000) + Target.kick(Reason) + }) const embed = new MessageEmbed() - .setColor("RANDOM") - .setTitle("Member kicked successfully!") + .setColor('RANDOM') + .setTitle('Member kicked successfully!') .setImage( - "https://c.tenor.com/esCHs7tm78UAAAAC/spongebob-squarepants-get-out.gif" + 'https://c.tenor.com/esCHs7tm78UAAAAC/spongebob-squarepants-get-out.gif', ) .setDescription( - `**${Target.user.username}** has been kick for - ${Reason}` + `**${Target.user.username}** has been kick for - ${Reason}`, ) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) - interaction.reply({ embeds: [embed] }); + interaction.reply({ embeds: [embed] }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } }, -}; +} diff --git a/slashCommands/ping.js b/slashCommands/ping.js index 8deb9fb..7d1917d 100644 --- a/slashCommands/ping.js +++ b/slashCommands/ping.js @@ -1,10 +1,10 @@ -const { MessageEmbed } = require("discord.js"); -const config = require("../botconfig/config.json"); -const ee = require("../botconfig/embed.json"); -const settings = require("../botconfig/settings.json"); +const { MessageEmbed } = require('discord.js') +const config = require('../botconfig/config.json') +const ee = require('../botconfig/embed.json') +const settings = require('../botconfig/settings.json') module.exports = { - name: "ping", - description: "Pings the bot", //the command description for Slash Command Overview + name: 'ping', + description: 'Pings the bot', //the command description for Slash Command Overview cooldown: [], memberpermissions: [], requiredroles: [], @@ -47,22 +47,22 @@ module.exports = { options, id, createdTimestamp, - } = interaction; - const { guild } = member; + } = interaction + const { guild } = member const pingEmbed = new MessageEmbed() - .setColor("RANDOM") - .setTitle("Hey! Why ping?") - .setThumbnail("https://i.gifer.com/8158.gif") + .setColor('RANDOM') + .setTitle('Hey! Why ping?') + .setThumbnail('https://i.gifer.com/8158.gif') .addFields({ - name: "Btw Pong!", + name: 'Btw Pong!', value: `\`${client.ws.ping}ms\``, inline: true, }) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) - interaction.reply({ embeds: [pingEmbed] }); + interaction.reply({ embeds: [pingEmbed] }) } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } }, -}; +} diff --git a/slashCommands/timeout.js b/slashCommands/timeout.js index b00c345..f899b72 100644 --- a/slashCommands/timeout.js +++ b/slashCommands/timeout.js @@ -1,32 +1,32 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../botconfig/embed.json"); -const ms = require("ms"); +const { MessageEmbed } = require('discord.js') +const ee = require('../botconfig/embed.json') +const ms = require('ms') module.exports = { - name: "timeout", - description: "Timeouts a user", + name: 'timeout', + description: 'Timeouts a user', cooldown: [], - memberpermissions: ["BAN_MEMBERS"], + memberpermissions: ['BAN_MEMBERS'], requiredroles: [], alloweduserids: [], options: [ { User: { - name: "user", - description: "The user to timeout", + name: 'user', + description: 'The user to timeout', required: true, }, }, { String: { - name: "time", - description: "The time to timeout the user for", + name: 'time', + description: 'The time to timeout the user for', required: true, }, }, { String: { - name: "reason", - description: "The reason for the ban", + name: 'reason', + description: 'The reason for the ban', required: false, }, }, @@ -43,55 +43,55 @@ module.exports = { options, id, createdTimestamp, - } = interaction; - const member = interaction.options.getMember("user"); - const giventime = ms(interaction.options.getString("time")); - let reason = interaction.options.getString("reason"); + } = interaction + const member = interaction.options.getMember('user') + const giventime = ms(interaction.options.getString('time')) + let reason = interaction.options.getString('reason') - if (!reason) reason = "No reason provided"; + if (!reason) reason = 'No reason provided' - const time = giventime; + const time = giventime - if (giventime > ms("1w") || giventime < ms("1s") || isNaN(time)) + if (giventime > ms('1w') || giventime < ms('1s') || isNaN(time)) return interaction.reply({ - content: "Please specify a valid time", + content: 'Please specify a valid time', ephemeral: true, - }); + }) const timeoutuser = await member.timeout(time, reason).catch((err) => { return interaction.reply({ content: `An error occured! \`\`\`js\n${err}\`\`\``, ephemeral: true, - }); - }); + }) + }) if (!timeoutuser) - return interaction.reply("I cannot timeout this user!", { + return interaction.reply('I cannot timeout this user!', { ephemeral: true, - }); + }) const embed = new MessageEmbed() - .setColor("RANDOM") - .setTitle("Member timed out successfully!") - .setImage("https://c.tenor.com/v8JBsczVfD4AAAAC/timeout.gif") + .setColor('RANDOM') + .setTitle('Member timed out successfully!') + .setImage('https://c.tenor.com/v8JBsczVfD4AAAAC/timeout.gif') .setDescription( `**${member.user.username}** has been timed out for ${msToTime( - time - )}!\nReason: ${reason}` + time, + )}!\nReason: ${reason}`, ) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) return interaction.reply({ embeds: [embed], - }); + }) }, -}; +} function msToTime(ms) { - let seconds = (ms / 1000).toFixed(1); - let minutes = (ms / (1000 * 60)).toFixed(1); - let hours = (ms / (1000 * 60 * 60)).toFixed(1); - let days = (ms / (1000 * 60 * 60 * 24)).toFixed(1); - if (seconds < 60) return seconds + " Sec"; - else if (minutes < 60) return minutes + " Min"; - else if (hours < 24) return hours + " Hrs"; - else return days + " Days"; + let seconds = (ms / 1000).toFixed(1) + let minutes = (ms / (1000 * 60)).toFixed(1) + let hours = (ms / (1000 * 60 * 60)).toFixed(1) + let days = (ms / (1000 * 60 * 60 * 24)).toFixed(1) + if (seconds < 60) return seconds + ' Sec' + else if (minutes < 60) return minutes + ' Min' + else if (hours < 24) return hours + ' Hrs' + else return days + ' Days' } diff --git a/slashCommands/translate.js b/slashCommands/translate.js index 3f9ec30..05de8d5 100644 --- a/slashCommands/translate.js +++ b/slashCommands/translate.js @@ -1,9 +1,9 @@ -const { MessageEmbed } = require("discord.js"); -const ee = require("../botconfig/embed.json"); -const translate = require("@vitalets/google-translate-api"); +const { MessageEmbed } = require('discord.js') +const ee = require('../botconfig/embed.json') +const translate = require('@vitalets/google-translate-api') module.exports = { - name: "translate", - description: "Translate text to specified language", //the command description for Slash Command Overview + name: 'translate', + description: 'Translate text to specified language', //the command description for Slash Command Overview cooldown: [], memberpermissions: [], requiredroles: [], @@ -11,16 +11,16 @@ module.exports = { options: [ { String: { - name: "lang", + name: 'lang', description: - "The language code to translate to. For example: en, es, fr, etc.", + 'The language code to translate to. For example: en, es, fr, etc.', required: true, }, }, { String: { - name: "text", - description: "The text to translate.", + name: 'text', + description: 'The text to translate.', required: true, }, }, @@ -39,24 +39,24 @@ module.exports = { options, id, createdTimestamp, - } = interaction; + } = interaction - const langcode = interaction.options.getString("lang"); - const text = interaction.options.getString("text"); + const langcode = interaction.options.getString('lang') + const text = interaction.options.getString('text') translate(`${text}`, { to: `${langcode}` }).then((res) => { const embed = new MessageEmbed() .setColor(ee.color) .setTitle(`Translated Text`) .addField(`Original Text (${res.from.language.iso})`, `${text}`) .addField(`Translated Text (${langcode}) `, `${res.text}`) - .setFooter({ text: ee.footertext, iconURL: ee.footericon }); - interaction.reply({ embeds: [embed] }); - }); + .setFooter({ text: ee.footertext, iconURL: ee.footericon }) + interaction.reply({ embeds: [embed] }) + }) } catch (err) { interaction.reply({ content: `An error occured!\n\`\`\`js\n${err}\`\`\``, ephemeral: true, - }); + }) } }, -}; +} diff --git a/slashCommands/userinfo.js b/slashCommands/userinfo.js index 3dbf470..e8417c8 100644 --- a/slashCommands/userinfo.js +++ b/slashCommands/userinfo.js @@ -1,44 +1,44 @@ -const Discord = require("discord.js"); -const { MessageEmbed } = require("discord.js"); -const config = require("../botconfig/config.json"); -var ee = require("../botconfig/embed.json"); -const moment = require("moment"); +const Discord = require('discord.js') +const { MessageEmbed } = require('discord.js') +const config = require('../botconfig/config.json') +var ee = require('../botconfig/embed.json') +const moment = require('moment') const flags = { - DISCORD_EMPLOYEE: "Discord Employee", - DISCORD_PARTNER: "Discord Partner", - BUGHUNTER_LEVEL_1: "Bug Hunter (Level 1)", - BUGHUNTER_LEVEL_2: "Bug Hunter (Level 2)", - HYPESQUAD_EVENTS: "HypeSquad Events", - HOUSE_BRAVERY: "House of Bravery", - HOUSE_BRILLIANCE: "House of Brilliance", - HOUSE_BALANCE: "House of Balance", - EARLY_SUPPORTER: "Early Supporter", - TEAM_USER: "Team User", - SYSTEM: "System", - VERIFIED_BOT: "Verified Bot", - VERIFIED_DEVELOPER: "Verified Bot Developer", -}; + DISCORD_EMPLOYEE: 'Discord Employee', + DISCORD_PARTNER: 'Discord Partner', + BUGHUNTER_LEVEL_1: 'Bug Hunter (Level 1)', + BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)', + HYPESQUAD_EVENTS: 'HypeSquad Events', + HOUSE_BRAVERY: 'House of Bravery', + HOUSE_BRILLIANCE: 'House of Brilliance', + HOUSE_BALANCE: 'House of Balance', + EARLY_SUPPORTER: 'Early Supporter', + TEAM_USER: 'Team User', + SYSTEM: 'System', + VERIFIED_BOT: 'Verified Bot', + VERIFIED_DEVELOPER: 'Verified Bot Developer', +} function trimArray(arr, maxLen = 25) { if (Array.from(arr.values()).length > maxLen) { - const len = Array.from(arr.values()).length - maxLen; + const len = Array.from(arr.values()).length - maxLen arr = Array.from(arr.values()) .sort((a, b) => b.rawPosition - a.rawPosition) - .slice(0, maxLen); - arr.map((role) => `<&${role.id}>`); - arr.push(`${len} more...`); + .slice(0, maxLen) + arr.map((role) => `<&${role.id}>`) + arr.push(`${len} more...`) } - return arr.join(", "); + return arr.join(', ') } const statuses = { - online: "🟢", - idle: "🟠", - dnd: "🔴", - offline: "⚫️", -}; + online: '🟢', + idle: '🟠', + dnd: '🔴', + offline: '⚫️', +} module.exports = { - name: "userinfo", - description: "Gives you information about a User", //the command description for Slash Command Overview + name: 'userinfo', + description: 'Gives you information about a User', //the command description for Slash Command Overview cooldown: [], memberpermissions: [], requiredroles: [], @@ -50,8 +50,8 @@ module.exports = { //{"String": { name: "ping_amount", description: "How many times do you want to ping?", required: true }}, //to use in the code: interacton.getString("ping_amount") { User: { - name: "which_user", - description: "From Which User do you want to get Information from?", + name: 'which_user', + description: 'From Which User do you want to get Information from?', required: false, }, }, //to use in the code: interacton.getUser("ping_a_user") @@ -77,147 +77,147 @@ module.exports = { options, id, createdTimestamp, - } = interaction; - const { guild } = member; + } = interaction + const { guild } = member //let IntOption = options.getInteger("OPTIONNAME"); //same as in IntChoices //const StringOption = options.getString("what_ping"); //same as in StringChoices - let UserOption = options.getUser("which_user"); - if (!UserOption) UserOption = member.user; + let UserOption = options.getUser('which_user') + if (!UserOption) UserOption = member.user //let ChannelOption = options.getChannel("OPTIONNAME"); //let RoleOption = options.getRole("OPTIONNAME"); try { - await guild.members.fetch(); - const member = guild.members.cache.get(UserOption.id); - const roles = member.roles; - const userFlags = UserOption.flags.toArray(); - const activity = UserOption.presence?.activities[0]; + await guild.members.fetch() + const member = guild.members.cache.get(UserOption.id) + const roles = member.roles + const userFlags = UserOption.flags.toArray() + const activity = UserOption.presence?.activities[0] //create the EMBED - const embeduserinfo = new MessageEmbed(); + const embeduserinfo = new MessageEmbed() embeduserinfo.setThumbnail( member.user.displayAvatarURL({ dynamic: true, size: 512, - }) - ); + }), + ) embeduserinfo.setAuthor({ name: - "Information about: " + + 'Information about: ' + member.user.username + - "#" + + '#' + member.user.discriminator, iconURL: member.user.displayAvatarURL({ dynamic: true, }), - }); + }) embeduserinfo.addField( - "**・ Username:**", + '**・ Username:**', `<@${member.user.id}>\n\`${member.user.tag}\``, - true - ); - embeduserinfo.addField("**❱ ID:**", `\`${member.id}\``, true); + true, + ) + embeduserinfo.addField('**❱ ID:**', `\`${member.id}\``, true) embeduserinfo.addField( - "**・ Avatar:**", + '**・ Avatar:**', `[\`Link to avatar\`](${member.user.displayAvatarURL({ - format: "png", + format: 'png', })})`, - true - ); + true, + ) embeduserinfo.addField( - "**・ Date Join DC:**", - "`" + - moment(member.user.createdTimestamp).format("DD/MM/YYYY") + - "`\n" + - "`" + - moment(member.user.createdTimestamp).format("hh:mm:ss") + - "`", - true - ); + '**・ Date Join DC:**', + '`' + + moment(member.user.createdTimestamp).format('DD/MM/YYYY') + + '`\n' + + '`' + + moment(member.user.createdTimestamp).format('hh:mm:ss') + + '`', + true, + ) embeduserinfo.addField( - "**・ Date Join Guild:**", - "`" + - moment(member.joinedTimestamp).format("DD/MM/YYYY") + - "`\n" + - "`" + - moment(member.joinedTimestamp).format("hh:mm:ss") + - "`", - true - ); + '**・ Date Join Guild:**', + '`' + + moment(member.joinedTimestamp).format('DD/MM/YYYY') + + '`\n' + + '`' + + moment(member.joinedTimestamp).format('hh:mm:ss') + + '`', + true, + ) embeduserinfo.addField( - "**・ Flags:**", + '**・ Flags:**', `\`${ userFlags.length - ? userFlags.map((flag) => flags[flag]).join(", ") - : "None" + ? userFlags.map((flag) => flags[flag]).join(', ') + : 'None' }\``, - true - ); + true, + ) embeduserinfo.addField( - "**・ Highest Role:**", + '**・ Highest Role:**', `${ - member.roles.highest.id === guild.id ? "None" : member.roles.highest + member.roles.highest.id === guild.id ? 'None' : member.roles.highest }`, - true - ); + true, + ) embeduserinfo.addField( - "**・ Is a Bot:**", - `\`${member.user.bot ? "Yes 🤖" : "No 🧍"}\``, - true - ); - var userstatus = "Not having an activity"; + '**・ Is a Bot:**', + `\`${member.user.bot ? 'Yes 🤖' : 'No 🧍'}\``, + true, + ) + var userstatus = 'Not having an activity' if (activity) { - if (activity.type === "CUSTOM_STATUS") { + if (activity.type === 'CUSTOM_STATUS') { let emoji = `${ activity.emoji ? activity.emoji.id - ? `<${activity.emoji.animated ? "a" : ""}:${ + ? `<${activity.emoji.animated ? 'a' : ''}:${ activity.emoji.name }:${activity.emoji.id}>` : activity.emoji.name - : "" - }`; + : '' + }` userstatus = `${emoji} \`${ - activity.state || "Not having an activity." - }\``; + activity.state || 'Not having an activity.' + }\`` } else { userstatus = `\`${ activity.type.toLowerCase().charAt(0).toUpperCase() + activity.type.toLowerCase().slice(1) - } ${activity.name}\``; + } ${activity.name}\`` } } - embeduserinfo.addField("**❱ Activity:**", `${userstatus}`); + embeduserinfo.addField('**❱ Activity:**', `${userstatus}`) embeduserinfo.addField( - "**・ Permissions:**", + '**・ Permissions:**', `${member.permissions .toArray() .map((p) => `\`${p}\``) - .join(", ")}` - ); + .join(', ')}`, + ) embeduserinfo.addField( `・ [${roles.cache.size}] Roles: `, roles.cache.size < 25 ? Array.from(roles.cache.values()) .sort((a, b) => b.rawPosition - a.rawPosition) .map((role) => `<@&${role.id}>`) - .join(", ") + .join(', ') : roles.cache.size > 25 ? trimArray(roles.cache) - : "None" - ); - embeduserinfo.setColor(ee.color); + : 'None', + ) + embeduserinfo.setColor(ee.color) embeduserinfo.setFooter({ text: ee.footertext, iconURL: ee.footericon, - }); + }) //send the EMBED interaction.reply({ embeds: [embeduserinfo], - }); + }) } catch (e) { - console.log(e); + console.log(e) } } catch (e) { - console.log(String(e.stack)); + console.log(String(e.stack)) } }, -}; +}