Editing a mute's duration sometimes applies the wrong timeout duration to the target #101
Labels
No labels
bug
cog
cog
Aurora
cog
Backup
cog
Bible
cog
EmojiInfo
cog
HotReload
cog
IssueCards
cog
Nerdify
cog
Pterodactyl
cog
RobloxVerify
cog
SeaUtils
cog
SentinelCore
cog
TickChanger
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cswimr/SeaCogs#101
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Please confirm that;
Hosting
Docker
What happened?
When editing a mute's duration, the wrong timeout duration will sometimes be applied to the target user. The expected behavior is that the timeout duration is the sum of the mute's original timestamp and the resulting duration converted to seconds. I suspect that the timestamp of the edit is being used instead of the original moderation timestamp.
Offending code
@classmethodasync def duration_edit_handler(cls, interaction: Interaction, old_moderation: Moderation, new_moderation: Moderation) -> bool: # pylint: disable=unused-argumentif (time() - new_moderation.unix_timestamp) + new_moderation.duration.total_seconds() > 2419200:await interaction.response.send_message(content=error("Please provide a duration that is less than 28 days from the initial moderation."), ephemeral=True)return Falsetry:member = await interaction.guild.fetch_member(new_moderation.target_id)await member.timeout(new_moderation.duration,reason=f"Case #{new_moderation.id:,} edited by {interaction.user.id}",)except NotFound:passreturn TrueReproduction steps
mutecase type.Relevant traceback or logs