本文整理汇总了C#中IBot类的典型用法代码示例。如果您正苦于以下问题:C# IBot类的具体用法?C# IBot怎么用?C# IBot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IBot类属于命名空间,在下文中一共展示了IBot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例3: Run
/// <summary>Runs the bot.</summary>
public static void Run(IBot bot)
{
using (var platform = new ConsolePlatform())
{
platform.DoRun(bot);
}
}
示例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;
}
}
示例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();
}
示例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);
}
}
}
}
示例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);
}
}
示例8: ASubBot
public ASubBot(IBot bot)
{
this.InitializeComponent();
this.bot = bot;
this.updateTimer = new System.Timers.Timer();
updateTimer.Elapsed += delegate {
onTick(); };
}
示例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);
}
}
示例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;
}
示例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();
}
示例12: FunkyBotStart
private void FunkyBotStart(IBot bot)
{
if (!ErrorClickerThread.ThreadState.HasFlag(ThreadState.Running))
{
ErrorClickerThread.Start();
DBLog.Info("[Funky] Error Clicking Thread Started.");
}
}
示例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();
}
示例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));
}
示例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();
}