From 1e995154c6d3c95b9221c99ea2bd1a9fdbf6e604 Mon Sep 17 00:00:00 2001 From: rtk-rnjn Date: Thu, 27 Jun 2024 17:32:36 +0530 Subject: [PATCH] Refactor code for better readability and maintainability --- cogs/nasa/nasa.py | 2 ++ events/on_msg.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cogs/nasa/nasa.py b/cogs/nasa/nasa.py index 6c9c83e9..f9008592 100644 --- a/cogs/nasa/nasa.py +++ b/cogs/nasa/nasa.py @@ -63,6 +63,8 @@ def __init__(self, bot: Parrot) -> None: self._cache: dict = {} self._api_params = {"api_key": NASA_KEY} + self.apod_loop.start() + @property def display_emoji(self) -> discord.PartialEmoji: return discord.PartialEmoji(name="nasa", id=892425662864982056) diff --git a/events/on_msg.py b/events/on_msg.py index d2be2133..74b67166 100644 --- a/events/on_msg.py +++ b/events/on_msg.py @@ -662,8 +662,8 @@ async def _on_message_passive_afk_user_message(self, message: discord.Message): if message.guild is None: return - if message.author.bot and message.interaction is not None: - interacted_user = message.interaction.user + if message.author.bot and message.interaction_metadata is not None: + interacted_user = message.interaction_metadata.user else: interacted_user = message.author