【问题标题】:Sending a message to a specific channel with discord.py使用 discord.py 向特定频道发送消息
【发布时间】:2020-01-26 05:12:58
【问题描述】:

我正在尝试使用 discord.py 制作一个 modmail 机器人,但我正在尝试将消息从 DM 发送到服务器中的特定频道。我尝试了以下方法:

@bot.command()
async def startcase(ctx, *args):
  channel = client.get_channel(XXXXXX)
  mesg = ' '.join(args)
  await ctx.channel.send(mesg)

【问题讨论】:

  • 你的问题是什么?你遇到了什么错误?

标签: python discord.py


【解决方案1】:

您正在使用来自Context.channel 属性的通道,这将是发送命令的通道,而不是您从Client.get_channel 获得的channel 来发送消息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-03
    • 2021-03-24
    • 1970-01-01
    • 1970-01-01
    • 2021-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多