Search in sources :

Example 1 with RelicType

use of me.shadorc.shadbot.data.premium.RelicType in project Shadbot by Shadorc.

the class GenerateRelicCmd method execute.

@Override
public void execute(Context context) throws MissingArgumentException, IllegalCmdArgumentException {
    if (!context.hasArg()) {
        throw new MissingArgumentException();
    }
    RelicType type = Utils.getValueOrNull(RelicType.class, context.getArg());
    if (type == null) {
        throw new IllegalCmdArgumentException(String.format("`%s`in not a valid type. %s", context.getArg(), FormatUtils.formatOptions(RelicType.class)));
    }
    Relic relic = PremiumManager.generateRelic(type);
    BotUtils.sendMessage(String.format(Emoji.CHECK_MARK + " %s relic generated: **%s**", StringUtils.capitalize(type.toString()), relic.getRelicID()), context.getChannel());
}
Also used : IllegalCmdArgumentException(me.shadorc.shadbot.exception.IllegalCmdArgumentException) Relic(me.shadorc.shadbot.data.premium.Relic) MissingArgumentException(me.shadorc.shadbot.exception.MissingArgumentException) RelicType(me.shadorc.shadbot.data.premium.RelicType)

Aggregations

Relic (me.shadorc.shadbot.data.premium.Relic)1 RelicType (me.shadorc.shadbot.data.premium.RelicType)1 IllegalCmdArgumentException (me.shadorc.shadbot.exception.IllegalCmdArgumentException)1 MissingArgumentException (me.shadorc.shadbot.exception.MissingArgumentException)1