python-discord / bot

The community bot for the Python Discord community
https://pythondiscord.com
MIT License
1.36k stars 671 forks source link

bb watch allows editing duration but doesn't support scheduled ending of infraction #2049

Open wookie184 opened 2 years ago

wookie184 commented 2 years ago

Running

!bb watch <userid> test
!infraction edit last 10s

Will result in this error when the bot tries to end the infraction

bot_1        | Traceback (most recent call last):
bot_1        |   File "/bot/bot/utils/scheduling.py", line 119, in _await_later
bot_1        |     await asyncio.shield(coroutine)
bot_1        |   File "/bot/bot/exts/moderation/infraction/_scheduler.py", line 402, in deactivate_infraction
bot_1        |     raise ValueError(
bot_1        | ValueError: Attempted to deactivate an unsupported infraction #14 (watch)!

Along with fixing this, we may also want to support setting a duration at the time it is set as well as maybe even setting a default duration. (relevant: https://github.com/python-discord/mods/issues/4)

shtlrs commented 1 year ago

@wookie184 Currently, a watch infaction isn't pardoned like a mute. Invoking the unwatch command posts another infraction to the api, and marks the previous one as inactive.

I'm in for changing that so that it abides to the same "laws" the pardonable infractions do, and then we give it a default duration (which we can decide upon in the PR, or here)

What I would like to do is merge the BB cog with the Infractions one. After all they'r both infractions & it'll allows us to leverage the same QoL/util functions there without having to mash things up.

But I wanted to ask first: Is there a very particular reason they're in separate cogs ?

wookie184 commented 1 year ago

There is quite a lot of code for the message relaying (in https://github.com/python-discord/bot/blob/main/bot/exts/moderation/watchchannels/_watchchannel.py), so there's some benefit in having it separate to avoid having one very large cog, maybe merging them could work though, having the QoL/util functions sounds like a good reason.

I think making it having an expiry was something that was brought up a while ago as a good idea, although it might be worth discussing it again so we're sure what we want. Making it follow the same rules as other infractions sounds good. Personally I don't think i've ever used BB so would be happy to get rid of some code debt and remove it entirely, but I think some might still use it :P

r4gesingh47 commented 1 year ago

Hey would love to pick this up, Never worked on discord but I think I can do it. Is this still pending?

shtlrs commented 1 year ago

Hey would love to pick this up, Never worked on discord but I think I can do it. Is this still pending?

Hey 👋 Thank your for the interest in picking this up.

However, I have tried to work on this in the past, and there's currently an issue with how we deal with our infractions in general due to the design.

So I'm afraid it is currently blocked by this issue

We're still discussing what the schema will look like, etc.

I'll be happy to assign you once the previous issue has been resolved.