-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import discord | ||
from discord.ext import commands | ||
from src.trakt.global_weekly import create_weekly_global_embed | ||
from utils.custom_logger import logger | ||
|
||
|
||
class TraktCog(commands.Cog): | ||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
@commands.command(name="trakt") | ||
async def trakt(self, ctx): | ||
"""Fetches and displays the weekly global Trakt stats manually.""" | ||
try: | ||
logger.info("!trakt command invoked") | ||
embed_data = create_weekly_global_embed() | ||
for embed in embed_data["embeds"]: | ||
await ctx.send(embed=discord.Embed.from_dict(embed)) | ||
except Exception as e: | ||
logger.error(f"Error processing !trakt command: {e}") | ||
await ctx.send("An error occurred while fetching Trakt data.") | ||
|
||
|
||
async def setup(bot): | ||
"""Setup function to add the cog to the bot.""" | ||
logger.info('Trakt cog have been loaded') | ||
await bot.add_cog(TraktCog(bot)) |