///// <summary> ///// Enables the NewMoon module. ///// </summary> ///// <returns></returns> //[Command("newmoon open")] //public async Task EnableNewMoonAsync() //{ // if (IsEventOrganizer(Context.User as IGuildUser, Context.Guild)) // { // } //} ///// <summary> ///// Temporarily halts the NewMoon module. ///// </summary> ///// <returns></returns> //[Command("newmoon close")] //public async Task DisableNewMoonAsync() //{ // if (IsEventOrganizer(Context.User as IGuildUser, Context.Guild)) // { // } //} //[Command("newmoon close 1")] //public async Task CloseCycle1Async() //{ // dynamic EventConfiguration = JsonConvert.DeserializeObject(System.IO.File.ReadAllText($"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}NewMoon{Path.DirectorySeparatorChar}Config.json")); // EventConfiguration.Cycle1OpenReg = false; // File.WriteAllText($"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}NewMoon{Path.DirectorySeparatorChar}Config.json", JsonConvert.SerializeObject(EventConfiguration, Formatting.Indented)); // await ReplyAsync("Cycle 1 registration has been closed."); //} //TODO: Implement Newmoon close 2, open 1, open 2. Update Save acceptance to see if Newmoon is active and implement setups accordingly. Implement registratnt listing. /// <summary> /// DMs the caller the New Moon registrations with the following spec: /// /// 1. "[Registrant Name] (Discord Nickname)" /// 2. Folder 1 /// 3. Folder 2 /// 4. Navicust Setups /// /// This method compiles all active registrations into a singular text file for easy parsing. /// </summary> /// <returns></returns> //[Command("newmoon setups")] //public async Task GetNewMoonRegistrantsAsync() //{ // //PSUEDO: // // obtain a list of setup files from the setups folder. // // substring out the Discord ID for lookup // // //} /// <summary> /// Registers the caller for the New Moon cycle that's currently active. /// </summary> //[Command("newmoon join")] //public async Task RegisterNewMoonAsync([Remainder]string NetbattlerName) //{ // if (IsNewMoonActive == true) //Is Newmoon Active? // { // if (Cycle1Open) //Is the current cycle open? // { // await AddNewMoonRoleAsync(Context.User as IGuildUser, RoleModule.GetRole("MOON BATTLER", Context.Guild)); //Add the MOON BATTLER role. // NewMoonParticipant newParticipant = new NewMoonParticipant(NetbattlerName.Replace('@', ' '), Context.User.Id, 1); //Create the Participant Entry based on the model. The Model creation automatically sets the location based on the cycle. // Cycle1Participants.Add(newParticipant); // WriteParticipantList(); // await ReplyAsync("You have registered for NEW MOON. Your Cycle is the current one. !awoo"); // } // else //The registration needs to go to the next upcoming cycle. // { // await AddNewMoonRoleAsync(Context.User as IGuildUser, RoleModule.GetRole("MOON BATTLER", Context.Guild)); //Add the MOON BATTLER role. // NewMoonParticipant newParticipant = new NewMoonParticipant(NetbattlerName.Replace('@', ' '), Context.User.Id, 2); //Create the Participant Entry based on the model. The Model creation automatically sets the location based on the cycle. // Cycle2Participants.Add(newParticipant); // WriteParticipantList(); // await ReplyAsync("You have registered for NEW MOON. Your Cycle is the upcoming one. !awoo"); // } // SyncParticipantList(); // } //} //[Command("newmoon advance")] //public async Task AdvanceNewmoonAsync() //{ //} //========================Support Functions===================== private bool IsEventOrganizer(IGuildUser caller, SocketGuild TargetServer) { SocketRole role = BotTools.GetRole("Event Organizer", TargetServer); if (caller.RoleIds.Contains(role.Id)) { return(true); //The user is an event organizer. } else { return(false); //The user is not an event organizer. } }