mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 15:57:42 +02:00
Guard
This commit is contained in:
@@ -66,6 +66,14 @@ client.on('commandError', (command, err) => {
|
||||
});
|
||||
|
||||
client.on('message', async (msg) => {
|
||||
if (msg.guild && msg.guild.settings.get('guard') && /(discord(.gg\/|app.com\/invite\/))/g.test(msg.content)) {
|
||||
if (msg.channel.permissionsFor(client.user).has('ADMINISTRATOR')) return;
|
||||
if (msg.member.roles.has(msg.guild.settings.get('staffRole'))) return;
|
||||
if (!msg.channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
|
||||
if (msg.channel.permissionsFor(client.user).has('MANAGE_MESSAGES')) msg.delete();
|
||||
else msg.channel.send('Message could not be deleted, missing the `Manage Messages` permission.');
|
||||
return msg.reply('Invites are prohibited from being posted here.');
|
||||
} else
|
||||
if (msg.isMentioned(client.user)) {
|
||||
if (msg.author.bot) return;
|
||||
if (msg.channel.type !== 'dm') {
|
||||
|
||||
Reference in New Issue
Block a user