From 035ec9133a142d64e35831baefa44659958f7d34 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 23 Apr 2021 11:44:17 -0400 Subject: [PATCH] Bot Info Command --- commands/info/bot.js | 57 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 commands/info/bot.js diff --git a/commands/info/bot.js b/commands/info/bot.js new file mode 100644 index 00000000..24f196ff --- /dev/null +++ b/commands/info/bot.js @@ -0,0 +1,57 @@ +const Command = require('../../structures/Command'); +const { MessageEmbed } = require('discord.js'); +const request = require('node-superfetch'); +const moment = require('moment'); +const { embedURL } = require('../../util/Util'); + +module.exports = class BotCommand extends Command { + constructor(client) { + super(client, { + name: 'bot', + aliases: ['discord-bot', 'bot-info', 'discord-bot-info'], + group: 'info', + memberName: 'bot', + description: 'Responds with information on a Discord bot.', + clientPermissions: ['EMBED_LINKS'], + credit: [ + { + name: 'Discord Bots', + url: 'https://discord.bots.gg/', + reason: 'API' + } + ], + args: [ + { + key: 'user', + prompt: 'What bot would you like to get information on?', + type: 'user' + } + ] + }); + } + + async run(msg, { user }) { + if (!user.bot) return msg.say('This user is not a bot.'); + try { + const { body } = await request.get(`https://discord.bots.gg/api/v1/bots/${user.id}`); + const embed = new MessageEmbed() + .setColor(0x000001) + .setTitle(`${body.username} by ${body.owner.username}#${body.owner.discriminator}`) + .setDescription(body.shortDescription) + .setAuthor('Discord Bots', 'https://i.imgur.com/OhZCqVd.jpg', 'https://discord.bots.gg/') + .setThumbnail(body.avatarURL) + .setURL(`https://discord.bots.gg/bots/${user.id}`) + .setFooter(user.id) + .addField('❯ Prefix', body.prefix || '???', true) + .addField('❯ Library', body.libraryName || '???', true) + .addField('❯ Servers', body.guildCount || '???', true) + .addField('❯ Invite', embedURL('Here', body.botInvite), true) + .addField('❯ Server', body.supportInvite ? embedURL('Here', body.supportInvite) : '???', true) + .addField('❯ Public List Date', moment.utc(body.addedDate).format('MM/DD/YYYY h:mm A'), true); + return msg.embed(embed); + } catch (err) { + if (err.status === 404) return msg.say('This bot is not publicly listed.'); + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/package.json b/package.json index d60ab296..51979cf7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "136.1.1", + "version": "136.2.0", "description": "Your personal server companion.", "main": "Xiao.js", "private": true,