@Override public MessageAction sendMessage(CharSequence text) { checkBot(); return PrivateChannel.super.sendMessage(text); }
@Override public MessageAction sendMessage(MessageEmbed embed) { checkBot(); return PrivateChannel.super.sendMessage(embed); }
@Override public MessageAction sendMessage(Message msg) { checkBot(); return PrivateChannel.super.sendMessage(msg); }
public static void sendPM(User user, String message) { try { user.openPrivateChannel().complete() .sendMessage(message.substring(0, Math.min(message.length(), 1999))).queue(); } catch (ErrorResponseException ignored) { } }
public static void sendPM(TextChannel channel, User user, String message) { try { user.openPrivateChannel().complete() .sendMessage(message.substring(0, Math.min(message.length(), 1999))).queue(); } catch (ErrorResponseException e) { channel.sendMessage(message).queue(); } }
/** * Sends the "Thanks for Voting" message in a direct message * to the given user with the given amount of points. * * @param user The user that should received the message. * @param points The amounts of points that should be displayed in the message. */ public void SendThanksForVotingMessageInDM(@Nonnull User user, int points) { user.openPrivateChannel().queue(message -> message.sendMessage( buildThanksForVotingMessage(points) ).queue(null, RestActionUtil.ignore), RestActionUtil.ignore); }
public void sendPrivateMessage(User target, String message, final Consumer<Message> onSuccess) { if (target != null && !target.isFake() && message != null && !message.isEmpty()) { botInstance.queue.add(target.openPrivateChannel(), privateChannel -> botInstance.queue.add(privateChannel.sendMessage(message), onSuccess)); } }
public static void sendPM(TextChannel channel, User user, String message, String fail) { user.openPrivateChannel().queue(pc -> pc.sendMessage(message).queue(), t -> { channel.sendMessage(fail).queue(); }); }
public static void sendPM(TextChannel channel, User user, EmbedBuilder message) { try { user.openPrivateChannel().complete().sendMessage(message.build()).complete(); } catch (ErrorResponseException e) { channel.sendMessage(message.build()).queue(); } }
public Message reply(String message) { try { return event.getChannel() .sendMessage(message.replace("{{prefix}}", Command.this.bot.getConfigs().config.prefix)) .complete(); } catch (PermissionException e) { event.getAuthor().openPrivateChannel().queue(privateChannel -> { privateChannel.sendMessage("**dabBot does not have permission to talk in the #" + event.getTextChannel().getName() + " text channel.**\nTo fix this, allow dabBot to " + "`Read Messages` and `Send Messages` in that text channel.\nIf you are not the guild " + "owner, please send this to them.").queue(); }); return null; } }
private void handleReminderMessage(CommandMessage context, String message, int time, boolean respondInDM) { if (respondInDM) { context.getAuthor().openPrivateChannel().queue(privateChannel -> { privateChannel.sendMessage(message).queueAfter(time, TimeUnit.SECONDS, null, RestActionUtil.ignore); }, throwable -> { context.getMessageChannel().sendMessage(message).queueAfter(time, TimeUnit.SECONDS, null, RestActionUtil.ignore); }); } else { context.getMessageChannel().sendMessage(message).queueAfter(time, TimeUnit.SECONDS, null, throwable -> { context.getAuthor().openPrivateChannel().queue(privateChannel -> { privateChannel.sendMessage(message).queueAfter(time, TimeUnit.SECONDS, null, RestActionUtil.ignore); }); }); } }
if (!tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_EMBED_LINKS)) { tc.getGuild().getOwner().getUser().openPrivateChannel().queue(pc -> { pc.sendMessage("Please give me permission to read message, write messages and embed links in the modlog channel: " + tc.getAsMention() + " or set the modlog channel to one I have access to!").queue();
"are not the guild owner, please send this to them.", voiceChannel.getName()); privateChannel.sendMessage(message).queue(); }); } else {
owner.openPrivateChannel().queue(pc -> pc.sendMessage(msg).queue());
/** * Sends the blacklist message to the given use in a direct * message to let the user know that they have been added * to the blacklist automatically. * * @param user The user that was blacklisted. * @param expires The carbon time instance for when the blacklist expires. */ public void sendBlacklistMessage(User user, Carbon expires) { user.openPrivateChannel().queue(channel -> { channel.sendMessage(MessageFactory.createEmbeddedBuilder() .setColor(Color.decode("#A5306B")) .setTitle("Whoa there!", "https://avairebot.com/") .setFooter("Expires", null) .setTimestamp(expires.getTime().toInstant()) .setDescription("Looks like you're using commands a bit too fast, I've banned you " + "from using any commands, or earning any XP until you cool down a bit.\n" + "Your ban expires in " + expires.addSecond().diffForHumans(true) + ", " + "keep in mind repeating the behavior will get you banned for longer " + "periods of time, eventually if you keep it up you will be banned " + "from using any of my commands permanently." ).build() ).queue(); }, RestActionUtil.ignore); }
channel.sendMessage(message.build()).queue(null, RestActionUtil.ignore); }, RestActionUtil.ignore);