mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-22 02:37:57 -05:00
[Warnings] Fix actions not being taken (#2218)
When multiple warning actions were registered, and the user didn't exceed the points for the highest action on the list, no action was taken. Resolves #2106. Also commented out the casetype registration for warnings, since it's not actually using modlog yet. Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
@@ -19,9 +19,11 @@ async def warning_points_add_check(
|
||||
act = {}
|
||||
async with guild_settings.actions() as registered_actions:
|
||||
for a in registered_actions:
|
||||
# Actions are sorted in decreasing order of points.
|
||||
# The first action we find where the user is above the threshold will be the
|
||||
# highest action we can take.
|
||||
if points >= a["points"]:
|
||||
act = a
|
||||
else:
|
||||
break
|
||||
if act and act["exceed_command"] is not None: # some action needs to be taken
|
||||
await create_and_invoke_context(ctx, act["exceed_command"], user)
|
||||
|
||||
Reference in New Issue
Block a user