Esempio n. 1
0
        static public async Task <bool> SendResponse(IFirehose firehose, int channelId, string userName, string message, bool whisper)
        {
            Logger.Info($"Sent {(whisper ? "whisper" : "message")} to {userName}: {message}");
            bool success = false;

            if (whisper)
            {
                success = await firehose.SendWhisper(channelId, userName, message);
            }
            else
            {
                success = await firehose.SendMessage(channelId, message);
            }

            if (!success)
            {
                Logger.Error($"Failed to send message '{message}' to {userName} in channel {channelId}");
            }
            return(success);
        }
Esempio n. 2
0
        static public async Task <int> GlobalWhisper(IFirehose firehose, int userId, string userName, string message)
        {
            List <int> channelIds = CreeperCarl.GetActiveChannelIds(userId);

            if (channelIds == null)
            {
                return(0);
            }
            else
            {
                // Whisper them the message in all of the channels.
                int successCount = 0;
                foreach (int channelId in channelIds)
                {
                    if (await firehose.SendWhisper(channelId, userName, message))
                    {
                        successCount++;
                    }
                }
                return(successCount);
            }
        }