use of tk.ardentbot.core.events.InteractiveEvent in project Ardent by adamint.
the class Command method dispatchInteractiveEvent.
private static boolean dispatchInteractiveEvent(OffsetDateTime creationTime, TextChannel channel, Message message, User user, Consumer<Message> function, int time, boolean sendMessage) {
final boolean[] success = { false };
Pair<String, Triplet<String, String, Consumer<Message>>> p = new Pair<>(channel.getId(), new Triplet<>(user.getId(), message.getId(), function));
InteractiveEvent e = GuildUtils.getShard(channel.getJDA()).interactiveEvent;
e.getMessageInteractivesQueue().add(p);
ex.schedule(() -> {
if (e.getMessageInteractivesQueue().contains(p)) {
e.getMessageInteractivesQueue().remove(p);
if (sendMessage) {
if (time >= 15) {
channel.sendMessage("Cancelled your interactive operation because you didn't respond within " + time + " seconds!").queue();
} else {
channel.sendMessage("Cancelled your reaction event because you didn't respond within **" + String.valueOf(time / 1000) + "** seconds").queue();
}
}
}
return success[0];
}, time, TimeUnit.SECONDS);
return success[0];
}
use of tk.ardentbot.core.events.InteractiveEvent in project Ardent by adamint.
the class Command method interactiveReaction.
public static void interactiveReaction(MessageChannel channel, Message message, User user, int seconds, Consumer<MessageReaction> function) {
Pair<String, Triplet<String, String, Consumer<MessageReaction>>> p = new Pair<>(channel.getId(), new Triplet<>(user.getId(), message.getId(), function));
InteractiveEvent e = GuildUtils.getShard(channel.getJDA()).interactiveEvent;
e.getReactionInteractivesQueue().add(p);
ex.schedule(() -> {
if (e.getReactionInteractivesQueue().contains(p)) {
e.getReactionInteractivesQueue().remove(p);
channel.sendMessage("Cancelled your reaction event because you didn't respond in time!").queue();
}
}, seconds, TimeUnit.SECONDS);
}
use of tk.ardentbot.core.events.InteractiveEvent in project Ardent by adamint.
the class Command method dispatchInteractiveEvent.
private static boolean dispatchInteractiveEvent(OffsetDateTime creationTime, TextChannel channel, Message message, Consumer<Message> function, int time, boolean sendMessage) {
final boolean[] success = { false };
Pair<String, Triplet<String, String, Consumer<Message>>> p = new Pair<>(channel.getId(), new Triplet<>(message.getAuthor().getId(), message.getId(), function));
InteractiveEvent e = GuildUtils.getShard(channel.getJDA()).interactiveEvent;
e.getMessageInteractivesQueue().add(p);
ex.schedule(() -> {
if (e.getMessageInteractivesQueue().contains(p)) {
e.getMessageInteractivesQueue().remove(p);
if (sendMessage) {
if (time >= 15) {
channel.sendMessage("Cancelled your interactive operation because you didn't respond within " + time + " seconds!").queue();
} else {
channel.sendMessage("Cancelled your reaction event because you didn't respond within **" + String.valueOf(time / 1000) + "** seconds").queue();
}
}
}
return success[0];
}, time, TimeUnit.SECONDS);
return success[0];
}
Aggregations