23 lines
703 B
C#
23 lines
703 B
C#
using SharpChat.Events;
|
|
using System.Linq;
|
|
|
|
namespace SharpChat.SockChat.Commands {
|
|
public class MessageActionCommand : ISockChatClientCommand {
|
|
public bool IsMatch(SockChatClientCommandContext ctx) {
|
|
return ctx.NameEquals("action")
|
|
|| ctx.NameEquals("me");
|
|
}
|
|
|
|
public void Dispatch(SockChatClientCommandContext ctx) {
|
|
if(!ctx.Args.Any())
|
|
return;
|
|
|
|
string actionStr = string.Join(' ', ctx.Args);
|
|
if(string.IsNullOrWhiteSpace(actionStr))
|
|
return;
|
|
|
|
ctx.Chat.Events.Dispatch("msg:add", ctx.Channel, ctx.User, new MessageAddEventData(actionStr, true));
|
|
}
|
|
}
|
|
}
|