• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Commands.CmdTrigger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         var helpName = trigger.Args.NextWord().ToLower();
         if (!string.IsNullOrEmpty(helpName))
         {
             var cmd = HelpCommandsManager.Search(helpName);
             if (cmd != null)
             {
                 HelpCommandsManager.Delete(cmd);
                 trigger.Reply(string.Format("Deleted command HelpTrigger: {0} HelpText: {1}", cmd.HelpName, cmd.HelpText));
             }
             else
             {
                 trigger.Reply("No command was found with that name!");
             }
         }
         else
         {
             trigger.Reply("An error occured deleting the specified command, it appears that the command did not exist, please check and try again or report the error!");
         }
     }
     catch (Exception e)
     {
         UtilityMethods.Print(e.Message + e.Data + e.StackTrace, true);
     }
 }
开发者ID:jaddie,项目名称:DarkWaterSupportBot,代码行数:28,代码来源:HelpCommands.cs


示例2: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         string[] attacks = {
                                "slaps %s",
                                "kicks %s",
                                "punches %s in the face",
                                "stings %s with a needle",
                                "shoots %s with a phaser"
                            };
         if (!string.IsNullOrEmpty(trigger.Args.Remainder))
         {
             var rand = new Random();
             int randomchoice = rand.Next(0, 4);
             if (trigger.Channel != null && !trigger.Channel.HasUser(trigger.Args.Remainder))
             {
                 trigger.Reply("I can't find that person to attack them!");
                 return;
             }
             string attack = attacks[randomchoice].Replace("%s", trigger.Args.Remainder);
             JadBot.Irc.CommandHandler.Describe(trigger.Target, attack, trigger.Args);
         }
         else
         {
             trigger.Reply("You didnt give me a nick to attack!");
         }
     }
     catch (Exception e)
     {
         WriteErrorSystem.WriteError(e);
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:33,代码来源:Information.cs


示例3: Process

 public override void Process(CmdTrigger trigger)
 {
     var user = trigger.User;
     if (user == null)
     {
         trigger.Reply("AuthCommand requires User-argument.");
     }
     else
     {
         if (user.IsAuthenticated)
         {
             trigger.Reply("User {0} is authed as: {1}", user.Nick, user.AuthName);
         }
         else
         {
             var authMgr = trigger.irc.AuthMgr;
             if (authMgr.IsResolving(user))
             {
                 trigger.Reply("User {0} is being resolved - Please wait...", user.Nick, user.AuthName);
             }
             else if (!authMgr.CanResolve)
             {
                 trigger.Reply("Authentication is not supported on this Network.");
             }
             else
             {
                 trigger.Reply("Resolving User...".Colorize(IrcColorCode.Red));
                 authMgr.ResolveAuth(user);
             }
         }
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:32,代码来源:DefaultCommands.cs


示例4: Process

        public override void Process(CmdTrigger<IrcCmdArgs> trigger)
        {
            var chan = trigger.Args.Channel;
            var voteChan = trigger.Text.NextWord();
            Vote vote;

            // If we have a channel given in the argument list
            if (voteChan.Length > 0)
                vote = Vote.GetVote(trigger.Args.IrcClient.GetChannel(voteChan));
            vote = Vote.GetVote(chan);

            if (vote != null)
            {

                trigger.Reply("The vote has ended!");
                trigger.Reply(VoteMgr.Mgr.Stats(vote));
                trigger.Reply(VoteMgr.Mgr.Result(vote));
                VoteMgr.Mgr.EndVote(vote);
                return;

            }

            else
            {
                Vote[] votesArray = new Vote[VoteMgr.Votes.Values.Count];
                VoteMgr.Votes.Values.CopyTo(votesArray, 0);
                foreach (var vte in votesArray)
                    VoteMgr.Mgr.EndVote(vte);
                trigger.Reply("Disposed of {0} vote[s].", votesArray.Length);
            }
        }
开发者ID:WCell,项目名称:WCell-IrcAddon,代码行数:31,代码来源:IrcCommands.cs


示例5: Process

 public override void Process(CmdTrigger trigger)
 {
     var nick = trigger.Args.NextWord();
     var messagetosend = trigger.Args.Remainder;
     if (string.IsNullOrEmpty(nick) || string.IsNullOrEmpty(messagetosend))
     {
         trigger.Reply("Failed to parse input, please try again");
     }
     else
     {
         using (var db = new UtilityBotDBContainer())
         {
             var msg = new Message
             {
                 DateLeft = DateTime.Now.ToString(),
                 FromIrcNick = trigger.User.Nick,
                 IrcNick = nick,
                 MessageText = messagetosend
             };
             db.Messages.AddObject(msg);
             db.SaveChanges();
             trigger.Reply("Message saved");
             return;
         }
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:26,代码来源:UtilityCommands.cs


示例6: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         string nextWord = trigger.Args.NextWord().ToLower();
         if (nextWord == "safe")
         {
             trigger.Reply("Safely shutting down WCell saving data and Starting it up again");
             var prog = new Process
             {
                 StartInfo = { FileName = @"c:\wcellupdater.exe", Arguments = @"c:\wcellsource\run\ c:\run\ debug\" }
             };
             prog.Start();
         }
         if (nextWord == "utility")
         {
             trigger.Reply("Restarting Utility - If there is no auto restarter the utility will not return");
             JadBot.Parser.Kill();
             var restartbat = new StreamWriter("Restartbat.bat") {AutoFlush = true};
             restartbat.WriteLine("taskkill /F /IM jad_bot.exe");
             restartbat.WriteLine("start " + JadBot.Utility.StartInfo.FileName);
             var cmd = new Process {StartInfo = {FileName = "cmd.exe", Arguments = "start RestartBat.bat"}};
             cmd.Start();
         }
     }
     catch (Exception e)
     {
         WriteErrorSystem.WriteError(e);
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:30,代码来源:SystemCommands.cs


示例7: Process

 public override void Process(CmdTrigger trigger)
 {
     var username = trigger.Args.NextWord();
     var userlevel = trigger.Args.NextWord().ToLower();
     if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(userlevel))
     {
         trigger.Reply("Invalid input please try again!");
     }
     else
     {
         if (!ValidateUserLevel(userlevel))
         {
             trigger.Reply("Invalid userlevel specified, options are guest,user,admin");
             return;
         }
         using (var db = new UtilityBotDBContainer())
         {
             foreach (var account in Queryable.Where(db.Accounts, account => account.Username == username))
             {
                 account.UserLevel = userlevel;
                 trigger.Reply("Account level changed to " + userlevel);
                 db.SaveChanges();
                 return;
             }
         }
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:27,代码来源:AccountCommands.cs


示例8: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         string filename = trigger.Args.NextWord();
         string httpLink = trigger.Args.Remainder;
         if(string.IsNullOrEmpty(filename) || string.IsNullOrEmpty(httpLink))
         {
             trigger.Reply("Error, invalid arguements try @help downloadlog");
             return;
         }
         trigger.Reply("Attempting to download log from {0} and save in unparsed folder as {1}", httpLink,
                       filename);
         var client = new WebClient();
         client.DownloadFile(httpLink, JadBot.UnparsedFolder + filename);
         using (var downloadedfile = new StreamReader(JadBot.UnparsedFolder + filename))
         {
             if (downloadedfile.BaseStream.Length < 1)
             {
                 trigger.Reply("The downloaded file looks empty, are you sure your link is valid?");
             }
             else
             {
                 trigger.Reply(
                     "Download complete file is saved in the unparsed logs folder as {0} you can now use the parse command on it.",
                     filename);
             }
         }
     }
     catch (Exception e)
     {
         WriteErrorSystem.WriteError(e);
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:34,代码来源:Parser.cs


示例9: AddAccount

 public static void AddAccount(CmdTrigger trigger, string username, string password, string userlevel)
 {
     using (var db = new UtilityBotDBContainer())
     {
         var account = new Account { Username = username, Password = password, UserLevel = userlevel };
         db.Accounts.AddObject(account);
         db.SaveChanges();
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:9,代码来源:AccountCommands.cs


示例10: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         trigger.Reply("If you have a picture you like show us or perhaps a file you want to send us .rar it and upload to http://bayimg.com/ and show us the link.");
     }
     catch (Exception e)
     {
         WriteErrorSystem.WriteError(e);
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:11,代码来源:BayCommands.cs


示例11: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         trigger.Reply(
             "AreaTriggers \n GOs \n Items \n NPCs \n Quests \n SpellsAndEffects \n Vehicles \n use these for the dumptype on the query command!");
     }
     catch (Exception e)
     {
         WriteErrorSystem.WriteError(e);
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:12,代码来源:DumpOperator.cs


示例12: Process

            //~find World.ReSync
            public override void Process(CmdTrigger trigger)
            {
                try
                {
                    trigger.Reply("Hai, I don't work yet! :O");

                }
                catch (Exception e)
                {
                    WriteErrorSystem.WriteError(e);
                }
            }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:13,代码来源:SourceCode.cs


示例13: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         var norris = new StreamWriter("LinusFacts.txt", true) { AutoFlush = false };
         norris.WriteLine(trigger.Args.Remainder);
         trigger.Reply("Added the new Linus Torvalds fact: {0} to storage", trigger.Args.Remainder);
         norris.Close();
     }
     catch (Exception e)
     {
         WriteErrorSystem.WriteError(e);
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:14,代码来源:LinusTorvalds.cs


示例14: Process

 public override void Process(CmdTrigger<IrcCmdArgs> trigger)
 {
     string word = trigger.Text.NextWord();
     string target = trigger.Text.NextWord();
     if (word.Equals("-u"))
     {
         TimeSpan time = TimeSpan.FromSeconds(trigger.Text.NextInt());
         trigger.Args.IrcClient.CommandHandler.Ban(target, time, trigger.Text.RemainingWords());
     }
     else
     {
         trigger.Args.IrcClient.CommandHandler.Ban(target, trigger.Text.RemainingWords());
     }
 }
开发者ID:WCell,项目名称:WCell-UtilityBot,代码行数:14,代码来源:DefaultCommands.cs


示例15: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         using (var norris = new StreamWriter("ChuckNorrisFacts.txt", true))
         {
             norris.WriteLine(trigger.Args.Remainder);
             trigger.Reply("Added the new Chuck Norris fact: {0} to storage", trigger.Args.Remainder);
         }
     }
     catch (Exception e)
     {
         WriteErrorSystem.WriteError(e);
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:15,代码来源:ChuckNorris.cs


示例16: Process

            public override void Process(CmdTrigger trigger)
            {
                try
                {
                    int fahrenheit = Convert.ToInt32(trigger.Args.Remainder.Trim());
                    int celsius = (fahrenheit - 32) * 5 / 9;
                    int kelvin = (fahrenheit + 459) * 5 / 9;

                    trigger.Reply(trigger.Args.Remainder + " Fahrenheit is , " + celsius + "C , " + kelvin + " Kelvin");
                }
                catch (Exception e)
                {
                    trigger.Reply(e.ToString());
                }
            }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:15,代码来源:Temperature.cs


示例17: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         string target = trigger.Target.ToString();
         if (trigger.Args.NextModifiers() == "target")
         {
             target = trigger.Args.NextWord();
         }
         JadBot.Irc.CommandHandler.Describe(target, trigger.Args.Remainder, trigger.Args);
     }
     catch (Exception e)
     {
         trigger.Reply("I cant write that action, perhaps invalid target?");
         trigger.Reply(e.Message);
         WriteErrorSystem.WriteError(e);
     }
 }
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:18,代码来源:FunCommands.cs


示例18: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         string reply = "";
         foreach (var value in TracBackend.GetTicket(trigger.Args.NextInt(1)))
         {
             reply += value;
             reply += "   ";
         }
         reply = reply.Replace("\n", " ");
         reply = reply.Replace("\r", " ");
         trigger.Reply(reply);
     }
     catch (Exception e)
     {
         // Error handling
     }
 }
开发者ID:jaddie,项目名称:WCell-Notifier,代码行数:19,代码来源:trac.cs


示例19: Process

 public override void Process(CmdTrigger trigger)
 {
     try
     {
         string target = trigger.Target.ToString();
         if (trigger.Args.NextModifiers() == "target")
         {
             target = trigger.Args.NextWord();
         }
         if(!string.IsNullOrEmpty(trigger.Args.Remainder))
         trigger.Irc.CommandHandler.Describe(target, trigger.Args.Remainder, trigger.Args);
         else
         trigger.Reply("Empty action");
     }
     catch (Exception e)
     {
         trigger.Reply("I cant write that action, perhaps invalid target?");
         trigger.Reply(e.Message);
         UtilityMethods.Print(e.Message + e.Data + e.StackTrace, true);
     }
 }
开发者ID:jaddie,项目名称:DarkWaterSupportBot,代码行数:21,代码来源:FunCommands.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Srvtools.InfoCommand类代码示例发布时间:2022-05-26
下一篇:
C# Irc.IrcUser类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap