Skip to content

Commit

Permalink
Fix dota colours
Browse files Browse the repository at this point in the history
  • Loading branch information
Aluerie committed Feb 17, 2025
1 parent 33282eb commit 1c44d7b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
12 changes: 4 additions & 8 deletions bot/bases/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ async def on_views_modals_error(
if interaction.channel_id == interaction.client.hideout.spam_channel_id:
# we don't need any extra embeds;
if not interaction.response.is_done():
await interaction.response.send_message(":(")
await interaction.response.send_message(":(", ephemeral=True)
return

response_to_user_embed = helpers.error_handler_response_embed(error, desc, unexpected=is_unexpected)
if interaction.response.is_done():
await interaction.followup.send(embed=response_to_user_embed, ephemeral=True)
await interaction.followup.send(embed=response_to_user_embed)
else:
await interaction.response.send_message(embed=response_to_user_embed, ephemeral=True)
await interaction.response.send_message(embed=response_to_user_embed)


class AluView(discord.ui.View):
Expand All @@ -104,11 +104,7 @@ class AluView(discord.ui.View):
"""

def __init__(
self,
*,
author_id: int | None,
view_name: str = "Interactive Element",
timeout: float | None = 180.0,
self, *, author_id: int | None, view_name: str = "Interactive Element", timeout: float | None = 180.0
) -> None:
"""Initialize AluView."""
super().__init__(timeout=timeout)
Expand Down
3 changes: 2 additions & 1 deletion bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ async def on_ready(self) -> None:
if not hasattr(self, "launch_time"):
self.launch_time = datetime.datetime.now(datetime.UTC)
log.info("Logged in as `%s`", self.user)
await self.send_warning("AluBot is ready.")
if not self.test:
await self.send_warning("AluBot is ready.")

@override
async def start(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions bot/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,6 @@ async def on_error(self, interaction: AluInteraction, error: app_commands.AppCom

response_embed = helpers.error_handler_response_embed(error, desc, unexpected=unexpected)
if not interaction.response.is_done():
await interaction.response.send_message(embed=response_embed, ephemeral=True)
await interaction.response.send_message(embed=response_embed)
else:
await interaction.followup.send(embed=response_embed, ephemeral=True)
await interaction.followup.send(embed=response_embed)
10 changes: 3 additions & 7 deletions ext/educational/language/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ async def format_page(self, entry: FreeDictionaryMeaning) -> discord.Embed:
class DictionaryCog(EducationalCog):
@app_commands.command(name="define")
@app_commands.describe(word="The word to look up")
async def _define(self, interaction: discord.Interaction[AluBot], word: str) -> None:
async def define(self, interaction: discord.Interaction[AluBot], word: str) -> None:
"""Looks up an English word in the dictionary."""
result = await parse_free_dictionary_for_word(self.bot.session, word=word)
if result is None:
Expand All @@ -359,12 +359,8 @@ async def _define(self, interaction: discord.Interaction[AluBot], word: str) ->
p = FreeDictionaryWordMeaningPaginator(interaction, result)
await p.start()

@_define.autocomplete("word")
async def _define_word_autocomplete(
self,
interaction: discord.Interaction[AluBot],
query: str,
) -> list[app_commands.Choice[str]]:
@define.autocomplete("word")
async def define_word_autocomplete(self, interaction: AluInteraction, query: str) -> list[app_commands.Choice[str]]:
if not query:
return []

Expand Down
4 changes: 2 additions & 2 deletions ext/fpc/dota/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def build_notification_image() -> Image.Image:

def draw_picked_heroes() -> None:
"""Draw picked heroes in the match."""
rectangle = Image.new("RGB", (canvas_w, topbar_h), str(color))
rectangle = Image.new("RGB", (canvas_w, topbar_h), fmt.color_to_str(color))
ImageDraw.Draw(rectangle)
canvas.paste(rectangle)

Expand Down Expand Up @@ -156,7 +156,7 @@ def draw_twitch_status() -> None:
font = ImageFont.truetype("./assets/fonts/Inter-Black-slnt=0.ttf", 13)
text = twitch_data["twitch_status"]
w, h = self.bot.transposer.get_text_wh(text, font)
draw.text(xy=(canvas_w - w, topbar_h + 1 + h), text=text, font=font, fill=str(color))
draw.text(xy=(canvas_w - w, topbar_h + 1 + h), text=text, font=font, fill=fmt.color_to_str(color))

draw_twitch_status()

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ reportUnusedVariable = "none"
reportUnusedClass = "none"
reportUnusedFunction = "none"

# Unknown stuff - a lot of libs don't **properly** declare types
# Unknown stuff - a lot of libs do not **properly** declare types for everything
reportUnknownMemberType = "none"
reportUnknownVariableType = "none"
reportUnknownArgumentType = "none"
Expand Down

0 comments on commit 1c44d7b

Please sign in to comment.