1
1
1 22020-12-09 14:29:15
Python
1 2, 2020-12-09 14:29:15

Discord.py how to implement a new discord response system in a bot?

Discord has a new answer system. The documentation for discord.py doesn't say anything about this. How can I use this system in my bot?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Nevzorov, 2020-12-09
@weRifiCatoR

The responses feature is relatively new, and there are no stable versions of the library with it yet.
There are two options at the moment:
1. Use the latest version of the library from GitHub .
In this case, you can use new methods. At the moment, there is no collected documentation for them, so you will have to read the source code of the library, or use the documentation built into python.
Change itself with adding answers: d1cb30cccf39648e21c0f7c73cb087fc730b8e25

# примеры использования, на данный момент, может измениться в будущем:
await ctx.send("my reply to your message", reference=discord.MessageReference(message_id=861988287927326702, channel_id=554470291913241936))
await ctx.send("my reply to your message", reference=discord.MessageReference.from_message(ctx.message))
await ctx.send("my reply to your message", reference=ctx.message.to_reference())
await ctx.reply("my reply to your message", mention_author=False)

2. Make a request to the discord API manually:
await bot.http.request(
    discord.http.Route(
        "POST", "/channels/{channel_id}/messages", channel_id=ctx.channel.id
    ),
    json={
        "content": "test",
        "message_reference": {
            "guild_id": "453391932705247478",
            "channel_id": "554470291913241936",
            "message_id": "861988287927326702",
        },
    },
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question