mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-02-11 05:58:26 -06:00
Add embed page for calendars. No more linking out to google!!!!
This commit is contained in:
@@ -16,11 +16,17 @@ import java.net.URI;
|
||||
* For Project: DisCal-Discord-Bot
|
||||
*/
|
||||
public class CalendarMessageFormatter {
|
||||
@Deprecated
|
||||
public static String getCalendarLink(String calId) {
|
||||
URI callURI = URI.create(calId);
|
||||
return "https://calendar.google.com/calendar/embed?src=" + callURI;
|
||||
}
|
||||
|
||||
//TODO: Add support for multiple calendars.
|
||||
public static String getCalendarLink(long guildId) {
|
||||
return "https://www.discalbot.com/embed/calendar/" + guildId;
|
||||
}
|
||||
|
||||
public static EmbedObject getCalendarLinkEmbed(Calendar cal, GuildSettings settings) {
|
||||
EmbedBuilder em = new EmbedBuilder();
|
||||
em.withAuthorIcon(DisCalAPI.getAPI().getClient().getGuildByID(266063520112574464L).getIconURL());
|
||||
@@ -33,7 +39,7 @@ public class CalendarMessageFormatter {
|
||||
//Some error, desc probably never set, just ignore no need to log.
|
||||
}
|
||||
em.appendField(MessageManager.getMessage("Embed.Calendar.Link.TimeZone", settings), cal.getTimeZone(), false);
|
||||
em.withUrl(CalendarMessageFormatter.getCalendarLink(cal.getId()));
|
||||
em.withUrl(CalendarMessageFormatter.getCalendarLink(settings.getGuildID()));
|
||||
em.withFooterText(MessageManager.getMessage("Embed.Calendar.Link.CalendarId", "%id%", cal.getId(), settings));
|
||||
em.withColor(56, 138, 237);
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ public class Authorization {
|
||||
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.withUrl(CalendarMessageFormatter.getCalendarLink(settings.getGuildID()));
|
||||
em.withColor(56, 138, 237);
|
||||
Message.sendDirectMessage(em.build(), poll.getUser());
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import com.cloudcraftgaming.discal.api.object.calendar.CalendarData;
|
||||
import com.cloudcraftgaming.discal.logger.Logger;
|
||||
import com.google.api.services.calendar.model.Calendar;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* Created by Nova Fox on 1/7/18.
|
||||
* Website: www.cloudcraftgaming.com
|
||||
@@ -93,7 +91,7 @@ public class WebCalendar {
|
||||
} else {
|
||||
id = cd.getCalendarId();
|
||||
address = cd.getCalendarAddress();
|
||||
link = "https://calendar.google.com/calendar/embed?src=" + URI.create(cd.getCalendarAddress());
|
||||
link = "https://www.discalbot.com/embed/calendar/" + gs.getGuildID();
|
||||
external = cd.isExternal();
|
||||
try {
|
||||
if (cd.isExternal()) {
|
||||
|
||||
Reference in New Issue
Block a user