bot icon indicating copy to clipboard operation
bot copied to clipboard

Automatically close help thread on ban

Open jahrules opened this issue 2 years ago • 10 comments

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.

jahrules avatar Jul 24 '23 23:07 jahrules

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.

shtlrs avatar Jul 24 '23 23:07 shtlrs

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.

hazelnutfox avatar Jul 25 '23 09:07 hazelnutfox

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)

ChrisLovering avatar Jul 25 '23 09:07 ChrisLovering

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.

shtlrs avatar Jul 25 '23 10:07 shtlrs

Yup

ChrisLovering avatar Jul 25 '23 10:07 ChrisLovering

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.

ChrisLovering avatar Jul 25 '23 11:07 ChrisLovering

Can i work on this?

DownDev avatar Aug 18 '23 08:08 DownDev

Is this still up for grabs?

brodycritchlow avatar Sep 06 '23 16:09 brodycritchlow

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?

wookie184 avatar Jan 24 '24 20:01 wookie184

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.

brodycritchlow avatar Feb 02 '24 19:02 brodycritchlow

I'll go ahead with that, and can get more thoughts from people reviewing the PR.

wookie184 avatar Apr 18 '24 10:04 wookie184