Search in sources :

Example 26 with CommandObject

use of com.github.vaerys.commands.CommandObject in project DiscordSailv2 by Vaerys-Dawn.

the class DailyMsg method getInfo.

public XEmbedBuilder getInfo(DailyMessage messageObject, CommandObject command) {
    XEmbedBuilder embedBuilder = new XEmbedBuilder(command);
    IUser user = command.client.get().getUserByID(messageObject.getUserID());
    if (user != null) {
        embedBuilder.withAuthorName(user.getName() + "#" + user.getDiscriminator());
    }
    if (messageObject.getDay() != null) {
        embedBuilder.withTitle(messageObject.getDay() + "");
    }
    String contents = messageObject.getContents(new CommandObject(command.guild, command.channel.get()));
    if (contents.matches("^(> |\\*> |\\*\\*> |\\*\\*\\*> |_> |__> |`> |```> ).*$") || contents.startsWith("> ")) {
        embedBuilder.withDesc(contents);
    } else {
        embedBuilder.withDesc("> " + contents);
    }
    String formattedFooter;
    if (messageObject.getUID() != -1) {
        formattedFooter = new Formatter().format("UID: %04d", messageObject.getUID()).toString();
    } else {
        formattedFooter = messageObject.getSpecialID();
    }
    embedBuilder.withFooterText(formattedFooter);
    return embedBuilder;
}
Also used : CommandObject(com.github.vaerys.commands.CommandObject) XEmbedBuilder(com.github.vaerys.objects.XEmbedBuilder) Formatter(java.util.Formatter) IUser(sx.blah.discord.handle.obj.IUser)

Aggregations

CommandObject (com.github.vaerys.commands.CommandObject)26 Collectors (java.util.stream.Collectors)13 SAILType (com.github.vaerys.enums.SAILType)12 ChannelSetting (com.github.vaerys.enums.ChannelSetting)11 Utility (com.github.vaerys.main.Utility)11 Command (com.github.vaerys.templates.Command)10 XEmbedBuilder (com.github.vaerys.objects.XEmbedBuilder)9 List (java.util.List)9 Permissions (sx.blah.discord.handle.obj.Permissions)9 RequestHandler (com.github.vaerys.handlers.RequestHandler)7 GuildHandler (com.github.vaerys.handlers.GuildHandler)6 ArrayList (java.util.ArrayList)6 UserObject (com.github.vaerys.masterobjects.UserObject)5 SubCommandObject (com.github.vaerys.objects.SubCommandObject)5 EventSubscriber (sx.blah.discord.api.events.EventSubscriber)5 GuildObject (com.github.vaerys.masterobjects.GuildObject)4 ZonedDateTime (java.time.ZonedDateTime)4 java.util (java.util)4 IChannel (sx.blah.discord.handle.obj.IChannel)4 IRole (sx.blah.discord.handle.obj.IRole)4