From 759da09c38631efe66630036fa8aa61cd6e92fa8 Mon Sep 17 00:00:00 2001 From: Alex Gravely Date: Mon, 19 Jun 2017 15:21:46 -0400 Subject: [PATCH 1/2] Update events.cs Gladly taking suggestions for a better comments. --- docs/guides/concepts/samples/events.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/guides/concepts/samples/events.cs b/docs/guides/concepts/samples/events.cs index c662b51a9..f268b6e49 100644 --- a/docs/guides/concepts/samples/events.cs +++ b/docs/guides/concepts/samples/events.cs @@ -8,7 +8,11 @@ public class Program public async Task MainAsync() { - _client = new DiscordSocketClient(); + // When working with events that have Cacheable 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.StartAsync(); @@ -25,7 +29,8 @@ public class Program private async Task MessageUpdated(Cacheable 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(); Console.WriteLine($"{message} -> {after}"); } -} \ No newline at end of file +} From 6e21d33999b493783a68500cabbffdefa7c986ab Mon Sep 17 00:00:00 2001 From: Alex Gravely Date: Tue, 20 Jun 2017 20:44:33 -0400 Subject: [PATCH 2/2] Update events.cs Forgot a var >_> --- docs/guides/concepts/samples/events.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/concepts/samples/events.cs b/docs/guides/concepts/samples/events.cs index f268b6e49..cf0492cb5 100644 --- a/docs/guides/concepts/samples/events.cs +++ b/docs/guides/concepts/samples/events.cs @@ -11,7 +11,7 @@ public class Program // When working with events that have Cacheable 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 }; + var _config = new DiscordSocketConfig { MessageCacheSize = 100 }; _client = new DiscordSocketClient(_config); await _client.LoginAsync(TokenType.Bot, "bot token");