簡體   English   中英

在 Discord 中發送消息時,我無法收到響應消息?

[英]I am not able to receive a response message when send a message in Discord?

在 Discord 中發送消息時,我無法收到響應消息? 我認為我在這里的交互有問題。發送(“你好!)

import nextcord
from nextcord import Button, Interaction
from nextcord.ext import commands
from config import DISCORD_ALERT_TOKEN

TESTING_GUILD_ID = 123456789 # Replace with your own guild IDs
client = commands.Bot(command_prefix="?")

@client.event
async def on_ready():
    print(f"{client.user.name} has connected to Discord.")
    await client.wait_until_ready()
    channel = client.get_channel(int(966316317890207779))
    await channel.send(f"{client.user.name} has connected to Discord.")

@client.slash_command(description="My first slash command", guild_ids=[TESTING_GUILD_ID])
async def hello(interaction: nextcord.Integration):
    await interaction.send("Hello!")  

client.run(DISCORD_ALERT_TOKEN)

所以在搜索之后我發現了問題。 要設置的范圍

如果未選中范圍應用程序命令,它將不起作用。 然后,您必須選擇它並再次邀請該機器人。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM