use of com.google.api.services.calendar.Calendar in project DisCal-Discord-Bot by NovaFox161.
the class AnnouncementTask method run.
@Override
public void run() {
Logger.getLogger().announcement("Starting announcement loop!");
try {
// Get the default stuff.
try {
discalService = CalendarAuth.getCalendarService();
} catch (IOException e) {
Logger.getLogger().exception(null, "Failed to get service! 00a0101", e, this.getClass(), true);
}
// NOTE: This list EXCLUDES disabled announcements!!!!!!!
ArrayList<Announcement> allAnnouncements = DatabaseManager.getManager().getEnabledAnnouncements();
for (Announcement a : allAnnouncements) {
Logger.getLogger().announcement("starting an announcement", a.getGuildId() + "", a.getAnnouncementId() + "", "N/a");
// Check if guild is part of DisCal's guilds. This way we can clear out the database...
if (!GuildUtils.active(a.getGuildId())) {
DatabaseManager.getManager().deleteAnnouncement(a.getAnnouncementId().toString());
continue;
}
// Get everything we need ready.
GuildSettings settings = getSettings(a);
CalendarData calendar = getCalendarData(a);
Calendar service;
try {
service = getService(settings);
} catch (Exception e) {
Logger.getLogger().exception(null, "Failed to handle custom service! 00a102", e, this.getClass(), true);
continue;
}
// Now we can check the announcement type and do all the actual logic here.
switch(a.getAnnouncementType()) {
case SPECIFIC:
if (EventUtils.eventExists(settings, a.getEventId())) {
try {
Event e = service.events().get(calendar.getCalendarId(), a.getEventId()).execute();
if (inRange(a, e)) {
// We can announce it.
AnnouncementMessageFormatter.sendAnnouncementMessage(a, e, calendar, settings);
// And now lets delete it
DatabaseManager.getManager().deleteAnnouncement(a.getAnnouncementId().toString());
}
} catch (IOException e) {
// Event getting error, we know it exists tho
Logger.getLogger().exception(null, "Failed to get event! 00a103", e, this.getClass(), true);
}
} else {
// Event is gone, we can just delete this shit.
DatabaseManager.getManager().deleteAnnouncement(a.getAnnouncementId().toString());
}
break;
case UNIVERSAL:
for (Event e : getEvents(settings, calendar, service, a)) {
if (inRange(a, e)) {
// It fits! Let's do it!
AnnouncementMessageFormatter.sendAnnouncementMessage(a, e, calendar, settings);
}
}
break;
case COLOR:
for (Event e : getEvents(settings, calendar, service, a)) {
if (a.getEventColor() == EventColor.fromNameOrHexOrID(e.getColorId())) {
if (inRange(a, e)) {
// It fits! Let's do it!
AnnouncementMessageFormatter.sendAnnouncementMessage(a, e, calendar, settings);
}
}
}
break;
case RECUR:
for (Event e : getEvents(settings, calendar, service, a)) {
if (inRange(a, e)) {
if (e.getId().contains("_") && e.getId().split("_")[0].equals(a.getEventId())) {
// It fits! Lets announce!
AnnouncementMessageFormatter.sendAnnouncementMessage(a, e, calendar, settings);
}
}
}
break;
}
Logger.getLogger().announcement("finished an announcement", a.getGuildId() + "", a.getAnnouncementId() + "", "N/a");
}
// Just clear everything immediately.
allSettings.clear();
calendars.clear();
customServices.clear();
allEvents.clear();
Logger.getLogger().announcement("Finished announcement loop!");
} catch (Exception e) {
Logger.getLogger().exception(null, "SOMETHING BAD IN THE ANNOUNCER!!!!! PANIC!!!", e, this.getClass(), true);
}
}
use of com.google.api.services.calendar.Calendar in project DisCal-Discord-Bot by NovaFox161.
the class Authorization method pollForAuth.
void pollForAuth(Poll poll) {
GuildSettings settings = DatabaseManager.getManager().getSettings(poll.getGuild().getLongID());
try {
String body = "client_id=" + clientData.getClientId() + "&client_secret=" + clientData.getClientSecret() + "&code=" + poll.getDevice_code() + "&grant_type=http://oauth.net/grant_type/device/1.0";
// Execute
com.mashape.unirest.http.HttpResponse<JsonNode> response = Unirest.post("https://www.googleapis.com/oauth2/v4/token").header("Content-Type", "application/x-www-form-urlencoded").body(body).asJson();
// Handle response.
if (response.getStatus() == 403) {
// Handle access denied
Message.sendDirectMessage(MessageManager.getMessage("AddCalendar.Auth.Poll.Failure.Deny", settings), poll.getUser());
} else if (response.getStatus() == 400) {
try {
// See if auth is pending, if so, just reschedule.
Type type = new TypeToken<AuthPollResponseError>() {
}.getType();
AuthPollResponseError apre = new Gson().fromJson(response.getBody().toString(), type);
if (apre.error.equalsIgnoreCase("authorization_pending")) {
// Response pending
PollManager.getManager().scheduleNextPoll(poll);
} else if (apre.error.equalsIgnoreCase("expired_token")) {
Message.sendDirectMessage(MessageManager.getMessage("AddCalendar.Auth.Poll.Failure.Expired", settings), poll.getUser());
} else {
Message.sendDirectMessage(MessageManager.getMessage("Notification.Error.Network", settings), poll.getUser());
Logger.getLogger().debug(poll.getUser(), "Poll Failure!", "Status code: " + response.getStatus() + " | " + response.getStatusText() + " | " + response.getBody().toString(), this.getClass(), true);
}
} catch (Exception e) {
// Auth is not pending, error occurred.
Logger.getLogger().exception(poll.getUser(), "Failed to poll for authorization to google account.", e, this.getClass(), true);
Logger.getLogger().debug(poll.getUser(), "More info on failure", "Status code: " + response.getStatus() + " | " + response.getStatusText() + " | " + response.getBody().toString(), this.getClass(), true);
Message.sendDirectMessage(MessageManager.getMessage("Notification.Error.Network", settings), poll.getUser());
}
} else if (response.getStatus() == 429) {
// We got rate limited... oops. Let's just poll half as often.
poll.setInterval(poll.getInterval() * 2);
PollManager.getManager().scheduleNextPoll(poll);
} else if (response.getStatus() == HttpStatusCodes.STATUS_CODE_OK) {
// Access granted
Type type = new TypeToken<AuthPollResponseGrant>() {
}.getType();
AuthPollResponseGrant aprg = new Gson().fromJson(response.getBody().toString(), type);
// Save credentials securely.
GuildSettings gs = DatabaseManager.getManager().getSettings(poll.getGuild().getLongID());
AESEncryption encryption = new AESEncryption(gs);
gs.setEncryptedAccessToken(encryption.encrypt(aprg.access_token));
gs.setEncryptedRefreshToken(encryption.encrypt(aprg.refresh_token));
DatabaseManager.getManager().updateSettings(gs);
try {
Calendar service = CalendarAuth.getCalendarService(gs);
List<CalendarListEntry> items = service.calendarList().list().setMinAccessRole("writer").execute().getItems();
Message.sendDirectMessage(MessageManager.getMessage("AddCalendar.Auth.Poll.Success", settings), poll.getUser());
for (CalendarListEntry i : items) {
if (!i.isDeleted()) {
EmbedBuilder em = new EmbedBuilder();
em.withAuthorIcon(Main.client.getGuildByID(266063520112574464L).getIconURL());
em.withAuthorName("DisCal");
em.withTitle(MessageManager.getMessage("Embed.AddCalendar.List.Title", settings));
em.appendField(MessageManager.getMessage("Embed.AddCalendar.List.Name", settings), i.getSummary(), false);
em.appendField(MessageManager.getMessage("Embed.AddCalendar.List.TimeZone", settings), i.getTimeZone(), false);
em.appendField(MessageManager.getMessage("Embed.AddCalendar.List.ID", settings), i.getId(), false);
em.withUrl(CalendarMessageFormatter.getCalendarLink(i.getId()));
em.withColor(56, 138, 237);
Message.sendDirectMessage(em.build(), poll.getUser());
}
}
// Response will be handled in guild, and will check. We already saved the tokens anyway.
} catch (IOException e1) {
// Failed to get calendars list and check for calendars.
Logger.getLogger().exception(poll.getUser(), "Failed to list calendars from external account!", e1, this.getClass(), true);
Message.sendDirectMessage(MessageManager.getMessage("AddCalendar.Auth.Poll.Failure.ListCalendars", settings), poll.getUser());
}
} else {
// Unknown network error...
Message.sendDirectMessage(MessageManager.getMessage("Notification.Error.Network", settings), poll.getUser());
Logger.getLogger().debug(poll.getUser(), "Network error; poll failure", "Status code: " + response.getStatus() + " | " + response.getStatusText() + " | " + response.getBody().toString(), this.getClass(), true);
}
} catch (Exception e) {
// Handle exception.
Logger.getLogger().exception(poll.getUser(), "Failed to poll for authorization to google account", e, this.getClass(), true);
Message.sendDirectMessage(MessageManager.getMessage("Notification.Error.Unknown", settings), poll.getUser());
}
}
use of com.google.api.services.calendar.Calendar in project DisCal-Discord-Bot by NovaFox161.
the class CalendarUtils method deleteCalendar.
/**
* Deletes a calendar from Google Calendar and the Db
*
* @param data The BotData of the Guild whose deleting their calendar.
* @return <code>true</code> if successful, else <code>false</code>.
*/
public static Boolean deleteCalendar(CalendarData data, GuildSettings settings) {
try {
// Only delete if the calendar is stored on DisCal's account.
if (!data.getCalendarAddress().equalsIgnoreCase("primary") && !settings.useExternalCalendar()) {
Calendar service = CalendarAuth.getCalendarService();
service.calendars().delete(data.getCalendarAddress()).execute();
}
} catch (IOException e) {
// Fail silently.
Logger.getLogger().exception(null, "Failed to delete calendar", e, CalendarUtils.class, true);
return false;
}
if (settings.useExternalCalendar()) {
// Update settings.
settings.setUseExternalCalendar(false);
settings.setEncryptedAccessToken("N/a");
settings.setEncryptedRefreshToken("N/a");
DatabaseManager.getManager().updateSettings(settings);
}
// Delete everything that is specific to the calendar...
DatabaseManager.getManager().deleteCalendar(data);
DatabaseManager.getManager().deleteAllEventData(data.getGuildId());
DatabaseManager.getManager().deleteAllRSVPData(data.getGuildId());
DatabaseManager.getManager().deleteAllAnnouncementData(data.getGuildId());
return true;
}
use of com.google.api.services.calendar.Calendar in project DisCal-Discord-Bot by NovaFox161.
the class EventUtils method deleteEvent.
/**
* Deletes an event from the calendar.
*
* @param settings Guild settings
* @param eventId The ID of the event to delete.
* @return <code>true</code> if successfully deleted, otherwise <code>false</code>.
*/
public static Boolean deleteEvent(GuildSettings settings, String eventId) {
// TODO: Support multiple calendars...
String calendarId = DatabaseManager.getManager().getMainCalendar(settings.getGuildID()).getCalendarAddress();
try {
Calendar service;
if (settings.useExternalCalendar()) {
service = CalendarAuth.getCalendarService(settings);
} else {
service = CalendarAuth.getCalendarService();
}
try {
service.events().delete(calendarId, eventId).execute();
} catch (Exception e) {
// Failed to delete event...
return false;
}
DatabaseManager.getManager().deleteAnnouncementsForEvent(settings.getGuildID(), eventId);
DatabaseManager.getManager().deleteEventData(eventId);
return true;
} catch (Exception e) {
System.out.println("Something weird happened when deleting an event!");
Logger.getLogger().exception(null, "Failed to delete event.", e, EventUtils.class, true);
e.printStackTrace();
}
return false;
}
use of com.google.api.services.calendar.Calendar in project Saber-Bot by notem.
the class ConfigCommand method action.
@Override
public void action(String head, String[] args, MessageReceivedEvent event) {
int index = 0;
String cId = args[index].replaceAll("[^\\d]", "");
TextChannel scheduleChan = event.getGuild().getTextChannelById(cId);
index++;
if (args.length > 1) {
switch(args[index++].toLowerCase()) {
case "m":
case "msg":
case "message":
String msgFormat = formatHelper(args[index]);
Main.getScheduleManager().setAnnounceFormat(scheduleChan.getId(), msgFormat);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.ANN, event.getJDA()), event.getChannel(), null);
break;
case "ch":
case "chan":
case "channel":
String chanIdentifier = chanHelper(args[index], event);
Main.getScheduleManager().setAnnounceChan(scheduleChan.getId(), chanIdentifier);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.ANN, event.getJDA()), event.getChannel(), null);
break;
case "em":
case "end-msg":
case "end-message":
String endFormat;
endFormat = formatHelper(args[index]);
Main.getScheduleManager().setEndAnnounceFormat(scheduleChan.getId(), endFormat);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.ANN, event.getJDA()), event.getChannel(), null);
break;
case "ech":
case "end-chan":
case "end-channel":
String endChanIdentifier;
switch(args[index].toLowerCase()) {
case "reset":
case "default":
case "null":
endChanIdentifier = null;
break;
default:
endChanIdentifier = chanHelper(args[index], event);
}
Main.getScheduleManager().setEndAnnounceChan(scheduleChan.getId(), endChanIdentifier);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.ANN, event.getJDA()), event.getChannel(), null);
break;
case "z":
case "zone":
ZoneId zone = ParsingUtilities.parseZone(args[index]);
Main.getScheduleManager().setTimeZone(scheduleChan.getId(), zone);
// correct/reload the event displays
Main.getDBDriver().getEventCollection().find(eq("channelId", scheduleChan.getId())).forEach((Consumer<? super Document>) document -> {
Integer id = document.getInteger("_id");
ScheduleEntry se = Main.getEntryManager().getEntry(id);
if (se.getStart().isAfter(se.getEnd())) {
Main.getDBDriver().getEventCollection().updateOne(eq("_id", id), set("end", Date.from(se.getEnd().plusDays(1).toInstant())));
}
Main.getEntryManager().reloadEntry(id);
});
// disable auto-sync'ing timezone
Main.getDBDriver().getScheduleCollection().updateOne(eq("_id", scheduleChan.getId()), set("timezone_sync", false));
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.MISC, event.getJDA()), event.getChannel(), null);
break;
case "cl":
case "clock":
Main.getScheduleManager().setClockFormat(scheduleChan.getId(), args[index]);
// reload the schedule display
Main.getDBDriver().getEventCollection().find(eq("channelId", scheduleChan.getId())).forEach((Consumer<? super Document>) document -> Main.getEntryManager().reloadEntry((Integer) document.get("_id")));
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.MISC, event.getJDA()), event.getChannel(), null);
break;
case "s":
case "sync":
Credential credential = GoogleAuth.getCredential(event.getAuthor().getId());
if (credential == null)
break;
Calendar service = GoogleAuth.getCalendarService(credential);
if (Main.getCalendarConverter().checkValidAddress(args[index], service))
Main.getScheduleManager().setAddress(scheduleChan.getId(), args[index]);
else
Main.getScheduleManager().setAddress(scheduleChan.getId(), "off");
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.SYNC, event.getJDA()), event.getChannel(), null);
break;
case "t":
case "time":
ZonedDateTime syncTime = ZonedDateTime.of(LocalDate.now(), ParsingUtilities.parseTime(args[index]), Main.getScheduleManager().getTimeZone(cId));
// don't allow times set in the past
if (syncTime.isBefore(ZonedDateTime.now()))
syncTime.plusDays(1);
Main.getScheduleManager().setSyncTime(cId, Date.from(syncTime.toInstant()));
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.SYNC, event.getJDA()), event.getChannel(), null);
break;
case "r":
case "remind":
case "reminder":
case "reminders":
Set<Integer> list = this.reminderHelper(args, index, cId);
// convert set to a list
List<Integer> rem = new ArrayList<>(list);
Main.getScheduleManager().setReminders(cId, rem);
// for every entry on channel, update
Main.getDBDriver().getEventCollection().find(eq("channelId", scheduleChan.getId())).forEach((Consumer<? super Document>) document -> {
ScheduleEntry se = new ScheduleEntry(document).reloadReminders(Main.getScheduleManager().getReminders(scheduleChan.getId()));
Main.getEntryManager().updateEntry(se, false);
});
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.REM, event.getJDA()), event.getChannel(), null);
break;
case "er":
case "end-remind":
case "end-reminder":
case "end-reminders":
Set<Integer> list2 = this.reminderHelper(args, index, cId);
// convert set to a list
List<Integer> rem2 = new ArrayList<>(list2);
Main.getScheduleManager().setEndReminders(cId, rem2);
// for every entry on channel, update
Main.getDBDriver().getEventCollection().find(eq("channelId", scheduleChan.getId())).forEach((Consumer<? super Document>) document -> {
ScheduleEntry se = new ScheduleEntry(document).reloadEndReminders(Main.getScheduleManager().getEndReminders(scheduleChan.getId()));
Main.getEntryManager().updateEntry(se, false);
});
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.REM, event.getJDA()), event.getChannel(), null);
break;
case "rm":
case "rem-msg":
case "remind-msg":
case "remind-message":
String remindFormat;
remindFormat = formatHelper(args[index]);
Main.getScheduleManager().setReminderFormat(scheduleChan.getId(), remindFormat);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.REM, event.getJDA()), event.getChannel(), null);
break;
case "rc":
case "rem-chan":
case "remind-chan":
case "remind-channel":
String remindChanIdentifier;
switch(args[index].toLowerCase()) {
case "reset":
case "default":
case "null":
remindChanIdentifier = null;
break;
default:
remindChanIdentifier = chanHelper(args[index], event);
break;
}
Main.getScheduleManager().setReminderChan(scheduleChan.getId(), remindChanIdentifier);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.REM, event.getJDA()), event.getChannel(), null);
break;
case "rsvp":
boolean enabled = Main.getScheduleManager().isRSVPEnabled(cId);
Map<String, String> options = Main.getScheduleManager().getRSVPOptions(cId);
Boolean new_enabled = null;
switch(args[index++].toLowerCase()) {
case "add":
case "a":
String emoji = args[index + 1].trim();
if (!EmojiManager.isEmoji(emoji)) {
emoji = emoji.replaceAll("[^\\d]", "");
}
options.put(emoji, args[index].trim());
Main.getScheduleManager().setRSVPOptions(cId, options);
break;
case "remove":
case "r":
if (options.containsKey(args[index])) {
options.remove(args[index]);
} else if (options.containsValue(args[index])) {
options.values().remove(args[index]);
}
Main.getScheduleManager().setRSVPOptions(cId, options);
break;
case "on":
case "true":
new_enabled = true;
break;
case "off":
case "false":
new_enabled = false;
break;
}
String clearEmoji = Main.getScheduleManager().getRSVPClear(cId);
// if add or remove option was used, clear the reactions and re-add the new reactions
if (new_enabled == null) {
// for each entry on the schedule
Main.getDBDriver().getEventCollection().find(eq("channelId", scheduleChan.getId())).forEach((Consumer<? super Document>) document -> {
event.getGuild().getTextChannelById(document.getString("channelId")).getMessageById(document.getString("messageId")).complete().clearReactions().queue((message) -> {
Map<String, String> map = Main.getScheduleManager().getRSVPOptions(document.getString("channelId"));
event.getGuild().getTextChannelById(document.getString("channelId")).getMessageById(document.getString("messageId")).queue(msg -> EntryManager.addRSVPReactions(map, clearEmoji, msg));
});
Main.getEntryManager().reloadEntry(document.getInteger("_id"));
});
} else // otherwise, if the rsvp setting was changes
if (enabled != new_enabled) {
// set schedule settings
Main.getScheduleManager().setRSVPEnable(cId, new_enabled);
if (new_enabled) {
// for each entry on the schedule
Main.getDBDriver().getEventCollection().find(eq("channelId", scheduleChan.getId())).forEach((Consumer<? super Document>) document -> {
Map<String, String> map = Main.getScheduleManager().getRSVPOptions(document.getString("channelId"));
event.getGuild().getTextChannelById(document.getString("channelId")).getMessageById(document.getString("messageId")).queue(msg -> EntryManager.addRSVPReactions(map, clearEmoji, msg));
Main.getEntryManager().reloadEntry(document.getInteger("_id"));
});
} else {
// for each entry on the schedule
Main.getDBDriver().getEventCollection().find(eq("channelId", scheduleChan.getId())).forEach((Consumer<? super Document>) document -> {
event.getGuild().getTextChannelById(document.getString("channelId")).getMessageById(document.getString("messageId")).complete().clearReactions().queue();
Main.getEntryManager().reloadEntry(document.getInteger("_id"));
});
}
}
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.RSVP, event.getJDA()), event.getChannel(), null);
break;
case "c":
case "clear":
String emoji = args[index].trim();
if (emoji.equalsIgnoreCase("off")) {
emoji = "";
} else if (!EmojiManager.isEmoji(emoji)) {
emoji = emoji.replaceAll("[^\\d]", "");
}
Main.getScheduleManager().setRSVPClear(cId, emoji);
String finalEmoji = emoji;
Map<String, String> rsvpOptions = Main.getScheduleManager().getRSVPOptions(cId);
Main.getEntryManager().getEntriesFromChannel(cId).forEach(se -> {
Message message = se.getMessageObject();
message.clearReactions().queue(ignored -> EntryManager.addRSVPReactions(rsvpOptions, finalEmoji, message));
});
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.RSVP, event.getJDA()), event.getChannel(), null);
break;
case "co":
case "confirm":
case "confirmation":
case "confirmations":
boolean confirmation = true;
switch(args[index].toLowerCase()) {
case "no":
case "false":
case "off":
confirmation = false;
break;
}
Main.getScheduleManager().setRSVPConfirmations(cId, confirmation);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.RSVP, event.getJDA()), event.getChannel(), null);
break;
case "ex":
case "exclude":
case "exclusivity":
boolean exclusive = true;
switch(args[index].toLowerCase()) {
case "no":
case "off":
case "false":
exclusive = false;
break;
}
Main.getScheduleManager().setRSVPExclusivity(cId, exclusive);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.RSVP, event.getJDA()), event.getChannel(), null);
break;
case "log":
case "logging":
String loggingChannel = null;
switch(args[index].toLowerCase()) {
case "no":
case "off":
case "false":
break;
default:
loggingChannel = args[index].replaceAll("[^\\d]", "");
break;
}
Main.getScheduleManager().setRSVPLoggingChannel(cId, loggingChannel);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.RSVP, event.getJDA()), event.getChannel(), null);
break;
case "st":
case "style":
String style = args[index].toLowerCase();
if (style.equals("full"))
Main.getScheduleManager().setStyle(cId, style);
else if (style.equals("narrow"))
Main.getScheduleManager().setStyle(cId, style);
// for each entry on the schedule
Main.getDBDriver().getEventCollection().find(eq("channelId", scheduleChan.getId())).forEach((Consumer<? super Document>) document -> Main.getEntryManager().reloadEntry(document.getInteger("_id")));
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.MISC, event.getJDA()), event.getChannel(), null);
break;
case "l":
case "len":
case "length":
Main.getScheduleManager().setSyncLength(cId, Integer.parseInt(args[index]));
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.SYNC, event.getJDA()), event.getChannel(), null);
break;
case "so":
case "sort":
int sortType;
switch(args[index]) {
case "on":
case "asc":
case "ascending":
sortType = 1;
break;
case "desc":
case "descending":
sortType = 2;
break;
default:
sortType = 0;
break;
}
Main.getScheduleManager().setAutoSort(cId, sortType);
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.MISC, event.getJDA()), event.getChannel(), null);
// now sort the schedule
if (sortType == 1)
Main.getScheduleManager().sortSchedule(cId, false);
if (sortType == 2)
Main.getScheduleManager().sortSchedule(cId, true);
break;
}
} else // print out all settings
{
MessageUtilities.sendMsg(this.genMsgStr(cId, Mode.FULL, event.getJDA()), event.getChannel(), null);
}
}
Aggregations