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


C# Channel.SaveConfig方法代码示例

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


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

示例1: Hook_PRIV

        public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
        {
            if (message == Configuration.System.CommandPrefix + "relay-off")
            {
                if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
                {
                    if (!GetConfig(channel, "NetCat.Enabled", false))
                    {
                        IRC.DeliverMessage("Relay is already disabled", channel.Name);
                        return;
                    }
                    SetConfig(channel, "NetCat.Enabled", false);
                    channel.SaveConfig();
                    IRC.DeliverMessage("Relay was disabled", channel.Name);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "token-on")
            {
                if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
                {
                    string token = GenerateToken();
                    SetConfig(channel, "NetCat.Token", true);
                    SetConfig(channel, "NetCat.TokenData", token);
                    channel.SaveConfig();
                    IRC.DeliverMessage("New token was generated for this channel, and it was sent to you in a private message", channel.Name);
                    IRC.DeliverMessage("Token for " + channel.Name + " is: " + token, invoker.Nick);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "token-off")
            {
                if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
                {
                    SetConfig(channel, "NetCat.Token", false);
                    channel.SaveConfig();
                    IRC.DeliverMessage("This channel will no longer require a token in order to relay messages into it", channel.Name);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "token-remind")
            {
                if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
                {
                    if (!GetConfig(channel, "NetCat.Token", false))
                    {
                        IRC.DeliverMessage("This channel doesn't require a token", channel.Name);
                        return;
                    }
                    string token = GetConfig(channel, "NetCat.TokenData", "<invalid>");
                    IRC.DeliverMessage("Token for " + channel.Name + " is: " + token, invoker.Nick);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "relay-on")
            {
                if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
                {
                    if (GetConfig(channel, "NetCat.Enabled", false))
                    {
                        IRC.DeliverMessage("Relay is already enabled", channel.Name);
                        return;
                    }
                    SetConfig(channel, "NetCat.Enabled", true);
                    channel.SaveConfig();
                    IRC.DeliverMessage("Relay was enabled", channel.Name);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
            }
        }
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:98,代码来源:NetCat.cs

示例2: Hook_PRIV

        public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
        {
            if (!message.StartsWith(Configuration.System.CommandPrefix) && GetConfig(channel, "Slap.Enabled", false))
            {
                string ms = message.Trim();
                ms = ms.Replace("!", "");
                ms = ms.Replace("?", "");
                ms = ms.ToLower();
                if (ms.StartsWith("hi "))
                    ms = ms.Substring(3);
                if (ms.StartsWith("hi, "))
                    ms = ms.Substring(4);
                if (ms.StartsWith("hello "))
                    ms = ms.Substring(6);
                if (ms.StartsWith("hello, "))
                    ms = ms.Substring(7);
                if (ms.EndsWith(":ping") || ms.EndsWith(": ping"))
                {
                    string target = message.Substring(0, message.IndexOf(":"));
                    if (GetConfig(channel, "Slap.Ping." + target, false))
                    {
                        IRC.DeliverMessage("Hi " + invoker.Nick + ", you just managed to say pointless nick: ping. Now please try again with some proper meaning of your request, something like nick: I need this and that. Or don't do that at all, it's very annoying. Thank you", channel);
                        return;
                    }
                }

                if (!channel.SystemUsers.IsKnown(invoker))
                {
                    if (ms == "i have a question" || ms == "can i ask a question" || ms == "is anyone willing to help" || ms == "can i ask" || ms == "i got a question" || ms == "can i have a question" || ms == "can someone help me" || ms == "i need help")
                    {
                        IRC.DeliverMessage("Hi " + invoker.Nick + ", just ask! There is no need to ask if you can ask", channel);
                        return;
                    }

                    if (ms == "is anyone here" || ms == "is anybody here" || ms == "is anybody there" || ms == "is some one there" || ms == "is someone there" || ms == "is someone here" || ms == "anyone here" || ms == "someone here")
                    {
                        IRC.DeliverMessage("Hi " + invoker.Nick + ", I am here, if you need anything, please ask, otherwise no one is going to help you... Thank you", channel);
                        return;
                    }
                }
            }

            if (message == Configuration.System.CommandPrefix + "slap" ||
                message == Configuration.System.CommandPrefix + "slap-on")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    SetConfig(channel, "Slap.Enabled", true);
                    IRC.DeliverMessage("I will be slapping annoying people since now", channel);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                    IRC.DeliverMessage("Permission denied", channel);
            }

            if (message == Configuration.System.CommandPrefix + "noslap" ||
                message == Configuration.System.CommandPrefix + "slap-off")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    SetConfig(channel, "Slap.Enabled", false);
                    IRC.DeliverMessage("I will not be slapping people since now", channel);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                    IRC.DeliverMessage("Permission denied", channel);
            }

            if (message == Configuration.System.CommandPrefix + "nopingslap")
            {
                if (channel.SystemUsers.IsApproved(invoker, "trust"))
                {
                    SetConfig(channel, "Slap.Ping." + invoker.Nick.ToLower(), false);
                    IRC.DeliverMessage("I will not be slapping people who slap you now", channel);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                    IRC.DeliverMessage("Permission denied", channel);
            }

            if (message == Configuration.System.CommandPrefix + "pingslap")
            {
                if (channel.SystemUsers.IsApproved(invoker, "trust"))
                {
                    SetConfig(channel, "Slap.Ping." + invoker.Nick.ToLower(), true);
                    IRC.DeliverMessage("I will be slapping people who ping you now", channel);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                    IRC.DeliverMessage("Permission denied", channel);
            }
        }
开发者ID:Lorwp,项目名称:wikimedia-bot,代码行数:96,代码来源:Slap.cs

示例3: Hook_PRIV

        public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
        {
            if (message.StartsWith(Configuration.System.CommandPrefix + "optools-on"))
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (GetConfig(channel, "OP.Enabled", false))
                    {
                        IRC.DeliverMessage(messages.Localize("OpE1", channel.Language), channel);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("OpM1", channel.Language), channel.Name);
                    SetConfig(channel, "OP.Enabled", true);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "optools-permanent-off")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (!GetConfig(channel, "OP.Permanent", false))
                    {
                        IRC.DeliverMessage(messages.Localize("OpE2", channel.Language), channel);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("OpM2", channel.Language), channel);
                    SetConfig(channel, "OP.Permanent", false);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "optools-permanent-on")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (GetConfig(channel, "OP.Permanent", false))
                    {
                        IRC.DeliverMessage(messages.Localize("OpE3", channel.Language), channel);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("OpM3", channel.Language), channel);
                    SetConfig(channel, "OP.Permanent", true);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "optools-off")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (!GetConfig(channel, "OP.Enabled", false))
                    {
                        IRC.DeliverMessage(messages.Localize("OpE4", channel.Language), channel);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("OpM4", channel.Language), channel);
                    SetConfig(channel, "OP.Enabled", false);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "kick "))
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (GetConfig(channel, "OP.Enabled", false))
                    {
                        string nick = message.Substring(6);
                        string reason = "Removed from the channel";
                        if (nick.Contains(" "))
                        {
                            reason = nick.Substring(nick.IndexOf(" ") + 1);
                            nick = nick.Substring(0, nick.IndexOf(" "));
                        }
                        libirc.User user = getUser(nick, channel);
//.........这里部分代码省略.........
开发者ID:reviforks,项目名称:wikimedia-bot,代码行数:101,代码来源:ChannelTools.cs

示例4: Hook_SetConfig

 public override bool Hook_SetConfig(Channel chan, libirc.UserInfo invoker, string config, string value)
 {
     switch (config)
     {
         case "recent-changes-template":
             if (value != "null")
             {
                 SetConfig(chan, "RC.Template", value);
                 IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan);
                 chan.SaveConfig();
                 return true;
             }
             SetConfig(chan, "RC.Template", "");
             IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { "null", config }), chan);
             chan.SaveConfig();
             return true;
     }
     return false;
 }
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:19,代码来源:ModuleRC.cs

示例5: Hook_PRIV


//.........这里部分代码省略.........
                {
                    if (channel.SharedDB != "local")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot16", channel.Language), channel);
                        return;
                    }
                    if (channel.SharedDB != "local" && channel.SharedDB != "")
                    {
                        IRC.DeliverMessage(messages.Localize("infobot15", channel.Language), channel);
                        return;
                    }
                    if (message.Length <= "@infobot-share-trust+ ".Length)
                    {
                        IRC.DeliverMessage(messages.Localize("db6", channel.Language), channel.Name);
                        return;
                    }
                    string name = message.Substring("@infobot-share-trust+ ".Length);
                    Channel guest = Core.GetChannel(name);
                    if (guest == null)
                    {
                        IRC.DeliverMessage(messages.Localize("db8", channel.Language), channel.Name);
                        return;
                    }
                    if (channel.SharedLinkedChan.Contains(guest))
                    {
                        IRC.DeliverMessage(messages.Localize("db14", channel.Language), channel.Name);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("db1", channel.Language, new List<string> { name }), channel.Name);
                    lock (channel.SharedLinkedChan)
                    {
                        channel.SharedLinkedChan.Add(guest);
                    }
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-ignore- "))
            {
                if (channel.SystemUsers.IsApproved(invoker, PermissionIgnore))
                {
                    string item = message.Substring("@infobot-ignore+ ".Length);
                    if (item != "")
                    {
                        if (!channel.Infobot_IgnoredNames.Contains(item))
                        {
                            IRC.DeliverMessage(messages.Localize("infobot-ignore-found", channel.Language, new List<string> { item }), channel);
                            return;
                        }
                        channel.Infobot_IgnoredNames.Remove(item);
                        IRC.DeliverMessage(messages.Localize("infobot-ignore-rm", channel.Language, new List<string> { item }), channel);
                        channel.SaveConfig();
                        return;
                    }
                }
                else
                {
                    if (!channel.SuppressWarnings)
                    {
                        IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, libirc.Defs.Priority.Low);
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:67,代码来源:Plugin.cs

示例6: Hook_SetConfig

 public override bool Hook_SetConfig(Channel chan, libirc.UserInfo invoker, string config, string value)
 {
     bool _temp_a;
     switch (config)
     {
         case "infobot-trim-white-space-in-name":
             if (bool.TryParse(value, out _temp_a))
             {
                 SetConfig(chan, "Infobot.Trim-white-space-in-name", _temp_a);
                 IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
                 chan.SaveConfig();
                 return true;
             }
             IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
             return true;
         case "infobot-auto-complete":
             if (bool.TryParse(value, out _temp_a))
             {
                 SetConfig(chan, "Infobot.auto-complete", _temp_a);
                 IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
                 chan.SaveConfig();
                 return true;
             }
             IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
             return true;
         case "infobot-sorted":
             if (bool.TryParse(value, out _temp_a))
             {
                 SetConfig(chan, "Infobot.Sorted", _temp_a);
                 IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
                 chan.SaveConfig();
                 return true;
             }
             IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
             return true;
         case "infobot-help":
             if (bool.TryParse(value, out _temp_a))
             {
                 SetConfig(chan, "Infobot.Help", _temp_a);
                 IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
                 chan.SaveConfig();
                 return true;
             }
             IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
             return true;
         case "infobot-case":
             if (bool.TryParse(value, out _temp_a))
             {
                 SetConfig(chan, "Infobot.Case", _temp_a);
                 IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
                 chan.SaveConfig();
                 Infobot infobot = (Infobot)chan.RetrieveObject("Infobot");
                 if (infobot != null)
                 {
                     infobot.Sensitive = _temp_a;
                 }
                 return true;
             }
             IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
             return true;
     }
     return false;
 }
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:63,代码来源:Plugin.cs

示例7: Hook_PRIV

        public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
        {
            if (GetConfig(channel, "Statistics.Enabled", false))
            {
                Statistics st = (Statistics)channel.RetrieveObject("Statistics");
                if (st != null)
                {
                    st.Stat(invoker.Nick, message, invoker.Host);
                }
            }

            if (message == Configuration.System.CommandPrefix + "statistics-off")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (!GetConfig(channel, "Statistics.Enabled", false))
                    {
                        IRC.DeliverMessage(messages.Localize("StatE2", channel.Language), channel);
                        return;
                    }
                    SetConfig(channel, "Statistics.Enabled", false);
                    channel.SaveConfig();
                    IRC.DeliverMessage(messages.Localize("Stat-off", channel.Language), channel);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "statistics-reset")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    Statistics st = (Statistics)channel.RetrieveObject("Statistics");
                    if (st != null)
                    {
                        st.Delete();
                    }
                    IRC.DeliverMessage(messages.Localize("Statdt", channel.Language), channel);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "statistics-on")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (GetConfig(channel, "Statistics.Enabled", false))
                    {
                        IRC.DeliverMessage(messages.Localize("StatE1", channel.Language), channel);
                        return;
                    }
                    SetConfig(channel, "Statistics.Enabled", true);
                    channel.SaveConfig();
                    IRC.DeliverMessage(messages.Localize("Stat-on", channel.Language), channel);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
                }
            }
        }
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:71,代码来源:Statistics.cs

示例8: Hook_SetConfig

 public override bool Hook_SetConfig(Channel chan, libirc.UserInfo invoker, string config, string value)
 {
     if (config == "style-rss")
     {
         if (value != "")
         {
             SetConfig(chan, "Rss.Style", value);
             chan.SaveConfig();
             IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
             return true;
         }
         IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
         return true;
     }
     return false;
 }
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:16,代码来源:Module.cs

示例9: Hook_PRIV


//.........这里部分代码省略.........
             {
                 IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
             }
         }
     }
     if (message.StartsWith("@rss-scanner+ "))
     {
         if (channel.SystemUsers.IsApproved(invoker, "trust"))
         {
             string item = message.Substring("@rss-scanner+ ".Length);
             if (item.Contains(" "))
             {
                 string id = item.Substring(0, item.IndexOf(" "));
                 string ur = item.Substring(item.IndexOf(" ") + 1);
                 Feed feed = (Feed)channel.RetrieveObject("rss");
                 if (feed != null)
                 {
                     feed.InsertItem(id, ur, true);
                 }
                 return;
             }
             if (item != "")
             {
                 Feed feed = (Feed)channel.RetrieveObject("rss");
                 if (feed != null)
                 {
                     feed.InsertItem(item, "", true);
                 }
                 return;
             }
             if (!channel.SuppressWarnings)
             {
                 IRC.DeliverMessage(messages.Localize("Rss5", channel.Language), channel.Name);
             }
         }
         else
         {
             if (!channel.SuppressWarnings)
             {
                 IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
             }
         }
     }
     if (message.StartsWith("@rss-scanner- "))
     {
         if (channel.SystemUsers.IsApproved(invoker, "trust"))
         {
             string item = message.Substring("@rss-scannerx ".Length);
             Feed feed = (Feed)channel.RetrieveObject("rss");
             if (feed != null)
             {
                 feed.RemoveItem(item);
             }
             return;
         }
         if (!channel.SuppressWarnings)
         {
             IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
         }
     }
     if (message == "@rss-off")
     {
         if (channel.SystemUsers.IsApproved(invoker, "admin"))
         {
             if (!GetConfig(channel, "Rss.Enable", false))
             {
                 IRC.DeliverMessage(messages.Localize("Rss1", channel.Language), channel.Name);
                 return;
             }
             SetConfig(channel, "Rss.Enable", false);
             IRC.DeliverMessage(messages.Localize("Rss2", channel.Language), channel.Name);
             channel.SaveConfig();
             return;
         }
         if (!channel.SuppressWarnings)
         {
             IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
         }
         return;
     }
     if (message == "@rss-on")
     {
         if (channel.SystemUsers.IsApproved(invoker, "admin"))
         {
             if (GetConfig(channel, "Rss.Enable", false))
             {
                 IRC.DeliverMessage(messages.Localize("Rss3", channel.Language), channel.Name);
                 return;
             }
             IRC.DeliverMessage(messages.Localize("Rss4", channel.Language), channel.Name);
             SetConfig(channel, "Rss.Enable", true);
             channel.SaveConfig();
             return;
         }
         if (!channel.SuppressWarnings)
         {
             IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
         }
     }
 }
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:101,代码来源:Module.cs

示例10: Hook_PRIV

        public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
        {
            WriteStatus(invoker.Nick, invoker.Host, channel.Name, item.Action.Talk);
            if (message.StartsWith(Configuration.System.CommandPrefix + "seen "))
            {
                if (GetConfig(channel, "Seen.Enabled", false))
                {
                    string parameter = "";
                    if (message.Contains(" "))
                    {
                        parameter = message.Substring(message.IndexOf(" ") + 1);
                    }
                    if (parameter != "")
                    {
                        RetrieveStatus(parameter, channel, invoker.Nick);
                        return;
                    }
                }
            }

            if (message.StartsWith(Configuration.System.CommandPrefix + "seenrx "))
            {
                if (channel.SystemUsers.IsApproved(invoker, "trust"))
                {
                    if (GetConfig(channel, "Seen.Enabled", false))
                    {
                        string parameter = "";
                        if (message.Contains(" "))
                        {
                            parameter = message.Substring(message.IndexOf(" ") + 1);
                        }
                        if (parameter != "")
                        {
                            RegEx(parameter, channel, invoker.Nick);
                            return;
                        }
                    }
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "seen-off")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (!GetConfig(channel, "Seen.Enabled", false))
                    {
                        IRC.DeliverMessage(messages.Localize("seen-e2", channel.Language), channel.Name);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("seen-off", channel.Language), channel.Name);
                    SetConfig(channel, "Seen.Enabled", false);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "seen-on")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (GetConfig(channel, "Seen.Enabled", false))
                    {
                        IRC.DeliverMessage(messages.Localize("seen-oe", channel.Language), channel.Name);
                        return;
                    }
                    SetConfig(channel, "Seen.Enabled", true);
                    channel.SaveConfig();
                    IRC.DeliverMessage(messages.Localize("seen-on", channel.Language), channel.Name);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
                }
            }
        }
开发者ID:reviforks,项目名称:wikimedia-bot,代码行数:87,代码来源:Seen.cs

示例11: Hook_PRIV

        public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
        {
            ChanLog(message, channel, invoker.Nick, invoker.Host);
            if (message == Configuration.System.CommandPrefix + "logon")
            {
                if (channel.SystemUsers.IsApproved(invoker, "admin"))
                {
                    if (GetConfig(channel, "Logging.Enabled", false))
                    {
                        IRC.DeliverMessage(messages.Localize("ChannelLogged", channel.Language), channel.Name);
                        return;
                    }
                    IRC.DeliverMessage(messages.Localize("LoggingOn", channel.Language), channel.Name);
                    SetConfig(channel, "Logging.Enabled", true);
                    channel.SaveConfig();
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
                return;
            }

            if (message == Configuration.System.CommandPrefix + "logoff")
            {
                if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
                {
                    if (!GetConfig(channel, "Logging.Enabled", false))
                    {
                        IRC.DeliverMessage(messages.Localize("LogsE1", channel.Language), channel.Name);
                        return;
                    }
                    SetConfig(channel, "Logging.Enabled", false);
                    channel.SaveConfig();
                    IRC.DeliverMessage(messages.Localize("NotLogged", channel.Language), channel.Name);
                    return;
                }
                if (!channel.SuppressWarnings)
                {
                    IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, libirc.Defs.Priority.Low);
                }
            }
        }
开发者ID:reviforks,项目名称:wikimedia-bot,代码行数:44,代码来源:Log.cs


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