mirror of
https://github.com/yuzu-emu/Command-fix.git
synced 2024-11-29 11:04:15 +01:00
Fix broken role & channel exemptions (#115)
* Fix broken role & channel exemptions * fix for citra * Fix long broken logging exemption * Typo * Typo2
This commit is contained in:
parent
e3ae371c57
commit
bffc187300
@ -39,7 +39,7 @@ function findArray(haystack: string | any[], arr: any[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function IsIgnoredCategory(categoryName: string) {
|
function IsIgnoredCategory(categoryName: string) {
|
||||||
const IgnoredCategory = ['internal-development', 'internal-general', 'internal-casual', 'website'];
|
const IgnoredCategory = ['internal', 'team', 'development'];
|
||||||
return IgnoredCategory.includes(categoryName);
|
return IgnoredCategory.includes(categoryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +79,13 @@ client.on('guildMemberAdd', (member) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.on('messageDelete', message => {
|
client.on('messageDelete', message => {
|
||||||
|
const AllowedRoles = ['Administrators', 'Moderators', 'Team', 'Developer', 'Support', 'VIP'];
|
||||||
|
let authorRoles = message.member?.roles?.cache?.map(x => x.name);
|
||||||
|
if (!authorRoles) {
|
||||||
|
logger.error(`Unable to get the roles for ${message.author}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!findArray(authorRoles, AllowedRoles)) {
|
||||||
let parent = (message.channel as discord.TextChannel).parent;
|
let parent = (message.channel as discord.TextChannel).parent;
|
||||||
if (parent && IsIgnoredCategory(parent.name) === false) {
|
if (parent && IsIgnoredCategory(parent.name) === false) {
|
||||||
if (((message.content && message.content.startsWith('.') === false) || (message.attachments.array().length > 0)) && message.author?.bot === false) {
|
if (((message.content && message.content.startsWith('.') === false) || (message.attachments.array().length > 0)) && message.author?.bot === false) {
|
||||||
@ -99,10 +106,11 @@ client.on('messageDelete', message => {
|
|||||||
logger.info(`${message.author?.username} ${message.author} deleted message: ${message.cleanContent}.`);
|
logger.info(`${message.author?.username} ${message.author} deleted message: ${message.cleanContent}.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('messageUpdate', (oldMessage, newMessage) => {
|
client.on('messageUpdate', (oldMessage, newMessage) => {
|
||||||
const AllowedRoles = ['Administrators', 'Moderators', 'Team', 'VIP'];
|
const AllowedRoles = ['Administrators', 'Moderators', 'Team', 'Developer', 'Support', 'VIP'];
|
||||||
let authorRoles = oldMessage.member?.roles?.cache?.map(x => x.name);
|
let authorRoles = oldMessage.member?.roles?.cache?.map(x => x.name);
|
||||||
if (!authorRoles) {
|
if (!authorRoles) {
|
||||||
logger.error(`Unable to get the roles for ${oldMessage.author}`);
|
logger.error(`Unable to get the roles for ${oldMessage.author}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user