static void Main(string[] args) { try { var tb = new TokenBucket(); RedditBot bot = new RedditBot("wow", "i'm cool", tb); var username = ConfigurationManager.AppSettings["redditUsername"]; var password = ConfigurationManager.AppSettings["redditPassword"]; var clientId = ConfigurationManager.AppSettings["clientId"]; var clientSecret = ConfigurationManager.AppSettings["clientSecret"]; bot.Authenticate(username, password, clientId, clientSecret); while (true) { bot.MakeRequest("sandboxtest", 9); System.Threading.Thread.Sleep(10000); } bot.DisposeClient(); } catch (MissingArgument ex) { Console.WriteLine($"{ex.Message}"); } catch (IncorrectLogin ex) { Console.WriteLine($"{ex.Message}"); } catch (NoSubreddit ex) { Console.WriteLine($"{ex.Message}"); } catch (OutOfTokensExceptions ex) { Console.WriteLine($"{ex.Message}"); } finally { Console.ReadKey(); } }
public RedditBot(string name, string description, TokenBucket tb) { _name = name; _description = description; _tb = tb; }