fix: parse some stuff correctly when using Redis gateway
This commit is contained in:
parent
6be8dd0773
commit
6faed635fa
@ -73,7 +73,7 @@ public class Bot
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_services.Resolve<RedisGatewayService>().OnEventReceived += (evt) => OnEventReceived(0, evt);
|
_services.Resolve<RedisGatewayService>().OnEventReceived += (evt) => OnEventReceivedInner(0, evt);
|
||||||
|
|
||||||
// Init the shard stuff
|
// Init the shard stuff
|
||||||
_services.Resolve<ShardInfoService>().Init();
|
_services.Resolve<ShardInfoService>().Init();
|
||||||
@ -97,6 +97,11 @@ public class Bot
|
|||||||
var userId = await _cache.GetOwnUser();
|
var userId = await _cache.GetOwnUser();
|
||||||
await _cache.TryUpdateSelfMember(userId, evt);
|
await _cache.TryUpdateSelfMember(userId, evt);
|
||||||
|
|
||||||
|
await OnEventReceivedInner(shardId, evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnEventReceivedInner(int shardId, IGatewayEvent evt)
|
||||||
|
{
|
||||||
// HandleEvent takes a type parameter, automatically inferred by the event type
|
// HandleEvent takes a type parameter, automatically inferred by the event type
|
||||||
// It will then look up an IEventHandler<TypeOfEvent> in the DI container and call that object's handler method
|
// It will then look up an IEventHandler<TypeOfEvent> in the DI container and call that object's handler method
|
||||||
// For registering new ones, see Modules.cs
|
// For registering new ones, see Modules.cs
|
||||||
@ -245,7 +250,7 @@ public class Bot
|
|||||||
_logger.Debug("Running once-per-minute scheduled tasks");
|
_logger.Debug("Running once-per-minute scheduled tasks");
|
||||||
|
|
||||||
// Check from a new custom status from Redis and update Discord accordingly
|
// Check from a new custom status from Redis and update Discord accordingly
|
||||||
if (_redis.Connection != null)
|
if (_redis.Connection != null && _config.RedisGatewayUrl == null)
|
||||||
{
|
{
|
||||||
var newStatus = await _redis.Connection.GetDatabase().StringGetAsync("pluralkit:botstatus");
|
var newStatus = await _redis.Connection.GetDatabase().StringGetAsync("pluralkit:botstatus");
|
||||||
if (newStatus != CustomStatusMessage)
|
if (newStatus != CustomStatusMessage)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user