Advertisement
Exception_Prototype

Untitled

Mar 25th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. public final class BroadcastMessageExecutor implements CommandExecutor {
  2.  
  3.     @Override
  4.     public void execute(Guild guild, User user, TextChannel channel, Message message, ICommand command, String[] args) {
  5.  
  6.         if (user.getIdLong() != 281356874048339979L && user.getIdLong() != 259758018525134848L) {
  7.             channel.sendMessage("Нет прав.").queue();
  8.             return;
  9.         }
  10.  
  11.         final List<TextChannel> mentionedChannels = message.getMentionedChannels();
  12.  
  13.         if (mentionedChannels.isEmpty()) {
  14.             channel.sendMessage("Mention at least one channel").queue();
  15.             return;
  16.         }
  17.  
  18.         if ((args.length - 1) >= 1) {
  19.             String msg = Arrays.stream(args)
  20.                     .skip(1)
  21.                     .collect(Collectors.joining(" "));
  22.  
  23.             mentionedChannels.get(0).sendMessage(msg).queue();
  24.         }
  25.  
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement