public WebCalendar fromCalendar(CalendarData cd, GuildSettings gs) {
if (cd.getCalendarAddress().equalsIgnoreCase("primary")) {
id = "primary";
address = "primary";
link = "N/a";
name = "N/a";
description = "N/a";
timezone = "N/a";
} else {
id = cd.getCalendarId();
address = cd.getCalendarAddress();
link = "https://www.discalbot.com/embed/calendar/" + gs.getGuildID();
external = cd.isExternal();
try {
Calendar cal = CalendarAuth.getCalendarService(gs).calendars().get(id).execute();
name = cal.getSummary();
description = cal.getDescription();
timezone = cal.getTimeZone().replaceAll("/", "___");
} catch (Exception e) {
Logger.getLogger().exception(null, "[WEB] Failed to get calendar!", e, this.getClass());
name = "ERROR!";
description = "ERROR";
timezone = "ERROR";
}
}
return this;
}