use of sh.okx.timeapi.TimeAPI in project Gary by help-chat.
the class SlowModeCommand method execute.
@Override
protected void execute(GuildMessageReceivedEvent e, String[] args) {
TextChannel channel = e.getChannel();
TimeAPI slowmodeTime = new TimeAPI(args[0]);
TimeAPI lastTime = new TimeAPI(args[1]);
e.getMessage().delete().queue();
channel.getManager().setSlowmode((int) slowmodeTime.getSeconds()).queue();
Task.scheduleAsync(r -> channel.getManager().setSlowmode(0).queue(), lastTime.getMilliseconds(), TimeUnit.MILLISECONDS);
MessageEmbed message = new EmbedBuilder().setColor(Constants.GREEN).setDescription("\uD83D\uDC22 Slowmode has been activated.").build();
channel.sendMessage(message).queue();
}
use of sh.okx.timeapi.TimeAPI in project Gary by help-chat.
the class NewGiveaway method execute.
@Override
protected void execute(GuildMessageReceivedEvent e, String[] args) {
GiveawayBuilder builder = new GiveawayBuilder();
builder.setAuthor(e.getAuthor());
builder.setEmote(args[0]);
builder.setPrize(args[1]);
TimeAPI time = new TimeAPI(args[2]);
builder.setTime(time);
builder.setTimeLeft(time);
giveawayHandler.add(builder.build(garyBot));
}
use of sh.okx.timeapi.TimeAPI in project Gary by help-chat.
the class ServiceHandler method sendError.
private void sendError(User author, TextChannel channel, String message) {
String name = channel.getName().toLowerCase();
MessageUtils.sendMessageHaste(String.join("\n", Lang.getAlternateList("formats.error.message", channel.getAsMention(), String.join("\n", Lang.getAlternateList("formats." + name + ".requirements")), String.join("\n", Lang.getAlternateList("formats." + name + ".template")), message)), author, channel, String.join("\n", Lang.getAlternateList("formats.error.backup-message", author.getAsMention(), channel.getAsMention())), new TimeAPI("30secs"));
}
Aggregations