Update events.cs
Gladly taking suggestions for a better comments.
This commit is contained in:
@@ -8,7 +8,11 @@ public class Program
|
|||||||
|
|
||||||
public async Task MainAsync()
|
public async Task MainAsync()
|
||||||
{
|
{
|
||||||
_client = new DiscordSocketClient();
|
// When working with events that have Cacheable<IMessage, ulong> parameters,
|
||||||
|
// you must enable the message cache in your config settings if you plan to
|
||||||
|
// use the cached message entity.
|
||||||
|
_config = new DiscordSocketConfig { MessageCacheSize = 100 };
|
||||||
|
_client = new DiscordSocketClient(_config);
|
||||||
|
|
||||||
await _client.LoginAsync(TokenType.Bot, "bot token");
|
await _client.LoginAsync(TokenType.Bot, "bot token");
|
||||||
await _client.StartAsync();
|
await _client.StartAsync();
|
||||||
@@ -25,7 +29,8 @@ public class Program
|
|||||||
|
|
||||||
private async Task MessageUpdated(Cacheable<IMessage, ulong> before, SocketMessage after, ISocketMessageChannel channel)
|
private async Task MessageUpdated(Cacheable<IMessage, ulong> before, SocketMessage after, ISocketMessageChannel channel)
|
||||||
{
|
{
|
||||||
|
// If the message was not in the cache, downloading it will result in getting a copy of `after`.
|
||||||
var message = await before.GetOrDownloadAsync();
|
var message = await before.GetOrDownloadAsync();
|
||||||
Console.WriteLine($"{message} -> {after}");
|
Console.WriteLine($"{message} -> {after}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user