diff --git a/main.py b/main.py index 20fd407..7e2e099 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,5 @@ import asyncio +import functools from sys import argv import discord @@ -18,7 +19,13 @@ client = commands.Bot(command_prefix="/", intents=intents) async def reply_message_async(interaction: discord.Interaction, owner: str, repo: str): - await interaction.followup.send(PICable.PICable(owner, repo, github_token)) + try: + loop = asyncio.get_running_loop() + result = await loop.run_in_executor(None, functools.partial(PICable.PICable, owner, repo, github_token)) + await interaction.followup.send(result) + except Exception as e: + print(f"Error processing PICable check: {e}") + await interaction.followup.send("An error occurred while processing your request. Please try again later.") return @@ -38,6 +45,5 @@ async def on_ready(): async def picable(interaction: discord.Interaction, owner: str, repository: str): await interaction.response.defer(ephemeral=False, thinking=True) asyncio.create_task(reply_message_async(interaction, owner, repository)) - client.run(discord_token)