mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-11 15:57:50 +02:00
msg
This commit is contained in:
+12
-12
@@ -34,36 +34,36 @@ module.exports = class BanCommand extends Command {
|
||||
return msg.member.permissions.has('BAN_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff'));
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
return message.say('This Command requires the `Ban Members` Permission.');
|
||||
const modlogs = message.guild.channels.find('name', message.guild.settings.get('modLog', 'mod_logs'));
|
||||
async run(msg, args) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
return msg.say('This Command requires the `Ban Members` Permission.');
|
||||
const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs'));
|
||||
if (!modlogs)
|
||||
return message.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
if (!member.bannable)
|
||||
return message.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
try {
|
||||
await member.send(`You were banned from ${message.guild.name}!\nReason: ${reason}.`);
|
||||
await member.send(`You were banned from ${msg.guild.name}!\nReason: ${reason}.`);
|
||||
} catch (err) {
|
||||
await message.say('Failed to send DM to user.');
|
||||
await msg.say('Failed to send DM to user.');
|
||||
}
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason
|
||||
});
|
||||
await message.say(':ok_hand:');
|
||||
await msg.say(':ok_hand:');
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(message.author.tag, message.author.displayAvatarURL)
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFF0000)
|
||||
.setTimestamp()
|
||||
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Ban\n**Reason:** ${reason}`);
|
||||
return modlogs.send({embed});
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+12
-12
@@ -31,35 +31,35 @@ module.exports = class KickCommand extends Command {
|
||||
return msg.member.permissions.has('KICK_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff'));
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
|
||||
return message.say('This Command requires the `Kick Members` Permission.');
|
||||
const modlogs = message.guild.channels.find('name', message.guild.settings.get('modLog', 'mod_logs'));
|
||||
async run(msg, args) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
|
||||
return msg.say('This Command requires the `Kick Members` Permission.');
|
||||
const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs'));
|
||||
if (!modlogs)
|
||||
return message.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
if (!member.kickable)
|
||||
return message.say('This member is not kickable. Perhaps they have a higher role than me?');
|
||||
return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
try {
|
||||
await member.send(`You were kicked from ${message.guild.name}!\nReason: ${reason}.`);
|
||||
await member.send(`You were kicked from ${msg.guild.name}!\nReason: ${reason}.`);
|
||||
} catch (err) {
|
||||
await message.say('Failed to send DM.');
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
await member.kick({
|
||||
reason
|
||||
});
|
||||
await message.say(':ok_hand:');
|
||||
await msg.say(':ok_hand:');
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(message.author.tag, message.author.displayAvatarURL)
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFFA500)
|
||||
.setTimestamp()
|
||||
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Kick\n**Reason:** ${reason}`);
|
||||
return modlogs.send({embed});
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,27 +26,27 @@ module.exports = class LockdownCommand extends Command {
|
||||
return msg.member.permissions.has('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).has('ADMINISTRATOR'))
|
||||
return message.say('This Command requires the `Administrator` Permission.');
|
||||
async run(msg, args) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ADMINISTRATOR'))
|
||||
return msg.say('This Command requires the `Administrator` Permission.');
|
||||
const { type } = args;
|
||||
if (type === 'start') {
|
||||
try {
|
||||
await message.channel.overwritePermissions(message.guild.defaultRole, {
|
||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, {
|
||||
SEND_MESSAGES: false
|
||||
});
|
||||
return message.say('Lockdown Started, users without Administrator can no longer post messages. Please use `;lockdown stop` to end the lockdown.');
|
||||
return msg.say('Lockdown Started, users without Administrator can no longer post messages. Please use `;lockdown stop` to end the lockdown.');
|
||||
} catch (err) {
|
||||
return message.say('Something went wrong!');
|
||||
return msg.say('Something went wrong!');
|
||||
}
|
||||
} else if (type === 'stop') {
|
||||
try {
|
||||
await message.channel.overwritePermissions(message.guild.defaultRole, {
|
||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, {
|
||||
SEND_MESSAGES: true
|
||||
});
|
||||
return message.say('Lockdown Ended, users without Administrator can now post messages.');
|
||||
return msg.say('Lockdown Ended, users without Administrator can now post messages.');
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,20 +29,20 @@ module.exports = class PruneCommand extends Command {
|
||||
return msg.member.permissions.has('MANAGE_MESSAGES') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff'));
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).has('READ_MESSAGE_HISTORY'))
|
||||
return message.say('This Command requires the `Read Message History` Permission.');
|
||||
if (!message.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
|
||||
return message.say('This Command requires the `Manage Messages` Permission.');
|
||||
async run(msg, args) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('READ_MESSAGE_HISTORY'))
|
||||
return msg.say('This Command requires the `Read Message History` Permission.');
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
|
||||
return msg.say('This Command requires the `Manage Messages` Permission.');
|
||||
const { count } = args;
|
||||
try {
|
||||
const messages = await message.channel.fetchMessages({
|
||||
const messages = await msg.channel.fetchMessages({
|
||||
limit: count + 1
|
||||
});
|
||||
await message.channel.bulkDelete(messages, true);
|
||||
await msg.channel.bulkDelete(messages, true);
|
||||
return null;
|
||||
} catch (err) {
|
||||
return message.say('There are no messages younger than two weeks that can be deleted.');
|
||||
return msg.say('There are no messages younger than two weeks that can be deleted.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -31,39 +31,39 @@ module.exports = class SoftbanCommand extends Command {
|
||||
return msg.member.permissions.has('KICK_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff'));
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
return message.say('This Command requires the `Ban Members` Permission.');
|
||||
if (!message.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
|
||||
return message.say('This Command requires the `Kick Members` Permission.');
|
||||
const modlogs = message.guild.channels.find('name', message.guild.settings.get('modLog', 'mod_logs'));
|
||||
async run(msg, args) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
return msg.say('This Command requires the `Ban Members` Permission.');
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
|
||||
return msg.say('This Command requires the `Kick Members` Permission.');
|
||||
const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs'));
|
||||
if (!modlogs)
|
||||
return message.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
if (!member.bannable)
|
||||
return message.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
try {
|
||||
await member.send(`You were softbanned from ${message.guild.name}!\nReason: ${reason}.`);
|
||||
await member.send(`You were softbanned from ${msg.guild.name}!\nReason: ${reason}.`);
|
||||
} catch (err) {
|
||||
await message.say('Failed to send DM to user.');
|
||||
await msg.say('Failed to send DM to user.');
|
||||
}
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason
|
||||
});
|
||||
await message.guild.unban(member.user);
|
||||
await message.say(':ok_hand:');
|
||||
await msg.guild.unban(member.user);
|
||||
await msg.say(':ok_hand:');
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(message.author.tag, message.author.displayAvatarURL)
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFF4500)
|
||||
.setTimestamp()
|
||||
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Softban\n**Reason:** ${reason}`);
|
||||
return modlogs.send({embed});
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -38,30 +38,30 @@ module.exports = class UnbanCommand extends Command {
|
||||
return msg.member.permissions.has('BAN_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff'));
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (!message.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
return message.say('This Command requires the `Ban Members` Permission.');
|
||||
const modlogs = message.guild.channels.find('name', message.guild.settings.get('modLog', 'mod_logs'));
|
||||
async run(msg, args) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
return msg.say('This Command requires the `Ban Members` Permission.');
|
||||
const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs'));
|
||||
if (!modlogs)
|
||||
return message.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { id, reason } = args;
|
||||
const bans = await message.guild.fetchBans();
|
||||
const bans = await msg.guild.fetchBans();
|
||||
if (!bans.has(id))
|
||||
return message.say('This ID is not in the Guild Banlist.');
|
||||
return msg.say('This ID is not in the Guild Banlist.');
|
||||
const member = bans.get(id);
|
||||
try {
|
||||
await message.guild.unban(member);
|
||||
await message.say(':ok_hand:');
|
||||
await msg.guild.unban(member);
|
||||
await msg.say(':ok_hand:');
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(message.author.tag, message.author.displayAvatarURL)
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0x00AE86)
|
||||
.setTimestamp()
|
||||
.setDescription(`**Member:** ${member.tag} (${member.id})\n**Action:** Unban\n**Reason:** ${reason}`);
|
||||
return modlogs.send({embed});
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,23 +30,23 @@ module.exports = class WarnCommand extends Command {
|
||||
return msg.member.permissions.has('KICK_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff'));
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const modlogs = message.guild.channels.find('name', message.guild.settings.get('modLog', 'mod_logs'));
|
||||
async run(msg, args) {
|
||||
const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs'));
|
||||
if (!modlogs)
|
||||
return message.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
try {
|
||||
await message.say(':ok_hand:');
|
||||
await msg.say(':ok_hand:');
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(message.author.tag, message.author.displayAvatarURL)
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFFFF00)
|
||||
.setTimestamp()
|
||||
.setDescription(`**Member:** ${member.user.tag} (${member.id})\n**Action:** Warn\n**Reason:** ${reason}`);
|
||||
return modlogs.send({embed});
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user