mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 08:14:47 +02:00
Remove shutdown and webhook (webhook is moving to Fidget)
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { WEBHOOK_URL } = process.env;
|
||||
|
||||
module.exports = class WebhookCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'webhook',
|
||||
aliases: ['rin', 'rin-say'],
|
||||
group: 'text-edit',
|
||||
memberName: 'webhook',
|
||||
description: 'Posts a message to the webhook defined in your `process.env`.',
|
||||
args: [
|
||||
{
|
||||
key: 'content',
|
||||
prompt: 'What text would you like the webhook to say?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
hasPermission(msg) {
|
||||
return this.client.isOwner(msg.author) || `The \`${this.name}\` command can only be used by the bot owner.`;
|
||||
}
|
||||
|
||||
async run(msg, { content }) {
|
||||
if (msg.channel.type === 'text' && msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) {
|
||||
await msg.delete();
|
||||
}
|
||||
try {
|
||||
await snekfetch
|
||||
.post(WEBHOOK_URL)
|
||||
.send({ content });
|
||||
return null;
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class ShutdownCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'shutdown',
|
||||
aliases: ['restart', 'power-off', 'die'],
|
||||
group: 'util',
|
||||
memberName: 'shutdown',
|
||||
description: 'Shuts down the current shard, or all shards.',
|
||||
guarded: true,
|
||||
args: [
|
||||
{
|
||||
key: 'all',
|
||||
prompt: 'Would you like to shutdown all shards?',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
hasPermission(msg) {
|
||||
return this.client.isOwner(msg.author) || `The \`${this.name}\` command can only be used by the bot owner.`;
|
||||
}
|
||||
|
||||
async run(msg, { all }) {
|
||||
await msg.say(`Shutting down ${all ? 'all shards' : 'this shard'}...`);
|
||||
if (all) await this.client.shard.broadcastEval('process.exit(0)');
|
||||
else process.exit(0);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user