static void Main(string[] args) { Bot = new TelegramBot.TelegramBot(Settings.APIKEY); #region DEBUG if (false) { User host = new DebugUser { First_Name = "Debug", Last_Name = "Sander", Username = "******", ID = DebugUser.GetNextID() }; UserManager.Instance.GetValue(ref host); GameRegistry.HostGame(host); for (int i = 0; i < 8; i++) { User user = new DebugUser { First_Name = "Debug", Last_Name = "test" + i, Username = "******" + i, ID = DebugUser.GetNextID() }; UserManager.Instance.GetValue(ref user); GameRegistry.JoinGame(host, user); } } #endregion GameRegistry.bot = Bot; var admin = new User { First_Name = "Sander", Last_Name = "van 't Einde", ID = 8225698, Username = "******" }; Bot.Admins.Add(UserManager.Instance.GetValue(ref admin)); Bot.MessageHandler.RegisterMessageHandler( new HostMessageHandler(), new JoinMessageHandler(), new UnknownMessageHandler(), new ViewPlayersMessageHandler(), new LeaveMessageHandler(), new StartMessageHandler(), new RequestMembershipMessageHandler() ); Bot.Start(); }
private static void Login(string[] args) { if (args?.Length == 0) { bot.PrintError("No parameters given"); return; } var user = string.Join(" ", args); var exist = UserManager.Instance.GetUserByUsername("_" + user); if (exist == null) { exist = new DebugUser { First_Name = "Debug", Last_Name = user, Username = "******" + user, ID = DebugUser.GetNextID() }; UserManager.Instance.GetValue(ref exist); } loggedIn = exist; bot.PrintSuccess($"{exist} logged in."); }