Browse Source

Fix examples

pull/1854/head
Paulo 4 years ago
parent
commit
395ecf005a
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/Discord.Net.Examples/WebSocket/BaseSocketClient.Events.Examples.cs

+ 3
- 3
src/Discord.Net.Examples/WebSocket/BaseSocketClient.Events.Examples.cs View File

@@ -15,7 +15,7 @@ namespace Discord.Net.Examples.WebSocket
=> client.ReactionAdded += HandleReactionAddedAsync; => client.ReactionAdded += HandleReactionAddedAsync;


public async Task HandleReactionAddedAsync(Cacheable<IUserMessage, ulong> cachedMessage, public async Task HandleReactionAddedAsync(Cacheable<IUserMessage, ulong> cachedMessage,
Cacheable<ISocketMessageChannel, ulong> originChannel, SocketReaction reaction)
Cacheable<IMessageChannel, ulong> originChannel, SocketReaction reaction)
{ {
var message = await cachedMessage.GetOrDownloadAsync(); var message = await cachedMessage.GetOrDownloadAsync();
if (message != null && reaction.User.IsSpecified) if (message != null && reaction.User.IsSpecified)
@@ -100,12 +100,12 @@ namespace Discord.Net.Examples.WebSocket
public void HookMessageDeleted(BaseSocketClient client) public void HookMessageDeleted(BaseSocketClient client)
=> client.MessageDeleted += HandleMessageDelete; => client.MessageDeleted += HandleMessageDelete;


public async Task HandleMessageDelete(Cacheable<IMessage, ulong> cachedMessage, Cacheable<ISocketMessageChannel, ulong> cachedChannel)
public async Task HandleMessageDelete(Cacheable<IMessage, ulong> cachedMessage, Cacheable<IMessageChannel, ulong> cachedChannel)
{ {
// check if the message exists in cache; if not, we cannot report what was removed // check if the message exists in cache; if not, we cannot report what was removed
if (!cachedMessage.HasValue) return; if (!cachedMessage.HasValue) return;
// gets or downloads the channel if it's not in the cache // gets or downloads the channel if it's not in the cache
ISocketMessageChannel channel = await cachedChannel.GetOrDownloadAsync();
IMessageChannel channel = await cachedChannel.GetOrDownloadAsync();
var message = cachedMessage.Value; var message = cachedMessage.Value;
Console.WriteLine( Console.WriteLine(
$"A message ({message.Id}) from {message.Author} was removed from the channel {channel.Name} ({channel.Id}):" $"A message ({message.Id}) from {message.Author} was removed from the channel {channel.Name} ({channel.Id}):"


Loading…
Cancel
Save