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

C# IBot类代码示例

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

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



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

示例1: Handle

 public bool Handle(ChatMessage message, IBot bot)
 {
     try
     {
         using (var _database = new TwitterNotifierSprocketRepository())
         {
             _database.RecordActivity(message.FromUser);
             InviteUserIfNeccessary(message.FromUser, bot, _database);
             var twitterUsers = GetUserNamesFromMessage(message.Content, _database);
             var user = _database.FetchOrCreateUser(message.FromUser);
             if (twitterUsers.Count() > 0)
             {
                 foreach (var u in twitterUsers)
                 {
                     if (ShouldNotifyUser(u.ScreenName, _database))
                     {
                         NotifyUserOnTwitter(message, user, u);
                         _database.MarkUserNotified(u.ScreenName);
                     }
                 }
                 return true;
             }
         }
     }
     catch (Exception e)
     {
         bot.PrivateReply(message.FromUser, e.GetBaseException().Message);
     }
     return false;
 }
开发者ID:sethwebster,项目名称:Jabbot.TwitterNotifierSprocket,代码行数:30,代码来源:TwitterNotifierSprocket.cs


示例2: CheckForkStatus

 private static void CheckForkStatus(KeyValuePair<dynamic, dynamic> fork, IDictionary<string, string> existingForkStatus, IBot bot)
 {
     string id = fork.Key.ToString();
     string url = fork.Value.ToString() + "/commits";
     var commits = url.GetResponse<IEnumerable<dynamic>>().ToList();
     bot.ProcessForkStatus(id, existingForkStatus, commits);
 }
开发者ID:NickJosevski,项目名称:jibbr,代码行数:7,代码来源:ForksTask.cs


示例3: Run

		/// <summary>Runs the bot.</summary>
		public static void Run(IBot bot)
		{
			using (var platform = new ConsolePlatform())
			{
				platform.DoRun(bot);
			}
		}
开发者ID:Corniel,项目名称:AIGames.UltimateTicTacToe.StarterBot,代码行数:8,代码来源:ConsolePlatform.cs


示例4: Decorator

        public Sequence this[IBot.IBot bot]
        {
            get
            {
                var seq = new Sequence(

                    new Decorator(ret => bot.isRunning, new TreeSharp.Action(ret => RunStatus.Success)),
                    
                    //first we must have a valid target
                    new Decorator(ret => Util.Targeting.HasValidTarget(bot.CurrentTarget), new TreeSharp.Action(ret => RunStatus.Success)),

                    //if we are already busy, don't continue.
                    new Decorator(ret => !bot.isInAction, new TreeSharp.Action(ret => RunStatus.Success)),


                    //send the attack action.
                    new TreeSharp.Action(ret =>
                    {
                        bot.Attack(bot.CurrentTarget);
                    }),

                    //wait for the action to complete (or we time out).
                    new Wait(1, ret => bot.isInAction, new TreeSharp.Action(ret => RunStatus.Success))
            );

                return seq;

            }

        }
开发者ID:InjectionDev,项目名称:Dev.D3,代码行数:30,代码来源:AttackTargetDecorator.cs


示例5: FunkyBotStop

        // When the bot stops, output a final item-stats report so it is as up-to-date as can be
        private void FunkyBotStop(IBot bot)
        {
            // Issue final reports
            OutputReport();

            PlayerMover.iTotalAntiStuckAttempts = 1;
            PlayerMover.vSafeMovementLocation = Vector3.Zero;
            PlayerMover.vOldPosition = Vector3.Zero;
            PlayerMover.iTimesReachedStuckPoint = 0;
            PlayerMover.timeLastRecordedPosition = DateTime.Today;
            PlayerMover.timeStartedUnstuckMeasure = DateTime.Today;
            hashUseOnceID = new HashSet<int>();
            dictUseOnceID = new Dictionary<int, int>();
            dictRandomID = new Dictionary<int, int>();
                Bot.Stats.iMaxDeathsAllowed=0;
                Bot.Stats.iDeathsThisRun=0;
                initTreeHooks=false;
            //Total Stats
                Bot.BotStatistics.ItemStats.Update();
                Bot.BotStatistics.GameStats.Update();
                Bot.BotStatistics.ProfileStats.OutputReport();

                RemoveHandlers();
                ResetTreehooks();
        }
开发者ID:NEVEROYATNII,项目名称:Funky,代码行数:26,代码来源:OnBotStop.cs


示例6: DoRun

		/// <summary>Runs it all.</summary>
		public void DoRun(IBot bot, IEnumerable<IInstruction> instructions)
		{
			if (bot == null) { throw new ArgumentNullException("bot"); }
			if (instructions == null) { throw new ArgumentNullException("instructions"); }

			var settings = new Settings();
			var state = new GameState();

			foreach (var instruction in instructions)
			{
				if (settings.Apply(instruction))
				{
					bot.ApplySettings(settings);
				}
				else if (state.Apply(instruction)) { }
				else if (instruction is RequestMoveInstruction)
				{
					bot.Update(state);
					try
					{
						var response = bot.GetResponse(((RequestMoveInstruction)instruction).Time);
						Writer.WriteLine(response.Move);
						if (!String.IsNullOrEmpty(response.Log))
						{
							Logger.WriteLine(response.Log);
						}
					}
					catch (Exception x)
					{
						Writer.WriteLine(new MoveInstruction(Move.Center));
						Logger.WriteLine(x);
					}
				}
			}
		}
开发者ID:Corniel,项目名称:AIGames.UltimateTicTacToe.StarterBot,代码行数:36,代码来源:ConsolePlatform.cs


示例7: Command

    public new IProcessingResult Command(IBot bot, IProcessingResult pr, IChatMessage msg, string cmd, string arg, string cmdOriginal, string argOriginal)
    {
        switch (cmd)
        {
            default: return pr;

            // core commands

            case "about": return About(bot, pr, arg);
            case "help": return Help(bot, pr, arg);
            case "commands": return GetCommandList(bot, pr, arg);
            case "uptime": return Uptime(bot, pr);
            case "modules": return Modules(bot, pr);

            case "edit": return Edit(pr, bot, msg, arg);
            case "unonebox":
            case "unbox": return Unonebox(pr, bot, msg, arg);
            case "undo": return Undo(bot, pr, arg);

            case "status": return Status(bot, pr);

            case "trust": return TrustedUsers(bot, pr, arg);
            case "ignore": return BannedUsers(bot, pr, arg);

            case "say": return Say(pr, arg);
            case "tell": return Tell(pr, arg);

            case "alias": return Alias(pr, bot, msg, arg);

            case "save": return Save(bot, pr, msg.UserID);
            case "shutdown": return Shutdown(bot, pr, arg, msg.UserID);


            // hoihoi-san borrowed

            case "google": return Google(pr, msg, arg);
            case "wiki": return Wiki(pr, msg, arg);
            case "urban": return Urban(pr, msg, arg);
            case "youtube": return Youtube(pr, msg, arg);
            case "weather": return Weather(pr, msg, arg);


            // advanfaged

            case "id": return ID(bot, pr, msg, arg);
            case "isch": return Isch(bot, pr, msg, arg);

            case "whois":
            case "what":
            case "last": return LastPostedImageID(bot, pr, msg, arg);


            // bonus

            case "hats": return Hats(pr);
            case "meme": return Meme(bot, pr, msg, arg);

        }
    }
开发者ID:iansaviour,项目名称:SE-chat-bot-app-3,代码行数:59,代码来源:CoreCommands.cs


示例8: ASubBot

 public ASubBot(IBot bot)
 {
     this.InitializeComponent();
     this.bot = bot;
     this.updateTimer = new System.Timers.Timer();
     updateTimer.Elapsed += delegate {
         onTick(); };
 }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:8,代码来源:ASubBot.cs


示例9: Loaded

 public void Loaded(IPlugin plugin, IBot bot)
 {
     foreach(AliasData alias in Aliases)
     {
         IExpression aliasExpression = Parse(bot.Command, alias.Expression);
         Add(bot.Command, plugin, alias, aliasExpression, false);
     }
 }
开发者ID:Gohla,项目名称:Veda-plugins,代码行数:8,代码来源:AliasPlugin.cs


示例10: GetAllUsersInSameRoomsAsJibber

 private static IEnumerable<string> GetAllUsersInSameRoomsAsJibber(IBot bot)
 {
     var rooms = GetRooms(bot);
     var users = rooms.SelectMany<dynamic, dynamic>(r => r.Users);
     var userNames = users.Select(u => u.Name);
     var distinctUserNames = userNames.Distinct().Cast<string>();
     return distinctUserNames;
 }
开发者ID:jimmyp,项目名称:jibbr,代码行数:8,代码来源:VoicemailRecorder.cs


示例11: Player

        //: base(bot, id, name, smiley, xPos, yPos, isGod, isMod, hasChat, coins, purple, isFriend, level)
        public Player(IBot bot, int id, string name, int smiley, double xPos, double yPos, bool isGod, bool isMod, bool hasChat, int coins, bool purple, bool isFriend, int level)
        {
            this.id = id;
            this.bot = bot;

            physicsPlayer = new PhysicsPlayer(bot, id, name, smiley, xPos, yPos, isGod, isMod, hasChat, coins, purple, isFriend, level);
            afkStopwatch.Start();
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:9,代码来源:Player.cs


示例12: FunkyBotStart

 private void FunkyBotStart(IBot bot)
 {
     if (!ErrorClickerThread.ThreadState.HasFlag(ThreadState.Running))
         {
              ErrorClickerThread.Start();
              DBLog.Info("[Funky] Error Clicking Thread Started.");
         }
 }
开发者ID:BUFORD,项目名称:Funky,代码行数:8,代码来源:Plugin.cs


示例13: BlockMap

 public BlockMap(IBot bot, int width = 0, int height = 0)
 {
     backgroundMap = new Stack<IBlock>[width + 1, height + 1];
     foregroundMap = new Stack<IBlock>[width + 1, height + 1];
     currentForegroundMap = new int[width + 1, height + 1];
     this.width = width;
     this.height = height;
     Reset();
 }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:9,代码来源:BlockMap.cs


示例14: FurnitureManager

        public FurnitureManager(IBot bot)
        {
            this.bot = bot;

            furnitureTypes.Add("door", new FurnitureDoor(0, 0));
            furnitureTypes.Add("switch", new FurnitureSwitch(0, 0));
            furnitureTypes.Add("switchdoor", new FurnitureSwitchDoor(0, 0));
            furnitureTypes.Add("empty", new FurnitureEmpty(0, 0));
            furnitureTypes.Add("spawn", new FurnitureSpawn(0, 0));
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:10,代码来源:FurnitureManager.cs


示例15: Minimap

 public Minimap(IBot bot, int width, int height)
     : base(bot)
 {
     this.bot = bot;
     this.width = width;
     this.height = height;
     this.bitmap = new Bitmap(width, height);
     updateThread = new SafeThread(UpdateMinimap);
     updateThread.Start();
 }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:10,代码来源:Minimap.cs


示例16: HouseBuilding

        public HouseBuilding(IBot bot)
            : base(bot)
        {
            this.furnitureManager = new FurnitureManager(bot);
            this.houseManager = new HouseManager(bot);

            HouseType tinyHouse = new HouseType("tinyhouse", 7, 7, 46, 48, 541);
            tinyHouse.AddCost("stone", 25);
            HouseType smallHouse = new HouseType("smallhouse", 9, 9, 93, 93);
            smallHouse.AddCost("stone", 100);
            HouseType mediumHouse = new HouseType("mediumhouse", 11, 11, 1023, 1024);
            mediumHouse.AddCost("stone", 400);
            mediumHouse.AddCost("copper", 20);
            HouseType largeHouse = new HouseType("largehouse", 13, 13, 14, 1018, 505);
            largeHouse.AddCost("stone", 600);
            largeHouse.AddCost("iron", 30);
            HouseType veryLargeHouse = new HouseType("verylargehouse", 15, 15, 1021, 42);
            veryLargeHouse.AddCost("stone", 800);
            veryLargeHouse.AddCost("gold", 50);
            HouseType hugeHouse = new HouseType("hugehouse", 17, 17, 196, 195, 618);
            hugeHouse.AddCost("stone", 1000);
            hugeHouse.AddCost("copper", 50);
            hugeHouse.AddCost("iron", 50);
            hugeHouse.AddCost("gold", 50);

            HouseType weirdHouse = new HouseType("weirdhouse", 17, 5, 80, 82, 548);
            weirdHouse.AddCost("stone", 400);
            HouseType strangeHouse = new HouseType("strangehouse", 3, 15, 50, 156, 575);
            strangeHouse.AddCost("stone", 300);
            HouseType candyHouse = new HouseType("candyhouse", 11, 11, 67, 60, 539);
            candyHouse.AddCost("stone", 400);
            candyHouse.AddCost("copper", 50);
            HouseType basicHouse = new HouseType("basichouse", 11, 11, 9, 10, 501);
            basicHouse.AddCost("stone", 400);
            HouseType brickHouse = new HouseType("brickhouse", 11, 11, 1024, 1023, 647);
            brickHouse.AddCost("stone", 400);
            HouseType coinHouse = new HouseType("coinhouse", 5, 5, 41, 100, 581);
            coinHouse.AddCost("stone", 400);

            this.houseManager.RegisterHouseType(tinyHouse);
            this.houseManager.RegisterHouseType(smallHouse);
            this.houseManager.RegisterHouseType(mediumHouse);
            this.houseManager.RegisterHouseType(largeHouse);
            this.houseManager.RegisterHouseType(veryLargeHouse);
            this.houseManager.RegisterHouseType(hugeHouse);

            this.houseManager.RegisterHouseType(weirdHouse);
            this.houseManager.RegisterHouseType(strangeHouse);
            this.houseManager.RegisterHouseType(candyHouse);
            this.houseManager.RegisterHouseType(basicHouse);
            this.houseManager.RegisterHouseType(brickHouse);
            this.houseManager.RegisterHouseType(coinHouse);

            EnableTick(5000);
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:55,代码来源:HouseBuilding.cs


示例17: ModuleService

        public ModuleService(IBot bot)
        {
            this.bot = bot;

            this.storageCatalog = new AzureStorageCatalog(string.Empty, string.Empty);
            this.aggregateCatalog = new AggregateCatalog(this.storageCatalog);
            this.moduleContainer = new CompositionContainer(this.aggregateCatalog);

            this.moduleContainer.ExportsChanged += this.ModuleContainerOnExportsChanged;
            this.storageCatalog.Changed += this.StorageCatalogOnChanged;
        }
开发者ID:pjmagee,项目名称:NazureBot,代码行数:11,代码来源:ModuleService.cs


示例18: ExecuteTask

        public void ExecuteTask(IBot bot, string baseUrl, string repositoryName)
        {
            var url = baseUrl.Append(ProjectWatchersFeed);
            var currentWatchers = url.GetResponse<IEnumerable<dynamic>>();
            var existingWatchers = _settings.GetValue<IList<string>>(WatchersKey, () => new List<string>());

            existingWatchers = bot.ProcessWatchers(repositoryName, existingWatchers, currentWatchers);

            _settings.Set(WatchersKey, existingWatchers);
            _settings.Save();
        }
开发者ID:NickJosevski,项目名称:jibbr,代码行数:11,代码来源:WatchersTask.cs


示例19: Loaded

        public void Loaded(IPlugin plugin, IBot bot)
        {
            foreach(MessageParserData data in Data)
            {
                Regex regex = ParseRegex(data.Pattern);
                IExpression expression = ParseExpression(bot.Command, data.Expression);
                Add(data, regex, expression, false);
            }

            _messageDisposable = bot.Messages.Subscribe(ParseMessage);
        }
开发者ID:Gohla,项目名称:Veda-plugins,代码行数:11,代码来源:MessageParserPlugin.cs


示例20: DoRun

		/// <summary>Runs it all.</summary>
		public void DoRun(IBot bot)
		{
			if (bot == null) { throw new ArgumentNullException("bot"); }

			var settings = new Settings();
			var match = new GameState(settings);

			string line;
			while ((line = this.Reader.ReadLine()) != null)
			{
#if !DEBUG
				try
				{
#endif
				var instruction = Instruction.Parse(line);

				switch (instruction.InstructionType)
				{
					case InstructionType.Player:
						match.UpdatePlayer(instruction);
						HandleOpponentReaction(bot, match, instruction);
						if (match.Result != RoundResult.NoResult)
						{
							bot.Result(match);
						}
						break;
					case InstructionType.Match: match.UpdateMatch(instruction); break;

					case InstructionType.Settings:
						settings.Update(instruction);
						match.Update(settings);
						break;

					case InstructionType.Action:
						match.UpdateAction(instruction);
						var action = bot.Action(match);
						Writer.WriteLine(action);
						break;

					case InstructionType.None:
					case InstructionType.Output:
					default:
						break;
				}
#if !DEBUG
				}
				catch (Exception x)
				{
					Console.Error.WriteLine(line);
					Console.Error.WriteLine(x);
				}
#endif
			}
		}
开发者ID:Webliezz,项目名称:AIGames.HeadsUpOmaha,代码行数:55,代码来源:ConsolePlatform.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IBraceCompletionSession类代码示例发布时间:2022-05-24
下一篇:
C# IBootstrap类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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