using SharpChat.Events; using System; using System.Linq; namespace SharpChat.Commands { public class ActionCommand : IChatCommand { public bool IsMatch(ChatCommandContext ctx) { return ctx.NameEquals("action") || ctx.NameEquals("me"); } public void Dispatch(ChatCommandContext ctx) { if(!ctx.Args.Any()) return; string actionStr = string.Join(' ', ctx.Args); if(string.IsNullOrWhiteSpace(actionStr)) return; ctx.Chat.DispatchEvent(new MessageCreateEvent( SharpId.Next(), ctx.Channel, ctx.User, DateTimeOffset.Now, actionStr, false, true, false )); } } }