chore: ruff formatting

This commit is contained in:
neoarz
2025-11-02 23:32:52 -05:00
parent 2ce2c69a87
commit 1eff6c9f53
91 changed files with 3824 additions and 2518 deletions

View File

@@ -6,6 +6,7 @@ from discord.ext import commands
import aiohttp
import random
def mcquote_command():
@commands.hybrid_command(
name="mcquote",
@@ -19,8 +20,10 @@ def mcquote_command():
description="This command can only be used in servers.",
color=0xE02B2B,
)
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
interaction = getattr(context, "interaction", None)
if interaction is not None:
if not interaction.response.is_done():
@@ -37,8 +40,10 @@ def mcquote_command():
description="The bot needs the `send messages` permission in this channel.",
color=0xE02B2B,
)
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
interaction = getattr(context, "interaction", None)
if interaction is not None:
if not interaction.response.is_done():
@@ -55,8 +60,10 @@ def mcquote_command():
description="Please provide text for the Minecraft quote.",
color=0xE02B2B,
)
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
interaction = getattr(context, "interaction", None)
if interaction is not None:
if not interaction.response.is_done():
@@ -73,8 +80,10 @@ def mcquote_command():
description="Text must be 25 characters or less.",
color=0xE02B2B,
)
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
interaction = getattr(context, "interaction", None)
if interaction is not None:
if not interaction.response.is_done():
@@ -88,7 +97,9 @@ def mcquote_command():
# Check if bot has send messages permission before starting quote generation
try:
test_embed = discord.Embed(title="Testing permissions...", color=0x7289DA)
test_embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
test_embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
await context.channel.send(embed=test_embed, delete_after=0.1)
except discord.Forbidden:
embed = discord.Embed(
@@ -96,8 +107,10 @@ def mcquote_command():
description="The bot needs the `send messages` permission to execute this command.",
color=0xE02B2B,
)
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
interaction = getattr(context, "interaction", None)
if interaction is not None:
if not interaction.response.is_done():
@@ -113,12 +126,16 @@ def mcquote_command():
description="<a:mariospin:1423677027013103709> Generating quote... This may take a moment.",
color=0x7289DA,
)
processing_embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
processing_embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
interaction = getattr(context, "interaction", None)
if interaction is not None:
if not interaction.response.is_done():
await interaction.response.send_message(embed=processing_embed, ephemeral=True)
await interaction.response.send_message(
embed=processing_embed, ephemeral=True
)
else:
await interaction.followup.send(embed=processing_embed, ephemeral=True)
else:
@@ -126,7 +143,7 @@ def mcquote_command():
quote_text = text.replace(" ", "+")
random_number = random.randint(1, 39)
mc_quote_url = f'https://skinmc.net/achievement/{random_number}/Achievement+Unlocked!/{quote_text}'
mc_quote_url = f"https://skinmc.net/achievement/{random_number}/Achievement+Unlocked!/{quote_text}"
try:
async with aiohttp.ClientSession() as session:
@@ -142,12 +159,17 @@ def mcquote_command():
title="Minecraft Quote",
color=0x7289DA,
)
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
embed.set_footer(text=f"Requested by {context.author.name}", icon_url=context.author.display_avatar.url)
embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
embed.set_footer(
text=f"Requested by {context.author.name}",
icon_url=context.author.display_avatar.url,
)
with open(temp_file_path, 'rb') as f:
with open(temp_file_path, "rb") as f:
file = discord.File(f, filename="mcquote.png")
interaction = getattr(context, "interaction", None)
if interaction is not None:
await context.channel.send(embed=embed)
@@ -168,8 +190,10 @@ def mcquote_command():
description="Failed to generate Minecraft quote. Please try again later.",
color=0xE02B2B,
)
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
interaction = getattr(context, "interaction", None)
if interaction is not None:
try:
@@ -186,8 +210,10 @@ def mcquote_command():
description=f"An unexpected error occurred: {str(e)}",
color=0xE02B2B,
)
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
embed.set_author(
name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp"
)
interaction = getattr(context, "interaction", None)
if interaction is not None:
try:
@@ -198,5 +224,5 @@ def mcquote_command():
else:
await processing_msg.delete()
await context.send(embed=embed, ephemeral=True)
return mcquote
return mcquote