Esempio n. 1
0
        private async Task HandleWhisperCommand(ChatMessage msg)
        {
            string userName = CommandUtils.GetSingleWordArgument(msg.Text);

            if (userName == null)
            {
                await CommandUtils.SendResponse(m_firehose, msg.ChannelId, msg.UserName, "I can globally whisper anyone on Mixer for you - they will get it no matter what channel they are watching. Give me a user name and the message you want to send.", true);

                return;
            }
            string message = CommandUtils.GetStringAfterFirstTwoWords(msg.Text);

            if (message == null)
            {
                await CommandUtils.SendResponse(m_firehose, msg.ChannelId, msg.UserName, "What do you want to say? Give me a user name and the message you want to send.", true);

                return;
            }

            int whispers = await CommandUtils.GlobalWhisper(m_firehose, userName, $"{msg.UserName} says: {message}");

            if (whispers == 0)
            {
                await CommandUtils.SendCantFindUser(m_firehose, msg, userName);
            }
            else
            {
                await CommandUtils.SendResponse(m_firehose, msg.ChannelId, msg.UserName, $"I sent your message to {await MixerUtils.GetProperUserName(userName)} in {whispers} channels", true);
            }
        }