From 56099d6b5004fbcba73bc4f2d921ead04895b9f4 Mon Sep 17 00:00:00 2001 From: Danstr5544 <73479857+Danstr5544@users.noreply.github.com> Date: Wed, 19 May 2021 13:06:51 +0100 Subject: [PATCH] Attempt to DM users before applying a warn action. * Merge pull request #5004 --- redbot/cogs/warnings/warnings.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/redbot/cogs/warnings/warnings.py b/redbot/cogs/warnings/warnings.py index 488a20989..c196e27fb 100644 --- a/redbot/cogs/warnings/warnings.py +++ b/redbot/cogs/warnings/warnings.py @@ -430,12 +430,6 @@ class Warnings(commands.Cog): "mod": ctx.author.id, } } - async with member_settings.warnings() as user_warnings: - user_warnings.update(warning_to_add) - current_point_count += reason_type["points"] - await member_settings.total_points.set(current_point_count) - - await warning_points_add_check(self.config, ctx, user, current_point_count) dm = guild_settings["toggle_dm"] showmod = guild_settings["show_mod"] dm_failed = False @@ -465,6 +459,11 @@ class Warnings(commands.Cog): " but I wasn't able to send them a warn message." ).format(user=user.mention) ) + async with member_settings.warnings() as user_warnings: + user_warnings.update(warning_to_add) + current_point_count += reason_type["points"] + await member_settings.total_points.set(current_point_count) + await warning_points_add_check(self.config, ctx, user, current_point_count) toggle_channel = guild_settings["toggle_channel"] if toggle_channel: