Search in sources :

Example 1 with ApplicationInfo

use of discord4j.core.object.entity.ApplicationInfo in project KaellyBot by Kaysoro.

the class AboutCommand method request.

@Override
public void request(MessageCreateEvent event, Message message, Matcher m, Language lg) {
    Optional<ApplicationInfo> appInfo = message.getClient().getApplicationInfo().blockOptional();
    if (appInfo.isPresent()) {
        message.getChannel().flatMap(chan -> chan.createEmbed(spec -> {
            spec.setTitle(Translator.getLabel(lg, "about.title").replace("{name}", Constants.name).replace("{version}", Constants.version)).setImage(Constants.changelog).setThumbnail(appInfo.get().getIconUrl(Image.Format.PNG).orElse(null)).addField(Translator.getLabel(lg, "about.invite.title"), Translator.getLabel(lg, "about.invite.desc").replace("{name}", Constants.name).replace("{invite}", Constants.invite), false).addField(Translator.getLabel(lg, "about.support.title"), Translator.getLabel(lg, "about.support.desc").replace("{name}", Constants.name).replace("{discordInvite}", Constants.discordInvite), false).addField(Translator.getLabel(lg, "about.twitter.title"), Translator.getLabel(lg, "about.twitter.desc").replace("{name}", Constants.name).replace("{twitter}", Constants.twitterAccount), false).addField(Translator.getLabel(lg, "about.opensource.title"), Translator.getLabel(lg, "about.opensource.desc").replace("{git}", Constants.git), false).addField(Translator.getLabel(lg, "about.free.title"), Translator.getLabel(lg, "about.free.desc").replace("{paypal}", Constants.paypal), false).addField(Translator.getLabel(lg, "about.privacy.title"), Translator.getLabel(lg, "about.privacy.desc").replace("{paypal}", Constants.paypal), false).addField(Translator.getLabel(lg, "about.graphist.title"), Translator.getLabel(lg, "about.graphist.desc").replace("{graphist}", Graphist.ELYCANN.toMarkdown()), false);
            StringBuilder st = new StringBuilder();
            for (Donator donator : Donator.values()) st.append(donator.getName()).append(", ");
            st.setLength(st.length() - 2);
            spec.addField(Translator.getLabel(lg, "about.donators.title"), st.toString() + ".", false);
        })).subscribe();
    }
}
Also used : User(discord4j.core.object.entity.User) Language(enums.Language) MessageCreateEvent(discord4j.core.event.domain.message.MessageCreateEvent) AbstractCommand(commands.model.AbstractCommand) Constants.authorName(data.Constants.authorName) Constants(data.Constants) ApplicationInfo(discord4j.core.object.entity.ApplicationInfo) Donator(enums.Donator) Image(discord4j.rest.util.Image) Matcher(java.util.regex.Matcher) Constants.authorAvatar(data.Constants.authorAvatar) Message(discord4j.core.object.entity.Message) Optional(java.util.Optional) Graphist(enums.Graphist) Translator(util.Translator) Donator(enums.Donator) ApplicationInfo(discord4j.core.object.entity.ApplicationInfo)

Aggregations

AbstractCommand (commands.model.AbstractCommand)1 Constants (data.Constants)1 Constants.authorAvatar (data.Constants.authorAvatar)1 Constants.authorName (data.Constants.authorName)1 MessageCreateEvent (discord4j.core.event.domain.message.MessageCreateEvent)1 ApplicationInfo (discord4j.core.object.entity.ApplicationInfo)1 Message (discord4j.core.object.entity.Message)1 User (discord4j.core.object.entity.User)1 Image (discord4j.rest.util.Image)1 Donator (enums.Donator)1 Graphist (enums.Graphist)1 Language (enums.Language)1 Optional (java.util.Optional)1 Matcher (java.util.regex.Matcher)1 Translator (util.Translator)1