remove event. improve description.
This commit is contained in:
17
main.py
17
main.py
@@ -3,7 +3,6 @@ from sys import argv
|
||||
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord import app_commands
|
||||
|
||||
import PICable
|
||||
|
||||
@@ -15,12 +14,11 @@ github_token = argv[2]
|
||||
|
||||
intents = discord.Intents.default()
|
||||
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))
|
||||
event.set()
|
||||
return
|
||||
|
||||
|
||||
@@ -35,12 +33,11 @@ async def on_ready():
|
||||
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.tree.command(name="picable", description="Check if a Github repository is eligible for PIC")
|
||||
@discord.app_commands.describe(owner="The owner of the repository", repository="The name of the repository")
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user