using Discord.WebSocket;
using Newtonsoft.Json.Linq;
using Noikoio.RegexBot.ConfigItem;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Noikoio.RegexBot.Feature.DBCache
{
///
/// Caches information regarding all known guilds, channels, and users.
/// The function of this feature should be transparent to the user, and thus no configuration is needed.
///
class EntityCache : BotFeature
{
private readonly DatabaseConfig _db;
public override string Name => nameof(EntityCache);
public EntityCache(DiscordSocketClient client) : base(client)
{
_db = RegexBot.Config.Database;
client.GuildAvailable += Client_GuildAvailable;
client.GuildUpdated += Client_GuildUpdated;
client.GuildMemberUpdated += Client_GuildMemberUpdated;
// it may not be necessary to handle JoinedGuild, as GuildAvailable still provides info
}
public override Task