-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Anon cmd and internal message logging #153
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
Taaku18
left a comment
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.
Everything else on the client side looks good.
| await self.process_commands(message) | ||
| if thread is not None: | ||
| await self.modmail_api.append_log(message, type='internal') | ||
|
|
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.
Even though there isn't a command being invoked here, the message should still propagate through discord. Or else it might mask issues in the future.
| await self.process_commands(message) |
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.
The documentation says that its the equivalent of those two calls, plus we need to know whether or not a command exists before we log an internal message.
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.
@kyb3r I mean add it at the end of on_message, that "suggested change" section might be a bit misleading. So...
...
thread = await self.threads.find(channel=ctx.channel)
if thread is not None:
await self.modmail_api.append_log(message, type='internal')
return await self.process_commands(message)
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.
But we are not logging command messages
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.
Yeah I know we're not logging commands, but we should still include return await self.invoke(ctx) at the end. This way "command_error" event will still be dispatched when an invalid command was received.
It doesn't really matter right now, but it may cause problems later as this suppresses the CommandNotFound from on_command_error.
Btw, also change:
if ctx.command:
to:
if ctx.command is not None:
Adds an anonymous command and now the bot logs all messages sent in thread channels. This closes #107 and closes #147