Help for a beginner

I'm trying to implement a command for a Steam Trading bot to decline trades by those marked as a scammer on the website SteamRep. It is difficult to test whether or not it is working because I need the help of someone who the bot won't trade with. Full disclosure, I am a beginner at C# and programming in general, but I am reading a lot and learning by trial and error. I am not asking anything to be done for me, I promise.

Can anyone find fault with this code, since I can't exactly test it? I have pointed out the lines I'm most concerned with.

 public override bool OnTradeRequest() { Bot.log.Success(Bot.SteamFriends.GetFriendPersonaName(OtherSID) + " (" + OtherSID.ToString() + ") has requested to trade with me!"); if (Bot.SteamFriends.GetPersonaState ().Equals (EPersonaState.Busy)) { Bot.log.Error ("Declined trade, I am already trading with someone else!"); Bot.SteamFriends.SendChatMessage (OtherSID, EChatEntryType.ChatMsg, "I am already in a trade! Please be patient! :)"); return false; } 

The next 5 lines are the ones I'm most concerned about:

 else { return SteamRep.isMarked(OtherSID.Render()); { if (SteamRep.isMarked) { Bot.log.Error ("Declined trade, user is marked as a scammer on SteamRep."); Bot.SteamFriends.SendChatMessage (OtherSID, EChatEntryType.ChatMsg, "I'm sorry, it looks like you are marked as a scammer on SteamRep. Per TF2 Outpost rules, I cannot trade with you. Nothing personal! If this is an error, please appeal on SteamRep. Thank you!"); return false; } else { Bot.log.Success("Accepted trade!"); return true; } } } } 

It uses SteamRep.cs:

using System.IO; using System.Net; using System; namespace SteamBot { public class SteamRep { public bool isMarked(string steamId32) { // Create the SteamRep API address with the SteamID32. string api = ";; string url = string.Format (api, steamId32); // Fetch the result of the endpoint as a string. WebClient client = new WebClient (); string result = client.DownloadString (url); // Check for the string "SCAMMER" in the result. return (result.IndexOf ("SCAMMER") > -1); } } } 

by ThereWasADream via /r/csharp

Leave a Reply