8000 Add: events for user, guild, and channel blacklist by Blocksnmore · Pull Request #349 · harmonyland/harmony · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 6 commits into from
May 17, 2023
Merged

Add: events for user, guild, and channel blacklist #349

merged 6 commits into from
May 17, 2023

Conversation

Blocksnmore
Copy link
Contributor

About

This pr adds the events commandUserBlacklisted, commandChannelBlacklisted, and commandGuildBlacklisted 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

  • These changes have been tested against Discord API or do not contain API change.
  • This PR includes only documentation changes, no code change.
  • This PR introduces some Breaking changes.

@@ -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)
Copy link
Member

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)

Copy link
Contributor Author

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.

Copy link
Member

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...

@@ -452,6 +452,9 @@ export type ClientEvents = {
commandUsed: [ctx: CommandContext]
commandError: [ctx: CommandContext, err: Error]
commandNotFound: [msg: Message, parsedCmd: ParsedCommand]
commandUserBlacklisted: [ctx: CommandContext]
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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'

Copy link
Member
@Helloyunho Helloyunho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@Helloyunho Helloyunho merged commit f8f6a47 into harmonyland:main May 17, 2023
@Blocksnmore Blocksnmore deleted the blacklistEvents branch May 18, 2023 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0