public AudioManager(IGuild guild) { this.guild = guild; client = guild.getClient(); }
@Override public IDiscordClient getClient() { return getGuild().getClient(); }
@Override public IDiscordClient getClient() { return getGuild().getClient(); }
public EmojiImpl(long id, IGuild guild, String name, boolean requiresColons, boolean isManaged, boolean isAnimated) { this(id, guild, name, new Cache<>((DiscordClientImpl) guild.getClient(), IRole.class), requiresColons, isManaged, isAnimated); }
public AudioPlayer(IAudioManager manager) { this.manager = manager; this.client = manager.getGuild().getClient(); inject(); }
public static boolean botHasMessageManagePerms(MessageReceivedEvent event) { return event.getGuild().getClient().getOurUser().getPermissionsForGuild(event.getMessage().getGuild()).contains(Permissions.MANAGE_MESSAGES); } }
IUser user = getGuild().getUserByID(Long.parseUnsignedLong(response.user_id)); users.put(response.ssrc, user); guild.getClient().getDispatcher().dispatch(new UserSpeakingEvent(user.getVoiceStateForGuild(guild).getChannel(), user, response.ssrc, response.speaking)); break; case UNKNOWN:
/** * Converts a json {@link EmojiObject} to a {@link IEmoji}. * * @param guild The guild the emoji belongs to. * @param json The json object representing the emoji. * @return The converted emoji object. */ public static IEmoji getEmojiFromJSON(IGuild guild, EmojiObject json) { long id = Long.parseUnsignedLong(json.id); List<IRole> roles = Arrays.stream(json.roles) .map(role -> guild.getRoleByID(Long.parseUnsignedLong(role))) .collect(Collectors.toList()); EmojiImpl emoji = (EmojiImpl) guild.getEmojiByID(id); if (emoji != null) { emoji.setName(json.name); emoji.setRoles(roles); return emoji; } Cache<IRole> roleCache = new Cache<>((DiscordClientImpl) guild.getClient(), IRole.class); roleCache.putAll(roles); return new EmojiImpl(id, guild, json.name, roleCache, json.require_colons, json.managed, json.animated); }
public WebGuild fromGuild(IGuild g) { id = g.getStringID(); name = g.getName(); iconUrl = g.getIconURL(); botNick = g.getClient().getOurUser().getNicknameForGuild(g); settings = DatabaseManager.getManager().getSettings(g.getLongID()); //Handle lists and stuffs for (IRole r : g.getRoles()) { roles.add(new WebRole().fromRole(r, settings)); } WebChannel all = new WebChannel(); all.setId(0); all.setName("All Channels"); all.setDiscalChannel(settings.getDiscalChannel().equalsIgnoreCase("all")); channels.add(all); for (IChannel c : g.getChannels()) { channels.add(new WebChannel().fromChannel(c, settings)); } announcements.addAll(DatabaseManager.getManager().getAnnouncements(g.getLongID())); calendar = new WebCalendar().fromCalendar(DatabaseManager.getManager().getMainCalendar(Long.valueOf(id)), settings); return this; }