當前位置: 首頁>>代碼示例>>C#>>正文


C# IrcChannel.Msg方法代碼示例

本文整理匯總了C#中Squishy.Irc.IrcChannel.Msg方法的典型用法代碼示例。如果您正苦於以下問題:C# IrcChannel.Msg方法的具體用法?C# IrcChannel.Msg怎麽用?C# IrcChannel.Msg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Squishy.Irc.IrcChannel的用法示例。


在下文中一共展示了IrcChannel.Msg方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnText

        protected override void OnText(IrcUser user, IrcChannel chan, StringStream text)
        {
            try
            {
                if (text.String.ToLower().Contains("badger"))
                {
                    Random rand = new Random();
                    var randomint = rand.Next(0, 100);
                    if(randomint > 50)
                    {
                        chan.Msg("Ahhhh Snakkeeee its a snaakee!!!! http://www.youtube.com/watch?v=EIyixC9NsLI");
                    }
                    else
                    {
                        chan.Msg("Mushroom Mushroom Mushroom! http://www.youtube.com/watch?v=EIyixC9NsLI");
                    }
                }
                else
                {
                    if (text.String.ToLower().Contains("snake"))
                    {
                        chan.Msg("Badger...Badger...Badger...Badger.. http://www.youtube.com/watch?v=EIyixC9NsLI");
                    }
                    else
                    {
                        if (text.String.ToLower().Contains("mushroom"))
                        {
                            chan.Msg("Badger..Badger..Badger! http://www.youtube.com/watch?v=EIyixC9NsLI");
                        }
                    }
                }

                if (text.String.Contains("ACTION") && text.String.ToLower().Contains("help") && text.String.ToLower().Contains("bot"))
                {
                    if (chan != null)
                        Irc.CommandHandler.Describe(chan, FunCommands.ReactToAction(), chan.Args);
                    else
                        Irc.CommandHandler.Describe(user, FunCommands.ReactToAction(), user.Args);
                }

                #region MessagesSent
                if(chan != null)
                UtilityMethods.Print(string.Format("User {0} on channel {1} Sent {2}", user, chan, text), true);

                #endregion
            }
            catch (Exception e)
            {
                CommandHandler.Msg("#woc", e.Message);
                UtilityMethods.Print(e.StackTrace + e.Message, true);
            }
        }
開發者ID:jaddie,項目名稱:DarkWaterSupportBot,代碼行數:52,代碼來源:Program.cs

示例2: OnText

        protected override void OnText(IrcUser user, IrcChannel chan, StringStream text)
        {
            try
            {
                CommandHandler.RemoteCommandPrefix = text.String.StartsWith("~") ? "~" : "@";
                if (text.String.ToLower().Contains("badger"))
                {
                    Random rand = new Random();
                    var randomint = rand.Next(0, 100);
                    if(randomint > 50)
                    {
                        chan.Msg("Ahhhh Snakkeeee its a snaakee!!!! http://www.youtube.com/watch?v=EIyixC9NsLI");
                    }
                    else
                    {
                        chan.Msg("Mushroom Mushroom Mushroom! http://www.youtube.com/watch?v=EIyixC9NsLI");
                    }
                }
                else
                {
                    if (text.String.ToLower().Contains("snake"))
                    {
                        chan.Msg("Badger...Badger...Badger...Badger.. http://www.youtube.com/watch?v=EIyixC9NsLI");
                    }
                    else
                    {
                        if (text.String.ToLower().Contains("mushroom"))
                        {
                            chan.Msg("Badger..Badger..Badger! http://www.youtube.com/watch?v=EIyixC9NsLI");
                        }
                    }
                }

                if (text.String.Contains("ACTION") && text.String.ToLower().Contains("utility") && text.String.ToLower().Contains("bot"))
                {
                    if (chan != null)
                        Irc.CommandHandler.Describe(chan, FunCommands.FunCommands.ReactToAction(), chan.Args);
                    else
                        Irc.CommandHandler.Describe(user, FunCommands.FunCommands.ReactToAction(), user.Args);
                }

                #region MessagesSent

                Console.WriteLine(string.Format("User {0} on channel {1} Sent {2}", user, chan, text));
                IrcLog.WriteLine(string.Format("User {0} on channel {1} Sent {2}", user, chan, text));
                #endregion
            }
            catch (Exception e)
            {
                CommandHandler.Msg("#woc", e.Message);
                WriteErrorSystem.WriteError(e);
            }
        }
開發者ID:jaddie,項目名稱:WCell-Utility-Bot,代碼行數:53,代碼來源:Program.cs


注:本文中的Squishy.Irc.IrcChannel.Msg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。