2023-02-16 20:34:59 +00:00
|
|
|
|
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 {
|
2023-02-16 22:47:30 +00:00
|
|
|
|
ChannelName = ctx.Channel.Name,
|
2023-02-16 20:34:59 +00:00
|
|
|
|
DateTime = DateTimeOffset.UtcNow,
|
|
|
|
|
Sender = ctx.User,
|
|
|
|
|
Text = string.Join(' ', ctx.Args),
|
|
|
|
|
Flags = ChatMessageFlags.Action,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|