Skip to content

Slowmode timeout argument #3327

Open
@jb3

Description

@jb3
Member

Supersedes #3325.

This issue is for the addition of a new argument to the !slowmode set command to have the bot time out slowmodes.

Proposed syntax: !slowmode set [channel] <delay> <duration>

Example use: !slowmode set #python-discussion 10s 30m

After expiration the slowmode should probably restore to whatever the previous value is, that way Moderators can still set a permanent value and have that be preserved (i.e. temporarily have a 10s slowmode before reverting to 2s after 2 hours).

We should persist this in Redis as it is non-critical if this information gets lost but will continue across reboots. This can likely be integrated with the existing scheduler.

Activity

added theissue type on May 18, 2025
added
a: moderationRelated to community moderation functionality: (moderation, defcon, verification)
t: enhancementChanges or improvements to existing features
up for grabsAvailable for anyone to work on
status: approvedThe issue has received a core developer's approval
on May 18, 2025
Rudransh-K999

Rudransh-K999 commented on May 19, 2025

@Rudransh-K999

yo

b0nes1

b0nes1 commented on Jun 1, 2025

@b0nes1

Hey I'm looking to tackle this one but just wanted to run through the implementation.

I'm not super familiar with redis but here's my understanding of approximately what needs to happen.

Scheduled tasks don't persist bot reboot, so when the cog is loaded it should load redis cache and check if there are active slowmodes for which a task to remove them needs to be created (for the time remaining), or if there are any slowmodes active which have already elapsed and for which the original timeout should be applied.

My proposed solution for when slowmode command with a timeout is sent:

  • cache the current slowmode interval so that it can be re-applied later.
  • cache the time that the slowmode should expire.
  • apply the slowmode.
  • schedule a task that removes slowmode and reapplies what it was originally.
  • when slowmode has expired, reapply original slowmode and remove corresponding data from redis.

if a moderator changes the slowmode and there is already a slowmode with a timeout counting down, then cancel the task to reapply the original slowmode. Create a new task with the more recent timeout and update redis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a: moderationRelated to community moderation functionality: (moderation, defcon, verification)l: 1 - intermediatep: 3 - lowLow Prioritystatus: approvedThe issue has received a core developer's approvalt: enhancementChanges or improvements to existing features

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @mbaruh@jb3@b0nes1@Rudransh-K999

    Issue actions

      Slowmode timeout argument · Issue #3327 · python-discord/bot