为了账号安全,请及时绑定邮箱和手机立即绑定

如何向特定频道发送消息?

如何向特定频道发送消息?

繁星淼淼 2023-08-08 15:45:43
@client.eventasync def on_message_delete(message):    content = message.content    author = message.author    await message.channel.send("{}: {}".format(author, content))我搜索了它,但找不到任何结果。我尝试使用 client.get_channel("id") 它给出了typerror 我尝试将其转换为 int 但仍然不起作用。 你能帮我吗?
查看完整描述

1 回答

?
开心每一天1111

TA贡献1836条经验 获得超13个赞

将检索到的数据发送到特定的公会和频道


specific_guild = client.get_guild( guild_id )#guild_id must be a integer

specific_channel = specific_guild.get_channel( channel_id )#channel_id must be a integer

await specific_channel.send("{}: {}".format(author, content))

将检索到的数据发送到同一行会的特定频道


specific_channel = message.guild.get_channel( channel_id )#channel_id must be a integer

await specific_channel.send("{}: {}".format(author, content))


查看完整回答
反对 回复 2023-08-08
  • 1 回答
  • 0 关注
  • 90 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信