forked from Galactic/galactic-bot
Merge branch 'master' of https://github.com/Navy-gif/New-Gbot
This commit is contained in:
commit
2eec1a2ff5
@ -17,9 +17,11 @@ class GuildCommand extends Command {
|
||||
|
||||
}
|
||||
|
||||
async execute(message) {
|
||||
async execute(message, { params }) {
|
||||
|
||||
const guild = await message.guild.fetch();
|
||||
let guild = null;
|
||||
//if(params[0]) guild = await this.client.fetchGuildPreview(params[0]);
|
||||
guild = await message.guild.fetch();
|
||||
|
||||
let vc = 0,
|
||||
tc = 0,
|
||||
@ -108,37 +110,6 @@ class GuildCommand extends Command {
|
||||
});
|
||||
|
||||
return message.embed(embed);
|
||||
|
||||
// return message.embed({
|
||||
// description: message.format('C_GUILD_TEMPLATE', {
|
||||
// createdAt,
|
||||
// description,
|
||||
// maxMembers,
|
||||
// approxPresences: guild.approximatePresenceCount,
|
||||
// maxPresences: guild.maximumPresences,
|
||||
// totalChannels,
|
||||
// vc,
|
||||
// tc,
|
||||
// cat,
|
||||
// news,
|
||||
// owner: guild.owner.id,
|
||||
// id: guild.id,
|
||||
// name: guild.name,
|
||||
// region: guild.region,
|
||||
// members: guild.memberCount,
|
||||
// boosters: guild.premiumSubscriptionCount,
|
||||
// tier: guild.premiumTier,
|
||||
// shard: guild.shardID,
|
||||
// roleCount: guild.roles.cache.size,
|
||||
// emojiCount: guild.emojis.cache.filter((e) => !e.animated).size,
|
||||
// gifEmojiCount: guild.emojis.cache.filter((e) => e.animated).size,
|
||||
// emojiTotal: 50 + 50 * guild.premiumTier,
|
||||
// features: guild.features.length ? guild.features.join(', ') : message.format('C_GUILD_NOFEAT')
|
||||
// }),
|
||||
// thumbnail: {
|
||||
// url: guild.iconURL()
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ class LookupCommand extends Command {
|
||||
"SvJgtEj",
|
||||
"discord.gg/SvJgtEj"
|
||||
],
|
||||
aliases: [],
|
||||
restricted: true //For now
|
||||
// throttling: {
|
||||
// usages: 1,
|
||||
@ -32,13 +33,11 @@ class LookupCommand extends Command {
|
||||
try {
|
||||
invite = await this.client.fetchInvite(params);
|
||||
} catch(e) {
|
||||
return message.respond(message.format('C_LOOKUP_FAILEDMATCH'), {
|
||||
return message.respond(message.format('C_LOOKUP_FAILED'), {
|
||||
emoji: 'failure'
|
||||
});
|
||||
}
|
||||
|
||||
console.log(invite);
|
||||
|
||||
const fields = [];
|
||||
|
||||
if(invite.inviter) {
|
||||
|
@ -45,12 +45,19 @@ module.exports = class AutoModeration extends Observer {
|
||||
];
|
||||
|
||||
this.whitelist = new BinaryTree(this.client, FilterPresets.whitelist);
|
||||
this.executing = {};
|
||||
|
||||
}
|
||||
|
||||
async _moderate(action, guild, channel, member, reason, filterResult) {
|
||||
|
||||
// Prevent simultaneous execution of the same filter on the same user when spamming
|
||||
if (!this.executing[filterResult.filter]) this.executing[filterResult.filter] = [];
|
||||
if (this.executing[filterResult.filter].includes(member.id)) return;
|
||||
this.executing[filterResult.filter].push(member.id);
|
||||
|
||||
const InfractionClass = CONSTANTS.Infractions[action.type];
|
||||
return this.client.moderationManager._handleTarget(InfractionClass, member, {
|
||||
const result = await this.client.moderationManager._handleTarget(InfractionClass, member, {
|
||||
guild,
|
||||
channel,
|
||||
executor: guild.me,
|
||||
@ -63,7 +70,10 @@ module.exports = class AutoModeration extends Observer {
|
||||
data: {
|
||||
automoderation: filterResult
|
||||
}
|
||||
});
|
||||
}).catch(this.client.logger.error.bind(this.client.logger));
|
||||
|
||||
await Util.wait(5000);
|
||||
this.executing[filterResult.filter].splice(this.executing[filterResult.filter].indexOf(member.id), 1);
|
||||
|
||||
}
|
||||
|
||||
@ -106,7 +116,7 @@ module.exports = class AutoModeration extends Observer {
|
||||
// _matcher: locally used variable for which word in the list triggered it |
|
||||
// type: which detection type matched it
|
||||
let filterResult = { filter: 'word', match: null, matched: false, matcher: null, _matcher: null, preset: false };
|
||||
const words = content.toLowerCase().split(' ').filter((elem) => elem.length);
|
||||
const words = content.toLowerCase().replace(/[,?.!]/gu, '').split(' ').filter((elem) => elem.length);
|
||||
// Remove any potential bypass characters
|
||||
//const _words = words.map((word) => word.replace(/[.'*_?+"#%&=-]/gu, ''));
|
||||
|
||||
@ -399,6 +409,7 @@ module.exports = class AutoModeration extends Observer {
|
||||
this.client.rateLimiter.queueDelete(msg.channel, msg);
|
||||
//msg.delete();
|
||||
|
||||
filterResult.filter = 'link';
|
||||
this._moderate(action, guild, channel, member, msg.format('L_FILTER_ACTION', { domain: filterResult.match }), filterResult, message);
|
||||
|
||||
} else this.client.rateLimiter.queueDelete(msg.channel, msg); //msg.delete();
|
||||
|
@ -1,7 +1,15 @@
|
||||
const { Setting } = require('../../../../interfaces/');
|
||||
const { FilterSetting } = require('../../../../interfaces/');
|
||||
const { Util } = require('../../../../../util');
|
||||
const emojis = {
|
||||
WARN: '<:note:744490065354293258>',
|
||||
MUTE: '<:muted:853709118988353556>',
|
||||
KICK: '👢',
|
||||
BAN: '🔨',
|
||||
SOFTBAN: '🧹',
|
||||
DELETE: '<:failure:723595130912637018>'
|
||||
};
|
||||
|
||||
module.exports = class WordWatcher extends Setting {
|
||||
module.exports = class WordWatcher extends FilterSetting {
|
||||
|
||||
constructor(client) {
|
||||
|
||||
@ -12,14 +20,15 @@ module.exports = class WordWatcher extends Setting {
|
||||
resolve: 'GUILD',
|
||||
usage: '<option> <method> <value..>',
|
||||
examples: [
|
||||
'wordfilter off'
|
||||
'wordwatcher off'
|
||||
],
|
||||
default: {
|
||||
wordWatcher: {
|
||||
channel: null,
|
||||
words: [],
|
||||
ignore: [],
|
||||
bypass: []
|
||||
bypass: [],
|
||||
actions: []
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -35,11 +44,14 @@ module.exports = class WordWatcher extends Setting {
|
||||
let index = null,
|
||||
langParams = {};
|
||||
|
||||
const result = await resolver.resolveMethod(params.map((param) => Util.sanitiseRegex(param)), {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let [first, ...rest] = params;
|
||||
rest = rest.map((param) => Util.sanitiseRegex(param, ['?', '\\', '(', ')', '|', '\\[', '\\]', '.', '-']));
|
||||
const result = await resolver.resolveMethod([first, ...rest], {
|
||||
existing: setting.words,
|
||||
allowedMethods: ['add', 'set', 'remove', 'reset', 'off']
|
||||
});
|
||||
const method = params.shift().toLowerCase();
|
||||
const method = first.toLowerCase();
|
||||
|
||||
// if (method.on || method.off) return {
|
||||
// error: true,
|
||||
@ -98,12 +110,18 @@ module.exports = class WordWatcher extends Setting {
|
||||
// index = `S_WORDWATCHER_BYPASS_${result.method.toUpperCase()}`;
|
||||
// langParams.changes = result.resolved.map((res) => res.name).join('`, `');
|
||||
|
||||
} else if (['action', 'actions'].includes(method)) {
|
||||
|
||||
params.shift();
|
||||
langParams = await this._action(message, params, setting, { _wordWatcher: true });
|
||||
({ index } = langParams);
|
||||
|
||||
} else if (result) {
|
||||
|
||||
setting.words = result.result;
|
||||
index = result.changed.length || result.method === 'reset' ? `S_WORDWATCHER_${result.method.toUpperCase()}` : 'S_NO_CHANGE';
|
||||
langParams.changes = result.changed.join('**, **');
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
const channel = await guild.resolveChannel(method);
|
||||
@ -132,6 +150,11 @@ module.exports = class WordWatcher extends Setting {
|
||||
|
||||
}
|
||||
|
||||
if (langParams.error) return {
|
||||
error: true,
|
||||
msg: langParams.msg
|
||||
};
|
||||
|
||||
await message.guild._updateSettings({ [this.index]: setting });
|
||||
return {
|
||||
error: false,
|
||||
@ -179,4 +202,26 @@ module.exports = class WordWatcher extends Setting {
|
||||
|
||||
}
|
||||
|
||||
async _createTrigger(message, action, actionObject, setting) {
|
||||
|
||||
const response = await message.prompt(message.format('S_WORDWATCHER_ACTION_ADD_TRIGGERS'), { time: 60 * 1000 });
|
||||
if (!response && !response.content) {
|
||||
if (setting.actions.find((ac) => ac.trigger === 'generic')) return {
|
||||
error: true,
|
||||
msg: message.format('S_FILTER_ACTIONS_EXISTING', { trigger: 'generic' })
|
||||
};
|
||||
setting.actions.push(actionObject);
|
||||
actionObject.trigger = 'generic';
|
||||
return actionObject;
|
||||
}
|
||||
if (['cancel', 'abort', 'exit'].includes(action.toLowerCase())) return {
|
||||
error: true,
|
||||
msg: message.format('ERR_CANCEL')
|
||||
};
|
||||
|
||||
const emoji = await this.client.resolver.resolveEmoji(response.content, message.guild);
|
||||
// WAITING FOR BUTTONS
|
||||
|
||||
}
|
||||
|
||||
};
|
@ -90,6 +90,8 @@
|
||||
"tigger",
|
||||
"tiggers",
|
||||
"nighter",
|
||||
"nighters",
|
||||
"nightstick",
|
||||
"luck",
|
||||
"puck",
|
||||
"pubs",
|
||||
@ -504,6 +506,7 @@
|
||||
"nightmare",
|
||||
"nightmares",
|
||||
"nightcore",
|
||||
"nightclub",
|
||||
"pingers",
|
||||
"nigeria",
|
||||
"nigel",
|
||||
|
Loading…
Reference in New Issue
Block a user