【发布时间】:2021-06-11 12:04:31
【问题描述】:
我正在尝试在 discord 中创建帮助“日志”命令。
@client.command()
async def logs(ctx):
for channel in ctx.guild.channels:
if channel.name == "henry-logs":
await ctx.send("Henry Logs channel is already setup. If you have access to it, it should be available in the channel list")
else:
await ctx.send("Henry logs channel is not found! If you have such access please create channel named **EXACTLY**")
await ctx.send("```henry-logs```")
但是它不会发送一次未找到的消息,而是针对每个不是“henry-logs”的频道,因为我在构建中使用了频道。
有没有办法修复它,如果频道不存在则只发送一次,如果存在则只发送一次?
【问题讨论】:
-
给出的答案是否回答了您的问题?如果是这样,请将其标记为已接受的答案以关闭此问题。如果您仍然看到一些错误或任何意外行为,请在您的问题中提供更多详细信息或对答案发表评论,谢谢!
标签: python discord discord.py