public MessageBuilder(Message message) { if (message != null) { isTTS = message.isTTS(); builder.append(message.getContentRaw()); List<MessageEmbed> embeds = message.getEmbeds(); if (embeds != null && !embeds.isEmpty()) embed = embeds.get(0); } }
/** * The author of this message * * @return The author of this message * * @see net.dv8tion.jda.core.entities.User User */ public User getAuthor() { return message.getAuthor(); }
public MessageReceivedEvent(JDA api, long responseNumber, Message message) { super(api, responseNumber, message.getIdLong(), message.getChannel()); this.message = message; }
public GuildMessageUpdateEvent(JDA api, long responseNumber, Message message) { super(api, responseNumber, message.getIdLong(), message.getTextChannel()); this.message = message; }
/** * Message fields: * - Message ID * - Author ID * - Channel ID * - Guild ID * - Raw Content * - Timestamp (Epoch seconds) * * @param message The message to serialise * @return The serialised message */ public static String getRedisMessageJson(Message message) { return FlareBot.GSON.toJson(new RedisMessage( message.getId(), message.getAuthor().getId(), message.getChannel().getId(), message.getGuild().getId(), message.getContentRaw(), message.getCreationTime().toInstant().toEpochMilli() )); }
@Override public String getRawMessage() { return message.getContentRaw(); }
/** * Applies the sendable information of the provided {@link net.dv8tion.jda.core.entities.Message Message} * to this MessageAction settings. * <br>This will override all existing settings <b>if</b> new settings are available. * * <p><b>This does not copy files!</b> * * @param message * The nullable Message to apply settings from * * @throws java.lang.IllegalArgumentException * If the message contains an {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbed} * that exceeds the sendable character limit, * see {@link net.dv8tion.jda.core.entities.MessageEmbed#isSendable(net.dv8tion.jda.core.AccountType) MessageEmbed.isSendable(AccountType)} * * @return Updated MessageAction for chaining convenience */ @CheckReturnValue public MessageAction apply(final Message message) { if (message == null || message.getType() != MessageType.DEFAULT) return this; final List<MessageEmbed> embeds = message.getEmbeds(); if (embeds != null && !embeds.isEmpty()) embed(embeds.get(0)); files.clear(); return content(message.getContentRaw()).tts(message.isTTS()); }
switch (message.getChannelType()) TextChannelImpl channel = (TextChannelImpl) message.getTextChannel(); if (getJDA().getGuildSetupController().isLocked(channel.getGuild().getIdLong())) return channel.getGuild().getIdLong(); channel.setLastMessageId(message.getIdLong()); manager.handle( new GuildMessageReceivedEvent( PrivateChannelImpl channel = (PrivateChannelImpl) message.getPrivateChannel(); channel.setLastMessageId(message.getIdLong()); manager.handle( new PrivateMessageReceivedEvent( GroupImpl channel = (GroupImpl) message.getGroup(); channel.setLastMessageId(message.getIdLong()); manager.handle( new GroupMessageReceivedEvent(
@Override public MessageAction editMessageById(String id, Message newContent) { Checks.notNull(newContent, "Message"); //checkVerification(); no verification needed to edit a message checkPermission(Permission.MESSAGE_READ); checkPermission(Permission.MESSAGE_WRITE); if (newContent.getContentRaw().isEmpty() && !newContent.getEmbeds().isEmpty()) checkPermission(Permission.MESSAGE_EMBED_LINKS); //Call MessageChannel's default return TextChannel.super.editMessageById(id, newContent); }
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 setLastNPMessage(Message m) { lastNP.put(m.getGuild().getIdLong(), new Pair<>(m.getTextChannel().getIdLong(), m.getIdLong())); }
private void sendTagInformationMessage(MessageReceivedEvent event) { String author = "**Senither#0001**"; if (event.getMessage().getChannelType().isGuild() && event.getGuild().getMemberById(88739639380172800L) != null) { author = "<@88739639380172800>"; } MessageFactory.makeEmbeddedMessage(event.getMessage().getChannel(), Color.decode("#E91E63"), String.format(mentionMessage, avaire.getSelfUser().getName(), author, CommandHandler.getLazyCommand("help").getCommand().generateCommandTrigger(event.getMessage()), AppInfo.getAppInfo().version )) .setFooter("This message will be automatically deleted in one minute.") .queue(message -> message.delete().queueAfter(1, TimeUnit.MINUTES, null, RestActionUtil.ignore)); }
public void editAsync(Message message, String content) { botInstance.queue.add(message.editMessage(content.substring(0, Math.min(1999, content.length())))); }
@Override public MessageChannel getMessageChannel() { return message.getChannel(); }
/** * Checks if the author of the message, of the message was * sent in a guild, that the guild is on the blacklist. * * @param message The message that should be checked. * @return <code>True</code> if either the user, or the entire * server is blacklisted, <code>False</code> otherwise. */ public boolean isBlacklisted(@Nonnull Message message) { return isBlacklisted(message.getAuthor()) || (message.getChannelType().isGuild() && isBlacklisted(message.getGuild())); }
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)); }
private String generateServer(Message message) { if (!message.getChannelType().isGuild()) { return "PRIVATE"; } return String.format(propertyOutput, message.getGuild().getName(), message.getGuild().getId() ); }
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); }