Method TryGetMessageAsync
- Namespace
- DisCatSharp.Entities
- Assembly
- DisCatSharp.dll
TryGetMessageAsync(ulong, bool, CancellationToken)
Tries to get a specific message.
public Task<DiscordMessage?> TryGetMessageAsync(ulong id, bool fetch = true, CancellationToken cancellationToken = default)
Parameters
idulongThe id of the message
fetchboolWhether to bypass the cache. Defaults to true.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
Exceptions
- UnauthorizedException
Thrown when the client does not have the ReadMessageHistory permission.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.