From 8a2c9df3fd75a08d2b4acabe0b3a6bd62da22b34 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Thu, 23 Apr 2020 19:06:09 -0700 Subject: shift groups around, new mod cmds, v7.5.0 --- src/bot.ts | 5 ++- src/commands/bot/clientid.ts | 29 +++++++++++++ src/commands/bot/invite.ts | 20 +++++++++ src/commands/bot/memorystats.ts | 34 ++++++++++++++++ src/commands/bot/memoryusage.ts | 27 ++++++++++++ src/commands/bot/uptime.ts | 39 ++++++++++++++++++ src/commands/bot/version.ts | 35 ++++++++++++++++ src/commands/crypto/btc.ts | 4 +- src/commands/crypto/btcchange.ts | 4 +- src/commands/fun/cow.ts | 26 ++++++++++++ src/commands/fun/dicksize.ts | 33 +++++++++++++++ src/commands/fun/quote.ts | 2 +- src/commands/moderation/addrole.ts | 55 +++++++++++++++++++++++++ src/commands/moderation/ban.ts | 25 ++++++++++++ src/commands/moderation/clear.ts | 77 +++++++++++++++++++++++++++++++++++ src/commands/moderation/kick.ts | 29 +++++++++++++ src/commands/moderation/removerole.ts | 54 ++++++++++++++++++++++++ src/commands/server/membercount.ts | 29 +++++++++++++ src/commands/server/pfp.ts | 27 ++++++++++++ src/commands/server/server.ts | 54 ++++++++++++++++++++++++ src/commands/server/servercount.ts | 28 +++++++++++++ src/commands/utility/clear.ts | 77 ----------------------------------- src/commands/utility/clientid.ts | 29 ------------- src/commands/utility/invite.ts | 21 ---------- src/commands/utility/membercount.ts | 29 ------------- src/commands/utility/memorystats.ts | 34 ---------------- src/commands/utility/memoryusage.ts | 27 ------------ src/commands/utility/server.ts | 54 ------------------------ src/commands/utility/servercount.ts | 28 ------------- src/commands/utility/uptime.ts | 39 ------------------ src/commands/utility/version.ts | 35 ---------------- src/commands/zerotwo/darling.ts | 6 ++- src/config.json | 2 +- 33 files changed, 635 insertions(+), 382 deletions(-) create mode 100644 src/commands/bot/clientid.ts create mode 100644 src/commands/bot/invite.ts create mode 100644 src/commands/bot/memorystats.ts create mode 100644 src/commands/bot/memoryusage.ts create mode 100644 src/commands/bot/uptime.ts create mode 100644 src/commands/bot/version.ts create mode 100644 src/commands/fun/cow.ts create mode 100644 src/commands/fun/dicksize.ts create mode 100644 src/commands/moderation/addrole.ts create mode 100644 src/commands/moderation/ban.ts create mode 100644 src/commands/moderation/clear.ts create mode 100644 src/commands/moderation/kick.ts create mode 100644 src/commands/moderation/removerole.ts create mode 100644 src/commands/server/membercount.ts create mode 100644 src/commands/server/pfp.ts create mode 100644 src/commands/server/server.ts create mode 100644 src/commands/server/servercount.ts delete mode 100644 src/commands/utility/clear.ts delete mode 100644 src/commands/utility/clientid.ts delete mode 100644 src/commands/utility/invite.ts delete mode 100644 src/commands/utility/membercount.ts delete mode 100644 src/commands/utility/memorystats.ts delete mode 100644 src/commands/utility/memoryusage.ts delete mode 100644 src/commands/utility/server.ts delete mode 100644 src/commands/utility/servercount.ts delete mode 100644 src/commands/utility/uptime.ts delete mode 100644 src/commands/utility/version.ts (limited to 'src') diff --git a/src/bot.ts b/src/bot.ts index b0a28e8..d23c625 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -31,12 +31,13 @@ client.registry .registerGroups([ ['fun', 'Fun Command Group'], ['moderation', 'Moderation Command Group'], - ['utility', 'Utility Command Group'], + ['server', 'Server Command Group'], ['voice', 'Voice Command Group'], ['nsfw', 'NSFW Command Group'], ['anime', 'Anime Command Group'], ['crypto', 'Crypto Command Group'], - ['zerotwo', 'Zero Two Command Group'] + ['zerotwo', 'Zero Two Command Group'], + ['bot', 'Bot COmmand Group'] ]) .registerDefaultGroups() .registerDefaultCommands({ diff --git a/src/commands/bot/clientid.ts b/src/commands/bot/clientid.ts new file mode 100644 index 0000000..da7717e --- /dev/null +++ b/src/commands/bot/clientid.ts @@ -0,0 +1,29 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class ClientIDBot extends Command { + constructor(client) { + super(client, { + name: 'clientid', + aliases: ['cid'], + group: 'bot', + memberName: 'clientid', + description: 'Tells you the bot\'s client ID version.', + examples: ['uwu!clientid', 'uwu!cid'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + msg.channel.send('Please wait...').then(m => { + m.edit(`** **`); + + let emb = new MessageEmbed() + .setDescription('uwufier\'s client ID is **699473263998271489**. ' + emoji.random()) + .setColor(0xFFCC4D) + + msg.channel.send(emb); + }); + } +}; \ No newline at end of file diff --git a/src/commands/bot/invite.ts b/src/commands/bot/invite.ts new file mode 100644 index 0000000..8c798d1 --- /dev/null +++ b/src/commands/bot/invite.ts @@ -0,0 +1,20 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class InviteBot extends Command { + constructor(client) { + super(client, { + name: 'invite', + aliases: ['inv'], + group: 'bot', + memberName: 'invite', + description: 'Gives you the bot\'s invite link.', + examples: ['uwu!invite', 'uwu!inv'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + msg.reply('https://crack.cf/uwu ' + emoji.random()) + } +}; \ No newline at end of file diff --git a/src/commands/bot/memorystats.ts b/src/commands/bot/memorystats.ts new file mode 100644 index 0000000..669ac84 --- /dev/null +++ b/src/commands/bot/memorystats.ts @@ -0,0 +1,34 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; + +module.exports = class MemoryStatsBot extends Command { + constructor(client) { + super(client, { + name: 'memorystats', + aliases: [ + 'memstats', + 'mem-stats', + 'memory-stats', + 'memorystats', + 'memstat', + 'mem-stat', + 'memory-stat', + 'memorystat' + ], + group: 'bot', + memberName: 'memorystats', + description: 'Checks the full, current, approximate memory usage statistics of the bot\'s Node.js process.', + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + const used = process.memoryUsage(); + msg.reply(`The full, current, approximate memory usage statistics are currentaly; +\`\`\`js +rss: ${Math.round(used.rss / 1024 / 1024 * 100) / 100} MBs +heapTotal: ${Math.round(used.heapTotal / 1024 / 1024 * 100) / 100} MBs +heapUsed: ${Math.round(used.heapUsed / 1024 / 1024 * 100) / 100} MBs +external: ${Math.round(used.external / 1024 / 1024 * 100) / 100} MBs +\`\`\``) + } +}; \ No newline at end of file diff --git a/src/commands/bot/memoryusage.ts b/src/commands/bot/memoryusage.ts new file mode 100644 index 0000000..545edd5 --- /dev/null +++ b/src/commands/bot/memoryusage.ts @@ -0,0 +1,27 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class MemoryUsageBot extends Command { + constructor(client) { + super(client, { + name: 'memoryusage', + aliases: [ + 'memusage', + 'mem-usage', + 'memory-usage', + 'mem', + 'memory', + 'memoryusage' + ], + group: 'bot', + memberName: 'memoryusage', + description: 'Checks the current, approximate memory usage of the bot\'s Node.js process.', + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + const used = process.memoryUsage().heapUsed / 1024 / 1024; + msg.reply(`The current, approximate memory usage is currently **${Math.round(used * 100) / 100}** MBs. ${emoji.random()}`) + } +}; \ No newline at end of file diff --git a/src/commands/bot/uptime.ts b/src/commands/bot/uptime.ts new file mode 100644 index 0000000..3280d9e --- /dev/null +++ b/src/commands/bot/uptime.ts @@ -0,0 +1,39 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { duration as _duration } from 'moment'; +import 'moment-duration-format'; +import emoji from 'emoji-random'; +import { MessageEmbed } from 'discord.js'; + +export default class UptimeBot extends Command { + constructor(client) { + super(client, { + name: 'uptime', + aliases: ['ut'], + group: 'bot', + memberName: 'uptime', + description: 'Tells you how long the bot has been online.', + throttling: { + usages: 5, + duration: 30 + }, + examples: [ + 'uwu!uptime', + 'uwu!ut' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + const duration = _duration(this.client.uptime).format(" D [days], H [hrs], m [mins], s [secs]"); + msg.channel.send('Please wait...').then(m => { + m.edit(`** **`); + + let emb = new MessageEmbed() + .setDescription('<@699473263998271489> has been up for ' + duration + '. ' + emoji.random()) + .setColor(0xFFCC4D) + + msg.channel.send(emb); + }); + } +} \ No newline at end of file diff --git a/src/commands/bot/version.ts b/src/commands/bot/version.ts new file mode 100644 index 0000000..7d2c71b --- /dev/null +++ b/src/commands/bot/version.ts @@ -0,0 +1,35 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; +import { MessageEmbed } from 'discord.js'; +import config from '../../config.json'; + +export default class VersionBot extends Command { + constructor(client) { + super(client, { + name: 'version', + group: 'bot', + memberName: 'version', + description: 'Tells you the bot\'s current build version.', + throttling: { + usages: 5, + duration: 30 + }, + examples: [ + 'uwu!version' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + msg.channel.send('Please wait...').then(m => { + m.edit(`** **`); + + let emb = new MessageEmbed() + .setDescription(`uwufier\'s current build version is **v${config['version']}**. ` + emoji.random()) + .setColor(0xFFCC4D) + + msg.channel.send(emb); + }); + } +} \ No newline at end of file diff --git a/src/commands/crypto/btc.ts b/src/commands/crypto/btc.ts index 1c467ab..3f3ffe9 100644 --- a/src/commands/crypto/btc.ts +++ b/src/commands/crypto/btc.ts @@ -3,12 +3,12 @@ import emoji from 'emoji-random'; import btc from 'btc-value'; btc.setApiKey('a43419ce-fc59-4951-8af9-20c5e36ef73f'); -module.exports = class BTCUtility extends Command { +module.exports = class BTCCrypto extends Command { constructor(client) { super(client, { name: 'btc', aliases: ['bitcoin', 'crypto'], - group: 'utility', + group: 'crypto', memberName: 'btc', description: 'Allows you to check the current Bitcoin price.', args: [ diff --git a/src/commands/crypto/btcchange.ts b/src/commands/crypto/btcchange.ts index 9ef5d4d..67eb0c7 100644 --- a/src/commands/crypto/btcchange.ts +++ b/src/commands/crypto/btcchange.ts @@ -3,12 +3,12 @@ import btc from 'btc-value'; import emoji from 'emoji-random'; btc.setApiKey('a43419ce-fc59-4951-8af9-20c5e36ef73f'); -module.exports = class BTCChangeUtility extends Command { +module.exports = class BTCChangeCrypto extends Command { constructor(client) { super(client, { name: 'btcchange', aliases: ['bitcoinchange', 'cryptochange', 'btcc'], - group: 'utility', + group: 'crypto', memberName: 'btcchange', description: 'Allows you to check the fluctuation in Bitcoin prices within a specified amount of time.', args: [ diff --git a/src/commands/fun/cow.ts b/src/commands/fun/cow.ts new file mode 100644 index 0000000..e8fa60b --- /dev/null +++ b/src/commands/fun/cow.ts @@ -0,0 +1,26 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import cows from 'cows'; + +module.exports = class CowFun extends Command { + constructor(client) { + super(client, { + name: 'cow', + aliases: ['cows'], + group: 'fun', + memberName: 'cow', + description: 'Gives you a random cow.', + throttling: { + usages: 5, + duration: 30 + }, + examples: ['uwu!cow', 'uwu!cows'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + let cowNumber = Math.round((Math.random() * cows().length)) + let cow = cows()[cowNumber] + msg.reply(`\`\`\`${cow}\`\`\``); + } +}; \ No newline at end of file diff --git a/src/commands/fun/dicksize.ts b/src/commands/fun/dicksize.ts new file mode 100644 index 0000000..9e023d1 --- /dev/null +++ b/src/commands/fun/dicksize.ts @@ -0,0 +1,33 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class DickSizeFun extends Command { + constructor(client) { + super(client, { + name: 'dicksize', + aliases: [ + 'peepeesize', + 'ppsize' + ], + group: 'fun', + memberName: 'dicksize', + description: 'Tells you your dick size.', + examples: [ + 'uwu!dicksize', + 'uwu!peepeesize', + 'uwu!ppsize' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + let size = msg.author.id.slice(-3) % 20 + 1 + + msg.reply('Scanning..').then(scanningMsg => { + // @ts-ignore + scanningMsg.delete() + msg.reply('Your dick size is **' + size + '** inches. ' + emoji.random()); + }); + } +}; \ No newline at end of file diff --git a/src/commands/fun/quote.ts b/src/commands/fun/quote.ts index 1e130a8..0961d1d 100644 --- a/src/commands/fun/quote.ts +++ b/src/commands/fun/quote.ts @@ -9,7 +9,7 @@ module.exports = class QuoteFun extends Command { aliases: ['quotes'], group: 'fun', memberName: 'quote', - description: 'Gives you a random quote from Adventure Time.', + description: '[Broken] Gives you a random quote from Adventure Time.', throttling: { usages: 5, duration: 30 diff --git a/src/commands/moderation/addrole.ts b/src/commands/moderation/addrole.ts new file mode 100644 index 0000000..ac0dbb6 --- /dev/null +++ b/src/commands/moderation/addrole.ts @@ -0,0 +1,55 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; + +module.exports = class AddRoleModeration extends Command { + constructor(client) { + super(client, { + name: 'addrole', + aliases: ['roleadd'], + group: 'moderation', + memberName: 'addrole', + description: 'Adds a role to a specific user.', + args: [ + { + key: 'userID', + prompt: 'Who would you like to add the role to? (@someone or myself)', + type: 'string', + default: '' + }, + { + key: 'roleID', + prompt: 'What role would you like to add?', + type: 'string' + } + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + examples: [ + 'uwu!addrole @CoolRole', + 'uwu!addrole @sin#1337 @CoolRole', + 'uwu!roleadd @sin#1337', + 'uwu!roleadd @sin#1337 @CoolerRole' + ] + }); + } + run(msg: CommandoMessage, { userID, roleID }) { + let role = msg.guild.roles.cache.find(role => role === roleID); + let member = msg.mentions.members?.first(); + if (!userID) { + if (role) { + console.log(role) + member?.roles.add(role) + msg.reply(`The role **${role}** has been added to **${member}**.`) + } else { + msg.reply('Role is either non-existant or you might\'ve mispelled it.') + } + } else if (userID) { + if (role) { + console.log(role) + member?.roles.add(role) + } else { + console.log(role) + msg.reply('Role is either non-existant or you might\'ve mispelled it.') + } + } + } +}; \ No newline at end of file diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts new file mode 100644 index 0000000..45f5298 --- /dev/null +++ b/src/commands/moderation/ban.ts @@ -0,0 +1,25 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; + +module.exports = class BanModeration extends Command { + constructor(client) { + super(client, { + name: 'ban', + aliases: ['banuser', 'ban-user'], + group: 'moderation', + memberName: 'ban', + description: 'Ban someone.', + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + examples: ['uwu!ban @sin#1337'] + }); + } + run(msg: CommandoMessage) { + let userID = msg.mentions.members?.first().id + if (!msg.guild.member(userID)) { + msg.reply('Member does not exist in server.') + } else { + msg.guild.members.ban(userID) + msg.say(`User **${userID}** has been banned!`) + } + } +}; \ No newline at end of file diff --git a/src/commands/moderation/clear.ts b/src/commands/moderation/clear.ts new file mode 100644 index 0000000..e83d023 --- /dev/null +++ b/src/commands/moderation/clear.ts @@ -0,0 +1,77 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class ClearBot extends Command { + constructor(client) { + super(client, { + name: 'clear', + aliases: ['delete', 'del', 'c', 'd'], + group: 'bot', + memberName: 'clear', + description: 'Clears a specified amount of messages.', + guildOnly: true, + args: [ + { + key: 'deleteAmount', + prompt: 'How many messages would you like to delete?', + type: 'integer' + } + ], + examples: [ + 'uwu!clear 23', + 'uwu!delete 75', + 'uwu!del 32', + 'uwu!c 45', + 'uwu!d 84' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'] + }); + } + async run(msg: CommandoMessage, { deleteAmount }) { + if (msg.member.hasPermission('MANAGE_MESSAGES')) { + if (!deleteAmount) { + msg.reply('You haven\'t specified an amount of messages which should be deleted. ' + emoji.random()).then(deleteNotificationMessage => { + // @ts-ignore + deleteNotificationMessage.delete({ timeout: 1000 }); + }); + } else if (isNaN(deleteAmount)) { + msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => { + // @ts-ignore + deleteNotificationMessage.delete({ timeout: 1000 }); + }); + } else if (deleteAmount > 100) { + msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => { + // @ts-ignore + deleteNotificationMessage.delete({ timeout: 1000 }); + }); + } else if (deleteAmount < 1) { + msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => { + // @ts-ignore + deleteNotificationMessage.delete({ timeout: 1000 }); + }); + } + /*else if (msg.createdTimestamp > 1209600) { + msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(') + } */ + else { + var clearAmount = deleteAmount + 1; + // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time. + // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1 + // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020 + + await msg.channel.messages.fetch({ + limit: clearAmount + }).then(messages => { // I am on v11 discord.js + msg.channel.bulkDelete(messages); + }); + msg.reply('It\'s been deleted ~uwu ' + emoji.random()).then(deleteNotificationMessage => { + // @ts-ignore + deleteNotificationMessage.delete({ timeout: 1000 }); + }); + } + } else { + msg.reply('Insufficent permsissions. ' + emoji.random()); + } + } +}; \ No newline at end of file diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts new file mode 100644 index 0000000..24b669d --- /dev/null +++ b/src/commands/moderation/kick.ts @@ -0,0 +1,29 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; + +module.exports = class KickModeration extends Command { + constructor(client) { + super(client, { + name: 'kick', + aliases: ['kickuser', 'kick-user'], + group: 'moderation', + memberName: 'kick', + description: 'Kick someone.', + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + examples: [ + 'uwu!kick @sin#1337', + 'uwu!kickuser @sin#1337', + 'uwu!kick-user @sin#1337' + ] + }); + } + run(msg: CommandoMessage) { + let userID = msg.mentions.members?.first().id + if (!msg.guild.member(userID)) { + msg.reply('Member does not exist in server.') + } else { + msg.guild.members.prune(userID) + msg.say(`User **${userID}** has been kicked!`) + } + } +}; \ No newline at end of file diff --git a/src/commands/moderation/removerole.ts b/src/commands/moderation/removerole.ts new file mode 100644 index 0000000..a4edc92 --- /dev/null +++ b/src/commands/moderation/removerole.ts @@ -0,0 +1,54 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; + +module.exports = class RemoveRoleModeration extends Command { + constructor(client) { + super(client, { + name: 'removerole', + aliases: ['roleremove'], + group: 'moderation', + memberName: 'removerole', + description: 'Removes a role to a specific user.', + args: [ + { + key: 'userID', + prompt: 'Who would you like to remove the role from? (@someone or myself)', + type: 'string' + }, + { + key: 'roleID', + prompt: 'What role would you like to remove?', + type: 'string' + } + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + examples: [ + 'uwu!removerole @CoolRole', + 'uwu!removerole @sin#1337 @CoolRole', + 'uwu!roleremove @sin#1337', + 'uwu!roleremove @sin#1337 @CoolerRole' + ] + }); + } + run(msg: CommandoMessage, { userID, roleID }) { + let role = msg.guild.roles.cache.find(r => r.id === roleID); + let member = msg.mentions.members?.first(); + if (!userID) { + if (role) { + console.log(role) + member?.roles.remove(role) + msg.reply(`The role **${role}** has been remove from **${member}**.`) + } else { + console.log(role) + msg.reply('Role is either non-existant or you might\'ve mispelled it.') + } + } else if (!userID) { + if (roleID) { + member?.roles.remove(roleID) + } else { + console.log(roleID) + msg.reply('Role is either non-existant or you might\'ve mispelled it.') + } + } + } +}; \ No newline at end of file diff --git a/src/commands/server/membercount.ts b/src/commands/server/membercount.ts new file mode 100644 index 0000000..f3fd2ee --- /dev/null +++ b/src/commands/server/membercount.ts @@ -0,0 +1,29 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class MemberCountServer extends Command { + constructor(client) { + super(client, { + name: 'membercount', + aliases: ['memberc', 'mcount', 'mc'], + group: 'server', + memberName: 'membercount', + description: 'Tells you how many members are in the current server.', + throttling: { + usages: 5, + duration: 30 + }, + examples: [ + 'uwu!membercount', + 'uwu!memberc', + 'uwu!mcount', + 'uwu!mc' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + msg.reply(`There are **${msg.guild.memberCount}** members in **${msg.guild.name}**. ` + emoji.random()); + } +}; \ No newline at end of file diff --git a/src/commands/server/pfp.ts b/src/commands/server/pfp.ts new file mode 100644 index 0000000..6d7ce73 --- /dev/null +++ b/src/commands/server/pfp.ts @@ -0,0 +1,27 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; + +module.exports = class PFPServer extends Command { + constructor(client) { + super(client, { + name: 'pfp', + aliases: ['profilepicture', 'profile-picture', 'profileimage', 'profile-image'], + group: 'server', + memberName: 'pfp', + description: 'Grabs the profile picture of a given user.', + args: [ + { + key: 'userID', + prompt: 'Which user\'s profile picture would you like to grab?', + type: 'string' + } + ], + examples: ['uwu!pfp @sin#1337'] + }); + } + run(msg: CommandoMessage, { userID } ) { + userID = msg.mentions.users.first()?.id; + this.client.users.fetch(userID).then(user => { + msg.reply({ files: [user.avatarURL()] }) + }) + } +}; \ No newline at end of file diff --git a/src/commands/server/server.ts b/src/commands/server/server.ts new file mode 100644 index 0000000..6758d24 --- /dev/null +++ b/src/commands/server/server.ts @@ -0,0 +1,54 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class ServerServer extends Command { + constructor(client) { + super(client, { + name: 'server', + aliases: [ + 'serverinfo', + 'si', + 'server-info', + 'serverstats', + 'server-stats' + ], + group: 'server', + memberName: 'server', + description: 'Gives you information about the current server.', + throttling: { + usages: 2, + duration: 60 + }, + guildOnly: true, + examples: [ + 'uwu!server', + 'uwu!serverinfo', + 'uwu!server-info', + 'uwu!serverstats', + 'uwu!server-stats', + 'uwu!si' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + var o = msg.guild.members.cache.filter(m => m.presence.status === 'online').size; + + let embed = new MessageEmbed() + + .setAuthor(`${msg.guild.name} - ${msg.guild.id}`, `${msg.guild.iconURL()}`, `https://discordapp.com/channels/${msg.guild.id}/${msg.guild.id}`) + .setDescription(`Here\'s all the information on \`${msg.guild.name}\``) + .setThumbnail(`${msg.guild.iconURL()}`) + .addField('Owner', `${msg.guild.owner}`, false) + .addField(`Members [${msg.guild.memberCount}]`, `${o} members are online.`, true) + .addField('Region', `${msg.guild.region}`, true) + .addField('Text channels', `${msg.guild.channels.cache.filter(c => c.type === 'text').size}`, true) + .addField('Voice channels', `${msg.guild.channels.cache.filter(c => c.type === 'voice').size}`, true) + .addField('Guild created', `${msg.guild.createdAt}`, false) + .addField(`${this.client.user.username} joined`, `${msg.guild.members.cache.get('699473263998271489').joinedAt}`) + .setColor(0xFFCC4D); + + msg.channel.send(embed); + } +}; \ No newline at end of file diff --git a/src/commands/server/servercount.ts b/src/commands/server/servercount.ts new file mode 100644 index 0000000..4690caa --- /dev/null +++ b/src/commands/server/servercount.ts @@ -0,0 +1,28 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +import emoji from 'emoji-random'; + +module.exports = class ServerCountServer extends Command { + constructor(client) { + super(client, { + name: 'servercount', + aliases: ['sc', 'scount', 'serverc'], + group: 'server', + memberName: 'servercount', + description: 'Tells you the amount of servers uwufy is in.', + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + msg.channel.send('Please wait...').then(m => { + m.edit(`** **`); + + let emb = new MessageEmbed() + .setDescription(`Currently running on ${this.client.guilds.cache.size} server(s). ` + emoji.random()) + .setColor(0xFFCC4D) + + msg.channel.send(emb); + }); + } +}; \ No newline at end of file diff --git a/src/commands/utility/clear.ts b/src/commands/utility/clear.ts deleted file mode 100644 index 80e0c73..0000000 --- a/src/commands/utility/clear.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class ClearUtility extends Command { - constructor(client) { - super(client, { - name: 'clear', - aliases: ['delete', 'del', 'c', 'd'], - group: 'utility', - memberName: 'clear', - description: 'Clears a specified amount of messages.', - guildOnly: true, - args: [ - { - key: 'deleteAmount', - prompt: 'How many messages would you like to delete?', - type: 'integer' - } - ], - examples: [ - 'uwu!clear 23', - 'uwu!delete 75', - 'uwu!del 32', - 'uwu!c 45', - 'uwu!d 84' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'] - }); - } - async run(msg: CommandoMessage, { deleteAmount }) { - if (msg.member.hasPermission('MANAGE_MESSAGES')) { - if (!deleteAmount) { - msg.reply('You haven\'t specified an amount of messages which should be deleted. ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); - }); - } else if (isNaN(deleteAmount)) { - msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); - }); - } else if (deleteAmount > 100) { - msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); - }); - } else if (deleteAmount < 1) { - msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); - }); - } - /*else if (msg.createdTimestamp > 1209600) { - msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(') - } */ - else { - var clearAmount = deleteAmount + 1; - // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time. - // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1 - // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020 - - await msg.channel.messages.fetch({ - limit: clearAmount - }).then(messages => { // I am on v11 discord.js - msg.channel.bulkDelete(messages); - }); - msg.reply('It\'s been deleted ~uwu ' + emoji.random()).then(deleteNotificationMessage => { - // @ts-ignore - deleteNotificationMessage.delete({ timeout: 1000 }); - }); - } - } else { - msg.reply('Insufficent permsissions. ' + emoji.random()); - } - } -}; \ No newline at end of file diff --git a/src/commands/utility/clientid.ts b/src/commands/utility/clientid.ts deleted file mode 100644 index 28073c5..0000000 --- a/src/commands/utility/clientid.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class ClientIDUtility extends Command { - constructor(client) { - super(client, { - name: 'clientid', - aliases: ['cid'], - group: 'utility', - memberName: 'clientid', - description: 'Tells you the bot\'s client ID version.', - examples: ['uwu!clientid', 'uwu!cid'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.channel.send('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription('uwufier\'s client ID is **699473263998271489**. ' + emoji.random()) - .setColor(0xFFCC4D) - - msg.channel.send(emb); - }); - } -}; \ No newline at end of file diff --git a/src/commands/utility/invite.ts b/src/commands/utility/invite.ts deleted file mode 100644 index 4e8150e..0000000 --- a/src/commands/utility/invite.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class InviteUtility extends Command { - constructor(client) { - super(client, { - name: 'invite', - aliases: ['inv'], - group: 'utility', - memberName: 'invite', - description: 'Gives you the bot\'s invite link.', - examples: ['uwu!invite', 'uwu!inv'], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.reply('https://crack.cf/uwu') - } -}; \ No newline at end of file diff --git a/src/commands/utility/membercount.ts b/src/commands/utility/membercount.ts deleted file mode 100644 index 4d64f5d..0000000 --- a/src/commands/utility/membercount.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class MemberCountUtility extends Command { - constructor(client) { - super(client, { - name: 'membercount', - aliases: ['memberc', 'mcount', 'mc'], - group: 'utility', - memberName: 'membercount', - description: 'Tells you how many members are in the current server.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!membercount', - 'uwu!memberc', - 'uwu!mcount', - 'uwu!mc' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.reply(`There are **${msg.guild.memberCount}** members in **${msg.guild.name}**. ` + emoji.random()); - } -}; \ No newline at end of file diff --git a/src/commands/utility/memorystats.ts b/src/commands/utility/memorystats.ts deleted file mode 100644 index 0729fc5..0000000 --- a/src/commands/utility/memorystats.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; - -module.exports = class MemoryStatsUtility extends Command { - constructor(client) { - super(client, { - name: 'memorystats', - aliases: [ - 'memstats', - 'mem-stats', - 'memory-stats', - 'memorystats', - 'memstat', - 'mem-stat', - 'memory-stat', - 'memorystat' - ], - group: 'utility', - memberName: 'memorystats', - description: 'Checks the full, current, approximate memory usage statistics of the bot\'s Node.js process.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - const used = process.memoryUsage(); - msg.reply(`The full, current, approximate memory usage statistics are currentaly; -\`\`\`js -rss: ${Math.round(used.rss / 1024 / 1024 * 100) / 100} MBs -heapTotal: ${Math.round(used.heapTotal / 1024 / 1024 * 100) / 100} MBs -heapUsed: ${Math.round(used.heapUsed / 1024 / 1024 * 100) / 100} MBs -external: ${Math.round(used.external / 1024 / 1024 * 100) / 100} MBs -\`\`\``) - } -}; \ No newline at end of file diff --git a/src/commands/utility/memoryusage.ts b/src/commands/utility/memoryusage.ts deleted file mode 100644 index 3c2913a..0000000 --- a/src/commands/utility/memoryusage.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; - -module.exports = class MemoryUsageUtility extends Command { - constructor(client) { - super(client, { - name: 'memoryusage', - aliases: [ - 'memusage', - 'mem-usage', - 'memory-usage', - 'mem', - 'memory', - 'memoryusage' - ], - group: 'utility', - memberName: 'memoryusage', - description: 'Checks the current, approximate memory usage of the bot\'s Node.js process.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - const used = process.memoryUsage().heapUsed / 1024 / 1024; - msg.reply(`The current, approximate memory usage is currently **${Math.round(used * 100) / 100}** MBs. ${emoji.random()}`) - } -}; \ No newline at end of file diff --git a/src/commands/utility/server.ts b/src/commands/utility/server.ts deleted file mode 100644 index f5fddca..0000000 --- a/src/commands/utility/server.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; - -module.exports = class ServerUtility extends Command { - constructor(client) { - super(client, { - name: 'server', - aliases: [ - 'serverinfo', - 'si', - 'server-info', - 'serverstats', - 'server-stats' - ], - group: 'utility', - memberName: 'server', - description: 'Gives you information about the current server.', - throttling: { - usages: 2, - duration: 60 - }, - guildOnly: true, - examples: [ - 'uwu!server', - 'uwu!serverinfo', - 'uwu!server-info', - 'uwu!serverstats', - 'uwu!server-stats', - 'uwu!si' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - var o = msg.guild.members.cache.filter(m => m.presence.status === 'online').size; - - let embed = new MessageEmbed() - - .setAuthor(`${msg.guild.name} - ${msg.guild.id}`, `${msg.guild.iconURL()}`, `https://discordapp.com/channels/${msg.guild.id}/${msg.guild.id}`) - .setDescription(`Here\'s all the information on \`${msg.guild.name}\``) - .setThumbnail(`${msg.guild.iconURL()}`) - .addField('Owner', `${msg.guild.owner}`, false) - .addField(`Members [${msg.guild.memberCount}]`, `${o} members are online.`, true) - .addField('Region', `${msg.guild.region}`, true) - .addField('Text channels', `${msg.guild.channels.cache.filter(c => c.type === 'text').size}`, true) - .addField('Voice channels', `${msg.guild.channels.cache.filter(c => c.type === 'voice').size}`, true) - .addField('Guild created', `${msg.guild.createdAt}`, false) - .addField(`${this.client.user.username} joined`, `${msg.guild.members.cache.get('699473263998271489').joinedAt}`) - .setColor(0xFFCC4D); - - msg.channel.send(embed); - } -}; \ No newline at end of file diff --git a/src/commands/utility/servercount.ts b/src/commands/utility/servercount.ts deleted file mode 100644 index eaccd89..0000000 --- a/src/commands/utility/servercount.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import emoji from 'emoji-random'; - -module.exports = class ServerCountUtility extends Command { - constructor(client) { - super(client, { - name: 'servercount', - aliases: ['sc', 'scount', 'serverc'], - group: 'utility', - memberName: 'servercount', - description: 'Tells you the amount of servers uwufy is in.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.channel.send('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription(`Currently running on ${this.client.guilds.cache.size} server(s). ` + emoji.random()) - .setColor(0xFFCC4D) - - msg.channel.send(emb); - }); - } -}; \ No newline at end of file diff --git a/src/commands/utility/uptime.ts b/src/commands/utility/uptime.ts deleted file mode 100644 index dcce606..0000000 --- a/src/commands/utility/uptime.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { duration as _duration } from 'moment'; -import 'moment-duration-format'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; - -export default class UptimeUtility extends Command { - constructor(client) { - super(client, { - name: 'uptime', - aliases: ['ut'], - group: 'utility', - memberName: 'uptime', - description: 'Tells you how long the bot has been online.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!uptime', - 'uwu!ut' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - const duration = _duration(this.client.uptime).format(" D [days], H [hrs], m [mins], s [secs]"); - msg.channel.send('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription('<@699473263998271489> has been up for ' + duration + '. ' + emoji.random()) - .setColor(0xFFCC4D) - - msg.channel.send(emb); - }); - } -} \ No newline at end of file diff --git a/src/commands/utility/version.ts b/src/commands/utility/version.ts deleted file mode 100644 index 0de170f..0000000 --- a/src/commands/utility/version.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; -import { MessageEmbed } from 'discord.js'; -import config from '../../config.json'; - -export default class VersionUtility extends Command { - constructor(client) { - super(client, { - name: 'version', - group: 'utility', - memberName: 'version', - description: 'Tells you the bot\'s current build version.', - throttling: { - usages: 5, - duration: 30 - }, - examples: [ - 'uwu!version' - ], - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.channel.send('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription(`uwufier\'s current build version is **v${config['version']}**. ` + emoji.random()) - .setColor(0xFFCC4D) - - msg.channel.send(emb); - }); - } -} \ No newline at end of file diff --git a/src/commands/zerotwo/darling.ts b/src/commands/zerotwo/darling.ts index 9cb5a17..3b7517e 100644 --- a/src/commands/zerotwo/darling.ts +++ b/src/commands/zerotwo/darling.ts @@ -12,7 +12,11 @@ module.exports = class DarlingZeroTwo extends Command { description: 'Get\'s or sets uwufier\'s current darling.', userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - examples: ['uwu!darling'], + examples: [ + 'uwu!darling', + 'uwu!darling set', + 'uwu!darling remove' + ], args: [ { key: 'darlingName', diff --git a/src/config.json b/src/config.json index 015fb11..57d6d07 100644 --- a/src/config.json +++ b/src/config.json @@ -1,5 +1,5 @@ { "secret":"Njk5NDczMjYzOTk4MjcxNDg5.XpU5oQ.btZuxVudhNllSQY6CxrXXtMJm9A", "yt-api-key":"AIzaSyCeG1lQAeInv4vjFv_eTL9IFAFNdQC9Nk8", - "version":"7.4.2" + "version":"7.5.0" } \ No newline at end of file -- cgit v1.2.3