Don't process messages until we're fully connected to shard zero

This commit is contained in:
Ske 2019-07-15 21:29:45 +02:00
parent 18e4d7c9ac
commit d47e7e7a06

View File

@ -171,6 +171,11 @@ namespace PluralKit.Bot
private async Task MessageReceived(SocketMessage _arg)
{
// _client.CurrentUser will be null if we've connected *some* shards but not shard #0 yet
// This will cause an error in WebhookCacheServices so we just workaround and don't process any messages
// until we properly connect. TODO: can we do this without chucking away a bunch of messages?
if (_client.CurrentUser == null) return;
using (SentrySdk.PushScope())
using (var serviceScope = _services.CreateScope())
{