Программы на Python
Anonymous
Как глобально синхронизировать команду слэша в discord.py
Сообщение
Anonymous » 07 ноя 2024, 23:07
Я хочу синхронизировать все слэш-команды со всеми гильдиями в discord.py
Мой код
Код: Выделить всё
import discord
from discord import app_commands
from discord.ext import commands
intents = discord.Intents.default()
client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)
@client.event
async def on_ready():
print(f'We have logged in as {client.user}')
try:
await tree.sync(guild=discord.Object(id=11234411))
print(f'Synced')
except Exception as e:
print(e)
@tree.command(name="ping", description="Simple ping pong command", guild=discord.Object(id=1032007648566059142))
async def ping(interaction):
await interaction.response.send_message(f"Pong", ephemeral=True)
Я пытался просто удалить guild=discord.Object(id=11234411), но это не работает
Подробнее здесь:
https://stackoverflow.com/questions/744 ... discord-py
1731010031
Anonymous
Я хочу синхронизировать все слэш-команды со всеми гильдиями в discord.py Мой код [code]import discord from discord import app_commands from discord.ext import commands intents = discord.Intents.default() client = discord.Client(intents=intents) tree = app_commands.CommandTree(client) @client.event async def on_ready(): print(f'We have logged in as {client.user}') try: await tree.sync(guild=discord.Object(id=11234411)) print(f'Synced') except Exception as e: print(e) @tree.command(name="ping", description="Simple ping pong command", guild=discord.Object(id=1032007648566059142)) async def ping(interaction): await interaction.response.send_message(f"Pong", ephemeral=True) [/code] Я пытался просто удалить guild=discord.Object(id=11234411), но это не работает Подробнее здесь: [url]https://stackoverflow.com/questions/74413367/how-to-sync-slash-command-globally-discord-py[/url]