remove event. improve description.

This commit is contained in:
Enzo Nunes
2025-02-24 18:43:11 +00:00
parent 722d221b43
commit 4d730116f0

17
main.py
View File

@@ -3,7 +3,6 @@ from sys import argv
import discord import discord
from discord.ext import commands from discord.ext import commands
from discord import app_commands
import PICable import PICable
@@ -15,12 +14,11 @@ github_token = argv[2]
intents = discord.Intents.default() intents = discord.Intents.default()
intents.message_content = True intents.message_content = True
client = commands.Bot(command_prefix="!", intents=intents) client = commands.Bot(command_prefix="/", intents=intents)
async def reply_message_async(interaction: discord.Interaction, owner: str, repo: str, event: asyncio.Event): async def reply_message_async(interaction: discord.Interaction, owner: str, repo: str):
await interaction.followup.send(PICable.PICable(owner, repo, github_token)) await interaction.followup.send(PICable.PICable(owner, repo, github_token))
event.set()
return return
@@ -35,12 +33,11 @@ async def on_ready():
print(f"Failed to sync commands: {e}") print(f"Failed to sync commands: {e}")
@client.tree.command(name="picable", description="Check a GitHub repository") @client.tree.command(name="picable", description="Check if a Github repository is eligible for PIC")
@app_commands.describe(owner="The owner of the repository", repo="The name of the repository") @discord.app_commands.describe(owner="The owner of the repository", repository="The name of the repository")
async def picable(interaction: discord.Interaction, owner: str, repo: str): async def picable(interaction: discord.Interaction, owner: str, repository: str):
await interaction.response.defer() await interaction.response.defer(ephemeral=False, thinking=True)
event = asyncio.Event() asyncio.create_task(reply_message_async(interaction, owner, repository))
asyncio.create_task(reply_message_async(interaction, owner, repo, event))
client.run(discord_token) client.run(discord_token)