Discord.net: Get the id of the message I just sent

Created on 28 Oct 2019  路  3Comments  路  Source: discord-net/Discord.Net

I use SocketTextChannel.SendMessageAsync() to send my messages. But after I sent them I need their ID. How can I accomplish that?

question

Most helpful comment

SendMessageAsync returns the message object for the message that gets sent. Store it and retrieve it's ID property

In case that still confuses you; var message = await SocketTextChannel.SendMessageAsync() will return you an IUserMessage which you can then get the ID from.

All 3 comments

SendMessageAsync returns the message object for the message that gets sent. Store it and retrieve it's ID property

SendMessageAsync returns the message object for the message that gets sent. Store it and retrieve it's ID property

In case that still confuses you; var message = await SocketTextChannel.SendMessageAsync() will return you an IUserMessage which you can then get the ID from.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings