This repository has been archived on 2023-06-01. You can view files and clone it, but cannot push or open issues or pull requests.
discord-bot-shtik/Behavior/Behavior.cs

26 lines
800 B
C#
Raw Normal View History

namespace vassago.Behavior;
using vassago.Models;
using System;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections.Generic;
//expect a behavior to be created per mesage
public abstract class Behavior
{
2023-06-19 01:14:04 -04:00
//TODO: message should have a channel, which should provide permissions. shouldn't have to pass it here.
public abstract Task<bool> ActOn(PermissionSettings permissions, Message message);
public virtual bool ShouldAct(PermissionSettings permissions, Message message)
{
2023-06-19 01:14:04 -04:00
return Regex.IsMatch(message.Content, $"{Trigger}\\b", RegexOptions.IgnoreCase);
}
public abstract string Name { get; }
public abstract string Trigger { get; }
2023-06-19 01:14:04 -04:00
public virtual string Description => Name;
}