This commit is contained in:
Erik 2022-03-29 01:46:55 +03:00
parent a7bad04495
commit 6c19c57631
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
6 changed files with 15 additions and 20 deletions

View File

@ -47,7 +47,9 @@ class EventHooker {
this.logger.debug(`Handler ${eventName}`); this.logger.debug(`Handler ${eventName}`);
// Should probably move this elsewhere, but testing this out -- or maybe not, might be the most appropriate place for this // Should probably move this elsewhere, but testing this out -- or maybe not, might be the most appropriate place for this
for (const arg of args) if (arg?.guild) arg.guildWrapper = this.target.getGuildWrapper(arg.guild.id); for (const arg of args) {
if (arg?.guild) arg.guildWrapper = this.target.getGuildWrapper(arg.guild.id);
}
if (eventName === 'interactionCreate') args[0] = new InteractionWrapper(this.target, args[0]); if (eventName === 'interactionCreate') args[0] = new InteractionWrapper(this.target, args[0]);

View File

@ -22,12 +22,15 @@ class Intercom {
_transportCommands() { _transportCommands() {
const clientId = this.client.application.id;
const commands = this.client.registry.components const commands = this.client.registry.components
.filter((c) => c._type === 'command' && c.slash) .filter((c) => c._type === 'command' && c.slash)
.map((c) => c.shape); .map((c) => c.shape);
// this.send('commands', { type: 'global', commands }); if (process.env.NODE_ENV === 'development') return this.send('commands', { type: 'guild', commands, clientId });
this.send('commands', { type: 'guild', commands, clientId: this.client.application.id });
this.send('commands', { type: 'global', commands, clientId });
this.send('commands', { type: 'guild', commands, clientId });
} }

View File

@ -1,5 +1,4 @@
const { Observer, Infraction } = require("../../interfaces"); const { Observer, Infraction } = require("../../interfaces");
const { GuildWrapper } = require("../../client/wrappers");
class AuditLogObserver extends Observer { class AuditLogObserver extends Observer {

View File

@ -42,8 +42,6 @@ class GuildLogger extends Observer {
['messageDeleteBulk', this.messageDeleteBulk.bind(this)], ['messageDeleteBulk', this.messageDeleteBulk.bind(this)],
['messageUpdate', this.messageEdit.bind(this)], ['messageUpdate', this.messageEdit.bind(this)],
['voiceStateUpdate', this.voiceState.bind(this)], ['voiceStateUpdate', this.voiceState.bind(this)],
//['guildBanAdd', this.ban.bind(this)],
//['guildBanRemove', this.unban.bind(this)],
['guildMemberAdd', this.memberJoin.bind(this)], ['guildMemberAdd', this.memberJoin.bind(this)],
['guildMemberRemove', this.memberLeave.bind(this)], ['guildMemberRemove', this.memberLeave.bind(this)],
['guildMemberUpdate', this.memberUpdate.bind(this)] ['guildMemberUpdate', this.memberUpdate.bind(this)]
@ -559,23 +557,15 @@ class GuildLogger extends Observer {
this.client.rateLimiter.queueSend(logChannel, wrapper.format(index, langParams).trim()); this.client.rateLimiter.queueSend(logChannel, wrapper.format(index, langParams).trim());
} }
// async ban(guild, user) {
// }
// async unban(guild, user) {
// }
_replaceTags(text, member) { _replaceTags(text, member) {
const { user, guild } = member; const { user, guild } = member;
return text return text
.replace(/\{mention\}/gu, `<@${member.id}>`) .replace(/\{mention\}/gu, `<@${member.id}>`)
.replace(/\{tag\}/gu, Util.escapeMarkdown(user.tag)) .replace(/\{tag\}/gu, Util.escapeMarkdown(user.tag))
.replace(/\{username\}/gu, Util.escapeMarkdown(user.username)) .replace(/\{username\}/gu, Util.escapeMarkdown(user.username))
.replace(/\{serversize\}/gu, guild.memberCount) .replace(/\{guildsize\}/gu, guild.memberCount)
.replace(/\{servername\}/gu, guild.name) .replace(/\{guildname\}/gu, guild.name)
.replace(/\{accage\}/gu, Util.humanise((Date.now() - user.createdTimestamp)/1000)) //.replace(/a/, '1') .replace(/\{accage\}/gu, Util.humanise((Date.now() - user.createdTimestamp)/1000)) //.replace(/a/, '1')
.replace(/\{id\}/gu, user.id) .replace(/\{id\}/gu, user.id)
.trim(); .trim();
@ -646,7 +636,7 @@ class GuildLogger extends Observer {
color: CONSTANTS.COLORS.BLUE color: CONSTANTS.COLORS.BLUE
}; };
logChannel.send({ embed }); logChannel.send({ embeds: [embed] });
} }

View File

@ -91,7 +91,7 @@ class WordWatcher extends FilterSetting {
} }
_createTrigger(interaction, action, actionObject, actions) { _createTrigger(interaction, action, actionObject) {
actionObject.trigger = actionObject.type; actionObject.trigger = actionObject.type;

View File

@ -90,7 +90,8 @@ class Setting extends Component {
hook.collector = await this.collector(wrapper, selectMenu); hook.collector = await this.collector(wrapper, selectMenu);
} }
usageEmbed(guild, verbose = false) { // , verbose = false -- unsure if this is a necessary argument anymore
usageEmbed(guild) {
const fields = []; const fields = [];