public void BuyIfLowerThan(ListingInfo listing, float wear) { Bot.RequestFloat(listing.InspectLink, v => { ReplyReceived = true; if (v <= wear) { Bot.BuyMarketItem(listing); SendChatMessage("Bought listing " + listing.InternalId + ", Float: " + v); Log.Success("Bought listing " + listing.InternalId + ", Float: " + v); } else { Log.Warn("Didn't buy " + listing.Name + ", Float too high: " + v); } }); }
public void OnMessageHandler(string message, EChatEntryType type) { _lastMessageWasFromTrade = false; if (!HandleWaitingOnUserResponse(message)) { if (message[0] == '/') { string command = message.Substring(1); string commandName = command.Split(' ')[0]; string[] commandArgs = new string[0]; if (command.Contains(" ")) { commandArgs = command.Split(' ').Skip(1).ToArray(); } switch (commandName) { case "dummy": ChatCommand dummyCommand = new ChatCommand(2); Log.Success("Dummycall successful!"); dummyCommand.Parse(message); foreach (var s in dummyCommand.GetArguments()) { Log.Success(s); } break; case "comment": try { string comment_id = commandArgs[0]; SteamID comment_steamId = new SteamID((ulong.Parse(comment_id))); string comment_message = commandArgs[1]; var success = PostProfileComment(comment_steamId, comment_message); if (success == HttpStatusCode.OK) { SendReplyMessage("Posted comment \"" + comment_message + "\" on " + comment_steamId.ToString() + "'s profile."); } else { SendReplyMessage("Commandexecution failed. Statuscode: " + success); } } catch (Exception e) { SendReplyMessage("Command execution failed. Command requires (string)steamid (string)message."); } break; case "game": ChatCommand gameCommand = new ChatCommand(1); gameCommand.Parse(message); string game_arg = gameCommand.GetArgument(0); if (game_arg == "stop") { Bot.SetGamePlaying(0); SendReplyMessage("Stopped game simulation"); } else { try { Bot.SetGamePlaying(int.Parse(game_arg)); SendReplyMessage("Started simulating gameplay of " + game_arg); } catch (Exception e) { SendReplyMessage(e.ToString()); } } break; default: SendReplyMessage("Command execution failed. Command not found."); break; } } else if (message.Contains("+csgo_econ_action_preview")) { Bot.RequestFloat(message, PrintFloat); } OnMessage(message, type); } }