当前位置: 首页>>代码示例>>C#>>正文


C# Winter.TwitchUser类代码示例

本文整理汇总了C#中Winter.TwitchUser的典型用法代码示例。如果您正苦于以下问题:C# TwitchUser类的具体用法?C# TwitchUser怎么用?C# TwitchUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TwitchUser类属于Winter命名空间,在下文中一共展示了TwitchUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Kill

        public void Kill(WinterBot bot, TwitchUser user, string cmd, string value)
        {
            bot.WriteDiagnostic(DiagnosticFacility.Info, "Bot killed by streamer.");
            WinterBotSource.Log.Kill();

            bot.Shutdown();
        }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:7,代码来源:BotControl.cs

示例2: bot_MessageReceived

        void bot_MessageReceived(WinterBot sender, TwitchUser user, string text)
        {
            if (m_lastStop.Elapsed().TotalSeconds < m_options.VoteClearTimer)
                return;

            if (m_active && m_lastVote.Elapsed().TotalSeconds >= m_options.VoteTimeout)
                Reset(sender);

            int result = -1;
            for (int i = 1; i <= m_options.MaxVoteValue; ++i)
            {
                if (text.Contains(i.ToString()))
                {
                    if (result != -1)
                    {
                        result = -1;
                        break;
                    }

                    result = i;
                }
            }

            if (result != -1)
            {
                m_result[user] = result;
                m_lastVote = DateTime.Now;
                m_dirty = true;
                if (!m_active)
                {
                    m_lastMessage = DateTime.Now;
                    m_active = true;
                }
            }
        }
开发者ID:holyjaw,项目名称:WinterBot,代码行数:35,代码来源:AutoPoll.cs

示例3: ChatMessage

 public ChatMessage(DateTime time, TwitchUser user, Action action, string text = null)
 {
     m_time = time;
     m_user = user;
     m_text = text;
     m_action = action;
 }
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:7,代码来源:ChatSaver.cs

示例4: JukeBoxCommand

        public void JukeBoxCommand(WinterBot sender, TwitchUser user, string cmd, string value)
        {
            if (!m_enabled)
            {
                if (!sender.CanUseCommand(user, AccessLevel.Mod))
                {
                    if (m_lastMessage.Elapsed().TotalSeconds <= 30)
                        return;

                    m_lastMessage = DateTime.Now;
                    sender.SendResponse(Importance.Low, "The jukebox is CLOSED. No additional requests are being accepted.");
                    return;
                }

                value = value.Trim().ToLower();

                if (value == "on")
                {
                    m_enabled = true;
                    m_lastMessage = DateTime.Now;
                    sender.SendResponse(Importance.Med, "Jukebox activated.  Use '!JukeboxMode off' to deactivate.");
                }
                else if (value == "off")
                {
                    sender.SendResponse(Importance.Med, "Jukebox mode is off.");
                }
                else
                {
                    sender.SendResponse(Importance.Low, "Usage: '!jukebox on' and '!jukebox off'.  Mod only.");
                }
            }
            else
            {
                if (sender.CanUseCommand(user, AccessLevel.Mod))
                {
                    if (value == "on")
                    {
                        sender.SendResponse(Importance.Low, "Jukebox mode is already enabled.");
                    }
                    else if (value == "off")
                    {
                        sender.SendResponse(Importance.High, "The jukebox is shutting down for the night. Please hold your song requests for next time.");
                        m_enabled = false;
                    }
                    else
                    {
                        SendMessage(sender);
                    }
                }
                else
                {
                    if (m_lastMessage.Elapsed().TotalSeconds <= 10)
                        return;

                    m_lastMessage = DateTime.Now;
                    SendMessage(sender);
                }
            }
        }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:59,代码来源:JukeBox.cs

示例5: Banliust

        public void Banliust(WinterBot sender, TwitchUser user, string cmd, string value)
        {
            if (string.IsNullOrWhiteSpace(value))
                return;

            UrlMatch match = new UrlMatch(sender, value);
            m_urlBanlist.Add(match);
            sender.SendResponse(Importance.Med, "Added {0} to the url ban list.", value);
        }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:9,代码来源:TimeoutController.cs

示例6: InsultUser

        //[BotCommand(AccessLevel.Normal, "insult")]
        public void InsultUser(WinterBot sender, TwitchUser user, string cmd, string value)
        {
            value = value.Trim().ToLower();
            if (TwitchUsers.IsValidUserName(value))
                user = sender.Users.GetUser(value);

            if (m_last.Elapsed().Minutes >= 1)
                sender.SendMessage("{0}, {1}", user.Name, m_insults[m_random.Next(m_insults.Length)]);

            m_last = DateTime.Now;
        }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:12,代码来源:Insult.cs

示例7: AddCommand

        public void AddCommand(WinterBot sender, TwitchUser user, string c, string v)
        {
            Args args = v.ParseArguments(m_bot);

            AccessLevel level = args.GetAccessFlag("ul", AccessLevel.Mod);
            string cmdName = args.GetOneWord();
            string cmdText = args.GetString();

            if (string.IsNullOrWhiteSpace(cmdName) || string.IsNullOrWhiteSpace(cmdText) || args.Error != null)
            {
                sender.SendResponse(Importance.Med, m_addCommandUsage);
                return;
            }

            if (cmdName[0] != '!')
            {
                sender.SendResponse(Importance.Med, string.Format("User commands must start with a '!'. {0}", m_addCommandUsage));
                return;
            }
            else
            {
                cmdName = cmdName.Substring(1);
            }

            if (cmdText[0] == '.' || cmdText[0] == '/')
            {
                sender.SendResponse(Importance.Med, string.Format("Cannot create a command which starts with a '{0}'.", cmdText[0]));
                return;
            }

            cmdName = cmdName.ToLower();
            Command userCommand = new Command(level, cmdText);

            bool exists;
            lock (m_sync)
            {
                exists = m_commands.ContainsKey(cmdName);
                m_commands[cmdName] = userCommand;
                m_dirty = true;
            }

            if (exists)
            {
                sender.SendResponse(Importance.Med, string.Format("Updated command: !{0}.", cmdName));
                WinterBotSource.Log.AddCommand(user.Name, cmdName, cmdText);
            }
            else
            {
                sender.SendResponse(Importance.Med, string.Format("Successfully added command: !{0}.", cmdName));
                WinterBotSource.Log.UpdateCommand(user.Name, cmdName, cmdText);
            }
        }
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:52,代码来源:BetterCommands.cs

示例8: bot_MessageReceived

        void bot_MessageReceived(WinterBot sender, TwitchUser user, string text)
        {
            if (!user.Name.Equals("frostysc", StringComparison.CurrentCultureIgnoreCase))
                return;

            if (m_random.Next(200) != 7)
                return;

            if (m_last.Elapsed().Minutes >= 5)
                sender.SendMessage("{0}, {1}", user.Name, m_insults[m_random.Next(m_insults.Length)]);

            m_last = DateTime.Now;
        }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:13,代码来源:Insult.cs

示例9: CheckMessage

        public void CheckMessage(WinterBot bot, TwitchUser user, string text)
        {
            if (user.IsModerator)
                return;

            string clearReason = null;

            List<string> urls;
            if (HasUrls(text, out urls))
            {
                // Check bans.
                if (MatchesAny(urls, m_urlBanlist))
                {
                    m_winterBot.Ban(user);
                    if (!string.IsNullOrEmpty(m_urlOptions.BanMessage))
                        bot.TimeoutMessage("{0}: {1}", user.Name, m_urlOptions.BanMessage);

                    m_winterBot.WriteDiagnostic(DiagnosticFacility.Ban, "Banned {0} for {1}.", user.Name, string.Join(", ", urls));
                }
                else if ((m_urlOptions.ShouldEnforce(user) || m_denyList.Contains(user)) && (!MatchesAll(urls, m_urlWhitelist) || MatchesAny(urls, m_urlBlacklist)))
                {
                    if (m_permit.Contains(user))
                        m_permit.Remove(user);
                    else
                        clearReason = m_urlOptions.Message;
                }
            }
            else if (m_symbolOptions.ShouldEnforce(user) && HasSpecialCharacter(text))
            {
                clearReason = m_symbolOptions.Message;
            }
            else if (m_capsOptions.ShouldEnforce(user) && TooManyCaps(user, text))
            {
                clearReason = m_capsOptions.Message;
            }
            else if (m_emoteOptions.ShouldEnforce(user) && TooManyEmotes(user, text))
            {
                clearReason = m_emoteOptions.Message;
            }
            else if (m_lengthOptions.ShouldEnforce(user) && MessageTooLong(user, text))
            {
                clearReason = m_lengthOptions.Message;
            }

            if (clearReason != null)
                ClearChat(bot, user, clearReason);
        }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:47,代码来源:TimeoutController.cs

示例10: Deny

        public void Deny(WinterBot sender, TwitchUser user, string cmd, string value)
        {
            value = value.Trim();

            if (!TwitchUsers.IsValidUserName(value))
            {
                sender.SendResponse(Importance.Med, "{0}: Usage: !deny [user]", user.Name);
                return;
            }

            var target = sender.Users.GetUser(value);
            if (target.IsModerator)
                return;

            if (m_permit.Contains(target))
                m_permit.Remove(target);

            m_denyList.Add(target);
            sender.SendResponse(Importance.High, "{0}: {1} is no longer allowed to post links.", user.Name, target.Name);
        }
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:20,代码来源:TimeoutController.cs

示例11: AutoMessageMode

        public void AutoMessageMode(WinterBot sender, TwitchUser user, string cmd, string value)
        {
            bool shouldEnable = false;
            if (value.Trim().ParseBool(ref shouldEnable))
            {
                m_msgOptions.Enabled = shouldEnable;
                if (shouldEnable)
                {
                    if (ShouldEnable)
                        Enable();
                    else
                        Disable();
                }

                sender.SendResponse(Importance.Med, "Auto message now {0}.", shouldEnable ? "enabled" : "disabled");
            }
            else
            {
                sender.SendResponse(Importance.Med, "Auto message is currently {0}.", m_msgOptions.Enabled ? "enabled" : "disabled");
            }
        }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:21,代码来源:Automessage.cs

示例12: bot_ChatClear

 void bot_ChatClear(WinterBot sender, TwitchUser user)
 {
     lock (m_sync)
         m_messages.Add(new ChatMessage(DateTime.Now, user, Action.Clear));
 }
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:5,代码来源:ChatSaver.cs

示例13: TryProcessCommand

        private void TryProcessCommand(WinterBot sender, TwitchUser user, string text)
        {
            Debug.Assert(sender == this);

            string cmd, value;
            if (!TryReadCommand(text, out cmd, out value))
                return;

            Debug.Assert(cmd != null);
            Debug.Assert(value != null);

            cmd = cmd.ToLower();
            CmdValue command;
            if (m_commands.TryGetValue(cmd, out command))
            {
                if (!CanUseCommand(user, command.Access))
                    return;

                command.Command(this, user, cmd, value);
            }
            else
            {
                OnUnknownCommand(user, cmd, value);
            }
        }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:25,代码来源:WinterBot.cs

示例14: SubscribeHandler

 private void SubscribeHandler(TwitchClient source, TwitchUser user)
 {
     var evt = UserSubscribed;
     if (evt != null)
     {
         m_events.Enqueue(new Tuple<Delegate, object[]>(evt, new object[] { this, user }));
         m_event.Set();
     }
 }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:9,代码来源:WinterBot.cs

示例15: OnUnknownCommand

 private void OnUnknownCommand(TwitchUser user, string cmd, string value)
 {
     var evt = UnknownCommandReceived;
     if (evt != null)
         evt(this, user, cmd, value);
 }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:6,代码来源:WinterBot.cs


注:本文中的Winter.TwitchUser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。