From 492d43c6088e9348636f3d58a71ffedd2429c759 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Mon, 11 Sep 2023 21:22:09 +0200 Subject: [PATCH] Fix reply command targets (#70) --- robocop_ng/cogs/meme.py | 2 +- robocop_ng/cogs/mod.py | 26 ++++++++++++++++++-------- robocop_ng/cogs/mod_timed.py | 8 ++++++-- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/robocop_ng/cogs/meme.py b/robocop_ng/cogs/meme.py index 3e4bbfd..35e534e 100644 --- a/robocop_ng/cogs/meme.py +++ b/robocop_ng/cogs/meme.py @@ -195,7 +195,7 @@ class Meme(Cog): if target is None and ctx.message.reference is None: await ctx.reply("https://tenor.com/view/bonk-gif-26414884") else: - if target is None: + if ctx.message.reference is not None: target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author diff --git a/robocop_ng/cogs/mod.py b/robocop_ng/cogs/mod.py index 3c1ee90..db2e07d 100644 --- a/robocop_ng/cogs/mod.py +++ b/robocop_ng/cogs/mod.py @@ -45,7 +45,9 @@ class Mod(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: + if target is not None: + reason = str(target) + reason target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author @@ -139,7 +141,9 @@ class Mod(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: + if target is not None: + reason = str(target) + reason target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author @@ -209,7 +213,9 @@ class Mod(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: + if target is not None: + reason = str(target) + reason target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author @@ -281,7 +287,9 @@ class Mod(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: + if target is not None: + reason = str(target) + reason target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author @@ -539,7 +547,7 @@ class Mod(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author @@ -578,7 +586,7 @@ class Mod(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author @@ -624,7 +632,9 @@ class Mod(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: + if target is not None: + reason = str(target) + reason target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author @@ -778,7 +788,7 @@ class Mod(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author diff --git a/robocop_ng/cogs/mod_timed.py b/robocop_ng/cogs/mod_timed.py index ef9d210..0134624 100644 --- a/robocop_ng/cogs/mod_timed.py +++ b/robocop_ng/cogs/mod_timed.py @@ -31,7 +31,9 @@ class ModTimed(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: + if target is not None: + duration = str(target) + duration target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author @@ -107,7 +109,9 @@ class ModTimed(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) else: - if target is None: + if ctx.message.reference is not None: + if target is not None: + duration = str(target) + duration target = ( await ctx.channel.fetch_message(ctx.message.reference.message_id) ).author