reply-targets: Await the result of fetch_message() (#39)

* Await the result of fetch_message()

* Apply black formatting
This commit is contained in:
TSRBerry 2023-04-05 18:57:46 +02:00 committed by GitHub
parent bf59634898
commit 3a0230259a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 30 deletions

View file

@ -43,8 +43,8 @@ class Meme(Cog):
) )
else: else:
if user is None: if user is None:
user = ctx.channel.fetch_message( user = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
celsius = random.randint(15, 100) celsius = random.randint(15, 100)
@ -72,8 +72,8 @@ class Meme(Cog):
) )
else: else:
if user is None: if user is None:
user = ctx.channel.fetch_message( user = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
celsius = random.randint(-50, 15) celsius = random.randint(-50, 15)
fahrenheit = self.c_to_f(celsius) fahrenheit = self.c_to_f(celsius)
@ -92,8 +92,8 @@ class Meme(Cog):
await ctx.send(f"No stars for you, {ctx.author.mention}!") await ctx.send(f"No stars for you, {ctx.author.mention}!")
else: else:
if user is None: if user is None:
user = ctx.channel.fetch_message( user = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
await ctx.send(f"{user.mention} gets a :star:, yay!") await ctx.send(f"{user.mention} gets a :star:, yay!")
@ -107,8 +107,8 @@ class Meme(Cog):
await ctx.send(f"{ctx.author.mention}, you can't reward yourself.") await ctx.send(f"{ctx.author.mention}, you can't reward yourself.")
else: else:
if user is None: if user is None:
user = ctx.channel.fetch_message( user = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
embed = discord.Embed( embed = discord.Embed(
title="ReSwitched Silver™!", title="ReSwitched Silver™!",
@ -183,8 +183,8 @@ class Meme(Cog):
await ctx.reply("https://tenor.com/view/bonk-gif-26414884") await ctx.reply("https://tenor.com/view/bonk-gif-26414884")
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
if target == ctx.author: if target == ctx.author:
if target.id == 181627658520625152: if target.id == 181627658520625152:

View file

@ -46,8 +46,8 @@ class Mod(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
@ -140,8 +140,8 @@ class Mod(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
@ -210,8 +210,8 @@ class Mod(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
@ -282,8 +282,8 @@ class Mod(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
@ -540,8 +540,8 @@ class Mod(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
log_channel = self.bot.get_channel(self.bot.config.modlog_channel) log_channel = self.bot.get_channel(self.bot.config.modlog_channel)
@ -579,8 +579,8 @@ class Mod(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
log_channel = self.bot.get_channel(self.bot.config.modlog_channel) log_channel = self.bot.get_channel(self.bot.config.modlog_channel)
@ -625,8 +625,8 @@ class Mod(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
@ -779,8 +779,8 @@ class Mod(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
try: try:

View file

@ -32,8 +32,8 @@ class ModTimed(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
@ -108,8 +108,8 @@ class ModTimed(Cog):
) )
else: else:
if target is None: if target is None:
target = ctx.channel.fetch_message( target = (
ctx.message.reference.message_id await ctx.channel.fetch_message(ctx.message.reference.message_id)
).author ).author
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author: