congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
WebGuild
Code IndexAdd Tabnine to your IDE (free)

How to use
WebGuild
in
org.dreamexposure.discal.core.object.web

Best Java code snippets using org.dreamexposure.discal.core.object.web.WebGuild (Showing top 20 results out of 315)

origin: NovaFox161/DisCal-Discord-Bot

WebGuild wg = new WebGuild().fromJson(data.getJSONObject("Guild"));
wg.setDiscalRole(data.getBoolean("Sufficient-Role"));
wg.setManageServer(data.getBoolean("Manager-Server"));
if (!(wg.isManageServer() || wg.isDiscalRole())) {
origin: NovaFox161/DisCal-Discord-Bot

@PostMapping(value = "/delete/announcement")
public static String deleteAnnouncement(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> queryParams) {
  try {
    String announcementId = queryParams.get("id");
    Map m = DiscordAccountHandler.getHandler().getAccount(request);
    WebGuild g = (WebGuild) m.get("selected");
    if (g.isManageServer()) {
      DatabaseManager.getManager().deleteAnnouncement(announcementId);
      //Update announcements list to display correctly.
      g.getAnnouncements().clear();
      g.getAnnouncements().addAll(DatabaseManager.getManager().getAnnouncements(Long.valueOf(g.getId())));
    }
    response.sendRedirect("/dashboard/guild/announcements");
    return "redirect:/dashboard/guild/announcements";
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to delete announcement!", e, DashboardHandler.class);
    response.setContentType("application/json");
    response.setStatus(500);
    return ResponseUtils.getJsonResponseMessage("Internal Server Error");
  }
}
origin: NovaFox161/DisCal-Discord-Bot

if (g.isManageServer()) {
  g.setBotNick(queryParams.get("bot-nick"));
  data.put("Reason", CrossTalkReason.UPDATE.name());
  data.put("Realm", DisCalRealm.BOT_SETTINGS);
  data.put("Guild-Id", g.getId());
  data.put("Bot-Nick", g.getBotNick());
if (g.isManageServer()) {
  g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
  g.getSettings().setPrefix(queryParams.get("prefix"));
  DatabaseManager.getManager().updateSettings(g.getSettings());
if (g.isManageServer()) {
  g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
  g.getSettings().setLang(queryParams.get("lang"));
  DatabaseManager.getManager().updateSettings(g.getSettings());
if (g.isManageServer()) {
  g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
  WebRole role = g.getRole((Long.valueOf(queryParams.get("con-role"))));
  for (WebRole wr : g.getRoles()) {
    wr.setControlRole(false);
    g.getSettings().setControlRole("everyone");
origin: NovaFox161/DisCal-Discord-Bot

  public static List<WebGuild> getGuilds(String userId, IDiscordClient client) {
    List<WebGuild> guilds = new ArrayList<>();

    for (IGuild g : client.getGuilds()) {
      for (IUser m : g.getUsers()) {
        if (m.getStringID().equals(userId)) {
          WebGuild wg = new WebGuild().fromGuild(g);
          wg.setManageServer(PermissionChecker.hasManageServerRole(g, m));
          wg.setDiscalRole(PermissionChecker.hasSufficientRole(g, m));
          guilds.add(wg);
        }
      }
    }

    return guilds;
  }
}
origin: NovaFox161/DisCal-Discord-Bot

  Map m = DiscordAccountHandler.getHandler().getAccount(request);
  WebGuild g = (WebGuild) m.get("selected");
  g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
  settings = g.getSettings();
} else {
  long guildId = requestBody.getLong("guild_id");
origin: NovaFox161/DisCal-Discord-Bot

WebGuild g = (WebGuild) m.get("selected");
if (g.isDiscalRole()) {
  Calendar calendar = new Calendar();
  calendar.setSummary(name);
  calendar.setTimeZone(tz.replace("___", "/"));
  try {
    com.google.api.services.calendar.Calendar service = CalendarAuth.getCalendarService(g.getSettings());
    rule.setScope(scope).setRole("reader");
    service.acl().insert(confirmed.getId(), rule).execute();
    CalendarData calendarData = new CalendarData(Long.valueOf(g.getId()), 1);
    calendarData.setCalendarId(confirmed.getId());
    calendarData.setCalendarAddress(confirmed.getId());
    g.setCalendar(new WebCalendar().fromCalendar(calendarData, g.getSettings()));
  } catch (Exception ex) {
    Logger.getLogger().exception(null, "[WEB] Failed to confirm calendar.", ex, DashboardHandler.class);
origin: NovaFox161/DisCal-Discord-Bot

  JSONObject data = ServerSocketHandler.sendAndReceive(requestBody);
  WebGuild wg = new WebGuild().fromJson(data.getJSONObject("Guild"));
  m.put("embed", wg);
} catch (IOException e) {
  Logger.getLogger().exception(null, "[Embed] Failed to get guild!", e, this.getClass());
  m.put("embed", new WebGuild());
  JSONObject data = ServerSocketHandler.sendAndReceive(requestBody);
  WebGuild wg = new WebGuild().fromJson(data.getJSONObject("Guild"));
  m.put("embed", wg);
} catch (IOException e) {
  Logger.getLogger().exception(null, "[Embed] Failed to get guild!", e, this.getClass());
  m.put("embed", new WebGuild());
origin: NovaFox161/DisCal-Discord-Bot

@PostMapping(value = "/delete/calendar")
public static String deleteCalendar(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> queryParams) {
  try {
    //TODO: Handle multiple calendars...
    //String calId = request.queryParams("calendar-id");
    Map m = DiscordAccountHandler.getHandler().getAccount(request);
    WebGuild g = (WebGuild) m.get("selected");
    if (g.isManageServer()) {
      CalendarData data = DatabaseManager.getManager().getMainCalendar(Long.valueOf(g.getId()));
      GuildSettings settings = DatabaseManager.getManager().getSettings(Long.valueOf(g.getId()));
      CalendarUtils.deleteCalendar(data, settings);
      g.setCalendar(new WebCalendar().fromCalendar(DatabaseManager.getManager().getMainCalendar(Long.valueOf(g.getId())), DatabaseManager.getManager().getSettings(Long.valueOf(g.getId()))));
      response.sendRedirect("/dashboard/guild/calendar");
      return "redirect:/dashboard/guild/calendar";
    } else {
      response.sendRedirect("/dashboard/guild/calendar");
      return "redirect:/dashboard/guild/calendar";
    }
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to delete/remove calendar!", e, DashboardHandler.class);
    response.setContentType("application/json");
    response.setStatus(500);
    return ResponseUtils.getJsonResponseMessage("Internal Server Error");
  }
}
origin: NovaFox161/DisCal-Discord-Bot

WebGuild g = (WebGuild) m.get("selected");
if (g.isDiscalRole()) {
  Announcement a = new Announcement(Long.valueOf(g.getId()));
  a.setAnnouncementChannelId(channelId);
  a.setMinutesBefore(Integer.valueOf(minutesRaw));
  g.getAnnouncements().clear();
  g.getAnnouncements().addAll(DatabaseManager.getManager().getAnnouncements(Long.valueOf(g.getId())));
origin: NovaFox161/DisCal-Discord-Bot

if (g.isDiscalRole()) {
  try {
    Calendar cal = CalendarAuth.getCalendarService(g.getSettings()).calendars().get(g.getCalendar().getId()).execute();
    cal.setSummary(queryParams.get("cal-name"));
    CalendarAuth.getCalendarService(g.getSettings()).calendars().update(g.getCalendar().getId(), cal).execute();
    g.getCalendar().setName(queryParams.get("cal-name"));
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to update calendar name", e, DashboardHandler.class);
if (g.isDiscalRole()) {
  try {
    Calendar cal = CalendarAuth.getCalendarService(g.getSettings()).calendars().get(g.getCalendar().getId()).execute();
    cal.setDescription(queryParams.get("cal-desc"));
    CalendarAuth.getCalendarService(g.getSettings()).calendars().update(g.getCalendar().getId(), cal).execute();
    g.getCalendar().setDescription(queryParams.get("cal-desc"));
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to update calendar description", e, DashboardHandler.class);
if (g.isDiscalRole()) {
  try {
    Calendar cal = CalendarAuth.getCalendarService(g.getSettings()).calendars().get(g.getCalendar().getId()).execute();
    cal.setTimeZone(queryParams.get("cal-tz").replace("___", "/"));
    CalendarAuth.getCalendarService(g.getSettings()).calendars().update(g.getCalendar().getId(), cal).execute();
    g.getCalendar().setTimezone(queryParams.get("cal-tz"));
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to update calendar timezone", e, DashboardHandler.class);
origin: NovaFox161/DisCal-Discord-Bot

  Map m = DiscordAccountHandler.getHandler().getAccount(request);
  WebGuild g = (WebGuild) m.get("selected");
  g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
  settings = g.getSettings();
} else {
  long guildId = requestBody.getLong("guild_id");
origin: NovaFox161/DisCal-Discord-Bot

WebGuild g = (WebGuild) m.get("selected");
if (g.isDiscalRole()) {
  Calendar calendar = new Calendar();
  calendar.setSummary(name);
  calendar.setTimeZone(tz.replace("___", "/"));
  try {
    com.google.api.services.calendar.Calendar service = CalendarAuth.getCalendarService(g.getSettings());
    rule.setScope(scope).setRole("reader");
    service.acl().insert(confirmed.getId(), rule).execute();
    CalendarData calendarData = new CalendarData(Long.valueOf(g.getId()), 1);
    calendarData.setCalendarId(confirmed.getId());
    calendarData.setCalendarAddress(confirmed.getId());
    g.setCalendar(new WebCalendar().fromCalendar(calendarData, g.getSettings()));
  } catch (Exception ex) {
    Logger.getLogger().exception(null, "[WEB] Failed to confirm calendar.", ex, DashboardHandler.class);
origin: NovaFox161/DisCal-Discord-Bot

  JSONObject data = ServerSocketHandler.sendAndReceive(requestBody);
  WebGuild wg = new WebGuild().fromJson(data.getJSONObject("Guild"));
  m.put("embed", wg);
} catch (IOException e) {
  Logger.getLogger().exception(null, "[Embed] Failed to get guild!", e, this.getClass());
  m.put("embed", new WebGuild());
  JSONObject data = ServerSocketHandler.sendAndReceive(requestBody);
  WebGuild wg = new WebGuild().fromJson(data.getJSONObject("Guild"));
  m.put("embed", wg);
} catch (IOException e) {
  Logger.getLogger().exception(null, "[Embed] Failed to get guild!", e, this.getClass());
  m.put("embed", new WebGuild());
origin: NovaFox161/DisCal-Discord-Bot

@PostMapping(value = "/delete/calendar")
public static String deleteCalendar(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> queryParams) {
  try {
    //TODO: Handle multiple calendars...
    //String calId = request.queryParams("calendar-id");
    Map m = DiscordAccountHandler.getHandler().getAccount(request);
    WebGuild g = (WebGuild) m.get("selected");
    if (g.isManageServer()) {
      CalendarData data = DatabaseManager.getManager().getMainCalendar(Long.valueOf(g.getId()));
      GuildSettings settings = DatabaseManager.getManager().getSettings(Long.valueOf(g.getId()));
      CalendarUtils.deleteCalendar(data, settings);
      g.setCalendar(new WebCalendar().fromCalendar(DatabaseManager.getManager().getMainCalendar(Long.valueOf(g.getId())), DatabaseManager.getManager().getSettings(Long.valueOf(g.getId()))));
      response.sendRedirect("/dashboard/guild/calendar");
      return "redirect:/dashboard/guild/calendar";
    } else {
      response.sendRedirect("/dashboard/guild/calendar");
      return "redirect:/dashboard/guild/calendar";
    }
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to delete/remove calendar!", e, DashboardHandler.class);
    response.setContentType("application/json");
    response.setStatus(500);
    return ResponseUtils.getJsonResponseMessage("Internal Server Error");
  }
}
origin: NovaFox161/DisCal-Discord-Bot

WebGuild g = (WebGuild) m.get("selected");
if (g.isDiscalRole()) {
  Announcement a = new Announcement(Long.valueOf(g.getId()));
  a.setAnnouncementChannelId(channelId);
  a.setMinutesBefore(Integer.valueOf(minutesRaw));
  g.getAnnouncements().clear();
  g.getAnnouncements().addAll(DatabaseManager.getManager().getAnnouncements(Long.valueOf(g.getId())));
origin: NovaFox161/DisCal-Discord-Bot

if (g.isDiscalRole()) {
  try {
    Calendar cal = CalendarAuth.getCalendarService(g.getSettings()).calendars().get(g.getCalendar().getId()).execute();
    cal.setSummary(queryParams.get("cal-name"));
    CalendarAuth.getCalendarService(g.getSettings()).calendars().update(g.getCalendar().getId(), cal).execute();
    g.getCalendar().setName(queryParams.get("cal-name"));
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to update calendar name", e, DashboardHandler.class);
if (g.isDiscalRole()) {
  try {
    Calendar cal = CalendarAuth.getCalendarService(g.getSettings()).calendars().get(g.getCalendar().getId()).execute();
    cal.setDescription(queryParams.get("cal-desc"));
    CalendarAuth.getCalendarService(g.getSettings()).calendars().update(g.getCalendar().getId(), cal).execute();
    g.getCalendar().setDescription(queryParams.get("cal-desc"));
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to update calendar description", e, DashboardHandler.class);
if (g.isDiscalRole()) {
  try {
    Calendar cal = CalendarAuth.getCalendarService(g.getSettings()).calendars().get(g.getCalendar().getId()).execute();
    cal.setTimeZone(queryParams.get("cal-tz").replace("___", "/"));
    CalendarAuth.getCalendarService(g.getSettings()).calendars().update(g.getCalendar().getId(), cal).execute();
    g.getCalendar().setTimezone(queryParams.get("cal-tz"));
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to update calendar timezone", e, DashboardHandler.class);
origin: NovaFox161/DisCal-Discord-Bot

if (g.isManageServer()) {
  g.setBotNick(queryParams.get("bot-nick"));
  data.put("Reason", CrossTalkReason.UPDATE.name());
  data.put("Realm", DisCalRealm.BOT_SETTINGS);
  data.put("Guild-Id", g.getId());
  data.put("Bot-Nick", g.getBotNick());
if (g.isManageServer()) {
  g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
  g.getSettings().setPrefix(queryParams.get("prefix"));
  DatabaseManager.getManager().updateSettings(g.getSettings());
if (g.isManageServer()) {
  g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
  g.getSettings().setLang(queryParams.get("lang"));
  DatabaseManager.getManager().updateSettings(g.getSettings());
if (g.isManageServer()) {
  g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
  WebRole role = g.getRole((Long.valueOf(queryParams.get("con-role"))));
  for (WebRole wr : g.getRoles()) {
    wr.setControlRole(false);
    g.getSettings().setControlRole("everyone");
origin: NovaFox161/DisCal-Discord-Bot

WebGuild wg = new WebGuild().fromJson(data.getJSONObject("Guild"));
wg.setDiscalRole(data.getBoolean("Sufficient-Role"));
wg.setManageServer(data.getBoolean("Manager-Server"));
if (!(wg.isManageServer() || wg.isDiscalRole())) {
origin: NovaFox161/DisCal-Discord-Bot

  Map m = DiscordAccountHandler.getHandler().getAccount(request);
  WebGuild g = (WebGuild) m.get("selected");
  g.setSettings(DatabaseManager.getManager().getSettings(Long.valueOf(g.getId())));
  settings = g.getSettings();
} else {
  long guildId = requestBody.getLong("guild_id");
origin: NovaFox161/DisCal-Discord-Bot

@PostMapping(value = "/delete/announcement")
public static String deleteAnnouncement(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> queryParams) {
  try {
    String announcementId = queryParams.get("id");
    Map m = DiscordAccountHandler.getHandler().getAccount(request);
    WebGuild g = (WebGuild) m.get("selected");
    if (g.isManageServer()) {
      DatabaseManager.getManager().deleteAnnouncement(announcementId);
      //Update announcements list to display correctly.
      g.getAnnouncements().clear();
      g.getAnnouncements().addAll(DatabaseManager.getManager().getAnnouncements(Long.valueOf(g.getId())));
    }
    response.sendRedirect("/dashboard/guild/announcements");
    return "redirect:/dashboard/guild/announcements";
  } catch (Exception e) {
    Logger.getLogger().exception(null, "[WEB] Failed to delete announcement!", e, DashboardHandler.class);
    response.setContentType("application/json");
    response.setStatus(500);
    return ResponseUtils.getJsonResponseMessage("Internal Server Error");
  }
}
org.dreamexposure.discal.core.object.webWebGuild

Javadoc

Created by Nova Fox on 12/19/17. Website: www.cloudcraftgaming.com For Project: DisCal-Discord-Bot

Most used methods

  • <init>
  • setDiscalRole
  • setManageServer
  • fromJson
  • getAnnouncements
  • getBotNick
  • getCalendar
  • getChannel
  • getChannels
  • getId
  • getRole
  • getRoles
  • getRole,
  • getRoles,
  • getSettings,
  • isDiscalRole,
  • isManageServer,
  • setBotNick,
  • setCalendar,
  • setSettings,
  • fromGuild

Popular in Java

  • Parsing JSON documents to java classes using gson
  • compareTo (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • setScale (BigDecimal)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now