Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 17, 2024
1 parent 37a7a54 commit ea124a6
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 72 deletions.
4 changes: 3 additions & 1 deletion src/exts/core/author.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def __init__(self, client: interactions.Client) -> None:
self.client: interactions.Client = client
self.topgg: str = "https://top.gg/bot/809084067446259722"
self.github: str = "https://github.com/B1ue-Dev/Articuno"
self.invite_url: str = "https://discord.com/oauth2/authorize?client_id=809084067446259722&permissions=1644905889023&scope=bot%20applications.commands"
self.invite_url: str = (
"https://discord.com/oauth2/authorize?client_id=809084067446259722&permissions=1644905889023&scope=bot%20applications.commands"
)

@interactions.slash_command(
name="about",
Expand Down
4 changes: 3 additions & 1 deletion src/exts/fun/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class Google(interactions.Extension):

def __init__(self, client: interactions.Client) -> None:
self.client: interactions.Client = client
self.google_icon: str = "https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/2048px-Google_%22G%22_Logo.svg.png"
self.google_icon: str = (
"https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/2048px-Google_%22G%22_Logo.svg.png"
)

@hybrid_slash_command(
name="img",
Expand Down
8 changes: 5 additions & 3 deletions src/exts/fun/hangman.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,11 @@ async def hangman_leaderboard(self, ctx: HybridContext) -> None:
)
await paginator.send(
ctx=ctx,
content=f"You are at top {current_position}."
if current_position != 0
else "",
content=(
f"You are at top {current_position}."
if current_position != 0
else ""
),
)


Expand Down
8 changes: 5 additions & 3 deletions src/exts/fun/hug.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ async def hug(self, ctx: HybridContext, user: interactions.Member) -> None:
)

await ctx.send(
content="Hey, thanks for the hug. ^_^"
if int(user.id) == int(self.client.user.id)
else None,
content=(
"Hey, thanks for the hug. ^_^"
if int(user.id) == int(self.client.user.id)
else None
),
files=file,
)

Expand Down
48 changes: 30 additions & 18 deletions src/exts/fun/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ async def jail(

url: str = "https://some-random-api.com/canvas/jail"
params: dict = {
"avatar": user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url,
"avatar": (
user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url
),
}

resp = await get_response(url, params)
Expand Down Expand Up @@ -80,9 +82,11 @@ async def tonikawa(

url: str = "https://some-random-api.com/canvas/tonikawa"
params: dict = {
"avatar": user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url,
"avatar": (
user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url
),
}

resp = await get_response(url, params)
Expand Down Expand Up @@ -150,9 +154,11 @@ async def trigger(

url: str = "https://some-random-api.com/canvas/triggered"
params: dict = {
"avatar": user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url,
"avatar": (
user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url
),
}

resp = await get_response(url, params)
Expand Down Expand Up @@ -204,9 +210,11 @@ async def tweet(
nick = username
url: str = "https://some-random-api.com/canvas/tweet"
params: dict = {
"avatar": user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url,
"avatar": (
user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url
),
"username": username,
"displayname": nick,
"comment": comment,
Expand Down Expand Up @@ -255,9 +263,11 @@ async def youtube(
username = user.user.username
url = "https://some-random-api.com/canvas/youtube-comment"
params = {
"avatar": user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url,
"avatar": (
user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url
),
"username": username,
"comment": comment,
}
Expand Down Expand Up @@ -299,9 +309,11 @@ async def amogus(
text = f"""{user.user.username} was {"not" if str(random.choice(["true", "false"])) == "false" else ""} The Impostor"""
url: str = "https://some-random-api.com/premium/amongus"
params: dict = {
"avatar": user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url,
"avatar": (
user.avatar.url
if user.guild_avatar is None
else user.guild_avatar.url
),
"username": user.user.username,
"custom": text,
"key": "hello",
Expand Down
4 changes: 3 additions & 1 deletion src/exts/fun/petpet.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ async def pet(self, ctx: HybridContext, user: interactions.Member) -> None:
if _hash.isdigit():
_url: str = f"https://cdn.discordapp.com/embed/avatars/{_hash}.png"
else:
_url: str = f"https://cdn.discordapp.com/avatars/{str(user.user.id)}/{_hash}.png"
_url: str = (
f"https://cdn.discordapp.com/avatars/{str(user.user.id)}/{_hash}.png"
)

member_avatar = Image.open(await get_response(_url)).convert("RGBA")
member_avatar = member_avatar.resize(
Expand Down
30 changes: 18 additions & 12 deletions src/exts/fun/tictactoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,21 +510,27 @@ async def process_turn(self, ctx: interactions.ComponentContext) -> None:
content = f"{ctx.author.mention}'s tic tac toe game " + (
"(easy mode)"
if ctx.message.content.find("easy mode") != -1
else "(hard mode)"
if ctx.message.content.find("hard mode") != -1
else "(medium mode)"
else (
"(hard mode)"
if ctx.message.content.find("hard mode") != -1
else "(medium mode)"
)
)

await ctx.edit_origin(
content=content
if not winner
else f"{winner} has won! "
+ (
"(easy mode)"
if ctx.message.content.find("easy mode") != -1
else "(hard mode)"
if ctx.message.content.find("hard mode") != -1
else "(medium mode)"
content=(
content
if not winner
else f"{winner} has won! "
+ (
"(easy mode)"
if ctx.message.content.find("easy mode") != -1
else (
"(hard mode)"
if ctx.message.content.find("hard mode") != -1
else "(medium mode)"
)
)
),
components=render_board(board, disable=winner is not None),
)
Expand Down
10 changes: 6 additions & 4 deletions src/exts/fun/whos_that_pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@ def _check(_ctx):
for i in range(4):
_button_disabled.append(
interactions.Button(
style=interactions.ButtonStyle.SECONDARY
if str(pokemon_list[i]["num"])
!= str(corrected_pokemon.num)
else interactions.ButtonStyle.SUCCESS,
style=(
interactions.ButtonStyle.SECONDARY
if str(pokemon_list[i]["num"])
!= str(corrected_pokemon.num)
else interactions.ButtonStyle.SUCCESS
),
label=f"{pokemon_list[i]['name']}",
custom_id=f"{pokemon_list[i]['num']}",
disabled=True,
Expand Down
70 changes: 43 additions & 27 deletions src/exts/utils/emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ async def info(self, ctx: interactions.SlashContext, emoji: str) -> None:

image = interactions.EmbedAttachment(url=_url)
embed = interactions.Embed(
title=f"``<a:{emote.name}:{emote.id}>``"
if emote.animated
else f"``<:{emote.name}:{emote.id}>``",
title=(
f"``<a:{emote.name}:{emote.id}>``"
if emote.animated
else f"``<:{emote.name}:{emote.id}>``"
),
description="".join(
[
f"[Emoji link]({_url})\n",
Expand Down Expand Up @@ -199,9 +201,11 @@ async def info(self, ctx: interactions.SlashContext, emoji: str) -> None:
)
image = interactions.EmbedAttachment(url=url)
embed = interactions.Embed(
title=f"``<a:{_emoji.name}:{_emoji.id}>``"
if _emoji.animated
else f"``<:{_emoji.name}:{_emoji.id}>``",
title=(
f"``<a:{_emoji.name}:{_emoji.id}>``"
if _emoji.animated
else f"``<:{_emoji.name}:{_emoji.id}>``"
),
description="".join(
[
f"[Emoji link]({url})\n",
Expand Down Expand Up @@ -241,9 +245,11 @@ async def info(self, ctx: interactions.SlashContext, emoji: str) -> None:
)
image = interactions.EmbedAttachment(url=url)
embed = interactions.Embed(
title=f"``<a:{_emoji.name}:{_emoji.id}>``"
if _emoji.animated
else f"``<:{_emoji.name}:{_emoji.id}>``",
title=(
f"``<a:{_emoji.name}:{_emoji.id}>``"
if _emoji.animated
else f"``<:{_emoji.name}:{_emoji.id}>``"
),
description="".join(
[
f"[Emoji link]({url})\n",
Expand Down Expand Up @@ -327,9 +333,9 @@ async def steal(

_io = (io.BytesIO(await resp.read())).read()
image = interactions.File(
file_name="unknown.gif"
if emote.animated
else "unknown.png",
file_name=(
"unknown.gif" if emote.animated else "unknown.png"
),
file=_io,
)
try:
Expand Down Expand Up @@ -374,9 +380,11 @@ async def steal(

_io = (io.BytesIO(await resp.read())).read()
image = interactions.File(
file_name="unknown.gif"
if str(resp.content_type) == "image/gif"
else "unknown.png",
file_name=(
"unknown.gif"
if str(resp.content_type) == "image/gif"
else "unknown.png"
),
file=_io,
)
try:
Expand Down Expand Up @@ -486,9 +494,11 @@ async def add(
_io = (io.BytesIO(await resp.read())).read()
image = interactions.File(
file=_io,
file_name="unknown.gif"
if resp.content_type == "image/gif"
else "unknown.png",
file_name=(
"unknown.gif"
if resp.content_type == "image/gif"
else "unknown.png"
),
)
try:
e = await ctx.guild.create_custom_emoji(
Expand Down Expand Up @@ -534,9 +544,11 @@ async def add(
_io = (io.BytesIO(await resp.read())).read()
image = interactions.File(
file=_io,
file_name="unknown.gif"
if resp.content_type == "image/gif"
else "unknown.png",
file_name=(
"unknown.gif"
if resp.content_type == "image/gif"
else "unknown.png"
),
)
try:
e = await ctx.guild.create_custom_emoji(
Expand Down Expand Up @@ -675,9 +687,11 @@ async def user_get_emoji(

image = interactions.EmbedAttachment(url=_emoji.url)
embed = interactions.Embed(
title=f"``<a:{_emoji.name}:{_emoji.id}>``"
if _emoji.animated
else f"``<:{_emoji.name}:{_emoji.id}>``",
title=(
f"``<a:{_emoji.name}:{_emoji.id}>``"
if _emoji.animated
else f"``<:{_emoji.name}:{_emoji.id}>``"
),
description="".join(
[
f"[Emoji link]({_emoji.url})\n",
Expand All @@ -701,9 +715,11 @@ async def user_get_emoji(

image = interactions.EmbedAttachment(url=_emoji.url)
embed = interactions.Embed(
title=f"``<a:{_emoji.name}:{_emoji.id}>``"
if _emoji.animated
else f"``<:{_emoji.name}:{_emoji.id}>``",
title=(
f"``<a:{_emoji.name}:{_emoji.id}>``"
if _emoji.animated
else f"``<:{_emoji.name}:{_emoji.id}>``"
),
description="".join(
[
f"[Emoji link]({_emoji.url})\n",
Expand Down
3 changes: 1 addition & 2 deletions src/utils/error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ async def on_command_error(

elif isinstance(event.error, interactions.errors.CommandCheckFailure):

class Null:
...
class Null: ...

return Null

Expand Down

0 comments on commit ea124a6

Please sign in to comment.