public static bool IsMe(this WhisperMessage whisperMessage) { return(string.Equals(whisperMessage.Username, BotService.OwnerUsername, BotService.StringComparison) || string.Equals(whisperMessage.Username, BotService.BotUsername, BotService.StringComparison)); ; }
private void whisperResponse(Bankbot sender, WhisperMessage m) { //does the whisper come from pajbot? if (m.Username == GlobalVars.Settings["masterchannelbot"]) { if (m.Message.Contains(" points! You should probably thank them ")) { List <string> splitwhispermessage = new List <string>(); splitwhispermessage = m.Message.Split(' ').ToList(); if (splitwhispermessage.Count == 12) { string depositSender = splitwhispermessage[0]; string amountString = splitwhispermessage[4]; long amount; if (long.TryParse(amountString, out amount)) { User u = User.GetUserFromDataBase(depositSender); u.Balance += amount; u.Save(); sender.ChatConnection.SendChatMessage(depositSender + " successfully deposited " + amount + " points."); } } } } }
private byte[] decrypt(SessionState sessionState, WhisperMessage ciphertextMessage) { if (!sessionState.hasSenderChain()) { throw new InvalidMessageException("Uninitialized session!"); } if (ciphertextMessage.getMessageVersion() != sessionState.getSessionVersion()) { throw new InvalidMessageException($"Message version {ciphertextMessage.getMessageVersion()}, but session version {sessionState.getSessionVersion()}"); } uint messageVersion = ciphertextMessage.getMessageVersion(); ECPublicKey theirEphemeral = ciphertextMessage.getSenderRatchetKey(); uint counter = ciphertextMessage.getCounter(); ChainKey chainKey = getOrCreateChainKey(sessionState, theirEphemeral); MessageKeys messageKeys = getOrCreateMessageKeys(sessionState, theirEphemeral, chainKey, counter); ciphertextMessage.verifyMac(messageVersion, sessionState.getRemoteIdentityKey(), sessionState.getLocalIdentityKey(), messageKeys.getMacKey()); byte[] plaintext = getPlaintext(messageVersion, messageKeys, ciphertextMessage.getBody()); sessionState.clearUnacknowledgedPreKeyMessage(); return(plaintext); }
/** * Encrypt a message. * * @param paddedMessage The plaintext message bytes, optionally padded to a constant multiple. * @return A ciphertext message encrypted to the recipient+device tuple. */ public CiphertextMessage encrypt(byte[] paddedMessage) { lock (SESSION_LOCK) { SessionRecord sessionRecord = sessionStore.loadSession(remoteAddress); SessionState sessionState = sessionRecord.getSessionState(); ChainKey chainKey = sessionState.getSenderChainKey(); MessageKeys messageKeys = chainKey.getMessageKeys(); ECPublicKey senderEphemeral = sessionState.getSenderRatchetKey(); uint previousCounter = sessionState.getPreviousCounter(); uint sessionVersion = sessionState.getSessionVersion(); byte[] ciphertextBody = getCiphertext(sessionVersion, messageKeys, paddedMessage); CiphertextMessage ciphertextMessage = new WhisperMessage(sessionVersion, messageKeys.getMacKey(), senderEphemeral, chainKey.getIndex(), previousCounter, ciphertextBody, sessionState.getLocalIdentityKey(), sessionState.getRemoteIdentityKey()); if (sessionState.hasUnacknowledgedPreKeyMessage()) { SessionState.UnacknowledgedPreKeyMessageItems items = sessionState.getUnacknowledgedPreKeyMessageItems(); uint localRegistrationId = sessionState.getLocalRegistrationId(); ciphertextMessage = new PreKeyWhisperMessage(sessionVersion, localRegistrationId, items.getPreKeyId(), items.getSignedPreKeyId(), items.getBaseKey(), sessionState.getLocalIdentityKey(), (WhisperMessage)ciphertextMessage); } sessionState.setSenderChainKey(chainKey.getNextChainKey()); sessionStore.storeSession(remoteAddress, sessionRecord); return(ciphertextMessage); } }
public static void LogMessage(WhisperMessage whisperMessage) { if (LastWhisperMessages.Count >= whisperMessageQueueLength - 1) { LastWhisperMessages.RemoveAt(0); } LastWhisperMessages.Add(whisperMessage); }
/// <summary>Function used to detect if a whisper command was received or not.</summary> public static bool detectedWhisperCommandReceived(string message, string username, HashSet <char> commandIdentifiers) { if (detectedWhisperReceived(message, username)) { var whisperMessage = new WhisperMessage(message, username); return(commandIdentifiers.Count > 0 && commandIdentifiers.Contains(whisperMessage.Message[0])); } return(false); }
/// <summary> /// Create a new ZreMsgOriginal /// </summary> public ZreMsgOriginal() { Hello = new HelloMessage(); Whisper = new WhisperMessage(); Shout = new ShoutMessage(); Join = new JoinMessage(); Leave = new LeaveMessage(); Ping = new PingMessage(); PingOk = new PingOkMessage(); }
/// <summary> /// Invokes the whisper command received. /// </summary> /// <param name="client">The client.</param> /// <param name="badges">The badges.</param> /// <param name="colorHex">The color hexadecimal.</param> /// <param name="color">The color.</param> /// <param name="username">The username.</param> /// <param name="displayName">The display name.</param> /// <param name="emoteSet">The emote set.</param> /// <param name="threadId">The thread identifier.</param> /// <param name="messageId">The message identifier.</param> /// <param name="userId">The user identifier.</param> /// <param name="isTurbo">if set to <c>true</c> [is turbo].</param> /// <param name="botUsername">The bot username.</param> /// <param name="message">The message.</param> /// <param name="userType">Type of the user.</param> /// <param name="commandText">The command text.</param> /// <param name="argumentsAsString">The arguments as string.</param> /// <param name="argumentsAsList">The arguments as list.</param> /// <param name="commandIdentifier">The command identifier.</param> public static void InvokeWhisperCommandReceived(this TwitchClient client, List <KeyValuePair <string, string> > badges, string colorHex, Color color, string username, string displayName, EmoteSet emoteSet, string threadId, string messageId, string userId, bool isTurbo, string botUsername, string message, UserType userType, string commandText, string argumentsAsString, List <string> argumentsAsList, char commandIdentifier) { WhisperMessage whisperMsg = new WhisperMessage(badges, colorHex, color, username, displayName, emoteSet, threadId, messageId, userId, isTurbo, botUsername, message, userType); OnWhisperCommandReceivedArgs model = new OnWhisperCommandReceivedArgs() { Command = new WhisperCommand(whisperMsg, commandText, argumentsAsString, argumentsAsList, commandIdentifier) }; client.RaiseEvent("OnWhisperCommandReceived", model); }
private void whisperWorker() { while (true) { WhisperMessage lastwhispermessage = this.LastWhisperMessage(); if (lastwhispermessage != null) { OnWhispereReceive(this, lastwhispermessage); } } }
public RTWhisperMessage(WhisperMessage msg) : base() { this.Message = msg.Message; this.IsTurbo = msg.IsTurbo; this.Badges = msg.Badges; this.DisplayName = msg.DisplayName; this.MessageIdStr = msg.MessageId; this.ThreadIdStr = msg.ThreadId; this.TwitchBotName = msg.BotUsername; this.UserIdStr = msg.UserId; this.UserName = msg.Username; this.UserType = (Enums.UserType)((int)msg.UserType); }
public void PropertyTest() { Mock <ITwitchChannelLink> cLink = new Mock <ITwitchChannelLink>(); WhisperMessage whisperMessage = new WhisperMessage(null, "", Color.Black, "BenAbt", "", new EmoteSet("1:2-3", "Hello World"), "", "", "", true, "", "", UserType.Admin); TwitchWhisperMessageNotification notification = new TwitchWhisperMessageNotification(cLink.Object, whisperMessage); notification.ChannelLink.Should().NotBeNull(); notification.ChannelLink.Should().Be(cLink.Object); notification.WhisperMessage.Should().Be(whisperMessage); }
private void HandleNonChannelMessage(string ircRawMessage, IRCParser.TwitchMessageType twitchMessageType) { switch (twitchMessageType) { case IRCParser.TwitchMessageType.Ping: { m_websocketClient.Send("PONG :tmi.twitch.tv"); break; } case IRCParser.TwitchMessageType.Notice: break; case IRCParser.TwitchMessageType.WhisperMessage: { WhisperMessage whisperMessage = new WhisperMessage(ircRawMessage); OnWhisperMessageReceivedEventArgs whisperEvent = new OnWhisperMessageReceivedEventArgs(whisperMessage); OnWhisperMessageReceived?.Invoke(this, whisperEvent); break; } case IRCParser.TwitchMessageType.JoinedChannel: { string sChannel = ircRawMessage.Substring(ircRawMessage.IndexOf('#') + 1, ircRawMessage.IndexOf(" :") - ((ircRawMessage.IndexOf('#') + 1))); OnBotJoinedChannel?.Invoke(this, new OnBotJoinedChannelEventArgs(sChannel)); m_channelsJoined.Add(sChannel); break; } case IRCParser.TwitchMessageType.LoginSuccessful: { // LOGIN SUCCESSFUL OnTwitchConnected?.Invoke(); break; } case IRCParser.TwitchMessageType.LoginFailure: { // LOGIN FAILED OnTwitchLoginFailed?.Invoke(); break; } } }
/** * Decrypt a message. * * @param ciphertext The {@link WhisperMessage} to decrypt. * @param callback A callback that is triggered after decryption is complete, * but before the updated session state has been committed to the session * DB. This allows some implementations to store the committed plaintext * to a DB first, in case they are concerned with a crash happening between * the time the session state is updated but before they're able to store * the plaintext to disk. * * @return The plaintext. * @throws InvalidMessageException if the input is not valid ciphertext. * @throws DuplicateMessageException if the input is a message that has already been received. * @throws LegacyMessageException if the input is a message formatted by a protocol version that * is no longer supported. * @throws NoSessionException if there is no established session for this contact. */ public byte[] decrypt(WhisperMessage ciphertext, DecryptionCallback callback) { lock (SESSION_LOCK) { if (!sessionStore.containsSession(remoteAddress)) { throw new NoSessionException($"No session for: {remoteAddress}"); } SessionRecord sessionRecord = sessionStore.loadSession(remoteAddress); byte[] plaintext = decrypt(sessionRecord, ciphertext); callback.handlePlaintext(plaintext); sessionStore.storeSession(remoteAddress, sessionRecord); return(plaintext); } }
private async Task ProcessWhisperAsync(WhisperMessage whisper) { if (whisper.Message[0] == _commandIdentifier) { // this is a command. It will be processed by ProcessChatCommand return; } _logger.LogInformation("received whisper"); var activity = CreateBaseActivity(channel: whisper.Username, isGroup: false, conversationType: TwitchConversation.Whisper); activity.Text = whisper.Message; activity.From = new ChannelAccount(id: whisper.UserId, name: whisper.Username); // override the default conversation activity.Type = ActivityTypes.Message; activity.ChannelData = whisper; await ProcessActivityAsync(activity); }
public virtual void ProcessWhisperMessage(WhisperMessage whisperMessage) { // !game_unsub_all if (CheckCommand(UNSUBSCRIBE_ALL_COMMAND, whisperMessage.Message)) { UnsubscribeUserToGame(whisperMessage.Username); } // Submitting a guess else { if (!HasUserSubmittedACorrectAnswer(whisperMessage.DisplayName, whisperMessage.Message, out string channelName)) { return; } OnWinnerAchieved?.Invoke(channelName, whisperMessage.DisplayName, m_quizGames[channelName].Winners.Count + 1); // If there are any remaining winner slots left? if (!m_quizGames[channelName].IsQualifiedWinner()) { return; } m_quizGames[channelName].AddWinner(whisperMessage.DisplayName); // If there are no more qualified winner slots if (m_quizGames[channelName].IsQualifiedWinner()) { return; } // Display a message in the channel the game was "played" on, showcasing the winners SendEndGameMessage(channelName, m_quizGames[channelName].Winners); // End the game m_quizGames[channelName].SetGameCooldown(GAME_COOLDOWN); m_quizGames[channelName].EndGame(); } }
private byte[] Decrypt(SessionRecord sessionRecord, WhisperMessage ciphertext) { lock (SESSION_LOCK) { IEnumerator <SessionState> previousStates = sessionRecord.GetPreviousSessionStates().GetEnumerator(); LinkedList <Exception> exceptions = new LinkedList <Exception>(); try { SessionState sessionState = new SessionState(sessionRecord.GetSessionState()); byte[] plaintext = Decrypt(sessionState, ciphertext); sessionRecord.SetState(sessionState); return(plaintext); } catch (InvalidMessageException e) { exceptions.AddLast(e); } while (previousStates.MoveNext()) { try { SessionState promotedState = new SessionState(previousStates.Current); byte[] plaintext = Decrypt(promotedState, ciphertext); sessionRecord.GetPreviousSessionStates().Remove(previousStates.Current); sessionRecord.PromoteState(promotedState); return(plaintext); } catch (InvalidMessageException e) { exceptions.AddLast(e); } } throw new InvalidMessageException("No valid sessions.", exceptions); } }
private byte[] decrypt(SessionRecord sessionRecord, WhisperMessage ciphertext) { lock (SESSION_LOCK) { IEnumerator <SessionState> previousStates = sessionRecord.getPreviousSessionStates().GetEnumerator(); //iterator LinkedList <Exception> exceptions = new LinkedList <Exception>(); try { SessionState sessionState = new SessionState(sessionRecord.getSessionState()); byte[] plaintext = decrypt(sessionState, ciphertext); sessionRecord.setState(sessionState); return(plaintext); } catch (InvalidMessageException e) { exceptions.AddLast(e); // add (java default behavioir addlast) } while (previousStates.MoveNext()) //hasNext(); { try { SessionState promotedState = new SessionState(previousStates.Current); //.next() byte[] plaintext = decrypt(promotedState, ciphertext); sessionRecord.getPreviousSessionStates().Remove(previousStates.Current); // previousStates.remove() sessionRecord.promoteState(promotedState); return(plaintext); } catch (InvalidMessageException e) { exceptions.AddLast(e); } } throw new InvalidMessageException("No valid sessions.", exceptions); } }
private void whisperResponse(Bankbot sender, WhisperMessage m) { //does the whisper come from pajbot? if (m.Username == GlobalVars.Settings["masterchannelbot"] && m.Message.StartsWith("Successfully gave away ")) { List <string> splitwhispermessage = new List <string>(); splitwhispermessage = m.Message.Split(' ').ToList(); if (splitwhispermessage.Count == 7) { string withdrawSender = splitwhispermessage[6]; string amountString = splitwhispermessage[3]; long amount; if (long.TryParse(amountString, out amount)) { User u = User.GetUserFromDataBase(withdrawSender); u.Balance -= amount; u.Save(); sender.ChatConnection.SendChatMessage(withdrawSender + ", successfully withdrawn " + amount + " points."); } } } }
private void TwitchClient_OnWhisperReceived(object sender, TwitchLib.Client.Events.OnWhisperReceivedArgs e) { WhisperMessage whisperMessage = e.WhisperMessage; string msg = whisperMessage.Message; switch (msg) { case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "y": case "Y": case "n": case "N": SilentAnswerQuiz(msg, whisperMessage); break; } }
public TwitchWhisperMessage(WhisperMessage whisperMessage) : base(whisperMessage) { MessageId = whisperMessage.MessageId.ToInt(); ThreadId = whisperMessage.ThreadId.ToInt(); }
private void printWhisperMessage(Bankbot sender, WhisperMessage m) { Console.WriteLine("|w|{0}: {1}", m.Username, m.Message); }
void SilentAnswerQuiz(string args, WhisperMessage chatMessage) { hub.Clients.All.ExecuteCommand("SilentAnswerQuiz", args, chatMessage.UserId, chatMessage.Username, chatMessage.DisplayName, chatMessage.ColorHex); }
public void handleMessage(Message msg) { // trading with auctionbot############################################################################################################# if (this.sttngs.waitForAuctionBot && msg is FailMessage) // bot is offline! shame on him! { FailMessage fm = (FailMessage)msg; if (fm.op == "Whisper" && fm.info == "Could not find the user '" + botname + "'.") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; pppmngr.startOKPopup("auctionmodresponse", "offline", "the auctionbot is offline"); } } if (this.sttngs.waitForAuctionBot && msg is WhisperMessage) { WhisperMessage wm = msg as WhisperMessage; if (wm.from == botname && wm.text == "invite me") { //invite the auctionmod for trade //App.Communicator.sendRequest(new TradeAcceptMessage("1b8a4125d2634634aa76f33e1d04b0d4")); App.Communicator.send(new TradeInviteMessage(botid)); this.sttngs.actualTrading = true; this.sttngs.addedCard = false; } } if ((this.sttngs.waitForAuctionBot || this.sttngs.actualTrading) && msg is WhisperMessage) { WhisperMessage wm = msg as WhisperMessage; if (wm.from == botname && wm.text == "invite me") { //invite the auctionmod for trade //App.Communicator.sendRequest(new TradeAcceptMessage("1b8a4125d2634634aa76f33e1d04b0d4")); this.sttngs.actualTrading = true; this.sttngs.addedCard = false; } if (wm.from == botname && wm.text == "there is not such an auction") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("not such an auction"); pppmngr.startOKPopup("auctionmodresponse", "non exsisting", "the auction you chosed, doesnt exist anymore"); } if (wm.from == botname && wm.text == "to slow") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("you are to slow bro"); pppmngr.startOKPopup("auctionmodresponse", "to slow", "you were responding to slow"); } if (wm.from == botname && wm.text == "auctionlimit reached") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("not more than 10 auctions"); pppmngr.startOKPopup("auctionmodresponse", "to much auctions", "You cant create more auctions"); } if (wm.from == botname && wm.text == "dont fool me") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("there are no auctions open"); pppmngr.startOKPopup("auctionmodresponse", "no auctions", "you dont own a finished auction"); } if (wm.from == botname && wm.text == "hit accept" && this.sttngs.AucBotMode == "getauc") { new Thread(new ThreadStart(this.acceptTrade)).Start(); } } //trade finished if (this.sttngs.actualTrading && msg is TradeViewMessage && (msg as TradeViewMessage).to.profile.name == botname && (msg as TradeViewMessage).modified == false && (msg as TradeViewMessage).to.accepted == true && (msg as TradeViewMessage).from.accepted == true) { if (this.sttngs.AucBotMode == "setauc") { pppmngr.startOKPopup("auctionmodresponse", "created auction", "you created the following auction:\r\n" + this.helpf.createdAuctionText); } if (this.sttngs.AucBotMode == "multisetauc") { pppmngr.startOKPopup("auctionmodresponse", "created auction", "you created some auctions!"); this.ps.clearAuctions(); } if (this.sttngs.AucBotMode == "bidauc") { pppmngr.startOKPopup("auctionmodresponse", "scroll bought", "you bought " + this.helpf.auctionBotCardsToNames[(msg as TradeViewMessage).to.cardIds[0]] + " for " + (msg as TradeViewMessage).from.gold + " gold."); } if (this.sttngs.AucBotMode == "getauc") { string reccards = ""; foreach (long x in (msg as TradeViewMessage).to.cardIds) { if (reccards != "") { reccards = reccards + ", "; } reccards = reccards + this.helpf.auctionBotCardsToNames[x]; } string output = "you received: " + (msg as TradeViewMessage).to.gold + " gold and some scrolls (look in Chat)."; if (reccards == "") { output = "you received: " + (msg as TradeViewMessage).to.gold + " gold."; } pppmngr.startOKPopup("auctionmodresponse", "stuff received", output); if (reccards != "") { RoomChatMessageMessage nrcmm = new RoomChatMessageMessage("[note]", "You received these scrolls: " + reccards + "."); nrcmm.from = "AuctionHouse"; App.ArenaChat.handleMessage(nrcmm); } } new Thread(new ThreadStart(this.getCardsAndGold)).Start(); } // get cardIDs+ Types from auctionbot, for knowing which cards you got :D if (this.sttngs.actualTrading && msg is LibraryViewMessage) { if ((((LibraryViewMessage)msg).profileId == this.botid)) { // the libViewMessage is from auctionmod :D helpf.setAuctionModCards(msg); } } //accept in bidmode, after he adds card + we adds money if (this.sttngs.actualTrading && msg is TradeViewMessage && this.sttngs.AucBotMode == "bidauc" && (msg as TradeViewMessage).to.profile.name == botname && (msg as TradeViewMessage).to.cardIds.Length == 1 && (msg as TradeViewMessage).to.cardIds[0] == this.sttngs.tradeCardID && (msg as TradeViewMessage).from.gold == this.sttngs.bidgold && (msg as TradeViewMessage).modified == true) { // trading with bot, he has added the wanted card, and we added the money... lets click ok in 5 seconds! (if modified = true (if he accept, it will be falls), so we accept only once new Thread(new ThreadStart(this.acceptTrade)).Start(); } //if trading with bot and wants to bid on an auction: add money, + wait till he adds card accept if (this.sttngs.waitForAuctionBot && !this.sttngs.addedCard && this.sttngs.AucBotMode == "bidauc" && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { new Thread(new ThreadStart(this.setGold)).Start(); } //if trading with bot and wants to set an auction: add card, accept after 5 seconds (threaded) if (this.sttngs.waitForAuctionBot && !this.sttngs.addedCard && this.sttngs.AucBotMode == "setauc" && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { App.Communicator.sendRequest(new TradeAddCardsMessage(new long[] { this.sttngs.tradeCardID })); this.sttngs.addedCard = true; new Thread(new ThreadStart(this.acceptTrade)).Start(); } //if trading with bot and wants to set some auctions: add cards, accept after 5 seconds (threaded) if (this.sttngs.waitForAuctionBot && !this.sttngs.addedCard && this.sttngs.AucBotMode == "multisetauc" && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { App.Communicator.sendRequest(new TradeAddCardsMessage(this.helpf.cardsForTradeIds.ToArray())); this.sttngs.addedCard = true; new Thread(new ThreadStart(this.acceptTrade)).Start(); } // trade was canceled if (this.sttngs.waitForAuctionBot && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "CANCEL_BARGAIN") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; } // trade was accepted if (this.sttngs.waitForAuctionBot && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { // nice! this.sttngs.waitForAuctionBot = false; } // trade was timeouted :D if (this.sttngs.waitForAuctionBot && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "TIMEOUT") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; } if (msg is RoomEnterMessage && (this.sttngs.waitForAuctionBot || this.sttngs.actualTrading)) { this.sttngs.autoAuctionRoom = (msg as RoomEnterMessage).roomName; this.sttngs.auctionScrollsMessagesCounter = 1; } if (msg is RoomChatMessageMessage && this.sttngs.auctionScrollsMessagesCounter >= 1) { if ((msg as RoomChatMessageMessage).from == "Scrolls") { this.sttngs.auctionScrollsMessagesCounter++; } if (this.sttngs.auctionScrollsMessagesCounter == 3) { App.ArenaChat.ChatRooms.LeaveRoom((msg as RoomChatMessageMessage).roomName); App.Communicator.send(new RoomExitMessage((msg as RoomChatMessageMessage).roomName)); } } return; }
/// <inheritdoc/> public void HandlePacket(Player player, Span <byte> packet) { WhisperMessage message = packet; this.messageAction.ChatMessage(player, message.ReceiverName, message.Message, this.IsWhisper); }
public override void OnWhisperMessageEvent(WhisperMessage message) { whisperMsg = message; }
/// <summary> /// Create a new ZreMsg /// </summary> public ZreMsg() { Hello = new HelloMessage(); Whisper = new WhisperMessage(); Shout = new ShoutMessage(); Join = new JoinMessage(); Leave = new LeaveMessage(); Ping = new PingMessage(); PingOk = new PingOkMessage(); }
protected override void ProcessWhisperMessage(WhisperMessage whisperMessage) { GameController.Instance.ProcessWhisperMessage(whisperMessage); }
/** * Decrypt a message. * * @param ciphertext The {@link WhisperMessage} to decrypt. * * @return The plaintext. * @throws InvalidMessageException if the input is not valid ciphertext. * @throws DuplicateMessageException if the input is a message that has already been received. * @throws LegacyMessageException if the input is a message formatted by a protocol version that * is no longer supported. * @throws NoSessionException if there is no established session for this contact. */ public byte[] decrypt(WhisperMessage ciphertext) { return(decrypt(ciphertext, new NullDecryptionCallback())); }
public static void Handle(TwitchBot twitchBot, WhisperMessage whisperMessage) { throw new NotImplementedException(); }
public OnWhisperMessageReceivedEventArgs(WhisperMessage whisperMessage) { WhisperMessage = whisperMessage; }
private void OnReadLine(object sender, ReadLineEventArgs e) { string decodedMessage = Encoding.UTF8.GetString(Encoding.Default.GetBytes(e.Line)); if (_logging) Console.WriteLine(decodedMessage); if (decodedMessage.Split(':').Length > 2) { if (decodedMessage.Split(':')[2] == "You are in a maze of twisty passages, all alike.") { _connected = true; OnConnected?.Invoke(null, new OnConnectedArgs {Username = TwitchUsername}); } } if (decodedMessage.Split(' ').Length > 3 && decodedMessage.Split(' ')[2] == "WHISPER") { var whisperMessage = new WhisperMessage(decodedMessage, _credentials.TwitchUsername); _previousWhisper = whisperMessage; OnWhisperReceived?.Invoke(null, new OnWhisperReceivedArgs {WhisperMessage = whisperMessage}); if (_commandIdentifier == '\0' || whisperMessage.Message[0] != _commandIdentifier) return; string command; var argumentsAsString = ""; var argumentsAsList = new List<string>(); if (whisperMessage.Message.Contains(" ")) { command = whisperMessage.Message.Split(' ')[0].Substring(1, whisperMessage.Message.Split(' ')[0].Length - 1); argumentsAsList.AddRange( whisperMessage.Message.Split(' ').Where(arg => arg != _commandIdentifier + command)); argumentsAsString = whisperMessage.Message.Replace(whisperMessage.Message.Split(' ')[0] + " ", ""); } else { command = whisperMessage.Message.Substring(1, whisperMessage.Message.Length - 1); } OnCommandReceived?.Invoke(null, new OnCommandReceivedArgs { Command = command, Username = whisperMessage.Username, ArgumentsAsList = argumentsAsList, ArgumentsAsString = argumentsAsString }); } else { //Special cases if (decodedMessage == ":tmi.twitch.tv NOTICE * :Error logging in") { _client.Disconnect(); OnIncorrectLogin?.Invoke(null, new OnIncorrectLoginArgs { Exception = new ErrorLoggingInException(decodedMessage, _credentials.TwitchUsername) }); } else { if (_logging) Console.WriteLine("Not registered: " + decodedMessage); } } }
void SilentAnswerQuiz(string args, WhisperMessage chatMessage) { hub.Clients.All.ExecuteCommand("SilentAnswerQuiz", args, UserInfo.FromChatMessage(chatMessage, 0)); }