Начерновил дерево команд

This commit is contained in:
bogdan zažigin 2023-04-04 20:45:36 +03:00
parent 94beb189ae
commit 2b39f8990f
Signed by: zaboal
GPG key ID: C9918166D559FE8A

View file

@ -10,14 +10,14 @@ gl = gitlab.Gitlab(url = 'https://gitlab.megu.one',
private_token = environ.get("TOKEN_GITLAB"))
project = gl.projects.get(13)
# надо чтобы id проекта привязался к id канала
intents = discord.Intents.default()
intents.message_content = True
discord_bot = discord.Client(intents=intents)
discord_bot = discord.Client(intents=intents) # Объявление о существовании бота
#tree_commands = discord.app_commands.CommandTree(discord_bot) # Объявление дерева команд бота
@ -31,10 +31,22 @@ async def on_message(message):
if message.content.startswith('/issue'): # Создание на базе этого задачи на ГитЛабе и отчёт об этом в канал
if project.issues.create({'title': issue_text,'description': 'Something useful here.'}):
await message.channel.send("Задача «" + issue_text + "» создана.")
#command_issue_extras = dict()
#@tree_commands.command(name="issue", description="создать задачу на GitLab", nsfw=False, auto_locale_strings=False)
#async def issue(interaction):
# await interaction.response.send_message(f"Pong", ephemeral=True)
#add_command(*command_issue, guild=None, guilds=None, override=True)
#asyncio.run(sync(*command_issue, guild=None))
command_issue = discord.app_commands.command(name="issue", description="создать задачу на GitLab", nsfw=False, auto_locale_strings=False)
add_command(command_issue, *, guild=None, guilds=None, override=True)
await sync(*, guild=None)
discord_bot.run(environ.get("TOKEN_DISCORD"))