Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. @Override
  2. public void onExecute(Context cont) {
  3. String arg = cont.event.getMessage().getContent().replace("-slowmode ", "");
  4. MessageHistory history = new MessageHistory(cont.event.getTextChannel());
  5. List<Message> msgs;
  6. int timerMax;
  7. boolean slow = false;
  8. if (StringUtils.isNumeric(arg)) {
  9. Static.LOG.info("good");
  10. timerMax = Integer.parseInt(arg);
  11. slow = true;
  12. cont.event.getChannel()
  13. .sendMessage(
  14. cont.event.getTextChannel().getAsMention() + " is now in slow mode. (" + timerMax + " seconds)")
  15. .queue();
  16. if (slow)
  17. //try {
  18. Static.LOG.info("good2");
  19. for (int i = 0; i >= timerMax; i++) {
  20. Static.LOG.info("good3");
  21. /**msgs = history.retrievePast(15).complete(true);
  22. cont.event.getTextChannel().deleteMessages(msgs).complete(true);
  23. EmbedBuilder em = new EmbedBuilder();
  24. em.setColor(Color.RED).setTitle("Error", null)
  25. .setDescription("Whoa, slow down there! You're sending too many messages. Try again in **"
  26. + timerMax + "** seconds.");
  27. cont.event.getAuthor().openPrivateChannel().queue(ch -> {
  28. ch.sendMessage(em.build()).queue();
  29. });**/
  30. }
  31. //} catch (Exception e) {
  32. // e.printStackTrace();
  33. //}
  34. }
  35.  
  36. if (arg.equals("off")) {
  37. slow = false;
  38. cont.event.getChannel().sendMessage(cont.event.getTextChannel().getAsMention() + " is no longer in slow mode.")
  39. .queue();
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement