python - 获取发送消息的频道的ID
问题描述
我想要做的是找到发送消息的频道。
前任:
async def on_message(on_message):
# Get Channel Id
channel bot.get_channel(channel_id)
await channel.send('test')
解决方案
你在遮遮掩掩on_message
。相反,您应该将正在传递的Message
对象命名为.on_message
message
该Message
对象具有一个channel
属性,即TextChannel
发送消息的属性。
该TextChannel
对象还具有一个id
属性,即通道的 ID。
有关降价的帮助,请参阅https://stackoverflow.com/editing-help。
推荐阅读
- dart - Flutter中解析的json中的多个对象
- angular - 我想从我的 url 中删除 pages/ 角度 5
- react-native - 当我运行将产品添加到购物车并打开模式时反应本机重定向初始场景
- html - rmarkdown 文件 (.Rmd) 的 html 在浏览器中未正确显示
- javascript - 如何分离功能
- c++ - 测试 double 是否为整数
- c# - 在 Unity 中导致相同实例的两种不同类型
- php - php twitter API试图获取非对象位置的属性
- python - 使用 unravel_index 查找最大数的索引
- javascript - 使用 jquery 和 ajax 提交表单但没有提交按钮