Skip messages before current user ID is established

This commit is contained in:
Ske 2020-03-08 11:10:05 +01:00
parent 20789411f6
commit 0eb2e8be6f

View File

@ -260,7 +260,7 @@ namespace PluralKit.Bot
public async Task HandleMessage(SocketMessage arg)
{
var shard = _client.GetShardFor((arg.Channel as IGuildChannel)?.Guild);
if (shard.ConnectionState != ConnectionState.Connected)
if (shard.ConnectionState != ConnectionState.Connected || _client.CurrentUser == null)
return; // Discard messages while the bot "catches up" to avoid unnecessary CPU pressure causing timeouts
RegisterMessageMetrics(arg);