mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Catch some stuff
This commit is contained in:
+2
-4
@@ -1,4 +1,4 @@
|
||||
const { TOKEN, OWNERS, COMMAND_PREFIX, INVITE, DBOTS_KEY, DBOTSORG_KEY } = process.env;
|
||||
const { TOKEN, OWNERS, COMMAND_PREFIX, INVITE } = process.env;
|
||||
const path = require('path');
|
||||
const CommandoClient = require('./structures/CommandoClient');
|
||||
const client = new CommandoClient({
|
||||
@@ -9,9 +9,7 @@ const client = new CommandoClient({
|
||||
unknownCommandResponse: false,
|
||||
disabledEvents: ['TYPING_START'],
|
||||
messageCacheLifetime: 600,
|
||||
messageSweepInterval: 120,
|
||||
dBotsToken: DBOTS_KEY,
|
||||
dBotsOrgToken: DBOTSORG_KEY
|
||||
messageSweepInterval: 120
|
||||
});
|
||||
|
||||
client.registry
|
||||
|
||||
@@ -50,10 +50,14 @@ module.exports = class BanCommand extends Command {
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
try {
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
} catch (err) {
|
||||
return msg.say(`Failed to ban ${member.user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully banned ${member.user.tag}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ module.exports = class HackbanCommand extends Command {
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
} catch (err) {
|
||||
return msg.say(`Could not hackban the user: \`${err.message}\``);
|
||||
return msg.say(`Failed to hackban ${user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully hackbanned ${user.tag}.`);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,11 @@ module.exports = class KickCommand extends Command {
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
await member.kick(`${msg.author.tag}: ${reason}`);
|
||||
try {
|
||||
await member.kick(`${msg.author.tag}: ${reason}`);
|
||||
} catch (err) {
|
||||
return msg.say(`Failed to kick ${member.user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully kicked ${member.user.tag}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -50,11 +50,15 @@ module.exports = class SoftbanCommand extends Command {
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason} (Softban)`
|
||||
});
|
||||
await msg.guild.unban(member.user, 'Softban');
|
||||
try {
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason} (Softban)`
|
||||
});
|
||||
await msg.guild.unban(member.user, 'Softban');
|
||||
} catch (err) {
|
||||
return msg.say(`Failed to softban ${member.user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully softbanned ${member.user.tag}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -38,7 +38,11 @@ module.exports = class UnbanCommand extends Command {
|
||||
await msg.say(`Are you sure you want to unban ${member.tag} (${member.id})?`);
|
||||
const verification = await verify(msg.channel, msg.author);
|
||||
if (!verification) return msg.say('Aborting.');
|
||||
await msg.guild.unban(member, `${msg.author.tag}: ${reason}`);
|
||||
try {
|
||||
await msg.guild.unban(member, `${msg.author.tag}: ${reason}`);
|
||||
} catch (err) {
|
||||
return msg.say(`Failed to unban ${member.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully unbanned ${member.tag}.`);
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "47.6.0",
|
||||
"version": "47.6.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
const { Client } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { DBOTS_KEY, DBOTSORG_KEY } = process.env;
|
||||
|
||||
class CommandoClient extends Client {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
Object.defineProperty(this, 'dBotsToken', { value: options.dBotsToken });
|
||||
Object.defineProperty(this, 'dBotsOrgToken', { value: options.dBotsOrgToken });
|
||||
Object.defineProperty(this, 'dBotsToken', { value: DBOTS_KEY });
|
||||
Object.defineProperty(this, 'dBotsOrgToken', { value: DBOTSORG_KEY });
|
||||
|
||||
this.on('guildCreate', () => {
|
||||
this.dBots();
|
||||
|
||||
Reference in New Issue
Block a user