mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Remove moderation group
This commit is contained in:
@@ -16,7 +16,6 @@ client.registry
|
||||
.registerGroups([
|
||||
['util', 'Utility'],
|
||||
['info', 'Discord Information'],
|
||||
['moderation', 'Moderation'],
|
||||
['random-res', 'Random Response'],
|
||||
['single-res', 'Single Response'],
|
||||
['events', 'Daily Events'],
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { verify } = require('../../util/Util');
|
||||
|
||||
module.exports = class BanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ban',
|
||||
aliases: ['banne'],
|
||||
group: 'moderation',
|
||||
memberName: 'ban',
|
||||
description: 'Bans a user.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['BAN_MEMBERS'],
|
||||
userPermissions: ['BAN_MEMBERS'],
|
||||
args: [
|
||||
{
|
||||
key: 'member',
|
||||
prompt: 'What member do you want to ban?',
|
||||
type: 'member'
|
||||
},
|
||||
{
|
||||
key: 'reason',
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
max: 140
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { member, reason }) {
|
||||
if (member.id === msg.author.id) return msg.reply('I don\'t think you want to ban yourself...');
|
||||
if (member.id === msg.guild.ownerID) return msg.reply('Don\'t you think that might be betraying your leader?');
|
||||
if (!member.bannable) return msg.reply('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
if (member.highestRole.position > msg.member.highestRole.position - 1) {
|
||||
return msg.reply('Your roles are too low to ban this member.');
|
||||
}
|
||||
await msg.say(`Are you sure you want to ban ${member.user.tag} (${member.id})?`);
|
||||
const verification = await verify(msg.channel, msg.author);
|
||||
if (!verification) return msg.say('Aborting.');
|
||||
try {
|
||||
await member.send(stripIndents`
|
||||
You were banned from ${msg.guild.name} by ${msg.author.tag}!
|
||||
**Reason**: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
try {
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
} catch (err) {
|
||||
return msg.reply(`Failed to ban ${member.user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully banned ${member.user.tag}.`);
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class ClearChannelCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'clear-channel',
|
||||
aliases: ['prune-all'],
|
||||
group: 'moderation',
|
||||
memberName: 'clear-channel',
|
||||
description: 'Deletes all messages in a channel by cloning it and then deleting it.',
|
||||
guildOnly: true,
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 30
|
||||
},
|
||||
clientPermissions: ['ADMINISTRATOR'],
|
||||
userPermissions: ['ADMINISTRATOR']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
if (!msg.channel.deletable) return msg.reply('This channel cannot be deleted.');
|
||||
const channel = await msg.channel.clone();
|
||||
if (msg.channel.parent) await channel.setParent(msg.channel.parent);
|
||||
await msg.channel.delete();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -1,57 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { verify } = require('../../util/Util');
|
||||
|
||||
module.exports = class HackbanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'hackban',
|
||||
aliases: ['hackbanne'],
|
||||
group: 'moderation',
|
||||
memberName: 'hackban',
|
||||
description: 'Bans a user who doesn\'t have to be in the server.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['BAN_MEMBERS'],
|
||||
userPermissions: ['ADMINISTRATOR'],
|
||||
args: [
|
||||
{
|
||||
key: 'id',
|
||||
prompt: 'What is the id of the member you want to hackban?',
|
||||
type: 'string',
|
||||
validate: id => {
|
||||
if (/^[0-9]+$/.test(id)) return true;
|
||||
return 'Invalid ID.';
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'reason',
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
max: 140
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { id, reason }) {
|
||||
if (id === msg.author.id) return msg.reply('I don\'t think you want to ban yourself...');
|
||||
if (id === msg.guild.ownerID) return msg.reply('Don\'t you think that might be betraying your leader?');
|
||||
let user;
|
||||
try {
|
||||
user = await this.client.users.fetch(id);
|
||||
} catch (err) {
|
||||
return msg.reply('Could not resolve user.');
|
||||
}
|
||||
await msg.say(`Are you sure you want to hackban ${user.tag} (${user.id})?`);
|
||||
const verification = await verify(msg.channel, msg.author);
|
||||
if (!verification) return msg.say('Aborting.');
|
||||
try {
|
||||
await msg.guild.ban(id, {
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
} catch (err) {
|
||||
return msg.reply(`Failed to hackban ${user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully hackbanned ${user.tag}.`);
|
||||
}
|
||||
};
|
||||
@@ -1,57 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { verify } = require('../../util/Util');
|
||||
|
||||
module.exports = class KickCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'kick',
|
||||
aliases: ['kickke'],
|
||||
group: 'moderation',
|
||||
memberName: 'kick',
|
||||
description: 'Kicks a user.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['KICK_MEMBERS'],
|
||||
userPermissions: ['KICK_MEMBERS'],
|
||||
args: [
|
||||
{
|
||||
key: 'member',
|
||||
prompt: 'What member do you want to kick?',
|
||||
type: 'member'
|
||||
},
|
||||
{
|
||||
key: 'reason',
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
max: 140
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { member, reason }) {
|
||||
if (member.id === msg.author.id) return msg.reply('I don\'t think you want to kick yourself...');
|
||||
if (member.id === msg.guild.ownerID) return msg.reply('Don\'t you think that might be betraying your leader?');
|
||||
if (!member.kickable) return msg.reply('This member is not kickable. Perhaps they have a higher role than me?');
|
||||
if (member.highestRole.position > msg.member.highestRole.position - 1) {
|
||||
return msg.reply('Your roles are too low to kick this member.');
|
||||
}
|
||||
await msg.say(`Are you sure you want to kick ${member.user.tag} (${member.id})?`);
|
||||
const verification = await verify(msg.channel, msg.author);
|
||||
if (!verification) return msg.say('Aborting.');
|
||||
try {
|
||||
await member.send(stripIndents`
|
||||
You were kicked from ${msg.guild.name} by ${msg.author.tag}!
|
||||
**Reason**: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
try {
|
||||
await member.kick(`${msg.author.tag}: ${reason}`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Failed to kick ${member.user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully kicked ${member.user.tag}.`);
|
||||
}
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class LockdownCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'lockdown',
|
||||
group: 'moderation',
|
||||
memberName: 'lockdown',
|
||||
description: 'Prevents users from posting in the current channel, or removes a lockdown.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['ADMINISTRATOR'],
|
||||
userPermissions: ['ADMINISTRATOR'],
|
||||
args: [
|
||||
{
|
||||
key: 'action',
|
||||
prompt: 'What action should be performed? Either start or stop.',
|
||||
type: 'string',
|
||||
default: 'start',
|
||||
validate: action => {
|
||||
if (['start', 'stop'].includes(action.toLowerCase())) return true;
|
||||
return 'Invalid action, please enter either start or stop.';
|
||||
},
|
||||
parse: action => action.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { action }) { // eslint-disable-line consistent-return
|
||||
if (action === 'start') {
|
||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false });
|
||||
return msg.say(stripIndents`
|
||||
Lockdown started, users without overwrites can no longer post messages.
|
||||
Please use \`lockdown stop\` to end the lockdown.
|
||||
`);
|
||||
}
|
||||
if (action === 'stop') {
|
||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: null });
|
||||
return msg.say('Lockdown ended, all users can now post messages.');
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,61 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { verify } = require('../../util/Util');
|
||||
|
||||
module.exports = class SoftbanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'softban',
|
||||
aliases: ['softbanne'],
|
||||
group: 'moderation',
|
||||
memberName: 'softban',
|
||||
description: 'Kicks a user and deletes their messages.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['BAN_MEMBERS'],
|
||||
userPermissions: ['KICK_MEMBERS'],
|
||||
args: [
|
||||
{
|
||||
key: 'member',
|
||||
prompt: 'What member do you want to softban?',
|
||||
type: 'member'
|
||||
},
|
||||
{
|
||||
key: 'reason',
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
max: 140
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { member, reason }) {
|
||||
if (member.id === msg.author.id) return msg.reply('I don\'t think you want to softban yourself...');
|
||||
if (member.id === msg.guild.ownerID) return msg.reply('Don\'t you think that might be betraying your leader?');
|
||||
if (!member.bannable) return msg.reply('This member is not softbannable. Perhaps they have a higher role than me?');
|
||||
if (member.highestRole.position > msg.member.highestRole.position - 1) {
|
||||
return msg.reply('Your roles are too low to softban this member.');
|
||||
}
|
||||
await msg.say(`Are you sure you want to softban ${member.user.tag} (${member.id})?`);
|
||||
const verification = await verify(msg.channel, msg.author);
|
||||
if (!verification) return msg.say('Aborting.');
|
||||
try {
|
||||
await member.send(stripIndents`
|
||||
You were softbanned from ${msg.guild.name} by ${msg.author.tag}!
|
||||
**Reason**: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
try {
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason} (Softban)`
|
||||
});
|
||||
await msg.guild.unban(member.user, 'Softban');
|
||||
} catch (err) {
|
||||
return msg.reply(`Failed to softban ${member.user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully softbanned ${member.user.tag}.`);
|
||||
}
|
||||
};
|
||||
@@ -1,49 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { verify } = require('../../util/Util');
|
||||
|
||||
module.exports = class UnbanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'unban',
|
||||
aliases: ['unbanne'],
|
||||
group: 'moderation',
|
||||
memberName: 'unban',
|
||||
description: 'Unbans a user.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['BAN_MEMBERS'],
|
||||
userPermissions: ['BAN_MEMBERS'],
|
||||
args: [
|
||||
{
|
||||
key: 'id',
|
||||
prompt: 'What is the id of the member you want to unban?',
|
||||
type: 'string',
|
||||
validate: id => {
|
||||
if (/^[0-9]+$/.test(id)) return true;
|
||||
return 'Invalid ID.';
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'reason',
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
max: 140
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { id, reason }) {
|
||||
const bans = await msg.guild.fetchBans();
|
||||
if (!bans.has(id)) return msg.reply('This ID is not in the server banlist.');
|
||||
const member = bans.get(id).user;
|
||||
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.');
|
||||
try {
|
||||
await msg.guild.unban(member, `${msg.author.tag}: ${reason}`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Failed to unban ${member.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully unbanned ${member.tag}.`);
|
||||
}
|
||||
};
|
||||
@@ -5,7 +5,7 @@ module.exports = class PruneCommand extends Command {
|
||||
super(client, {
|
||||
name: 'prune',
|
||||
aliases: ['clear'],
|
||||
group: 'moderation',
|
||||
group: 'other',
|
||||
memberName: 'prune',
|
||||
description: 'Deletes up to 99 messages from the current channel.',
|
||||
guildOnly: true,
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "52.2.0",
|
||||
"version": "53.0.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "XiaoBot.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user