summaryrefslogtreecommitdiff
path: root/src/commands/minecraft/minecraftserverstatus.ts
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 /src/commands/minecraft/minecraftserverstatus.ts
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 'src/commands/minecraft/minecraftserverstatus.ts')
-rw-r--r--src/commands/minecraft/minecraftserverstatus.ts76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/commands/minecraft/minecraftserverstatus.ts b/src/commands/minecraft/minecraftserverstatus.ts
deleted file mode 100644
index 706b43f..0000000
--- a/src/commands/minecraft/minecraftserverstatus.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
-import { MessageEmbed } from 'discord.js';
-import axios from 'axios'
-//@ts-ignore no types
-import emoji from 'emoji-random'
-
-module.exports = class MinecraftServerMinecraft extends Command {
- constructor(client: CommandoClient) {
- super(client, {
- name: 'minecraftserverstatus',
- aliases: [
- 'mcserverstatus',
- 'minecraft-server-status',
- 'mcss'
- ],
- group: 'utility',
- memberName: 'minecraftserverstatus',
- description: 'Grabs you the server status of a Minecraft server.',
- examples: [
- 'uwu!minecraftserverstatus',
- 'uwu!mcss'
- ],
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
- clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
- throttling: {
- usages: 5,
- duration: 30
- },
- args: [
- {
- key: 'ip',
- prompt: 'What is the IP of the server?',
- type: 'string'
- },
- {
- key: 'port',
- prompt: 'What is the port of the server?',
- type: 'integer',
- default: '25565',
- max: 65535,
- min: 1
- }
- ]
- });
- }
- async run(msg: CommandoMessage, { ip, port }: any) {
- const res = (
- await axios(`https://mcapi.us/server/status?ip=${ip}&port=${port}`).catch(err => {
- console.error(err)
- return msg.reply('Woops, an error has occured. ' + emoji.random())
- })
- //@ts-ignore yes this exists...
- ).data
-
- if (res.status !== 'success') {
- return msg.reply('Woops, there was an error with your request. ' + emoji.random())
- }
-
- let emb = new MessageEmbed()
- .setTitle(ip)
- .setTimestamp(res.last_updated)
- .setColor(0xFFCC4D)
-
- if (res.online) {
- emb.addField('Server Status', 'Currentaly online.', true)
- emb.addField('Version', res.server.name, true)
- emb.addField('Members', `${res.players.now}/${res.players.max}`, true)
- emb.addField('MOTD', `\`\`\`${res.motd}\`\`\``, true)
- } else if (res.last_online) {
- emb.addField('Server Status', `Offline. Last seen ${new Date(res.last_online)}`, true)
- } else {
- emb.addField('Server Status', 'Offline. Never seen online before.', true)
- }
- return msg.reply(emb)
- }
-}; \ No newline at end of file