public static async Task ContentCheck(SocialLinkerCommand command) { // If there is a cooldown session active for the command type "status", return the method immediately. if (await UserCooldownMethods.IsCooldownActive(command, "status") == true) { return; } // Get the account information of the command's user. var command_user_account = UserInfoClasses.GetAccount(command.User); // Check if the user's account has been activated. If not, send them to the initial usage setup menu. if (command_user_account.Account_Activated == "No") { await First_Use_Content_Filter_Menu.First_Use_Content_Filter_Start((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } // End of initial usage and cooldown checks. Status status_object = new Status(); switch (command.CommandType) { case "Slash": switch (command.CommandName) { case "status": await status_object.StatusScreen(command); break; case "status_text": break; } break; case "Context": if (command.Message.Content.ToLower().Contains("detail")) { await status_object.StatusDetails(command); } else { await status_object.StatusScreen(command); } break; } }
public static async Task MakerCommandParser(SocialLinkerCommand sl_command) { // If there is a cooldown session active for the command type "scene", return the method immediately. if (await UserCooldownMethods.IsCooldownActive(sl_command, "scene") == true) { return; } // Get the account information of the command's user. var command_user_account = UserInfoClasses.GetAccount(sl_command.User); // Check if the user's account has been activated. If not, send them to the initial usage setup menu. if (command_user_account.Account_Activated == "No") { await First_Use_Content_Filter_Menu.First_Use_Content_Filter_Start((SocketTextChannel)sl_command.Channel, (SocketGuildUser)sl_command.User); return; } // End of initial usage and cooldown checks. await CommandParser.Type_Directory(sl_command); }
public static async Task SlapCommand(SocialLinkerCommand command) { // If there is a cooldown session active for the command type "social", return the method immediately. if (await UserCooldownMethods.IsCooldownActive(command, "social") == true) { return; } // Get the account information of the command's user. var command_user_account = UserInfoClasses.GetAccount(command.User); // Check if the user's account has been activated. If not, send them to the initial usage setup menu. if (command_user_account.Account_Activated == "No") { await First_Use_Content_Filter_Menu.First_Use_Content_Filter_Start((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } // End of initial usage and cooldown checks. //Establish variables for both the user of the command and the user who is pinged SocketUser commandTarget = null; SocketUser commandUser = null; //Retreive the first mentioned user of the message if there is one var mentionedUser = command.Message.MentionedUsers.FirstOrDefault(); //If a mentioned user exists, assign them to commandTarget. If not, set commandTarget to the command user. commandTarget = mentionedUser ?? command.User; commandUser = command.User; //Check if the mentioned user is null. If so, send an error-tutorial message. if (mentionedUser == null) { SlapError(command.Message); return; } //If the mentioned user is the command user, send a special message and return else if (mentionedUser == commandUser) { SlapSelf(command.Message); return; } //If the mentioned user is the bot itself, send a special message and return else if (mentionedUser.Id == BotConfig.bot.id) { SlapBot(command.Message); return; } //If the previous conditions are false, get the command user's account information var account = UserInfoClasses.GetAccount(commandTarget); //If a user is mentioned and they're not the command user and not a bot, add Expression to both users if ((mentionedUser != null) && (mentionedUser != command.User) && (mentionedUser.IsBot == false)) { Core.LevelSystem.SocialStats.AddExpression(command.Message, commandUser); Core.LevelSystem.SocialStats.AddExpression(command.Message, commandTarget); } //Send a slap message to the mentioned user SlapUser(command.Message, commandTarget); await Task.CompletedTask; }
public async Task StartThemeMenu(SocialLinkerCommand command) { // If there is a cooldown session active for the command type "menu", return the method immediately. if (await UserCooldownMethods.IsCooldownActive(command, "menu") == true) { return; } // Create two variables to check if there is a menu list entry with either the current channel ID or current user ID. var channelSearch = Global.MenuIdList.SingleOrDefault(x => x.MenuMessage.Channel.Id == command.Channel.Id); var userSearch = Global.MenuIdList.SingleOrDefault(x => x.User.Id == command.User.Id); // If the channel entry exists and the user is not the same, send an error message. if (channelSearch != null && channelSearch.User.Id != command.User.Id) { // Case 1: Search by channel successful, user ID does not match. Create new entry for new user. // Create a new menu in the current channel. await SetFirstTheme_Menu.SetFirstThemeMain((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } // Else, if the channel entry exists and the user is the same, assume they want to reset the menu and delete the previous entry. else if (channelSearch != null && channelSearch.User.Id == command.User.Id) { // Case 2: Search by channel successful, user ID matches. Resetting menu in same channel. // Attempt deleting the message if it hasn't been deleted by the user yet. try { // Delete the currently active menu. await channelSearch.MenuMessage.DeleteAsync(); } catch (Exception ex) { Console.WriteLine(ex); } // Stop the timeout timer associated with the menu. channelSearch.MenuTimer.Stop(); // Remove the menu entry from the global list. Global.MenuIdList.Remove(channelSearch); // Create a new menu in the current channel. await SetFirstTheme_Menu.SetFirstThemeMain((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } // Else, if an entry exists where the user is found but they're in a different channel now, delete previous entry and reset the menu. else if (userSearch != null && userSearch.MenuMessage.Channel.Id != command.Channel.Id) { // Case 3: Search by user successful, channel ID does not match. Resetting menu in new channel. // Attempt deleting the message if it hasn't been deleted by the user yet. try { // Delete the currently active menu. await userSearch.MenuMessage.DeleteAsync(); } catch (Exception ex) { Console.WriteLine(ex); } // Stop the timeout timer associated with the menu. userSearch.MenuTimer.Stop(); // Remove the menu entry from the global list. Global.MenuIdList.Remove(userSearch); // Create a new menu in the current channel. await SetFirstTheme_Menu.SetFirstThemeMain((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } // For any other condition (if one should exist and not be handled here), create a new menu entry. else { // Case 4: No previous entry found. Create new entry. // Create a new menu in the current channel. await SetFirstTheme_Menu.SetFirstThemeMain((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } }
public static async Task StartShop(SocialLinkerCommand command) { // If there is a cooldown session active for the command type "menu", return the method immediately. if (await UserCooldownMethods.IsCooldownActive(command, "menu") == true) { return; } // Get the account information of the command's user. var command_user_account = UserInfoClasses.GetAccount(command.User); // Check if the user's account has been activated. If not, send them to the initial usage setup menu. if (command_user_account.Account_Activated == "No") { await First_Use_Content_Filter_Menu.First_Use_Content_Filter_Start((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } // End of initial usage and cooldown checks. // Check if there is a menu list entry with the current channel ID. var channelSearch = Global.MenuIdList.SingleOrDefault(x => x.MenuMessage.Channel.Id == command.Channel.Id); var userSearch = Global.MenuIdList.SingleOrDefault(x => x.User.Id == command.User.Id); // Also check if there is an item tracker entry for the current user ID. This should not exist without a menu entry, so you don't need to check for its validity. var itemSearch = Global.ItemIdList.SingleOrDefault(x => x.User.Id == command.User.Id); // If the entry exists and the user is not the same, send an error message if (channelSearch != null && channelSearch.User.Id != command.User.Id) { // await Context.Channel.SendMessageAsync("Case 1: Search by channel successful, user ID does not match. Create new entry for new user."); // Create a new menu in the current channel await ShopMenu.ShopStart((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } // Else if the entry exists and the user is the same, assume they want to reset the menu and delete the previous entry. else if (channelSearch != null && channelSearch.User.Id == command.User.Id) { // await Context.Channel.SendMessageAsync("Case 2: Search by channel successful, user ID matches. Resetting menu in same channel."); // Attempt deleting the message if it hasn't been deleted by the user yet try { // Delete the currently active menu await channelSearch.MenuMessage.DeleteAsync(); } catch (Exception ex) { Console.WriteLine(ex); } // Stop the timeout timer associated with the menu channelSearch.MenuTimer.Stop(); // Remove the menu entry from the global list Global.MenuIdList.Remove(channelSearch); // Remove the item tracker entry from the global list Global.ItemIdList.Remove(itemSearch); // Create a new menu in the current channel await ShopMenu.ShopStart((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } // Else if an entry exists where the user is found but they're in a different channel now, delete previous entry and reset the menu. else if (userSearch != null && userSearch.MenuMessage.Channel.Id != command.Channel.Id) { // await Context.Channel.SendMessageAsync("Case 3: Search by user successful, channel ID does not match. Resetting menu in new channel."); // Attempt deleting the message if it hasn't been deleted by the user yet. try { // Delete the currently active menu await userSearch.MenuMessage.DeleteAsync(); } catch (Exception ex) { Console.WriteLine(ex); } // Stop the timeout timer associated with the menu userSearch.MenuTimer.Stop(); // Remove the menu entry from the global list Global.MenuIdList.Remove(userSearch); // Remove the item tracker entry from the global list Global.ItemIdList.Remove(itemSearch); // Create a new menu in the current channel await ShopMenu.ShopStart((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } // For any other condition (if one should exist and not be handled here), create new entry else { // await Context.Channel.SendMessageAsync("Case 4: No previous entry found. Create new entry."); // Create a new menu in the current channel await ShopMenu.ShopStart((SocketTextChannel)command.Channel, (SocketGuildUser)command.User); return; } }