public GuildMessageUpdateEvent(JDA api, long responseNumber, Message message) { super(api, responseNumber, message.getIdLong(), message.getTextChannel()); this.message = message; }
public GuildMessageReceivedEvent(JDA api, long responseNumber, Message message) { super(api, responseNumber, message.getIdLong(), message.getTextChannel()); this.message = message; }
static String toChannel(Message message, String string) { if (message.getTextChannel() == null || string == null) return string; return parseChannel(message.getTextChannel(), string); }
TextChannel channel = message.getTextChannel(); if (getJDA().getGuildSetupController().isLocked(channel.getGuild().getIdLong())) return channel.getGuild().getIdLong();
TextChannelImpl channel = (TextChannelImpl) message.getTextChannel(); if (getJDA().getGuildSetupController().isLocked(channel.getGuild().getIdLong())) return channel.getGuild().getIdLong();
/** * Converts the message object to a channel object and parses the channel * and string to the {@link #parseChannel(Channel, String)} method. * * @param message The message that the channel should be retrieved from. * @param string The original string that should be parsed. * @return The parsed string if the given message contains a valid channel instance, * otherwise it will just return the original unchanged string. */ private static String toChannel(@Nonnull Message message, @Nonnull String string) { return parseChannel(message.getTextChannel(), string); }
/** * Gets the level up channel from the current message event and guild * transformer, if no valid level up channel is set for the given * guild, the message text chanel will be returned instead. * * @param message The message event that should be used as a default. * @param guild The guild transformer that should be used to get the level up channel. * @return The level up channel if one is set, otherwise the text channel from the message object. */ private TextChannel getLevelUpChannel(Message message, GuildTransformer guild) { String levelChannel = guild.getLevelChannel(); if (levelChannel == null) { return message.getTextChannel(); } TextChannel channel = message.getGuild().getTextChannelById(levelChannel); return channel == null ? message.getTextChannel() : channel; }
private void delete(Message message) { if (message.getTextChannel().getGuild().getSelfMember() .getPermissions(message.getTextChannel()).contains(Permission.MESSAGE_MANAGE)) message.delete().queue(); }
public CommandMessage(CommandContainer container, DatabaseEventHolder databaseEventHolder, Message message, boolean mentionableCommand, String[] aliasArguments) { if (container != null) { setI18nCommandPrefix(container); } this.message = message; this.guild = message.getGuild(); this.member = message.getMember(); this.channel = message.getTextChannel(); this.databaseEventHolder = databaseEventHolder; this.mentionableCommand = mentionableCommand; this.aliasArguments = aliasArguments.length == 0 ? null : String.join(" ", aliasArguments); }
public void setLastNPMessage(Message m) { lastNP.put(m.getGuild().getIdLong(), new Pair<>(m.getTextChannel().getIdLong(), m.getIdLong())); }
public void addReactionListener(long guildId, Message message, CommandReactionListener<?> handler) { if (handler == null) { return; } if (message.getChannelType().equals(ChannelType.TEXT)) { if (!PermissionUtil.checkPermission(message.getTextChannel(), message.getGuild().getSelfMember(), Permission.MESSAGE_ADD_REACTION)) { return; } } if (!reactions.containsKey(guildId)) { reactions.put(guildId, new ConcurrentHashMap<>()); } if (!reactions.get(guildId).containsKey(message.getIdLong())) { for (String emote : handler.getEmotes()) { message.addReaction(emote).complete(); } reactions.get(guildId).put(message.getIdLong(), handler); } }
@Override public boolean canTalk() { if (!isGuildMessage()) { return true; } return message.getGuild().getSelfMember().hasPermission(message.getTextChannel(), Permission.MESSAGE_WRITE, Permission.MESSAGE_READ, Permission.MESSAGE_EMBED_LINKS ); }
if (!message.getGuild().getSelfMember().hasPermission(message.getTextChannel(), permission.getPermission())) { missingBotPermissions.add(permission);
public static void deleteMessage(@Nonnull Message message, int delay, TimeUnit timeUnit) { if (message.getJDA().getSelfUser().getId().equals(message.getAuthor().getId())) { handleDeleteMessage(message, delay, timeUnit); } else if (message.getGuild() != null && message.getGuild().getSelfMember().hasPermission(message.getTextChannel(), Permission.MESSAGE_MANAGE)) { handleDeleteMessage(message, delay, timeUnit); } }
public void editBlocking(Message msg, String newContent) { if (!msg.getChannelType().equals(ChannelType.TEXT)) { return; } TextChannel channel = botInstance.getJda().getTextChannelById(msg.getTextChannel().getId()); if (channel == null) { return; } botInstance.queue.add(channel.editMessageById(msg.getId(), newContent)); }
public void addReaction(Message message) { if (!(message.getChannel().getType() == ChannelType.TEXT && message.getGuild().getSelfMember() .hasPermission(message.getTextChannel(), Permission.MESSAGE_HISTORY))) { message.getChannel().sendMessage("I can't add buttons due to not having the `Message History` permission!").queue(); return; } this.message = message; if (unicode != null) message.addReaction(unicode).queue(); else { try { message.addReaction(Getters.getEmoteById(emoteId)).queue(); } catch (IllegalArgumentException ignored) {} } }
message.getTextChannel().sendMessage("I don't have the `Embed Links` permission, the permission is required for all of my commands to work.\nhttps://avairebot.com/missing-embed-permissions.png\nThis error can sometimes occur when the `everyone` role has it disabled and no other roles enables it.\nThis message will be automatically deleted in 30 seconds.") .queue(newMessage -> newMessage.delete().queueAfter(30, TimeUnit.SECONDS, null, RestActionUtil.ignore));
Message jdaMessage = (Message) object; return parseGuild(jdaMessage.getGuild(), parseChannel(jdaMessage.getTextChannel(), parseUser(jdaMessage.getAuthor(), message))); return parseChannel(((Message) object).getTextChannel(), message);
if (PermissionUtil.checkPermission(message.getTextChannel(), guild.getSelfMember(), Permission.MESSAGE_ADD_REACTION, Permission.MESSAGE_HISTORY)) { message.addReaction(Emojibet.STAR).complete(); message.addReaction(Emojibet.NEXT_TRACK).complete();
updateSongMessage(user, message1, message1.getTextChannel()); })); ButtonUtil.sendButtonedMessage(channel, eb.build(), buttonGroup);