当前位置: 首页>>代码示例>>Java>>正文


Java CommandEvent.reactError方法代码示例

本文整理汇总了Java中com.jagrosh.jdautilities.commandclient.CommandEvent.reactError方法的典型用法代码示例。如果您正苦于以下问题:Java CommandEvent.reactError方法的具体用法?Java CommandEvent.reactError怎么用?Java CommandEvent.reactError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jagrosh.jdautilities.commandclient.CommandEvent的用法示例。


在下文中一共展示了CommandEvent.reactError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replyError

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
public void replyError(Config config, CommandEvent commandEvent, Throwable throwable, LocaleService localeService) {
    if (config != null && config.getReplyInDmWhenPossible()) {
        commandEvent.replyInDM(throwable.getMessage());
        commandEvent.reactError();
        handleOriginMessage(commandEvent);
    } else {
        commandEvent.reactError();
        EmbedBuilder embedBuilder = new EmbedBuilder();
        embedBuilder.setAuthor(null, null, null);
        embedBuilder.setTitle(null);
        embedBuilder.setDescription(throwable.getMessage());
        final String msgRemoveText = localeService.getMessageFor(LocaleService.ERROR_KEEP_CHAT_CLEAN,
                localeService.getLocaleForUser(commandEvent.getAuthor()),
                String.valueOf(BotServerMain.timeToRemoveFeedbackInSeconds));
        embedBuilder.setFooter(msgRemoveText, null);
        final MessageEmbed messageEmbed = embedBuilder.build();
        replyThenDeleteFeedbackAndOriginMessageAfterXTime(commandEvent, messageEmbed,
                BotServerMain.timeToRemoveFeedbackInSeconds, TimeUnit.SECONDS);
    }
}
 
开发者ID:magnusmickelsson,项目名称:pokeraidbot,代码行数:22,代码来源:CleanUpMostFeedbackStrategy.java

示例2: replyError

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
public void replyError(Config config, CommandEvent commandEvent, Throwable throwable, LocaleService localeService) {
    if (config != null && config.getReplyInDmWhenPossible()) {
        commandEvent.replyInDM(throwable.getMessage());
        commandEvent.reactError();
    } else {
        commandEvent.reactError();
        EmbedBuilder embedBuilder = new EmbedBuilder();
        embedBuilder.setAuthor(null, null, null);
        embedBuilder.setTitle(null);
        embedBuilder.setDescription(throwable.getMessage());
        final String msgRemoveText = localeService.getMessageFor(LocaleService.ERROR_KEEP_CHAT_CLEAN,
                localeService.getLocaleForUser(commandEvent.getAuthor()),
                String.valueOf(BotServerMain.timeToRemoveFeedbackInSeconds));
        embedBuilder.setFooter(msgRemoveText, null);
        final MessageEmbed messageEmbed = embedBuilder.build();
        replyThenDeleteFeedbackAndOriginMessageAfterXTime(commandEvent, messageEmbed,
                BotServerMain.timeToRemoveFeedbackInSeconds, TimeUnit.SECONDS);
    }
}
 
开发者ID:magnusmickelsson,项目名称:pokeraidbot,代码行数:21,代码来源:DefaultFeedbackStrategy.java

示例3: getFeedbackStrategyIfPossible

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
private Config.FeedbackStrategy getFeedbackStrategyIfPossible(CommandEvent event, String enumValue) {
    Config.FeedbackStrategy valueToSet = null;
    if (enumValue != null) {
        try {
            valueToSet = Config.FeedbackStrategy.valueOf(enumValue.toUpperCase());
        } catch (Throwable t) {
            event.replyInDM("Bad value of " + Config.FeedbackStrategy.class.getSimpleName() + ". Available values: " +
                    StringUtils.join(Config.FeedbackStrategy.values(), ", "));
            event.reactError();
            return null;
        }
    }
    return valueToSet;
}
 
开发者ID:magnusmickelsson,项目名称:pokeraidbot,代码行数:15,代码来源:InstallCommand.java

示例4: getGroupCreationStrategyIfPossible

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
private Config.RaidGroupCreationStrategy getGroupCreationStrategyIfPossible(CommandEvent event, String enumValue) {
    Config.RaidGroupCreationStrategy valueToSet = null;
    if (enumValue != null) {
        try {
            valueToSet = Config.RaidGroupCreationStrategy.valueOf(enumValue.toUpperCase());
        } catch (Throwable t) {
            event.replyInDM("Bad value of " + Config.RaidGroupCreationStrategy.class.getSimpleName() +
                    ". Available values: " +
                    StringUtils.join(Config.RaidGroupCreationStrategy.values(), ", "));
            event.reactError();
            return null;
        }
    }
    return valueToSet;
}
 
开发者ID:magnusmickelsson,项目名称:pokeraidbot,代码行数:16,代码来源:InstallCommand.java

示例5: replyError

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
public void replyError(Config config, CommandEvent commandEvent, Throwable throwable, LocaleService localeService) {
    if (config != null && config.getReplyInDmWhenPossible()) {
        commandEvent.replyInDM(throwable.getMessage());
        commandEvent.reactError();
    } else {
        commandEvent.reactError();
        EmbedBuilder embedBuilder = new EmbedBuilder();
        embedBuilder.setAuthor(null, null, null);
        embedBuilder.setTitle(null);
        embedBuilder.setDescription(throwable.getMessage());
        final MessageEmbed messageEmbed = embedBuilder.build();
        commandEvent.reply(messageEmbed);
    }
}
 
开发者ID:magnusmickelsson,项目名称:pokeraidbot,代码行数:16,代码来源:KeepAllFeedbackStrategy.java

示例6: changeGroupTime

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
private boolean changeGroupTime(CommandEvent commandEvent, Config config, User user, String userName, Raid raid,
                                LocalDateTime newDateTime) {
    boolean groupChanged = false;
    final Set<RaidGroup> groups = raidRepository.getGroups(raid);
    final Set<EmoticonSignUpMessageListener> listenersToCheck =
            getListenersToCheck(commandEvent, config, user, raid, groups);

    for (EmoticonSignUpMessageListener listener : listenersToCheck) {
        final String raidId = raid.getId();
        final LocalDateTime currentStartAt = listener.getStartAt();
        if (currentStartAt != null && currentStartAt.equals(newDateTime)) {
            LOGGER.info("Group is already at input time.");
            // This group is already at the time to change to
            commandEvent.reactError();
        } else if (currentStartAt != null) {
            LOGGER.info("Changing group time from " + currentStartAt + " to " + newDateTime);
            RaidGroup raidGroup = raidRepository.changeGroup(user, raidId, listener.getUserId(),
                    currentStartAt, newDateTime);
            raidRepository.moveAllSignUpsForTimeToNewTime(raidId, currentStartAt, newDateTime, user);
            listener.setStartAt(newDateTime);
            groupChanged = true;
            replyBasedOnConfigAndRemoveAfter(config, commandEvent,
                    localeService.getMessageFor(LocaleService.MOVED_GROUP,
                            localeService.getLocaleForUser(user),
                            printTimeIfSameDay(currentStartAt),
                            printTimeIfSameDay(newDateTime), raid.getGym().getName()),
                    BotServerMain.timeToRemoveFeedbackInSeconds);
            LOGGER.info("Group time changed. Group: " + raidGroup);
            commandEvent.reactSuccess();
        } else {
            LOGGER.info("Group is about to get cleaned up.");
            commandEvent.reactError();
            // This group is about to get cleaned up since its start time is null
            replyBasedOnConfigAndRemoveAfter(config, commandEvent,
                    localeService.getMessageFor(LocaleService.GROUP_CLEANING_UP,
                            localeService.getLocaleForUser(user)),
                    BotServerMain.timeToRemoveFeedbackInSeconds);
            return true;
        }
    }
    if (!groupChanged) {
        throw new UserMessedUpException(userName,
                localeService.getMessageFor(LocaleService.BAD_SYNTAX, localeService.getLocaleForUser(user),
                        "!raid change group 10:00 solna platform"));
    }
    return false;
}
 
开发者ID:magnusmickelsson,项目名称:pokeraidbot,代码行数:48,代码来源:AlterRaidCommand.java


注:本文中的com.jagrosh.jdautilities.commandclient.CommandEvent.reactError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。