Skip to content

Commit

Permalink
Fix reply command targets
Browse files Browse the repository at this point in the history
  • Loading branch information
TSRBerry committed Aug 18, 2023
1 parent 69b7406 commit ee9c741
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion robocop_ng/cogs/meme.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async def bam_member(self, ctx, target: Optional[discord.Member]):
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
Expand Down
26 changes: 18 additions & 8 deletions robocop_ng/cogs/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ async def mute(self, ctx, target: Optional[discord.Member], *, reason: str = "")
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
Expand Down Expand Up @@ -139,7 +141,9 @@ async def kick(self, ctx, target: Optional[discord.Member], *, reason: str = "")
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
Expand Down Expand Up @@ -209,7 +213,9 @@ async def ban(self, ctx, target: Optional[discord.Member], *, reason: str = ""):
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
Expand Down Expand Up @@ -281,7 +287,9 @@ async def bandel(
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
Expand Down Expand Up @@ -539,7 +547,7 @@ async def approve(
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
Expand Down Expand Up @@ -578,7 +586,7 @@ async def revoke(
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
Expand Down Expand Up @@ -624,7 +632,9 @@ async def warn(self, ctx, target: Optional[discord.Member], *, reason: str = "")
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
Expand Down Expand Up @@ -778,7 +788,7 @@ async def nickname(self, ctx, target: Optional[discord.Member], *, nick: str = "
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
Expand Down
8 changes: 6 additions & 2 deletions robocop_ng/cogs/mod_timed.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ async def timeban(
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
Expand Down Expand Up @@ -107,7 +109,9 @@ async def timemute(
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
Expand Down

0 comments on commit ee9c741

Please sign in to comment.