Fix incoming users not getting cached
This commit is contained in:
parent
9cfdeba8be
commit
33e893e278
1 changed files with 11 additions and 8 deletions
|
@ -31,18 +31,19 @@ namespace Noikoio.RegexBot.Module.EntityCache
|
||||||
client.GuildAvailable += Client_GuildAvailable;
|
client.GuildAvailable += Client_GuildAvailable;
|
||||||
client.GuildUpdated += Client_GuildUpdated;
|
client.GuildUpdated += Client_GuildUpdated;
|
||||||
client.GuildMemberUpdated += Client_GuildMemberUpdated;
|
client.GuildMemberUpdated += Client_GuildMemberUpdated;
|
||||||
// it may not be necessary to handle JoinedGuild, as GuildAvailable provides this info
|
client.UserJoined += Client_UserJoined;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log("No database storage available.").Wait();
|
Log("No database storage available.").Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<object> ProcessConfiguration(JToken configSection) => Task.FromResult<object>(null);
|
public override Task<object> ProcessConfiguration(JToken configSection) => Task.FromResult<object>(null);
|
||||||
|
|
||||||
#region Event handling
|
#region Event handling
|
||||||
// Guild _and_ guild member information has become available
|
// Guild and guild member information has become available.
|
||||||
|
// This is a very expensive operation, when joining larger guilds for the first time.
|
||||||
private async Task Client_GuildAvailable(SocketGuild arg)
|
private async Task Client_GuildAvailable(SocketGuild arg)
|
||||||
{
|
{
|
||||||
await Task.Run(async () =>
|
await Task.Run(async () =>
|
||||||
|
@ -64,12 +65,14 @@ namespace Noikoio.RegexBot.Module.EntityCache
|
||||||
{
|
{
|
||||||
await Task.Run(() => UpdateGuildMember(arg2));
|
await Task.Run(() => UpdateGuildMember(arg2));
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Table setup
|
// A new guild member has appeared
|
||||||
|
private async Task Client_UserJoined(SocketGuildUser arg)
|
||||||
#endregion
|
{
|
||||||
|
await UpdateGuildMember(arg);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
private async Task UpdateGuild(SocketGuild g)
|
private async Task UpdateGuild(SocketGuild g)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in a new issue