Search in sources :

Example 1 with TimeAPI

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();
}
Also used : TextChannel(net.dv8tion.jda.api.entities.TextChannel) EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) MessageEmbed(net.dv8tion.jda.api.entities.MessageEmbed) TimeAPI(sh.okx.timeapi.TimeAPI)

Example 2 with TimeAPI

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));
}
Also used : TimeAPI(sh.okx.timeapi.TimeAPI) GiveawayBuilder(me.piggypiglet.gary.core.objects.giveaways.GiveawayBuilder)

Example 3 with TimeAPI

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"));
}
Also used : TimeAPI(sh.okx.timeapi.TimeAPI)

Aggregations

TimeAPI (sh.okx.timeapi.TimeAPI)3 GiveawayBuilder (me.piggypiglet.gary.core.objects.giveaways.GiveawayBuilder)1 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)1 MessageEmbed (net.dv8tion.jda.api.entities.MessageEmbed)1 TextChannel (net.dv8tion.jda.api.entities.TextChannel)1