Implement MessageReceived delegate
This commit is contained in:
parent
262f77d82d
commit
f19ef5a662
2 changed files with 35 additions and 2 deletions
|
@ -21,13 +21,27 @@ namespace Noikoio.RegexBot.Feature.AutoRespond
|
|||
/// </list>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
class AutoRespond : BotFeature
|
||||
partial class AutoRespond : BotFeature
|
||||
{
|
||||
public override string Name => "AutoRespond";
|
||||
|
||||
public AutoRespond(DiscordSocketClient client) : base(client)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
client.MessageReceived += Client_MessageReceived;
|
||||
}
|
||||
|
||||
private async Task Client_MessageReceived(SocketMessage arg)
|
||||
{
|
||||
// Determine channel type - if not a guild channel, stop.
|
||||
var ch = arg.Channel as SocketGuildChannel;
|
||||
if (ch == null) return;
|
||||
|
||||
// TODO either search server by name or remove server name support entirely
|
||||
var defs = GetConfig(ch.Guild.Id) as IEnumerable<ResponseDefinition>;
|
||||
if (defs == null) return;
|
||||
|
||||
foreach (var def in defs)
|
||||
await Task.Run(async () => await ProcessMessage(arg, def));
|
||||
}
|
||||
|
||||
[ConfigSection("autoresponses")]
|
||||
|
|
19
Feature/AutoRespond/AutoRespond_Process.cs
Normal file
19
Feature/AutoRespond/AutoRespond_Process.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using Discord.WebSocket;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Noikoio.RegexBot.Feature.AutoRespond
|
||||
{
|
||||
partial class AutoRespond
|
||||
{
|
||||
private async Task ProcessMessage(SocketMessage msg, ResponseDefinition def)
|
||||
{
|
||||
// Filtering checks
|
||||
|
||||
// Rate limit checks
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue