Exemplo n.º 1
0
 public CommandDan(ICarl commandCallback, IFirehose firehose)
     : base(firehose)
 {
     m_client.DefaultRequestHeaders.Add("Client-ID", "Karl");
     m_commandCallback = commandCallback;
     m_firehose.SubChatMessages(this);
 }
Exemplo n.º 2
0
 public FriendlyDan(IFirehose firehose)
     : base(firehose)
 {
     Setup();
     m_firehose.SubUserActivity(this);
     m_firehose.SubCommandListener(this);
     s_instance = this;
 }
Exemplo n.º 3
0
        static public async Task <int> GlobalWhisper(IFirehose firehose, string userName, string message)
        {
            int?userId = await MixerUtils.GetUserId(userName);

            if (!userId.HasValue)
            {
                return(0);
            }
            return(await GlobalWhisper(firehose, userId.Value, userName, message));
        }
Exemplo n.º 4
0
        static public async Task <int> GlobalWhisper(IFirehose firehose, int userId, string message)
        {
            string userName = await MixerUtils.GetUserName(userId);

            if (String.IsNullOrWhiteSpace(userName))
            {
                return(0);
            }
            return(await GlobalWhisper(firehose, userId, userName, message));
        }
Exemplo n.º 5
0
        public MessagesDan(IFirehose firehose)
            : base(firehose)
        {
            m_firehose.SubChatMessages(this);
            m_firehose.SubCommandListener(this);

            m_wordHistory.SetPreparer(this);

            m_statsThread = new Thread(StatsThread);
            m_statsThread.IsBackground = true;
            m_statsThread.Start();
        }
Exemplo n.º 6
0
        public static async Task <bool> CheckForMutualFriendsAndMessageIfNot(IFirehose m_firehose, ChatMessage msg, int actionReceiverId, string action)
        {
            if (HasAdvancePermissions(msg.UserId) || FriendlyDan.AreMutualFriends(msg.UserId, actionReceiverId))
            {
                return(true);
            }
            else
            {
                await SendResponse(m_firehose, msg.ChannelId, msg.UserName, $"You need to be mutual friends with {await MixerUtils.GetUserName(actionReceiverId)} before you can {action} them. You both need to friend each other with the \"^friends add\" command.", msg.IsWhisper);

                return(false);
            }
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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);
            }
        }
Exemplo n.º 9
0
 static public async Task <bool> SendResponse(IFirehose firehose, ChatMessage msg, string message, bool forceWhisper = true)
 {
     return(await SendResponse(firehose, msg.ChannelId, msg.UserName, message, msg.IsWhisper || forceWhisper));
 }
Exemplo n.º 10
0
 public static async Task <bool> SendMixerUserNotFound(IFirehose m_firehose, ChatMessage msg, string failedToFindUserName, bool isChannel = false)
 {
     return(await SendResponse(m_firehose, msg.ChannelId, msg.UserName, $"I can't find a {(isChannel ? "channel" : "user")} named {await MixerUtils.GetProperUserName(failedToFindUserName)} on Mixer. Is that spelled correctly? 😕", msg.IsWhisper));
 }
Exemplo n.º 11
0
 public static async Task <bool> SendCantFindUser(IFirehose m_firehose, ChatMessage msg, string failedToFindUserName)
 {
     return(await SendResponse(m_firehose, msg.ChannelId, msg.UserName, $"It doesn't look like {await MixerUtils.GetProperUserName(failedToFindUserName)} is active on Mixer right now. Maybe they're lurking? 🙈", msg.IsWhisper));
 }
Exemplo n.º 12
0
 static public async Task <bool> SendAccessDenied(IFirehose firehose, int channelId, string userName)
 {
     return(await SendResponse(firehose, channelId, userName, "You don't have permissions to do that 🤨", true));
 }
Exemplo n.º 13
0
 static public async Task <bool> SendAccessDenied(IFirehose firehose, ChatMessage msg)
 {
     return(await SendAccessDenied(firehose, msg.ChannelId, msg.UserName));
 }
Exemplo n.º 14
0
 public TimedFirehose(DateTime shutoffTime, IFirehose firehose) : base()
 {
     ShutoffTime = shutoffTime;
     Delegate    = firehose;
 }
Exemplo n.º 15
0
 public IndexSpecBuilder SetFirehose(IFirehose firehose)
 {
     _spec.Spec.IoConfig.Firehose = firehose;
     return(this);
 }
Exemplo n.º 16
0
 public Dan(IFirehose firehose)
 {
     m_firehose = firehose;
 }