summaryrefslogtreecommitdiff
path: root/src/commands/utility
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/utility')
-rw-r--r--src/commands/utility/btc.ts36
-rw-r--r--src/commands/utility/btcchange.js47
-rw-r--r--src/commands/utility/clear.js72
-rw-r--r--src/commands/utility/membercount.js29
-rw-r--r--src/commands/utility/server.js54
-rw-r--r--src/commands/utility/servers.ts28
-rw-r--r--src/commands/utility/uptime.ts40
7 files changed, 306 insertions, 0 deletions
diff --git a/src/commands/utility/btc.ts b/src/commands/utility/btc.ts
new file mode 100644
index 0000000..2845194
--- /dev/null
+++ b/src/commands/utility/btc.ts
@@ -0,0 +1,36 @@
+import { Command } from 'discord.js-commando';
+import emoji from 'emoji-random';
+import btc from 'btc-value';
+btc.setApiKey('a43419ce-fc59-4951-8af9-20c5e36ef73f');
+
+module.exports = class BTCUtility extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'btc',
+ aliases: ['bitcoin', 'crypto'],
+ group: 'utility',
+ memberName: 'btc',
+ description: 'Allows you to check current Bitcoin price.',
+ args: [
+ {
+ key: 'currencyName',
+ prompt: 'What currency could you like to see it in? (USD, AUD, CAD)',
+ type: 'string'
+ }
+ ],
+ examples: [
+ 'uwu!bitcoin aud',
+ 'uwu!crypto cad',
+ 'uwu!btc usd'
+ ],
+ userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
+ });
+ }
+ run(msg: Message, { currencyName }) {
+ currencyName = currencyName.toUpperCase();
+ btc({ isDecimal: true, currencyCode: currencyName }).then(value => {
+ msg.reply('The current price of *Bitcoin* in **' + currencyName + '** is **' + value + '**. ' + emoji.random());
+ });
+ }
+}; \ No newline at end of file
diff --git a/src/commands/utility/btcchange.js b/src/commands/utility/btcchange.js
new file mode 100644
index 0000000..474a3ee
--- /dev/null
+++ b/src/commands/utility/btcchange.js
@@ -0,0 +1,47 @@
+const { Command } = require('discord.js-commando');
+const btc = require('btc-value');
+btc.setApiKey('a43419ce-fc59-4951-8af9-20c5e36ef73f');
+
+module.exports = class BTCChangeUtility extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'btcchange',
+ aliases: ['bitcoinchange', 'cryptochange', 'btcc'],
+ group: 'utility',
+ memberName: 'btcchange',
+ description: 'Allows you to check the fluctuation in Bitcoin prices within a specified amount of time.',
+ args: [
+ {
+ key: 'timeAmount',
+ prompt: 'What time range do you want to check the fluction amount in? (day, hour, week)',
+ type: 'string'
+ }
+ ],
+ examples: [
+ 'uwu!btcchange day',
+ 'uwu!bitcoinchange hour',
+ 'uwu!cryptochange week',
+ 'uwu!btcc day'
+ ],
+ userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
+ });
+ }
+ run(msg, { timeAmount }) {
+ if (timeAmount == 'day') {
+ btc.getPercentageChangeLastDay().then(percentage => {
+ msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random());
+ });
+ } else if (timeAmount == 'hour') {
+ btc.getPercentageChangeLastHour().then(percentage => {
+ msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random());
+ });
+ } else if (timeAmount == 'week') {
+ btc.getPercentageChangeLastWeek().then(percentage => {
+ msg.reply('The fluction amount of *Bitcoin* in the last **' + timeAmount + '** is **' + percentage + '%**. ' + emoji.random());
+ });
+ } else {
+ msg.reply('*' + timeAmount + '* is not a valid range. ' + emoji.random());
+ }
+ }
+}; \ No newline at end of file
diff --git a/src/commands/utility/clear.js b/src/commands/utility/clear.js
new file mode 100644
index 0000000..6871cca
--- /dev/null
+++ b/src/commands/utility/clear.js
@@ -0,0 +1,72 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('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, { 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 => {
+ deleteNotificationMessage.delete({ timeout: 1000 });
+ });
+ } else if (isNaN(deleteAmount)) {
+ msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => {
+ deleteNotificationMessage.delete({ timeout: 1000 });
+ });
+ } else if (deleteAmount > 100) {
+ msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => {
+ deleteNotificationMessage.delete({ timeout: 1000 });
+ });
+ } else if (deleteAmount < 1) {
+ msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => {
+ 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 => {
+ deleteNotificationMessage.delete({ timeout: 1000 });
+ });
+ }
+ } else {
+ msg.reply('Insufficent perms. ' + emoji.random());
+ }
+ }
+}; \ No newline at end of file
diff --git a/src/commands/utility/membercount.js b/src/commands/utility/membercount.js
new file mode 100644
index 0000000..1178236
--- /dev/null
+++ b/src/commands/utility/membercount.js
@@ -0,0 +1,29 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('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) {
+ 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/server.js b/src/commands/utility/server.js
new file mode 100644
index 0000000..58555fa
--- /dev/null
+++ b/src/commands/utility/server.js
@@ -0,0 +1,54 @@
+const { Command } = require('discord.js-commando');
+const { MessageEmbed } = require('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) {
+ 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.filter(c => c.type === 'text').size}`, true)
+ .addField('Voice channels', `${msg.guild.channels.filter(c => c.type === 'voice').size}`, true)
+ .addField('Guild created', `${msg.guild.createdAt}`, false)
+ .addField(`${this.client.user.username} joined`, `${msg.guild.members.get('699473263998271489').joinedAt}`)
+ .setColor(0xFFCC4D);
+
+ msg.channel.send(embed);
+ }
+}; \ No newline at end of file
diff --git a/src/commands/utility/servers.ts b/src/commands/utility/servers.ts
new file mode 100644
index 0000000..1b3ce0f
--- /dev/null
+++ b/src/commands/utility/servers.ts
@@ -0,0 +1,28 @@
+import { Command } from 'discord.js-commando';
+import { MessageEmbed, Message } from 'discord.js';
+import emoji from 'emoji-random';
+
+module.exports = class ServersUtility extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'servers',
+ aliases: ['servercount', 'scount', 'serverc'],
+ group: 'utility',
+ memberName: 'servers',
+ description: 'Tells you the amount of servers uwufy is in.',
+ userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
+ });
+ }
+ run(msg: Message) {
+ msg.channel.send('Please wait..').then(m => {
+ m.edit(`** **`);
+
+ let emb = new MessageEmbed()
+ .setDescription(`Currently running on 31${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
new file mode 100644
index 0000000..eebd031
--- /dev/null
+++ b/src/commands/utility/uptime.ts
@@ -0,0 +1,40 @@
+import { Command } from 'discord.js-commando';
+import { duration as _duration } from 'moment';
+import 'moment-duration-format';
+// @ts-ignore
+import emoji from 'emoji-random';
+import { MessageEmbed, Message } 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: Message) {
+ 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('uwufier has been up for ' + duration + '. ' + emoji.random())
+ .setColor(0xFFCC4D)
+
+ msg.channel.send(emb);
+ });
+ }
+} \ No newline at end of file