public void OnChatReceived(ReceiveTextEvent e) { string author = e.FromLocalised ?? e.From; string content = e.MessageLocalised ?? e.Message; _log.LogInformation("Received text: '{content}' from {author}", content, author); }
internal ReceiveTextEvent InvokeEvent(ReceiveTextEvent arg) { if (_api.ValidateEvent(arg)) { ReceiveText?.Invoke(_api, arg); } return(arg); }
private void AssertEvent(ReceiveTextEvent @event) { Assert.NotNull(@event); Assert.Equal(DateTime.Parse("2019-08-29T11:36:51Z"), @event.Timestamp); Assert.Equal(EventName, @event.Event); Assert.Equal("Mawson Dock", @event.From); Assert.Equal(MessageChannel.Npc, @event.Channel); Assert.Equal("$STATION_NoFireZone_exited;", @event.Message); Assert.Equal("Вы вышли из зоны запрета огня", @event.MessageLocalised); }
private void ReceiveTextCallback(ReceiveTextEvent obj) { var message = new ChatMessage() { Time = obj.Timestamp, Channel = (ChatChannel)Enum.Parse(typeof(ChatChannel), obj.Channel, true), Message = string.IsNullOrEmpty(obj.MessageLocalised) ? obj.Message : obj.MessageLocalised, From = string.IsNullOrEmpty(obj.FromLocalised) ? obj.From : obj.FromLocalised }; _messages.Enqueue(message); OnAction("AddChatMessage"); if (_messages.Count > MaxChatMessages) { _messages.Dequeue(); } }
private void ReceiveText(string text) { ReceiveTextEvent?.Invoke(text); }
internal void InvokeReceiveTextEvent(ReceiveTextEvent arg) { ReceiveTextEvent?.Invoke(this, arg); }
internal void InvokeReceiveTextEvent(ReceiveTextEvent arg) => ReceiveTextEvent?.Invoke(null, arg);