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) { } }
os.close(); user.openPrivateChannel().complete().sendFile(image, fileName, null) .queue(); } catch (IOException | ErrorResponseException e) {
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(); } }
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)); } }
/** * 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 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(); } }
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); }); }); } }
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; } }
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()
} catch (PermissionException e) { if (user != null && !user.isBot()) { user.openPrivateChannel().queue(privateChannel -> { String message = String.format( "**dabBot does not have permission to connect to the %s voice channel.**\nTo fix this, " +
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); }
user.openPrivateChannel().queue(channel -> { EmbedBuilder message = MessageFactory.createEmbeddedBuilder() .setColor(action.getType().getColor())
FlareBot.LOGGER.error("Failed to write data", e); sender.openPrivateChannel().complete().sendFile(new File("data.json"), new MessageBuilder() .append('\u200B').build()).queue();