mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-15 00:12:38 +02:00
updoot
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class DonateCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'donate',
|
||||
aliases: ['patreon'],
|
||||
group: 'util',
|
||||
memberName: 'donate',
|
||||
description: 'Responds with Xiao\'s Patreon donation link.',
|
||||
guarded: true
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(stripIndents`
|
||||
Contribute to XiaoBot development!
|
||||
https://www.patreon.com/xiaobot
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -1,69 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class HelpCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'help',
|
||||
aliases: ['commands'],
|
||||
group: 'util',
|
||||
memberName: 'help',
|
||||
description: 'Displays a list of available commands, or detailed information for a specified command.',
|
||||
guarded: true,
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'command',
|
||||
prompt: 'Which command would you like to view the help for?',
|
||||
type: 'string',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const { command } = args;
|
||||
const commands = this.client.registry.findCommands(command, false, msg);
|
||||
const showAll = command && command.toLowerCase() === 'all';
|
||||
if (command && !showAll) {
|
||||
if (commands.length === 1) {
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle(`Command ${commands[0].name}`)
|
||||
.setDescription(stripIndents`
|
||||
${commands[0].description}
|
||||
${commands[0].details || ''}
|
||||
`)
|
||||
.addField('❯ Format',
|
||||
msg.anyUsage(`${commands[0].name} ${commands[0].format ? commands[0].format : ''}`))
|
||||
.addField('❯ Aliases',
|
||||
commands[0].aliases.join(', ') || 'None')
|
||||
.addField('❯ Group',
|
||||
commands[0].group.name);
|
||||
return msg.embed(embed);
|
||||
} else if (commands.length > 1) {
|
||||
return msg.say(`Multiple commands found: ${commands.map((c) => c.name).join(', ')}`);
|
||||
} else {
|
||||
return msg.say(`Could not identify command. Use ${msg.usage(null)} to view a list of commands.`);
|
||||
}
|
||||
} else {
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle(!showAll ? `Commands Available in ${msg.guild ? msg.guild.name : 'this DM'}` : 'All Commands')
|
||||
.setDescription(`Use ${msg.usage('<command>')} to view detailed information about a command.`)
|
||||
.setColor(0x00AE86);
|
||||
for (const group of this.client.registry.groups.values()) {
|
||||
embed.addField(`❯ ${group.name}`,
|
||||
showAll ?
|
||||
group.commands.map((c) => c.name).join(', ') || 'None' :
|
||||
group.commands.filter((c) => c.isUsable(msg)).map((c) => c.name).join(', ') || 'None');
|
||||
}
|
||||
try {
|
||||
await msg.direct({ embed });
|
||||
return msg.say(':mailbox_with_mail: Sent you a DM with information.');
|
||||
} catch (err) {
|
||||
return msg.say('Failed to send DM. You probably have DMs disabled.');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,46 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { version } = require('../../package');
|
||||
const moment = require('moment');
|
||||
require('moment-duration-format');
|
||||
|
||||
module.exports = class InfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'info',
|
||||
aliases: ['information', 'stats'],
|
||||
group: 'util',
|
||||
memberName: 'info',
|
||||
description: 'Responds with detailed bot information.',
|
||||
guarded: true,
|
||||
clientPermissions: ['EMBED_LINKS']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const guilds = await this.client.shard.fetchClientValues('guilds.size');
|
||||
const memory = await this.client.shard.broadcastEval('process.memoryUsage().heapUsed');
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x00AE86)
|
||||
.setFooter('©2017 dragonfire535#8081')
|
||||
.addField('❯ Servers',
|
||||
guilds.reduce((prev, val) => prev + val, 0), true)
|
||||
.addField('❯ Shards',
|
||||
this.client.options.shardCount, true)
|
||||
.addField('❯ Commands',
|
||||
this.client.registry.commands.size, true)
|
||||
.addField('❯ Source Code',
|
||||
'[View Here](https://github.com/dragonfire535/xiaobot)', true)
|
||||
.addField('❯ Memory Usage',
|
||||
`${Math.round(memory.reduce((prev, val) => prev + val, 0) / 1024 / 1024)}MB`, true)
|
||||
.addField('❯ Uptime',
|
||||
moment.duration(this.client.uptime).format('d[d]h[h]m[m]s[s]'), true)
|
||||
.addField('❯ Version',
|
||||
`v${version}`, true)
|
||||
.addField('❯ Node Version',
|
||||
process.version, true)
|
||||
.addField('❯ Library',
|
||||
'[discord.js](https://discord.js.org)[-commando](https://github.com/Gawdl3y/discord.js-commando)', true); // eslint-disable-line max-len
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class InviteCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'invite',
|
||||
group: 'util',
|
||||
memberName: 'invite',
|
||||
description: 'Responds with an invite for the bot and an invite to the home server.',
|
||||
guarded: true
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const invite = await this.client.generateInvite('1345846343');
|
||||
return msg.say(stripIndents`
|
||||
Add me to your server with this link:
|
||||
<${invite}>
|
||||
Or, come to my server with this link:
|
||||
${this.client.options.invite}
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class PingCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ping',
|
||||
aliases: ['pong', 'ping-pong'],
|
||||
group: 'util',
|
||||
memberName: 'ping',
|
||||
description: 'Checks the bot\'s ping to the Discord server.',
|
||||
guarded: true
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const message = await msg.say('Pinging...');
|
||||
return message.edit(stripIndents`
|
||||
:ping_pong: Pong! \`${Math.round(message.createdTimestamp - msg.createdTimestamp)}ms\`
|
||||
Heartbeat: \`${Math.round(this.client.ping)}ms\`
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class SettingHelpCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'setting-help',
|
||||
group: 'util',
|
||||
memberName: 'setting-help',
|
||||
description: 'View help on how to set up settings.',
|
||||
guildOnly: true,
|
||||
guarded: true
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(stripIndents`
|
||||
**Invite Guard:** Place \`<inviteguard>\` in your default channel's topic. (${msg.guild.defaultChannel})
|
||||
**Mod Log Channel:** Place \`<modlog>\` in a channel's topic.
|
||||
**Portal Channel:** Place \`<portal>\` in a channel's topic.
|
||||
**Member Log Channel:** Place \`<memberlog>\` in a channel's topic.
|
||||
**Custom Join Message:** Place \`<joinmessage>message</joinmessage>\` in the Member Log's Channel.
|
||||
**Custom Leave Message:** Place \`<leavemessage>message</leavemessage>\` in the Member Log's Channel.
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -1,46 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const moment = require('moment');
|
||||
require('moment-duration-format');
|
||||
|
||||
module.exports = class ShardInfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'shard-info',
|
||||
aliases: ['shard', 'shard-stats'],
|
||||
group: 'util',
|
||||
memberName: 'shard-info',
|
||||
description: 'Responds with detailed information for a specific Shard.',
|
||||
guarded: true,
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'shard',
|
||||
prompt: 'Which Shard would you like to get data for?',
|
||||
type: 'integer',
|
||||
validate: (shard) => {
|
||||
if (shard < this.client.options.shardCount && shard > -1) return true;
|
||||
else return 'Invalid Shard ID';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const { shard } = args;
|
||||
const memory = await this.client.shard.broadcastEval('process.memoryUsage().heapUsed');
|
||||
const uptime = await this.client.shard.fetchClientValues('uptime');
|
||||
const guilds = await this.client.shard.fetchClientValues('guilds.size');
|
||||
const embed = new MessageEmbed()
|
||||
.setTitle(`Shard ${shard}`)
|
||||
.setColor(0x00AE86)
|
||||
.addField('❯ Servers',
|
||||
guilds[shard], true)
|
||||
.addField('❯ Memory Usage',
|
||||
`${Math.round(memory[shard] / 1024 / 1024)}MB`, true)
|
||||
.addField('❯ Uptime',
|
||||
moment.duration(uptime[shard]).format('d[d]h[h]m[m]s[s]'), true);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const moment = require('moment');
|
||||
require('moment-duration-format');
|
||||
|
||||
module.exports = class UptimeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'uptime',
|
||||
group: 'util',
|
||||
memberName: 'uptime',
|
||||
description: 'Responds with how long the bot has been active on this Shard.',
|
||||
guarded: true
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(moment.duration(this.client.uptime).format('d[ days], h[ hours], m[ minutes, and ]s[ seconds]'));
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { dbotsOrgKey } = require('../../config');
|
||||
|
||||
module.exports = class UpvotersCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'upvoters',
|
||||
aliases: ['upvote'],
|
||||
group: 'util',
|
||||
memberName: 'upvoters',
|
||||
description: 'Responds with Xiao\'s upvoters on Discord Bots.',
|
||||
guarded: true
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const { body } = await snekfetch
|
||||
.get(`https://discordbots.org/api/bots/${this.client.user.id}/votes`)
|
||||
.set({ Authorization: dbotsOrgKey });
|
||||
const haste = await snekfetch
|
||||
.post('https://hastebin.com/documents')
|
||||
.send(body.map((user) => `${user.username}#${user.discriminator}`).join('\n'));
|
||||
return msg.say(stripIndents`
|
||||
Upvote Xiao and get rewards while joining ${body.length} others!
|
||||
<https://discordbots.org/bot/${this.client.user.id}>
|
||||
List of Upvoters: <https://hastebin.com/${haste.body.key}>
|
||||
`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user