Name adjustments and moved some things to the common lib.
This commit is contained in:
parent
b8ec381f3b
commit
0cc5d46ea9
50 changed files with 323 additions and 323 deletions
SharpChat/ClientCommands
33
SharpChat/ClientCommands/ActionClientCommand.cs
Normal file
33
SharpChat/ClientCommands/ActionClientCommand.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using SharpChat.Events;
|
||||
|
||||
namespace SharpChat.ClientCommands {
|
||||
public class ActionClientCommand : ClientCommand {
|
||||
public bool IsMatch(ClientCommandContext ctx) {
|
||||
return ctx.NameEquals("action")
|
||||
|| ctx.NameEquals("me");
|
||||
}
|
||||
|
||||
public void Dispatch(ClientCommandContext ctx) {
|
||||
if(ctx.Args.Length < 1)
|
||||
return;
|
||||
|
||||
string actionStr = string.Join(' ', ctx.Args);
|
||||
if(string.IsNullOrWhiteSpace(actionStr))
|
||||
return;
|
||||
|
||||
ctx.Chat.DispatchEvent(new MessageCreateEvent(
|
||||
ctx.Chat.RandomSnowflake.Next(),
|
||||
ctx.Channel.Name,
|
||||
ctx.User.UserId,
|
||||
ctx.User.UserName,
|
||||
ctx.User.Colour,
|
||||
ctx.User.Rank,
|
||||
ctx.User.NickName,
|
||||
ctx.User.Permissions,
|
||||
DateTimeOffset.Now,
|
||||
actionStr,
|
||||
false, true, false
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue