public async Task Debug(string arg) { if (119019602574442497 != Context.User.Id) { // Secrurity check await ReplyAsync("This is a debug command, you cannot use it!"); return; } if (arg == "readxmlcalendar") { CalendarXMLManagement.CalendarReadXML(); await ReplyAsync("There are " + CalendarXMLManagement.arrEvents.Count + " events in the file."); } else if (arg == "writexml") { CalendarXMLManagement.CalendarWriteXML(); //await ReplyAsync("Loaded " + CalendarXMLManagement.arrEvents.Count + " events from file."); } else if (arg == "readxmlindex") { XMLIntIncrementer.IndexReadXML(); //await ReplyAsync("Loaded " + CalendarXMLManagement.arrEvents.Count + " events from file."); } else if (arg == "writexmlindex") { XMLIntIncrementer.IndexWriteXML(); //await ReplyAsync("Loaded " + CalendarXMLManagement.arrEvents.Count + " events from file."); } else if (arg == "initxmlindex") { XMLIntIncrementer.InitializeIndexXML(); //await ReplyAsync("Loaded " + CalendarXMLManagement.arrEvents.Count + " events from file."); } }
public async Task Newevent(string sEventName = "", string sEventDateTime = "") { if (sEventDateTime == "" | sEventName == "") { //Not enough data given, send user info on how to use this string helptext = "Not enough parameters! Please state at least the following: Eventname and event date + time \nExample: \n!newevent " + @"""My Event"" ""2018-12-24 12:34"" "; var channel = await Context.User.GetOrCreateDMChannelAsync(); await channel.SendMessageAsync(helptext); } else if (Context.Guild == null) { //Text was send by DM, not supported string helptext = "Please use this command in a text channel of your server, not via DM. This will be fixed in a later release."; var channel = await Context.User.GetOrCreateDMChannelAsync(); await channel.SendMessageAsync(helptext); } else { // try to adapt what the time is supposed to be DateTime dtEventDateTime = DateTime.Parse(sEventDateTime); //bool bPublic = false; //if (sPublic != "") { bPublic = true; } CalendarEvent newevent = new CalendarEvent(); newevent.EventID = XMLIntIncrementer.XMLIntIncrement.CalendarEvent; newevent.Active = true; newevent.Eventname = sEventName; newevent.EventDate = dtEventDateTime; newevent.EventCreator = Context.User.Id; newevent.CreatedDate = DateTime.Now; List <ulong> temp = new List <ulong>(); temp.Add(Context.User.Id); newevent.Attendees = temp; newevent.PublicEvent = false; newevent.EventGuild = Context.Guild.Id; XMLIntIncrementer.XMLIntIncrement.CalendarEvent++; CalendarXMLManagement.arrEvents.Add(newevent); CalendarXMLManagement.CalendarWriteXML(); XMLIntIncrementer.IndexWriteXML(); await ReplyAsync("Added new event with ID " + newevent.EventID); string helptext = "You can add more details to the event if you like:\n\n" + "\nAdd a max attendee limit: !editev *eventid* **maxattendees** 15" + "\nAdd a URL to a briefing: !editev *eventid* **briefingurl** http://someurl.com/briefing" + "\nAdd a URL to a Discord invite: !editev *eventid* **discordurl** http://disc0rd.gg/yourinviteid \n" + @"Add a short description to the event: !editev *eventid* **description** ""Description goes here""" + "\nToggle public flag of the event: !editev *eventid* **public**" + "\n" + @"Edit the event name: !editev *eventid* **name** ""My Eventname""" + "\n" + @"Edit the event date: !editev *eventid* **date** ""2018-12-24 13:37"""; var channel = await Context.User.GetOrCreateDMChannelAsync(); await channel.SendMessageAsync(helptext); } }