Added DBCache
Currently incomplete. This feature will maintain a cache of entities in a database to be used by upcoming features and possible external utilities to be created in the future.
This commit is contained in:
parent
eedf7d38d2
commit
5c972997c0
3 changed files with 77 additions and 1 deletions
74
Feature/DBCache/DBCache.cs
Normal file
74
Feature/DBCache/DBCache.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.WebSocket;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Noikoio.RegexBot.Feature.DBCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Caches information regarding all incoming messages and all known guilds, channels, and users.
|
||||
/// The function of this feature should be transparent to the user, and thus no configuration is needed.
|
||||
/// </summary>
|
||||
class DBCache : BotFeature
|
||||
{
|
||||
public override string Name => "Database cache";
|
||||
|
||||
public DBCache(DiscordSocketClient client) : base(client)
|
||||
{
|
||||
client.GuildAvailable += Client_GuildAvailable;
|
||||
client.GuildUpdated += Client_GuildUpdated;
|
||||
client.GuildMemberUpdated += Client_GuildMemberUpdated;
|
||||
|
||||
client.MessageReceived += Client_MessageReceived;
|
||||
client.MessageUpdated += Client_MessageUpdated;
|
||||
}
|
||||
|
||||
public override Task<object> ProcessConfiguration(JToken configSection) => Task.FromResult<object>(null);
|
||||
|
||||
#region Guild and user cache
|
||||
/* Note:
|
||||
* We save information per guild in their own schemas named "g_NUM", where NUM is the Guild ID.
|
||||
*
|
||||
* The creation of these schemas is handled within here, but we're possibly facing a short delay
|
||||
* in the event that other events that we're listening for come in without a schema having been
|
||||
* created yet in which to put them in.
|
||||
* Got to figure that out.
|
||||
*/
|
||||
|
||||
// Guild information has changed
|
||||
private Task Client_GuildUpdated(SocketGuild arg1, SocketGuild arg2)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Single guild member information has changed
|
||||
private Task Client_GuildMemberUpdated(SocketGuildUser arg1, SocketGuildUser arg2)
|
||||
{
|
||||
// which is old and which is new?
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// All member data in a guild has become known
|
||||
private Task Client_GuildAvailable(SocketGuild arg)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Message cache
|
||||
private Task Client_MessageUpdated(Discord.Cacheable<Discord.IMessage, ulong> arg1, SocketMessage arg2, ISocketMessageChannel arg3)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Task Client_MessageReceived(SocketMessage arg)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -47,7 +47,8 @@ namespace Noikoio.RegexBot
|
|||
{
|
||||
new Feature.AutoMod.AutoMod(_client),
|
||||
new Feature.ModTools.ModTools(_client),
|
||||
new Feature.AutoRespond.AutoRespond(_client)
|
||||
new Feature.AutoRespond.AutoRespond(_client),
|
||||
new Feature.DBCache.DBCache(_client)
|
||||
};
|
||||
var dlog = Logger.GetLogger("Discord.Net");
|
||||
_client.Log += async (arg) =>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Discord.Net" Version="1.0.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
||||
<PackageReference Include="Npgsql" Version="3.2.5" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
Loading…
Reference in a new issue