bot
bot copied to clipboard
Automatically close help thread on ban
It's probably a rare occurrence but it happened today (https://discord.com/channels/267624335836053506/1133167276401643630) where a user who had an open help thread got banned in a different channel. This left the people helping confused for a bit as to where the user went. It would be a nice feature if the bot would automatically close any open help thread (with a message indicating user has 'decided to pursue opportunities at other servers' or similar). That way the people helping don't have to notice they were banned.
That's a nice idea.
However, I feel that, like you said, it's quite the rare case to happen. (that they happen to have an open help thread).
The thing is that the threads are not necessarily cached, so we'll very probably end up with cache misses which Increases the number of API calls we'd need to make to fetch that thread for that owner.
If we consider having a lot of bans throughout the day, this will get us rate limited when we don't necessarily need to.
Any check for channels would only need to be done if banned user had Help Cooldown role. So we don't add overhead to all bans, only when we actually know user had the channel open.
We're thinking about removing the help cooldown role in the near future, so there is the potential that users could have multiple help posts open.
Open threads should be in the bot's cache, so something like this should do the trick.
help_forum = guild.get_channel(constants.Channels.python_help)
for post in help_forum.threads:
if post.owner_id == banned_user.id:
await help_channels._channel.help_post_closed(post)
Open threads should be in the bot's cache, so something like this should do the trick.
Ah yes that's true, even on bot restart, right Chris ?
In that case, that should be fine to have.
Yup
We should also include that the post was closed due to the OP being banned in the close message so that we don't get people saying the bot is bugged since it closed a post early.
Can i work on this?
Is this still up for grabs?
I'm not 100% sure about this. In some cases a mod may want to ban the author of a thread (in the thread) and also issue infractions or send a message to others interacting in the thread.
Automatically closing the thread would make this sort of awkward. If a mod sends another message it will reopen the thread, and then it would never close unless reclosed manually. It's also a bit confusing to have messages after the thread closed message.
If this was a common enough issue I guess it might be worth it, but i'm not sure it is.
An alternative solution would be to send a message whenever the author leaves the server (whether through a ban or not), but not automatically close it. Thoughts?
An alternative solution would be to send a message whenever the author leaves the server (whether through a ban or not), but not automatically close it. Thoughts?
Just to put my thoughts here, I think sending a message would definitely be a better way to handle this without being overly-intrusive in the thread.
I'll go ahead with that, and can get more thoughts from people reviewing the PR.