IceFire
IceFire

Reputation: 33

Discord.py How to get the id of a sent message with the BOT?

How can I get the id of the message I send using the BOT? I'm using something like that:

await ctx.send("Test")

But then I don't know what to do to get the id. On the API reference there isn't written how to achieve that.

Upvotes: 2

Views: 7692

Answers (1)

Deru
Deru

Reputation: 1173

You can do:

message = await ctx.send("Test")

To get the message you sent. If you then want to get the id of that message you can do the following:

message = await ctx.send("Test")
message_id = message.id

Upvotes: 5

Related Questions