@Override public int compareTo(TextChannel chan) { Checks.notNull(chan, "Other TextChannel"); if (this == chan) return 0; Checks.check(getGuild().equals(chan.getGuild()), "Cannot compare TextChannels that aren't from the same guild!"); if (this.getPositionRaw() == chan.getPositionRaw()) return Long.compare(id, chan.getIdLong()); return Integer.compare(rawPosition, chan.getPositionRaw()); }
public void setTextChannel(TextChannel tc) { this.textId = tc == null ? 0 : tc.getIdLong(); this.manager.writeSettings(); }
public GuildAudioController getOrCreate(Guild guild, TextChannel textChannel, AudioPlayerManager playerManager) { GuildAudioController manager = guildAudioControllers.computeIfAbsent(guild.getIdLong(), $ -> new GuildAudioController(bot, guild, textChannel.getIdLong(), playerManager, executorService)); manager.getScheduler().setTextChannelId(textChannel.getIdLong()); return manager; }
guild.getTextChannelsMap().remove(channel.getIdLong()); getJDA().getEventManager().handle( new TextChannelDeleteEvent(
public void setLastNPMessage(Message m) { lastNP.put(m.getGuild().getIdLong(), new Pair<>(m.getTextChannel().getIdLong(), m.getIdLong())); }
public static void sendMessage(MessageType type, EmbedBuilder builder, TextChannel channel, long autoDeleteDelay) { if (builder.build().getColor() == null) builder.setColor(type.getColor()); if (type == MessageType.ERROR) { if (flareHeart == null) flareHeart = Getters.getEmoteById(386550693294768129L); builder.setDescription(builder.build().getDescription() + "\n\nIf you need more support join our " + "[Support Server](" + Constants.INVITE_URL + ")! Our staff can support on any issue you may have! " + (flareHeart == null ? "<3" : flareHeart.getAsMention())); } if (type != MessageType.WARNING && type != MessageType.ERROR && builder.getFields().isEmpty()) { Optional<String> globalMsg = getGlobalMessage(); if ((!lastGlobalMsg.containsKey(channel.getIdLong()) || System.currentTimeMillis() - lastGlobalMsg.get(channel.getIdLong()) >= GLOBAL_MSG_DELAY) && globalMsg.isPresent()) { lastGlobalMsg.put(channel.getIdLong(), System.currentTimeMillis()); builder.setDescription(builder.build().getDescription() + "\n\n" + globalMsg.get()); } } if (autoDeleteDelay > 0) sendAutoDeletedMessage(builder.build(), autoDeleteDelay, channel); else sendMessage(builder.build(), channel); }
guild.getTextChannelCache().forEach(chan -> getJDA().getTextChannelMap().remove(chan.getIdLong())); guild.getVoiceChannelCache().forEach(chan -> getJDA().getVoiceChannelMap().remove(chan.getIdLong())); guild.getCategoryCache().forEach(chan -> getJDA().getCategoryMap().remove(chan.getIdLong()));
guildTransformer.getLevelExemptChannels().remove(channel.getIdLong()); break; guildTransformer.getLevelExemptChannels().add(channel.getIdLong()); break; if (guildTransformer.getLevelExemptChannels().contains(channel.getIdLong())) { guildTransformer.getLevelExemptChannels().remove(channel.getIdLong()); } else { guildTransformer.getLevelExemptChannels().add(channel.getIdLong()); boolean isEnabled = !guildTransformer.getLevelExemptChannels().contains(channel.getIdLong());
+ event.getChannel().getIdLong() + ")", true), new MessageEmbed.Field("Command", cmd.getCommand(), true), field); } catch (Exception ex) {
+ ") to `" + reminder + "`").queue(); Scheduler.queueFutureAction(guild.getGuildIdLong(), channel.getIdLong(), sender.getIdLong(), reminder.substring(0, Math.min(reminder.length(), 1000)), period, action);
TextChannel tc = GuildUtils.getChannel(args[2], guild); if (tc != null) { guild.getSettings().getChannelBlacklist().add(tc.getIdLong()); MessageUtils.sendSuccessMessage("Added " + tc.getAsMention() + " to the blacklist!", channel); TextChannel tc = GuildUtils.getChannel(args[2], guild); if (tc != null) { if (!guild.getSettings().getChannelBlacklist().contains(tc.getIdLong())) { MessageUtils.sendWarningMessage("That channel is not blacklisted!", channel); return; guild.getSettings().getChannelBlacklist().remove(tc.getIdLong()); MessageUtils.sendSuccessMessage("Removed " + tc.getAsMention() + " from the blacklist!", channel);
.queue(); if (tc.get().getIdLong() != channel.getIdLong()) channel.sendMessage(new EmbedBuilder().setColor(locking ? ColorUtils.RED : ColorUtils.GREEN) .setDescription(tc.get().getAsMention() + " has been " + (locking ? "locked" : "unlocked") + "!") new FlareBotTask("ChannelUnlock-" + tc.get().getIdLong()) { @Override public void run() {
private boolean handleOfficialGuildStuff(GuildMessageReceivedEvent event, Command command) { Guild guild = event.getGuild(); GuildWrapper wrapper = FlareBotManager.instance().getGuild(guild.getId()); if (event.getChannel().getIdLong() == 226785954537406464L && !event.getMember().hasPermission(Permission.MESSAGE_MANAGE)) { event.getChannel().sendMessage("Heyo " + event.getAuthor().getAsMention() + " please use me in <#226786507065786380>!").queue(); return false; } return true; }
if (args.length == 0) { Collections.addAll(headers, "code", "name"); List<QActiveSubscriptions> subscriptionsForChannel = CSubscriptions.getSubscriptionsForChannel(CChannels.getCachedId(txt.getIdLong(), txt.getGuild().getIdLong())); for (QActiveSubscriptions subscriptions : subscriptionsForChannel) { ArrayList<String> row = new ArrayList<>();
/** * Creates the audio state by copying the currently playing track, the volume, * voice and channel IDs used for the music, guild ID, as well as all the * tracks in the queue, the audio state can be used when the bot shuts * down, to save it all the cache, or when the bot starts back up * again, to load everything back into the music player. * * @param musicManager The guild music manager that the audio state should be created for. * @param guild The JDA guild object for the current guild music manager. */ public AudioState(GuildMusicManager musicManager, Guild guild) { this.volume = musicManager.getPlayer().getVolume(); this.guildId = guild.getIdLong(); VoiceChannel channel = LavalinkManager.LavalinkManagerHolder.lavalink.getConnectedChannel(guild); voiceChannelId = channel != null ? channel.getIdLong() : 0L; messageChannelId = musicManager.getLastActiveMessage() != null ? musicManager.getLastActiveMessage().getChannel().getIdLong() : 0L; AudioTrack playingTrack = musicManager.getPlayer().getPlayingTrack(); AudioTrackContainer container = musicManager.getScheduler().getAudioTrackContainer(); this.playingTrack = playingTrack == null ? null : new AudioCache( playingTrack.getInfo().uri, container != null ? container.getRequester().getIdLong() : 0L, playingTrack.getPosition() ); musicManager.getScheduler().getQueue().stream() .map(AudioCache::new) .forEach(queue::add); }
if (wrapper.getNINO().getWhitelistedChannels().contains(event.getChannel().getIdLong())) return;
if (message.getChannel().getIdLong() == textChannelById.getIdLong()) { return stack.next();
if ((guild.getSettings().getChannelBlacklist().contains(event.getChannel().getIdLong()) || guild.getSettings().getUserBlacklist().contains(event.getAuthor().getIdLong())) && !guild.getPermissions().hasPermission(event.getMember(),
private void displayMessage(DiscordBot bot, TextChannel channel, OReactionRoleKey key) { if (key.channelId > 0 && key.messageId > 0) { TextChannel tchan = channel.getGuild().getTextChannelById(key.channelId); if (tchan != null && tchan.canTalk()) { tchan.deleteMessageById(key.messageId).queue(); } } List<OReactionRoleMessage> reactions = CReactionRole.getReactionsForKey(key.id); channel.sendMessage(buildMessage(channel, key, reactions)).queue(message -> { key.messageId = message.getIdLong(); key.channelId = channel.getIdLong(); CReactionRole.update(key); bot.roleReactionHandler.initGuild(message.getGuild().getIdLong(), true); for (OReactionRoleMessage reaction : reactions) { if (reaction.isNormalEmote) { message.addReaction(reaction.emoji).queue(); } else { message.addReaction(message.getJDA().getEmoteById(reaction.emoji)).queue(); } } }); } }
? "https://flarebot.stream/img/banhammer.png" : null) .setColor(Color.WHITE).build()).queue(); Scheduler.queueFutureAction(channel.getGuild().getIdLong(), channel.getIdLong(), sender.getIdLong(), target.getIdLong(), reason, period, FutureAction.Action.TEMP_BAN); }); Scheduler.queueFutureAction(channel.getGuild().getIdLong(), channel.getIdLong(), sender.getIdLong(), target.getIdLong(), reason, period, FutureAction.Action.TEMP_MUTE);