[Core] Add [p]set mentionhelp command to the bot #3914

Closed
Drapersniper wants to merge 9 commits from fixes-3912 into V3/develop
Drapersniper commented 2020-06-04 15:11:10 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

fixes #3912

  • Bot will now respond to a blank mention of itself with the available prefixes.
### Type - [ ] Bugfix - [ ] Enhancement - [x] New feature ### Description of the changes fixes #3912 - Bot will now respond to a blank mention of itself with the available prefixes.
tekulvw (Migrated from github.com) reviewed 2020-06-04 15:11:10 +02:00
Jackenmen commented 2020-06-19 02:28:05 +02:00 (Migrated from github.com)

I don't think we should be adding such event to the bot. IMO, it would be better to just do all the necessary checks in newly added on_message_without_command event listener.
And they should definitely happen after checking the mentionhelp setting is enabled.

I don't think we should be adding such event to the bot. IMO, it would be better to just do all the necessary checks in newly added `on_message_without_command` event listener. And they should definitely happen *after* checking the `mentionhelp` setting is enabled.
Drapersniper commented 2020-06-19 11:50:00 +02:00 (Migrated from github.com)

I don't think we should be adding such event to the bot. IMO, it would be better to just do all the necessary checks in newly added on_message_without_command event listener.
And they should definitely happen after checking the mentionhelp setting is enabled.

yeah the checks after is a good point.

The event, the reason for an early exit here, is i dont want the message_without_command dispatched if this mention this setting is enabled, and the checks all pass.

This is to reduce the risk of cogs also doing things on this signal.
For example, cleverbot cog, it replies if you just use @botMention the bot will also reply, and with this on it would send 2 messages. but using a separate event that is dispatched earlier, and stop on_message_without_command being dispatched this wont be the case.

> I don't think we should be adding such event to the bot. IMO, it would be better to just do all the necessary checks in newly added `on_message_without_command` event listener. > And they should definitely happen _after_ checking the `mentionhelp` setting is enabled. yeah the checks after is a good point. The event, the reason for an early exit here, is i dont want the `message_without_command` dispatched if this mention this setting is enabled, and the checks all pass. This is to reduce the risk of cogs also doing things on this signal. For example, cleverbot cog, it replies if you just use @botMention the bot will also reply, and with this on it would send 2 messages. but using a separate event that is dispatched earlier, and stop `on_message_without_command` being dispatched this wont be the case.
Jackenmen commented 2020-06-19 12:48:32 +02:00 (Migrated from github.com)

using a separate event that is dispatched earlier, and stop on_message_without_command being dispatched this wont be the case.

This is exactly something that IMO we should NOT be doing.

> using a separate event that is dispatched earlier, and stop on_message_without_command being dispatched this wont be the case. This is exactly something that IMO we should NOT be doing.
Drapersniper commented 2020-06-19 13:11:08 +02:00 (Migrated from github.com)

using a separate event that is dispatched earlier, and stop on_message_without_command being dispatched this wont be the case.

This is exactly something that IMO we should NOT be doing.

Personally i feel that if this is enable it should take priority over other cogs.

As a bot owner if i enabled this behaviour for a single mention i wouldnt other cogs to mess up with it.

But input from the community here could be useful.

and example is a user goes and run @botMention

With my proposal if the setting is enable it would show the prefixes and not send a on_message_without_command event.

With what jack is suggesting we could send the dispatch for that event which means cogs that listen to that event and single mention would also respond.

So for example, cleverbot would also respond to the mention sending 2 messages to the user, the prefixes, and the clever bot message.

> > using a separate event that is dispatched earlier, and stop on_message_without_command being dispatched this wont be the case. > > This is exactly something that IMO we should NOT be doing. Personally i feel that if this is enable it should take priority over other cogs. As a bot owner if i enabled this behaviour for a single mention i wouldnt other cogs to mess up with it. But input from the community here could be useful. and example is a user goes and run @botMention With my proposal if the setting is enable it would show the prefixes and not send a `on_message_without_command` event. With what jack is suggesting we could send the dispatch for that event which means cogs that listen to that event and single mention would also respond. So for example, cleverbot would also respond to the mention sending 2 messages to the user, the prefixes, and the clever bot message.
mikeshardmind commented 2020-06-19 17:30:25 +02:00 (Migrated from github.com)

not dispatching message_without_command would definitely break people using that event.

Personally, I find any bot that responds to just a plain mention to be a malfunction at best, mentions aren't obviously commands and could very easily just be an easy way to reference a bot in conversation knowing that bots don't get annoyed at pings.

To that end, I'm not sure why this isn't just a 3rd party cog rather than another setting that has to be checked on every non-command message even for people not using this.

Even if this is to be included though, changing that event behavior would be problematic.

not dispatching `message_without_command` would definitely break people using that event. Personally, I find any bot that responds to just a plain mention to be a malfunction at best, mentions *aren't* obviously commands and could very easily just be an easy way to reference a bot in conversation knowing that bots don't get annoyed at pings. To that end, I'm not sure why this isn't just a 3rd party cog rather than another setting that has to be checked on every non-command message even for people not using this. Even if this is to be included though, changing that event behavior would be problematic.
Drapersniper (Migrated from github.com) reviewed 2020-06-19 17:33:57 +02:00
Drapersniper (Migrated from github.com) commented 2020-06-19 17:33:57 +02:00

Just a note so that i dont forget .. this is wrong.

Just a note so that i dont forget .. this is wrong.
Kowlin commented 2020-06-19 18:07:24 +02:00 (Migrated from github.com)

I feel like this strongly impacts performance and should not be added to core at all sadly enough.

This if block seems like an extreme drain in performance considering how much stuff it has to check. The on_message event is already a hotly contested. Before the commands are processed i18n will have to run, context is being generated, and finally this if block will have to go through its steps. This all adds time before command execution for something which has a very low chance of occurring in a live situation.

https://github.com/Cog-Creators/Red-DiscordBot/pull/3914/files#diff-b4e8893536462f5cd5d7e291288c4d5eR908-R920

A good way to look at this is to ask your self, how many times am I gonna mention the bot for its prefix. And from what I've seen, the use case of where the bot acts as the primary moderation bot for an extremely scaled server. This is nearly never gonna occur.

Simply put, this adds too much time between execution to be beneficial at all when the bot is under constant stress already.

I feel like this strongly impacts performance and should not be added to core at all sadly enough. This ``if`` block seems like an extreme drain in performance considering how much stuff it has to check. The ``on_message`` event is already a hotly contested. Before the commands are processed i18n will have to run, context is being generated, and finally this if block will have to go through its steps. This all adds time before command execution for something which has a very low chance of occurring in a live situation. https://github.com/Cog-Creators/Red-DiscordBot/pull/3914/files#diff-b4e8893536462f5cd5d7e291288c4d5eR908-R920 A good way to look at this is to ask your self, how many times am I gonna mention the bot for its prefix. And from what I've seen, the use case of where the bot acts as the primary moderation bot for an extremely scaled server. This is nearly never gonna occur. Simply put, this adds too much time between execution to be beneficial at all when the bot is under constant stress already.
mikeshardmind commented 2020-06-26 00:57:54 +02:00 (Migrated from github.com)

I've gone ahead and created this as an additional cog to demonstrate a correct implementation of this which does not require making a listener which cannot be removed by people who do not want this behavior heavier for it. Given the simplicity of it, I have no issue keeping this in the repo long term, and anyone should be able to trivially modify it.

Given how easy this is to add on without being in core, I hope this is enough reason to not make core's on_message handling heavier.

I've gone ahead and created this [as an additional cog](https://github.com/mikeshardmind/SinbadCogs/blob/v3/mentionhelp/mentionhelp.py) to demonstrate a correct implementation of this which does not require making a listener which cannot be removed by people who do not want this behavior heavier for it. Given the simplicity of it, I have no issue keeping this in the repo long term, and anyone should be able to trivially modify it. Given how easy this is to add on without being in core, I hope this is enough reason to not make core's `on_message` handling heavier.
Drapersniper commented 2020-06-26 12:27:39 +02:00 (Migrated from github.com)

The aforementioned cog looks good to me.

Closing this in favour of it.

The aforementioned cog looks good to me. Closing this in favour of it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!3914
No description provided.