private void HandleBotUpdates(BotInterface bot) { List <UpdateMessage> updates = bot.GetUpdates(); foreach (UpdateMessage update in updates) { bot.HandleUpdate(update); } }
public void Start(BotInterface bot) { Task.Run(() => { while (true) { HandleBotUpdates(bot); } }, cancellation_token_source.Token); }
public static void OnGiveDuellistCommand(string id) { if (BotInterface.GiveDuellist(id).GetAwaiter().GetResult()) { Logger.Success("'" + id + "' should got its duellist rank!"); } else { Logger.Fatal("An error occurred while performing this command, because a failure was returned from the bot!"); } }
/// <summary> /// Toggle The Bot InterFace /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { if (BotInterface == null) { if (Client.Roles.Role == ClientRoles.Roles.IsBasher) { BotInterface = new BasherScript(); } else if (Client.Roles.Role == ClientRoles.Roles.IsCaster) { BotInterface = new CasterScript(); } //TODO: Add more scripts based on Role. else if (Client.Roles.Role == ClientRoles.Roles.NonSet) { if (!Client.RolesForm.Visible) { Client.RolesForm.Socket = Socket; Invoke(new MethodInvoker(Client.RolesForm.Show)); } else { Invoke(new MethodInvoker(Client.RolesForm.Hide)); } } if (BotInterface != null) { BotInterface.BaseForm = BaseForm; BotInterface.ClientSerial = ClientSerial; BotInterface.Proxy = Proxy; BotInterface.Socket = Socket; BotInterface.Start(); this.button1.Text = "Stop"; } } else { BotInterface.Stop(); BotInterface = null; this.button1.Text = "Start"; } }
private void OnDiscordVerified(string userID) { User user = UserController.GetUser(userID); BotInterface.GiveDuellist(user.DiscordID).GetAwaiter().GetResult(); }