import asyncio from sys import argv import discord from discord.ext import commands from discord import app_commands import PICable if len(argv) != 3: print("Usage:\n\t" + argv[0] + " ") exit(1) discord_token = argv[1] github_token = argv[2] intents = discord.Intents.default() intents.message_content = True client = commands.Bot(command_prefix="!", intents=intents) async def reply_message_async(interaction: discord.Interaction, owner: str, repo: str, event: asyncio.Event): await interaction.followup.send(PICable.PICable(owner, repo, github_token)) event.set() return @client.event async def on_ready(): print(f"We have logged in as {client.user}") await client.change_presence(activity=discord.Game("with PIC ideas")) try: synced = await client.tree.sync() print(f"Synced {len(synced)} command(s)") except Exception as e: print(f"Failed to sync commands: {e}") @client.tree.command(name="picable", description="Check a GitHub repository") @app_commands.describe(owner="The owner of the repository", repo="The name of the repository") async def picable(interaction: discord.Interaction, owner: str, repo: str): await interaction.response.defer() event = asyncio.Event() asyncio.create_task(reply_message_async(interaction, owner, repo, event)) client.run(discord_token)