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


C# WinterBot.CanUseCommand方法代码示例

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


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

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

示例2: UnknownCommandReceived

        void UnknownCommandReceived(WinterBot sender, TwitchUser user, string cmd, string value)
        {
            cmd = cmd.ToLower();
            Command command;

            lock (m_sync)
                if (!m_commands.TryGetValue(cmd, out command))
                    return;

            if (!sender.CanUseCommand(user, command.AccessLevel))
            {
                WinterBotSource.Log.DenyCommand(user.Name, cmd, "access");
                return;
            }

            if (CanSendCommand(user, cmd))
            {
                sender.SendResponse(Importance.Low, command.Text);
                m_sent.AddLast(new Tuple<string, DateTime>(cmd, DateTime.Now));
            }
        }
开发者ID:KnightRobby,项目名称:WinterBot,代码行数:21,代码来源:BetterCommands.cs


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