【发布时间】:2021-02-10 07:13:10
【问题描述】:
所以我想在有人在这个频道写文章时添加一条消息
代码
@bot.event
async def on_message(message):
formats = ['jpg', 'png', 'gif', 'svg']
attachments = [f for f in message.attachments if f.filename.split('.')[-1] in formats]
if message.channel.name == 'bild' and not attachments:
await message.delete()
await bot.process_commands(message)
我是否只将 ctx 添加到 on_message(message) 并使用 ctx.send 完成它?
【问题讨论】:
-
“当有人在这个频道写信时我想添加一条消息”是什么意思?您要向该频道发送消息吗?
-
是的,向那个频道发送一条消息说,你不能只发送文本,类似的东西
标签: python discord discord.py