31 lines
881 B
C#
31 lines
881 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 {
|
|||
|
Target = ctx.Channel,
|
|||
|
TargetName = ctx.Channel.TargetName,
|
|||
|
DateTime = DateTimeOffset.UtcNow,
|
|||
|
Sender = ctx.User,
|
|||
|
Text = string.Join(' ', ctx.Args),
|
|||
|
Flags = ChatMessageFlags.Action,
|
|||
|
};
|
|||
|
}
|
|||
|
}
|
|||
|
}
|