[RequireUserPermission(GuildPermission.ViewAuditLog)] //Admin-Only. public async Task UpdateOnedriveAsync([Remainder] string newOnedriveLink) { dynamic BotConfiguration = JsonConvert.DeserializeObject(System.IO.File.ReadAllText($"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}config.json")); BotConfiguration.OneDriveLink = newOnedriveLink; System.IO.File.WriteAllText($"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}config.json", JsonConvert.SerializeObject(BotConfiguration, Formatting.Indented)); await ReplyAsync("", false, EmbedTool.ChannelMessage("The drive Link has been updated.")); }
public async Task CloseEventAsync() {//Closes the event and delets the Participant JSON and the Event JSON. if (IsEventActive()) { File.Delete($"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}Data{Path.DirectorySeparatorChar}Event.json"); File.Delete($"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}Data{Path.DirectorySeparatorChar}Registration.json"); Directory.Delete($"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}Setups"); await ReplyAsync("", embed : EmbedTool.ChannelMessage("The Event has concluded.")); } }
[RequireUserPermission(GuildPermission.ViewAuditLog)] //Admin-only. public async Task AdminQuoteRemove([Remainder] int QuoteID) { ResyncQuotesList(); for (int i = 0; i < MasterQuoteList.Count; i++) { if (MasterQuoteList[i].QuoteID == QuoteID) { //The Quote ID is located. MasterQuoteList.RemoveAt(i); //Remove the quote from the library. WriteQuoteList(); //Write the list to the JSON. await ReplyAsync("", embed : EmbedTool.ChannelMessage($"Quote {QuoteID.ToString()} removed from the library by a moderator.")); } } }
public async Task JoinEventAsync([Remainder] string NetbattlerName) { SyncParticipantList(); if (IsEventActive()) { //Is the event active? if (GetActiveEvent().RegistrationOpen == true) { //Is registration open? if (IsParticipantRegistered(Context.User.Id) == true) { //The user is already registered. await ReplyAsync("", embed : EmbedTool.CommandError($"You are already registered for the {GetActiveEvent().EventName} event.")); } else { if (VerifyNetbattlerName(NetbattlerName) == true) { //Completing Task 56 //The Netbattler Name the user is attempting to use is already registered. await ReplyAsync("The Netbattler Name you've selected is already in use. Please register with a different name."); } else { //The Netbattler Name is not registered. EventParticipant newParticipant = new EventParticipant(NetbattlerName.Replace('@', ' '), Context.User.Id); ParticipantList.Add(newParticipant); WriteParticipantList(); await ToggleRole(Context.User as IGuildUser, RoleModule.GetRole("Official Netbattler", Context.Guild));//Add the Official Netbattler role to the user. await ReplyAsync("", embed : EmbedTool.ChannelMessage($"You have registered for the event {GetActiveEvent().EventName} sucessfully!")); } } } else //registration is closed. { await ReplyAsync("", embed : EmbedTool.CommandError($"{GetActiveEvent().EventName} is currently not accepting registrations.")); } } else { await ReplyAsync("", embed : EmbedTool.CommandError("There currently isn't an active event.")); } }
public async Task QuoteSpecificAsync([Remainder] uint quoteID) { //1. Update the local list for Quotes. ResyncQuotesList(); //2. Locate the quote. Quote selectedQuote = null; try { selectedQuote = MasterQuoteList.Find(x => x.QuoteID == quoteID); } catch (Exception ex) { await ReplyAsync(ex.Message); throw; } //3. Respond with said quote. if (selectedQuote != null) { if (selectedQuote.QuoteAuthorNickname == null) { await ReplyAsync($"Quote { selectedQuote.QuoteID.ToString()} by Library Export: {selectedQuote.QuoteContents}"); } else { await ReplyAsync($"Quote { selectedQuote.QuoteID.ToString()} by {selectedQuote.QuoteAuthorNickname}: {selectedQuote.QuoteContents}"); } } else { await ReplyAsync("", embed : EmbedTool.ChannelMessage("The quote you specified is not in the library.")); } }
public async Task RemoveQuoteAsync([Remainder] int quoteid) { //1. Pull down the deserialized list. ResyncQuotesList(); //2. Locate the quote in question for verification by enumeration. bool QuoteExists = false; //False by default for (int i = 0; i < MasterQuoteList.Count; i++) { if (MasterQuoteList[i].QuoteID == quoteid) {//The Quote ID is located. QuoteExists = true; if (MasterQuoteList[i].QuoteAuthor == Context.User.Id) { //The requestor is the author of the quote. MasterQuoteList.RemoveAt(i); //Remove the quote from the library. WriteQuoteList(); //Write the list to the JSON. QuoteExists = true; //Quote was found and deleted. } else //The requestor is not the author of the quote. { await ReplyAsync("", embed : EmbedTool.ChannelMessage("You are not the author of the quote.")); } } } //3. Respond based on what was or wasn't found. if (QuoteExists == false) { await ReplyAsync("", embed : EmbedTool.ChannelMessage("The quote does not exist in the library.")); } else { await ReplyAsync("", embed : EmbedTool.ChannelMessage($"Quote {quoteid.ToString()} removed from the library.")); } }
public async Task DropEventAsync() { SyncParticipantList(); if (IsEventActive()) { //We don't need to check for open registration to drop. var caller = Context.User as IGuildUser; if (IsParticipantRegistered(Context.User.Id) == true) {//The user is already registered. ParticipantList.Remove(GetParticipant(caller)); WriteParticipantList(); await ToggleRole(Context.User as IGuildUser, RoleModule.GetRole("Official Netbattler", Context.Guild)); //Remove the Official Netbattler role. await ReplyAsync("", embed : EmbedTool.ChannelMessage($"You have dropped from {GetActiveEvent().EventName}")); } else { await ReplyAsync("", embed : EmbedTool.CommandError($"You are not registered for the {GetActiveEvent().EventName} event.")); } } else { await ReplyAsync("", embed : EmbedTool.CommandError("There currently isn't an active event.")); } }
public async Task OneDriveAsync() { dynamic BotConfiguration = JsonConvert.DeserializeObject(System.IO.File.ReadAllText($"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}config.json")); await ReplyAsync("", false, EmbedTool.ChannelMessage($"This folder contains all of the saves, patches, and extra info you will need to netbattle.\n<{BotConfiguration.DriveLink}>")); }
public async Task LegacyGuides() { await ReplyAsync("", false, EmbedTool.ChannelMessage("Complete guide for how to play BBN3 and other pre-BN6 games online!\n<http://legacy.n1gp.net/>")); }