[英]How to convert a message id from discord in the actually text that is written?
所以我正在用 Python 编写一个不和谐的机器人,我想获得我之前定义的消息的消息内容......使用我的代码我只得到这个:
<Message id=1234567890 channel=<TextChannel id=1234567890 name='tests' position=6 nsfw=False news=False category_id=1234567890> type=<MessageType.default: 0> author=<Member id=1234567890 name='example' discriminator='1234' bot=False nick='name' guild=<Guild id=1234567890 name='name2' shard_id=None chunked=True member_count=5>> flags=<MessageFlags value=0>>
这是代码:
await message.channel.send('Please work:')
try:
beschreibung = await client.wait_for('message', check=definitionidefinedbefore, timeout=85.0)
except asyncio.TimeoutError:
return await message.channel.send('Too slow.')
我只想要写在消息中的文本,而不是其他内容。
我在互联网上找不到任何东西,我几乎绝望了😅如果有人能帮助我,我将不胜感激:)
打印的字符串看起来像是从其__repr__
函数打印对象的结果。
从 discord.py 文档中,我在那里找到了Message
对象,您可以通过访问其content
属性(如beschreibung.content
来简单地访问消息内容。
文档: https : //discordpy.readthedocs.io/en/latest/api.html? highlight = message# discord.Message.content
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.