Skip to content
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

Add a cooldown for tags (auto-responses) per-channel cooldowns #589

Closed
wants to merge 3 commits into from

Conversation

TyladYT
Copy link

@TyladYT TyladYT commented Oct 25, 2023

This modification adds a cooldown per auto-response (tags) per-channel to make sure that if multiple people execute a tag all at once, then the bot doesn't send it twice. It'll only respond to one tag.
E.G. If a user asks, "how do I appeal?", then four people execute !appeal to show the user what to do, that message is sent 4 times. But with this modification, the bot only replies to one, and reacts with the timer emoji for the rest.

This modification adds a cooldown per auto-response (tags) per-channel to make sure that if multiple people execute a tag all at once, then the bot doesn't send it twice. It'll only respond to one tag.
@CLAassistant
Copy link

CLAassistant commented Oct 25, 2023

CLA assistant check
All committers have signed the CLA.

@Soapy7261
Copy link
Contributor

Wouldn't this be better to be an option a server owner can set instead of being hard coded (and being forced on)?

@JulianVennen
Copy link
Member

This sounds like a nice thing to add but there are a few small issues with this implementation:

  1. I think the timeout should apply per channel AND per auto response. This could be achieved by using channelId + ":" + autoResponseId as the key for the set
  2. I don't think reacting to the message is necessary if the response is under cooldown.
  3. I think most of the comments you added are redundant since they more or less just repeat the code before it.

@Soapy7261
Copy link
Contributor

Soapy7261 commented Oct 26, 2023

I think the timeout should apply per channel AND per auto response. This could be achieved by using channelId + ":" + autoResponseId as the key for the set

I kind of disagree, because if you have multiple tickets and such with different staff members handling different tickets, or just overall a lot of tickets, this could be annoying (forced, at least)

@JulianVennen
Copy link
Member

The point was that you can use different auto responses at the same time or the same auto response in different channels at the same time.

Look at the implementation example

@TyladYT
Copy link
Author

TyladYT commented Oct 27, 2023

  1. I think the timeout should apply per channel AND per auto response. This could be achieved by using channelId + ":" + autoResponseId as the key for the set

I completely agree with how it should be based per-channel AND per-autoresponse, this would enforce cooldowns a lot better since then people won't have to wait the cooldown out if another user has used the same tag/autoresponse in the other channel.
I will implement this suggestion into my ModBot instance, and continue testing.

  1. I don't think reacting to the message is necessary if the response is under cooldown.

I think a reaction is necessary, due to letting the user know that a cooldown is currently active. It would make things much easier and simple to apply to the user's mind, letting them know "Hey, a cooldown is currently in place" without actually sending a message, because atm in my opinion ModBot is just messages everywhere right now. Adding a reaction would ease things up a bit in this aspect, if you get what I mean?
At one time, Minehut used a cooldown emoji for their bot, the same timer one I used in this code snippet. It worked as a fantastic solution rather than replying to the message and then deleting the reply. Plus, you can't reply to messages in ephemeral responses meaning it would be pretty pointless to reply with a cooldown message if it's not ephemeral. Nobody needs to see a "This command is on cooldown" message or whatever, a reaction fits just perfectly.

Feel free to ask me questions, I can elaborate at any time if you like.

@JulianVennen
Copy link
Member

Autoresponses are not always commands and if the bot reacts to your message with an emoji, and you don't know that it would usually have responded to that message, that might be confusing.

I think it would generally be a good thing to implement a real "tag" system that uses slash commands for your use case. This could use an ephemeral response when the tag is on "timeout" while also removing the message before it, providing autocompletion etc.

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.

4 participants