summaryrefslogtreecommitdiff
path: root/server/src/commands/owner
diff options
context:
space:
mode:
author8cy <[email protected]>2020-07-23 23:24:17 -0700
committer8cy <[email protected]>2020-07-23 23:24:17 -0700
commitbb511abc03bb66848947e37a999502b813c77269 (patch)
tree612c010fc8317e1cdf11471a18aad0270819d33e /server/src/commands/owner
parentfix: if clear amount equal or over 100, round down to 99 (diff)
downloaddep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz
dep-core-bb511abc03bb66848947e37a999502b813c77269.zip
goodbye old uwufier :cry:
Diffstat (limited to 'server/src/commands/owner')
-rw-r--r--server/src/commands/owner/DM.ts90
-rw-r--r--server/src/commands/owner/IP.ts27
-rw-r--r--server/src/commands/owner/Reload.ts40
-rw-r--r--server/src/commands/owner/ServerCount.ts24
-rw-r--r--server/src/commands/owner/Status.ts35
-rw-r--r--server/src/commands/owner/Username.ts35
6 files changed, 251 insertions, 0 deletions
diff --git a/server/src/commands/owner/DM.ts b/server/src/commands/owner/DM.ts
new file mode 100644
index 0000000..e0e793a
--- /dev/null
+++ b/server/src/commands/owner/DM.ts
@@ -0,0 +1,90 @@
+import { Command } from 'discord-akairo';
+import { Message } from 'discord.js';
+import { colour } from '../../Config';
+
+export default class DMOwner extends Command {
+ public constructor() {
+ super('dm', {
+ aliases: ['dm', 'pm'],
+ category: 'owner',
+ description: {
+ content: 'DM a specified user.',
+ usage: '[user id] [message]',
+ examples: [
+ '217348698294714370 hi'
+ ]
+ },
+ ratelimit: 3,
+ args: [
+ {
+ id: 'user',
+ type: 'string'
+ },
+ {
+ id: 'type',
+ type: 'string',
+ prompt: {
+ start: 'What type of DM would you like to send the specified user?',
+ retry: 'That is not a valid DM type!'
+ }
+ },
+ {
+ id: 'text',
+ type: 'string',
+ prompt: {
+ start: 'What would you like to send to the specified user?'
+ },
+ match: 'rest'
+ }
+ ],
+ ownerOnly: true
+ });
+ }
+
+ public exec(msg: Message, { user, type, text }): Promise<Message> {
+ if (type == 'embed') {
+ function uuidv4() {
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
+ let r = Math.random() * 16 | 0, v = c == 'x' ? r : (4 & 0x3 | 0x8);
+ return v.toString(16);
+ });
+ }
+
+ const uuid = uuidv4();
+
+ user = this.client.users.resolve(user);
+ if (!user) return msg.channel.send('An incorrect user ID was provided.');
+
+ const embed = this.client.util.embed()
+ .setTitle('You received a message from the developer!')
+ .setColor(colour)
+ .setDescription(text)
+ .setFooter(`If you wish to respond, use the following command: ${this.client.commandHandler.prefix}feedback --reply ${uuid} <message>`)
+ .setTimestamp();
+
+ let attachment = (msg.attachments).array();
+ if (attachment[0]) {
+ this.client.users.resolve(user).send(embed, { files: [attachment[0].url] })
+ .then(() => { return msg.channel.send(`A DM has successfully been sent to ${user.username}.`)})
+ .catch(() => { return msg.channel.send(`Could not send a DM to ${user.username}.`)});
+ } else {
+ this.client.users.resolve(user).send(embed)
+ .then(() => { return msg.channel.send(`A DM has successfully been sent to ${user.tag}.`)})
+ .catch(() => { return msg.channel.send(`Could not send a DM to ${user.tag}.`)});
+ }
+ } else if (type === 'normal') {
+ let attachment = (msg.attachments).array();
+ if (attachment[0]) {
+ this.client.users.resolve(user).send(text, { files: [attachment[0].url] })
+ .then(() => { return msg.channel.send(`A DM has successfully been sent to ${user.username}.`)})
+ .catch(() => { return msg.channel.send(`Could not send a DM to ${user.username}.`)});
+ } else {
+ this.client.users.resolve(user).send(text)
+ .then(() => { return msg.channel.send(`A DM has successfully been sent to ${user.tag}.`)})
+ .catch(() => { return msg.channel.send(`Could not send a DM to ${user.tag}.`)});
+ }
+ }
+
+ return;
+ }
+} \ No newline at end of file
diff --git a/server/src/commands/owner/IP.ts b/server/src/commands/owner/IP.ts
new file mode 100644
index 0000000..244c11f
--- /dev/null
+++ b/server/src/commands/owner/IP.ts
@@ -0,0 +1,27 @@
+import { Command } from 'discord-akairo';
+import { Message } from 'discord.js';
+import request from 'node-superfetch';
+
+export default class IPOwner extends Command {
+ public constructor() {
+ super('ip', {
+ aliases: ['ip'],
+ category: 'owner',
+ description: {
+ content: 'Gives you the bot\'s IP address.',
+ usage: '',
+ examples: [
+ ''
+ ]
+ },
+ ratelimit: 3,
+ ownerOnly: true
+ });
+ }
+
+ public async exec(msg: Message): Promise<Message> {
+ let { body } = await request.get('https://api.ipify.org').query({ format: 'json' });
+ //@ts-ignore
+ return msg.reply(`${this.client.user.username}'s IP address is **${body.ip}**. *Which script kiddie in chat asked you to send this zzz. -Sin*`);
+ }
+} \ No newline at end of file
diff --git a/server/src/commands/owner/Reload.ts b/server/src/commands/owner/Reload.ts
new file mode 100644
index 0000000..ac7bd1f
--- /dev/null
+++ b/server/src/commands/owner/Reload.ts
@@ -0,0 +1,40 @@
+import { Command } from 'discord-akairo';
+import { Message } from 'discord.js';
+
+export default class ReloadOwner extends Command {
+ public constructor() {
+ super('reload', {
+ aliases: ['reload', 'reboot', 'reloadlistener'],
+ category: 'owner',
+ description: {
+ content: 'Reload a command.',
+ usage: '[command]',
+ examples: [
+ 'ping'
+ ]
+ },
+ ratelimit: 3,
+ args: [
+ {
+ id: 'command',
+ type: 'string',
+ prompt: {
+ start: 'What command would you like to reload?',
+ },
+ match: 'rest'
+ }
+ ],
+ ownerOnly: true
+ });
+ }
+
+ public exec(msg: Message, { command }): Promise<Message> {
+ if (msg.util.parsed.alias == 'reloadlistener') {
+ this.client.listenerHandler.reload(command);
+ return msg.channel.send(`Successfully reloaded the listener ${command}`);
+ } else {
+ this.handler.reload(command);
+ return msg.channel.send(`Successfully reloaded the command ${command}`);
+ }
+ }
+} \ No newline at end of file
diff --git a/server/src/commands/owner/ServerCount.ts b/server/src/commands/owner/ServerCount.ts
new file mode 100644
index 0000000..5068c22
--- /dev/null
+++ b/server/src/commands/owner/ServerCount.ts
@@ -0,0 +1,24 @@
+import { Command } from 'discord-akairo';
+import { Message } from 'discord.js';
+
+export default class ServerCountOwner extends Command {
+ public constructor() {
+ super('servercount', {
+ aliases: ['servercount', 'server-count'],
+ category: 'owner',
+ description: {
+ content: 'Check the amount of servers the bot is in.',
+ usage: '',
+ examples: [
+ ''
+ ]
+ },
+ ratelimit: 3,
+ ownerOnly: true
+ });
+ }
+
+ public exec(msg: Message): Promise<Message> {
+ return msg.channel.send(`${this.client.user.username} is currently in **${this.client.guilds.cache.size}** server(s).`);
+ }
+} \ No newline at end of file
diff --git a/server/src/commands/owner/Status.ts b/server/src/commands/owner/Status.ts
new file mode 100644
index 0000000..8bf8dad
--- /dev/null
+++ b/server/src/commands/owner/Status.ts
@@ -0,0 +1,35 @@
+import { Command } from 'discord-akairo';
+import { Message } from 'discord.js';
+
+export default class StatusOwner extends Command {
+ public constructor() {
+ super('status', {
+ aliases: ['status'],
+ category: 'owner',
+ description: {
+ content: 'Change the status of the bot.',
+ usage: '[status message]',
+ examples: [
+ 'hello, world!'
+ ]
+ },
+ ratelimit: 3,
+ args: [
+ {
+ id: 'status',
+ type: 'string',
+ prompt: {
+ start: 'Which status would you like to give me?',
+ },
+ match: 'rest'
+ }
+ ],
+ ownerOnly: true
+ });
+ }
+
+ public exec(msg: Message, { status }): Promise<Message> {
+ this.client.user.setActivity(status);
+ return msg.channel.send(`My status has not been set to ${status}!`);
+ }
+} \ No newline at end of file
diff --git a/server/src/commands/owner/Username.ts b/server/src/commands/owner/Username.ts
new file mode 100644
index 0000000..df6d6c4
--- /dev/null
+++ b/server/src/commands/owner/Username.ts
@@ -0,0 +1,35 @@
+import { Command } from 'discord-akairo';
+import { Message } from 'discord.js';
+
+export default class UsernameOwner extends Command {
+ public constructor() {
+ super('username', {
+ aliases: ['username'],
+ category: 'owner',
+ description: {
+ content: 'Change the username of the bot.',
+ usage: '[username]',
+ examples: [
+ 'Aki'
+ ]
+ },
+ ratelimit: 3,
+ args: [
+ {
+ id: 'username',
+ type: 'string',
+ prompt: {
+ start: 'What username would you like to give me?',
+ },
+ match: 'rest'
+ }
+ ],
+ ownerOnly: true
+ });
+ }
+
+ public exec(msg: Message, { username }): Promise<Message> {
+ this.client.user.setUsername(username);
+ return msg.channel.send(`My username has now been set to ${username}!`)
+ }
+} \ No newline at end of file