35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
|
using SharpChat.Messages;
|
|||
|
using SharpChat.Sessions;
|
|||
|
using SharpChat.Users;
|
|||
|
|
|||
|
namespace SharpChat.Events {
|
|||
|
[Event(TYPE)]
|
|||
|
public class MessageCreateEvent : Event {
|
|||
|
public const string TYPE = @"message:create";
|
|||
|
|
|||
|
public long MessageId { get; }
|
|||
|
public string Text { get; }
|
|||
|
public bool IsAction { get; }
|
|||
|
|
|||
|
public string UserName { get; }
|
|||
|
public Colour UserColour { get; }
|
|||
|
public int UserRank { get; }
|
|||
|
public string UserNickName { get; }
|
|||
|
public UserPermissions UserPermissions { get; }
|
|||
|
|
|||
|
public MessageCreateEvent(ISession session, IMessage message)
|
|||
|
: base(message.Channel, session) {
|
|||
|
MessageId = message.MessageId;
|
|||
|
Text = message.Text;
|
|||
|
IsAction = message.IsAction;
|
|||
|
UserName = message.Sender.UserName;
|
|||
|
UserColour = message.Sender.Colour;
|
|||
|
UserRank = message.Sender.Rank;
|
|||
|
UserNickName = message.Sender is ILocalUser localUser && !string.IsNullOrWhiteSpace(localUser.NickName)
|
|||
|
? localUser.NickName
|
|||
|
: null;
|
|||
|
UserPermissions = message.Sender.Permissions;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|