@Override public String execute(DiscordBot bot, String[] args, MessageChannel channel, User author, Message inputMessage) { if (items.size() < MIN_QUEUE_ITEMS) { bot.queue.add(channel.sendTyping()); getFMLItems(); } if (!items.isEmpty()) { try { String item = StringEscapeUtils.unescapeHtml4(items.take()); if (item.length() >= 2000) { item = item.substring(0, 1999); } return item; } catch (InterruptedException e) { Launcher.logToDiscord(e, "fml-command", "interrupted"); } } return Templates.command.fml_not_today.formatGuild(channel); }
context.getMessageChannel().sendTyping().queue(); int timeout = args[0].equals("timeout") || args[0].equals("-t") ? NumberUtil.parseInt(args[1], -1) : -1;
@Override public boolean onCommand(CommandMessage context, String[] args) { long start = System.currentTimeMillis(); context.getMessage().getChannel().sendTyping().queue(v -> { long ping = System.currentTimeMillis() - start; context.makeInfo(context.i18n("message")) .set("heartbeat", context.getJDA().getPing()) .set("rating", ratePing(context, ping)) .set("ping", ping) .queue(); }); return true; }
headers.put("User-Agent", "AvaIre-Discord-Bot (" + avaire.getSelfUser().getId() + ")"); context.getMessageChannel().sendTyping().queue();
@Override public boolean onCommand(CommandMessage context, String[] args) { if (!hasApiKey()) { return false; } if (args.length == 0) { return sendErrorMessage(context, "errors.missingArgument", "city"); } DrainWeatherQueueTask.queueWeather(new DrainWeatherQueueTask.WeatherEntity( context.getAuthor().getIdLong(), context.getMessageChannel().getIdLong(), String.join(" ", args) )); context.getMessageChannel().sendTyping().queue(); return true; }
@Override public void doCommand(CommandEvent event) event.getChannel().sendTyping().queue(); String title; if(event.getArgs().isEmpty())
} else if (startedWithMention && BotConfig.BOT_CHATTING_ENABLED) { commandSuccess = false; channel.sendTyping().queue(); outMsg = author.getAsMention() + ", " + bot.chatBotHandler.chat(guildId > 0 ? Long.parseLong(CGuild.getCachedDiscordId(guildId)) : 0L, inputMessage, channel); } else if (BotConfig.BOT_COMMAND_SHOW_UNKNOWN ||