sharp-chat/SharpChat/Commands/ActionCommand.cs

30 lines
838 B
C#

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) {
throw new NotImplementedException();
}
public ChatMessage ActionDispatch(ChatCommandContext ctx) {
if(!ctx.Args.Any())
return null;
return new ChatMessage {
ChannelName = ctx.Channel.Name,
DateTime = DateTimeOffset.UtcNow,
Sender = ctx.User,
Text = string.Join(' ', ctx.Args),
Flags = ChatMessageFlags.Action,
};
}
}
}