net.dv8tion.jda.core.entities.Emote Java Examples

The following examples show how to use net.dv8tion.jda.core.entities.Emote. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmoteCmd.java    From Selfbot with Apache License 2.0 6 votes vote down vote up
@Override
protected void execute(String args, MessageReceivedEvent event) {
    String id = args.replaceAll("<:.+:(\\d+)>", "$1");
    Emote emote = event.getJDA().getEmoteById(id);
    if(emote==null)
        tempReply("Invalid emote or emote ID", event);
    else
    {
        EmbedBuilder builder = new EmbedBuilder();
        if(event.getGuild()!=null)
            builder.setColor(event.getGuild().getSelfMember().getColor());
        builder.setImage(emote.getImageUrl());
        builder.setDescription(emote.getAsMention()+" **:"+emote.getName()+":**\nID: **"+emote.getId()+"**\nGuild: **"+emote.getGuild().getName()+"**");
        reply(builder.build(), event);
    }
}
 
Example #2
Source File: Getters.java    From FlareBot with MIT License 4 votes vote down vote up
@Nullable
public static Emote getEmoteById(long emoteId) {
    return getShardManager().getEmoteById(emoteId);
}
 
Example #3
Source File: GuildUtils.java    From FlareBot with MIT License 2 votes vote down vote up
/**
 * Gets an {@link Emote} from an id.
 *
 * @param l the id as a long of the emote
 * @return null if the id is invalid or wasn't found, otherwise a {@link Emote}
 */
public static Emote getEmoteById(long l) {
    return Getters.getGuildCache().stream().map(g -> g.getEmoteById(l))
            .filter(Objects::nonNull).findFirst().orElse(null);
}