mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 10:19:11 +02:00
Fix Everything
This commit is contained in:
+33
-41
@@ -24,11 +24,8 @@ module.exports = class BanCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: (reason) => {
|
||||
if (reason.length < 140) {
|
||||
return true;
|
||||
} else {
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
if (reason.length < 140) return true;
|
||||
else return 'Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -38,9 +35,7 @@ module.exports = class BanCommand extends Command {
|
||||
async run(msg, args) {
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
const { member, reason } = args;
|
||||
if (!member.bannable) {
|
||||
return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
}
|
||||
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
await msg.say(`Are you sure you want to ban ${member.user.tag} (${member.id})?`);
|
||||
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
|
||||
@@ -48,43 +43,40 @@ module.exports = class BanCommand extends Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (['y', 'yes'].includes(collected.first().content.toLowerCase())) {
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were banned from ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
await msg.say(`Successfully banned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the ban to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
if (!['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting Ban.');
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were banned from ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
await msg.say(`Successfully banned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the ban to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Ban
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFF0000)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Ban
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFF0000)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Ban
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} else {
|
||||
return msg.say('Aborting Ban.');
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} catch (err) {
|
||||
return msg.say('Aborting Ban.');
|
||||
|
||||
+31
-41
@@ -23,12 +23,9 @@ module.exports = class KickCommand extends Command {
|
||||
key: 'reason',
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: reason => {
|
||||
if (reason.length < 140) {
|
||||
return true;
|
||||
} else {
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
validate: (reason) => {
|
||||
if (reason.length < 140) return true;
|
||||
else return 'Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -38,9 +35,7 @@ module.exports = class KickCommand extends Command {
|
||||
async run(msg, args) {
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
const { member, reason } = args;
|
||||
if (!member.kickable) {
|
||||
return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
|
||||
}
|
||||
if (!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
await msg.say(`Are you sure you want to kick ${member.user.tag} (${member.id})?`);
|
||||
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
|
||||
@@ -48,42 +43,37 @@ module.exports = class KickCommand extends Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (['y', 'yes'].includes(collected.first().content.toLowerCase())) {
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were kicked from ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await member.kick({
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
await msg.say(`Successfully kicked ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the kick to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
if (!['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting Kick.');
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were kicked from ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await member.kick({ reason: `${msg.author.tag}: ${reason}` });
|
||||
await msg.say(`Successfully kicked ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the kick to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Kick
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFFA500)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Kick
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFFA500)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Kick
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} else {
|
||||
return msg.say('Aborting Kick.');
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} catch (err) {
|
||||
return msg.say('Aborting Kick.');
|
||||
|
||||
@@ -18,11 +18,8 @@ module.exports = class LockdownCommand extends Command {
|
||||
type: 'string',
|
||||
default: 'start',
|
||||
validate: (type) => {
|
||||
if (['start', 'stop'].includes(type.toLowerCase())) {
|
||||
return true;
|
||||
} else {
|
||||
return 'Please enter either `start` or `stop`.';
|
||||
}
|
||||
if (['start', 'stop'].includes(type.toLowerCase())) return true;
|
||||
else return 'Please enter either `start` or `stop`.';
|
||||
},
|
||||
parse: (type) => type.toLowerCase()
|
||||
}
|
||||
@@ -38,7 +35,7 @@ module.exports = class LockdownCommand extends Command {
|
||||
Lockdown Started, users without Administrator can no longer post messages.
|
||||
Please use \`lockdown stop\` to end the lockdown.
|
||||
`);
|
||||
} else if (type === 'stop') {
|
||||
} else {
|
||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: null });
|
||||
return msg.say('Lockdown Ended.');
|
||||
}
|
||||
|
||||
@@ -21,11 +21,8 @@ module.exports = class PruneCommand extends Command {
|
||||
prompt: 'How many messages do you want to delete? Limit of up to 99.',
|
||||
type: 'integer',
|
||||
validate: (count) => {
|
||||
if (count < 100 && count > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return 'Invalid Count. Count must be from 1-99.';
|
||||
}
|
||||
if (count < 100 && count > 0) return true;
|
||||
else return 'Count must be from 1-99.';
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -24,11 +24,8 @@ module.exports = class SoftbanCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: (reason) => {
|
||||
if (reason.length < 140) {
|
||||
return true;
|
||||
} else {
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
if (reason.length < 140) return true;
|
||||
else return 'Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -38,9 +35,7 @@ module.exports = class SoftbanCommand extends Command {
|
||||
async run(msg, args) {
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
const { member, reason } = args;
|
||||
if (!member.bannable) {
|
||||
return msg.say('This member is not softbannable. Perhaps they have a higher role than me?');
|
||||
}
|
||||
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
await msg.say(`Are you sure you want to softban ${member.user.tag} (${member.id})?`);
|
||||
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
|
||||
@@ -48,44 +43,41 @@ module.exports = class SoftbanCommand extends Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (['y', 'yes'].includes(collected.first().content.toLowerCase())) {
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were softbanned from ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} 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');
|
||||
await msg.say(`Successfully softbanned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the softban to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
if (!['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting Softban.');
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were softbanned from ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} 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');
|
||||
await msg.say(`Successfully softbanned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the softban to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Softban
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFF4500)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Softban
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFF4500)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Softban
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} else {
|
||||
return msg.say('Aborting Softban.');
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} catch (err) {
|
||||
return msg.say('Aborting Softban.');
|
||||
|
||||
@@ -24,11 +24,8 @@ module.exports = class UnbanCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: (reason) => {
|
||||
if (reason.length < 140) {
|
||||
return true;
|
||||
} else {
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
if (reason.length < 140) return true;
|
||||
else return 'Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -39,9 +36,7 @@ module.exports = class UnbanCommand extends Command {
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
const { id, reason } = args;
|
||||
const bans = await msg.guild.fetchBans();
|
||||
if (!bans.has(id)) {
|
||||
return msg.say('This ID is not in the Guild Banlist.');
|
||||
}
|
||||
if (!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.');
|
||||
const member = bans.get(id).user;
|
||||
try {
|
||||
await msg.say(`Are you sure you want to unban ${member.tag} (${member.id})?`);
|
||||
@@ -50,32 +45,29 @@ module.exports = class UnbanCommand extends Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (['y', 'yes'].includes(collected.first().content.toLowerCase())) {
|
||||
await msg.guild.unban(member, `${msg.author.tag}: ${reason}`);
|
||||
await msg.say(`Successfully unbanned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the unban to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
if (!['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting Unban.');
|
||||
await msg.guild.unban(member, `${msg.author.tag}: ${reason}`);
|
||||
await msg.say(`Successfully unbanned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the unban to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
**Member:** ${member.tag} (${member.id})
|
||||
**Action:** Unban
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0x00AE86)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.tag} (${member.id})
|
||||
**Action:** Unban
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0x00AE86)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.tag} (${member.id})
|
||||
**Action:** Unban
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} else {
|
||||
return msg.say('Aborting Unban.');
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} catch (err) {
|
||||
return msg.say('Aborting Unban.');
|
||||
|
||||
+28
-34
@@ -23,11 +23,8 @@ module.exports = class WarnCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: (reason) => {
|
||||
if (reason.length < 140) {
|
||||
return true;
|
||||
} else {
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
if (reason.length < 140) return true;
|
||||
else return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -44,39 +41,36 @@ module.exports = class WarnCommand extends Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (['y', 'yes'].includes(collected.first().content.toLowerCase())) {
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were warned in ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await msg.say(`Successfully warned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the warn to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
if (!['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting Warn.');
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were warned in ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await msg.say(`Successfully warned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the warn to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Warn
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFFFF00)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Warn
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFFFF00)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Warn
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} else {
|
||||
return msg.say('Aborting Warn.');
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} catch (err) {
|
||||
return msg.say('Aborting Warn.');
|
||||
|
||||
Reference in New Issue
Block a user