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


C# WinterBot.SendMessage方法代码示例

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


在下文中一共展示了WinterBot.SendMessage方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: bot_Tick

        void bot_Tick(WinterBot sender, TimeSpan timeSinceLastUpdate)
        {
            if (m_lastMessage.Elapsed().TotalMinutes >= m_msgOptions.Delay &&
                m_totalMessages >= m_msgOptions.MessageDelay &&
                sender.LastMessageSent.Elapsed().TotalSeconds >= 45)
            {
                m_lastMessage = DateTime.Now;
                m_totalMessages = 0;

                var messages = m_msgOptions.Messages;
                if (messages.Length == 0)
                    return;

                m_curr %= messages.Length;

                string msg = null;
                if (m_random != null)
                    msg = messages[m_random.Next(messages.Length)];
                else
                    msg = messages[m_curr++];

                sender.SendMessage(msg);
            }
        }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:24,代码来源:Automessage.cs

示例4: SendMessage

        private void SendMessage(WinterBot sender, string fmt, params object[] args)
        {
            if (m_lastMessage.Elapsed().Seconds < 20)
                return;

            sender.SendMessage(Importance.Low, string.Format(fmt, args));
            m_lastMessage = DateTime.Now;
        }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:8,代码来源:Betting.cs

示例5: m_bot_Tick

        void m_bot_Tick(WinterBot sender, TimeSpan timeSinceLastUpdate)
        {
            if (!IsBettingOpen)
            {
                sender.SendMessage(Importance.High, "Betting is now CLOSED.");
                CancelCallback();
                return;
            }

            if (m_bettingStarted.Elapsed().TotalSeconds >= m_time)
            {
                sender.SendMessage(Importance.High, "Betting is now CLOSED.");
                CancelCallback();
                m_state = State.WaitingResult;
            }
        }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:16,代码来源:Betting.cs

示例6: Result

        public void Result(WinterBot sender, TwitchUser user, string cmd, string value)
        {
            if (!Enabled)
                return;

            if (IsBettingClosed)
            {
                sender.SendMessage(Importance.Med, "Betting is not currently open.");
                return;
            }

            Args args = value.ParseArguments(sender);
            string result = args.GetOneWord();

            if (string.IsNullOrWhiteSpace(result))
            {
                sender.SendMessage(Importance.Med, "Usage: '!result [player]'.");
                return;
            }
            else if (!m_betting.Contains(result))
            {
                sender.SendMessage(Importance.High, "'{0}' not a valid player, valid players: {1}", result, string.Join(", ", m_betting));
                return;
            }

            var winners = from bet in m_bets
                          where bet.Value.Item1.Equals(result, StringComparison.CurrentCultureIgnoreCase)
                          select bet;

            var losers = from bet in m_bets
                         where !bet.Value.Item1.Equals(result, StringComparison.CurrentCultureIgnoreCase)
                         select bet;

            int totalWinners = 0, totalLosers = 0;
            foreach (var winner in winners)
            {
                AddPoints(winner.Key, winner.Value.Item2);
                totalWinners++;
            }

            foreach (var loser in losers)
            {
                AddPoints(loser.Key, -loser.Value.Item2);
                totalLosers++;
            }

            Tuple<TwitchUser, int>[] t = (from bet in m_bets
                                               select new Tuple<TwitchUser, int>(bet.Key, m_points[bet.Key])).ToArray();

            lock (m_sync)
                foreach (var usr in m_bets.Keys)
                    m_queue.Add(new Tuple<TwitchUser, int>(usr, m_points[usr]));

            m_event.Set();

            ClearBetting();
            CancelCallback();

            sender.SendMessage(Importance.High, "Betting complete.  {0} winners and {1} losers.  Point totals can be found here: http://www.darkautumn.net/winter/chat.php?POINTS", totalWinners, totalLosers);
        }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:60,代码来源:Betting.cs

示例7: BettingEnable

        public void BettingEnable(WinterBot sender, TwitchUser user, string cmd, string value)
        {
            bool enable = false;
            if (!value.ParseBool(ref enable))
            {
                sender.SendMessage(Importance.Low, "Betting is currently: {0}", Enabled ? "enabled" : "disabled");
                return;
            }

            Enabled = enable;
            sender.SendMessage(Importance.Med, "Betting is now {0}.", Enabled ? "enabled" : "disabled");
        }
开发者ID:NitroXenon,项目名称:WinterBot,代码行数:12,代码来源:Betting.cs

示例8: bot_UserSubscribed

 void bot_UserSubscribed(WinterBot sender, TwitchUser user)
 {
     var subMessage = m_chatOptions.SubscribeMessage;
     if (!string.IsNullOrWhiteSpace(subMessage))
         sender.SendMessage("{0}: {1}", user.Name, subMessage);
 }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:6,代码来源:Automessage.cs

示例9: bot_UserFollowed

 private void bot_UserFollowed(WinterBot sender, TwitchUser user)
 {
     var msg = m_chatOptions.FollowMessage;
     if (!string.IsNullOrWhiteSpace(msg))
         sender.SendMessage("{0}: {1}", user.Name, msg);
 }
开发者ID:BigAbboTT,项目名称:WinterBot,代码行数:6,代码来源:Automessage.cs

示例10: ListCommands

        public void ListCommands(WinterBot sender, TwitchUser user, string cmd, string value)
        {
            if (m_lastCommandList.Elapsed().TotalSeconds < 15)
            {
                WinterBotSource.Log.DenyCommand(user.Name, cmd, "time");
                return;
            }

            m_lastCommandList = DateTime.Now;
            sender.SendMessage("A full listing of user commands can be found here: " + HttpManager.Instance.GetUrl("commands.php"));
            m_sent.AddLast(new Tuple<string, DateTime>("commands", DateTime.Now));
        }
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:12,代码来源:BetterCommands.cs


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