-
-
Notifications
You must be signed in to change notification settings - Fork 49
Add: events for user, guild, and channel blacklist #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/commands/client.ts
Outdated
@@ -291,6 +280,17 @@ export class CommandClient extends Client implements CommandClientOptions { | |||
guild: msg.guild | |||
} | |||
|
|||
const isUserBlacklisted = await this.isUserBlacklisted(msg.author.id) | |||
if (isUserBlacklisted) return this.emit('commandUserBlacklisted', ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty good work but I'm not sure if users want the whole ctx in the blacklist event...
I personally think that it's good to move back to the top and give the user the appropriate object (like give User
for the event commandUserBlacklisted
and so on)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that it would be nice to give the ctx as you might want to reply to the user and inform them that they're blacklisted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just giving the message object would be enough hmmm...
src/gateway/handlers/mod.ts
Outdated
@@ -452,6 +452,9 @@ export type ClientEvents = { | |||
commandUsed: [ctx: CommandContext] | |||
commandError: [ctx: CommandContext, err: Error] | |||
commandNotFound: [msg: Message, parsedCmd: ParsedCommand] | |||
commandUserBlacklisted: [ctx: CommandContext] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just my thoughts but maybe blacklist'ed' is kinda overkill
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any suggestions for different wording? I just went with this as it's what came to mind first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... 'commandBlockedUser' seems better than 'blacklist'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
About
This pr adds the events
commandUserBlacklisted
,commandChannelBlacklisted
, andcommandGuildBlacklisted
that execute when a blacklist occurs.I moved the checks after
ctx
is defined so that it could be passed and from my testing it looks to not have broken anything but if there's any issues please let me know.Status