RegexBot/Module/AutoMod/Responses/Remove.cs

24 lines
727 B
C#
Raw Normal View History

2017-08-26 17:24:37 +00:00
using Discord.WebSocket;
using Noikoio.RegexBot.ConfigItem;
using System;
using System.Threading.Tasks;
2017-11-12 03:12:24 +00:00
namespace Noikoio.RegexBot.Module.AutoMod.Responses
2017-08-26 17:24:37 +00:00
{
/// <summary>
/// Removes the invoking message.
/// Takes no parameters.
/// </summary>
2017-09-05 17:18:07 +00:00
class Remove : ResponseBase
2017-08-26 17:24:37 +00:00
{
2017-09-05 17:18:07 +00:00
public Remove(ConfigItem rule, string cmdline) : base(rule, cmdline)
2017-08-26 17:24:37 +00:00
{
// Throw exception if extra parameters found
if (cmdline.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Length > 1)
throw new RuleImportException("Incorrect number of parameters.");
}
public override Task Invoke(SocketMessage msg) => msg.DeleteAsync();
}
}