本文整理汇总了Java中net.dv8tion.jda.core.EmbedBuilder.setTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Java EmbedBuilder.setTimestamp方法的具体用法?Java EmbedBuilder.setTimestamp怎么用?Java EmbedBuilder.setTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dv8tion.jda.core.EmbedBuilder
的用法示例。
在下文中一共展示了EmbedBuilder.setTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
public Message render(Color color, Instant now)
{
MessageBuilder mb = new MessageBuilder();
boolean close = now.plusSeconds(6).isAfter(end);
mb.append(Constants.YAY).append(close ? " **G I V E A W A Y** " : " **GIVEAWAY** ").append(Constants.YAY);
EmbedBuilder eb = new EmbedBuilder();
if(close)
eb.setColor(Color.RED);
else if(color==null)
eb.setColor(Constants.BLURPLE);
else
eb.setColor(color);
eb.setFooter((winners==1 ? "" : winners+" Winners | ")+"Ends at",null);
eb.setTimestamp(end);
eb.setDescription("React with "+Constants.TADA+" to enter!\nTime remaining: "+FormatUtil.secondsToTime(now.until(end, ChronoUnit.SECONDS)));
if(prize!=null)
eb.setAuthor(prize, null, null);
if(close)
eb.setTitle("Last chance to enter!!!", null);
mb.setEmbed(eb.build());
return mb.build();
}
示例2: execute
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event) {
EmbedBuilder eb = new EmbedBuilder();
MessageBuilder mb = new MessageBuilder();
mb.append(Constants.YAY+" All about **GiveawayBot** "+Constants.YAY);
//eb.setThumbnail("http://i.imgur.com/sCEbmKa.png");
eb.setTitle("Hold giveaways quickly and easily!");
eb.setDescription("Hello! I'm **GiveawayBot**, and I'm here to make it as easy as possible to hold "
+ "giveaways on your Discord server! I was created by [**jagrosh**#4824](http://jagrosh.com) "
+ "(<@113156185389092864>) using the [JDA]("+JDAInfo.GITHUB+") library ("+JDAInfo.VERSION+") and "
+ "[JDA-Utilities]("+JDAUtilitiesInfo.GITHUB+") ("+JDAUtilitiesInfo.VERSION+"). Check out my "
+ "commands by typing `!ghelp`, and checkout my website at **http://giveawaybot.party**.");
eb.addField("\uD83D\uDCCA Stats", bot.getShards().stream().mapToInt(jda -> jda.getGuilds().size()).sum()+" servers\n"+bot.getShards().size()+" shards\n"
+bot.getShards().stream().mapToInt(jda -> jda.getUsers().size()).sum()+" users", true);
eb.addField("\uD83C\uDF89 Giveaways", bot.getGiveaways().size()+" right now!", true);
eb.addField("\uD83C\uDF10 Links", "[Website]("+Constants.WEBSITE+")\n[Invite]("+Constants.INVITE+")\n[Support](https://discord.gg/0p9LSGoRLu6Pet0k)", true);
eb.setFooter("Last restart", null);
eb.setTimestamp(Constants.START);
eb.setColor(Constants.BLURPLE);
mb.setEmbed(eb.build());
event.getChannel().sendMessage(mb.build()).queue();
}
示例3: logChannel
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
/**
* Logs to the assigned log channel if it has been set
*/
public static void logChannel(LogLevel level, User author, String text, Object... args)
{
if(MDCBot.logChannel != null && level.isHigherThanOrEqualTo(Config.get(EConfigs.LOG_LEVEL)))
{
if(author == null)
author = MDCBot.jda.getSelfUser();
EmbedBuilder message = new EmbedBuilder();
message.setColor(level.colour);
message.setAuthor(getFullUser(author), null, author.getEffectiveAvatarUrl());
message.setTitle(level.toString());
message.setDescription(String.format(text, args));
message.setTimestamp(Instant.now());
MDCBot.logChannel.sendMessage(message.build()).queue();
}
}
示例4: setPhoto
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
private void setPhoto(EmbedBuilder builder, CallbackMessage<CallbackWallPost> message, Photo photo, boolean showText) {
String url = String.format(PHOTO_URL,
Math.abs(message.getGroupId()),
message.getObject().getId(),
Math.abs(photo.getOwnerId()),
photo.getId());
if (showText) {
setText(builder, photo.getText(), url);
}
builder.setImage(coalesce(photo.getPhoto2560(),
photo.getPhoto1280(),
photo.getPhoto807(),
photo.getPhoto604(),
photo.getPhoto130(),
photo.getPhoto75()));
if (photo.getDate() != null) {
builder.setTimestamp(new Date(((long) photo.getDate()) * 1000).toInstant());
}
}
示例5: sendUserInv
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
private void sendUserInv(Member member, MessageChannel channel, String prefix, Color color, Member requestedBy) {
EmbedBuilder embed = new EmbedBuilder();
Long guildID = member.getGuild().getIdLong();
Long userID = member.getUser().getIdLong();
UserProfile up;
try {
up = dbMan.getUserProfile(guildID, userID);
HashMap<Long, Item> inv = up.getInv();
embed.setColor(color);
embed.setAuthor(localize(channel, "command.inv.title", member.getEffectiveName()), null, member.getUser().getAvatarUrl());
if (inv.isEmpty()) {
embed.addField(localize(channel, "command.inc.inventory"), localize(channel, "command.inv.empty"), false);
} else {
for (Item item : inv.values()) {
embed.addField(localize(channel, "command.inv.item", item.getLocalizedName(channel), item.getItemID()), item.getDescription(channel), true);
}
}
if (requestedBy != null)
embed.addField("", localize(channel, "command.inv.requested_by", member.getEffectiveName(), requestedBy.getEffectiveName()), false);
embed.setFooter(localize(channel, "command.inv.usage", prefix + commandName), null);
embed.setTimestamp(Instant.now());
embed.setThumbnail(member.getUser().getAvatarUrl());
channel.sendMessage(embed.build()).queue();
} catch (SQLException e) {
e.printStackTrace();
}
}
示例6: log
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
/**
* Logs a message to the logging channel.
*/
public static void log(MessageEmbed m) {
if (!Config.getLogChannel().equals("0")) {
EmbedBuilder eb = new EmbedBuilder(m);
eb.setTimestamp(OffsetDateTime.now());
DiscordUtils.getTextChannelById(Config.getLogChannel()).sendMessage(eb.build()).queue();
}
}
示例7: trigger
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
public boolean trigger(Status status) {
if(getDiscoChannel() == null || !getDiscoChannel().canTalk()) {
return false;
}
if ((status.isRetweet() && !showRetweets)
|| (status.getInReplyToScreenName() != null && !showReplies)) {
return true;
}
EmbedBuilder em = new EmbedBuilder();
String text = status.getText();
em.setTitle("New tweet from \\@" + status.getUser().getScreenName(),
"https://twitter.com/" + status.getUser().getScreenName()
+ "/status/" + status.getId())
.setColor(Color.MAGENTA)
.setThumbnail(status.getUser().getProfileImageURL())
.setDescription(text);
String url = null;
for(MediaEntity e : status.getMediaEntities()) {
if(this.showPictures && url == null && (e.getType().equals("photo")))
url = e.getMediaURL();
text = text.replaceAll(e.getURL(), "");
}
if(url != null)
em.setImage(url);
if(status.getMediaEntities().length > 0 && url == null || status.getMediaEntities().length > 1) {
em.setFooter("Tweet contains more media", null);
} else {
em.setFooter("Local time", null);
}
em.setTimestamp(Instant.now());
getDiscoChannel().sendMessage(em.build()).queue();
return true;
}
示例8: embedMessage
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
protected MessageEmbed embedMessage(CommandEvent event, String message, ResponseLevel level, String footer) {
EmbedBuilder embedBuilder = new EmbedBuilder();
User bot = event.getJDA().getSelfUser();
embedBuilder.setAuthor(bot.getName() + " #" + bot.getDiscriminator(),
null, bot.getEffectiveAvatarUrl());
embedBuilder.setDescription(message);
footer = footer == null ? (level == null ? ResponseLevel.DEFAULT.getFooter() : level.getFooter()) : footer;
embedBuilder.setFooter(footer, null);
embedBuilder.setTimestamp(event.getMessage().getCreationTime());
embedBuilder.setColor(getResponseColor(level, event.getGuild(), bot));
return embedBuilder.build();
}
示例9: sendProfile
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
private void sendProfile(Member member, MessageChannel channel, String prefix, String userLevelName, Color color, Member requestedBy) {
EmbedBuilder embed = new EmbedBuilder();
Long guildID = member.getGuild().getIdLong();
Long userID = member.getUser().getIdLong();
UserProfile up;
try {
up = dbMan.getUserProfile(guildID, userID);
embed.setColor(color);
embed.setAuthor(localize(channel, "command.profile.profile_of", member.getEffectiveName()), null, member.getUser().getAvatarUrl());
embed.addField(localize(channel, "command.profile.rank"), up.getRankName(), false);
embed.addField(localize(channel, "command.profile.exp"), up.getLevel().toString(), true);
if (up.getRankExp() != null)
embed.addField(localize(channel, "command.profile.exp_required"), up.getRankExp().toString(), true);
else
embed.addField(localize(channel, "command.profile.exp_required"), localize(channel, "command.profile.max_rank"), true);
embed.addField(localize(channel, "command.profile.points"), up.getPoints().toString(), true);
embed.addField(localize(channel, "command.profile.gold"), up.getBalance().toString() + " :moneybag:", true);
embed.addField(localize(channel, "command.profile.tables_flipped"), up.getFlipped().toString(), true);
embed.addField(localize(channel, "command.profile.tables_unflipped"), up.getUnflipped().toString(), true);
embed.addField(localize(channel, "command.profile.werewolf_games"), up.getWerewolfGames().toString(), true);
embed.addField(localize(channel, "command.profile.werewolf_wins"), up.getWerewolfWins().toString(), true);
embed.addField(localize(channel, "command.profile.items"), up.getItemCount().toString(), true);
if (requestedBy != null)
embed.addField("", localize(channel, "command.profile.requested_by", requestedBy.getEffectiveName()), false);
embed.setFooter(localize(channel, "command.profile.notice", prefix), null);
embed.setTimestamp(Instant.now());
embed.setThumbnail(member.getUser().getAvatarUrl());
if (up.getTitle() == null || up.getTitle().equals("")) {
embed.setDescription(userLevelName);
} else {
embed.setDescription(userLevelName + System.lineSeparator() + "**Title:** " + up.getTitle());
}
channel.sendMessage(embed.build()).queue();
} catch (SQLException e) {
e.printStackTrace();
}
}
示例10: end
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
public void end(RestJDA restJDA)
{
MessageBuilder mb = new MessageBuilder();
mb.append(Constants.YAY).append(" **GIVEAWAY ENDED** ").append(Constants.YAY);
EmbedBuilder eb = new EmbedBuilder();
eb.setColor(new Color(1));
eb.setFooter((winners==1 ? "" : winners+" Winners | ")+"Ended at",null);
eb.setTimestamp(end);
if(prize!=null)
eb.setAuthor(prize, null, null);
try {
List<Long> ids = restJDA.getReactionUsers(Long.toString(channelId), Long.toString(messageId), MiscUtil.encodeUTF8(Constants.TADA))
.cache(true).stream().collect(Collectors.toList());
List<Long> wins = selectWinners(ids, winners);
String toSend;
if(wins.isEmpty())
{
eb.setDescription("Could not determine a winner!");
toSend = "A winner could not be determined!";
}
else if(wins.size()==1)
{
eb.setDescription("Winner: <@"+wins.get(0)+">");
toSend = "Congratulations <@"+wins.get(0)+">! You won"+(prize==null ? "" : " the **"+prize+"**")+"!";
}
else
{
eb.setDescription("Winners:");
wins.forEach(w -> eb.appendDescription("\n").appendDescription("<@"+w+">"));
toSend = "Congratulations <@"+wins.get(0)+">";
for(int i=1; i<wins.size(); i++)
toSend+=", <@"+wins.get(i)+">";
toSend+="! You won"+(prize==null ? "" : " the **"+prize+"**")+"!";
}
mb.setEmbed(eb.build());
restJDA.editMessage(channelId, messageId, mb.build()).queue();
restJDA.sendMessage(channelId, toSend).queue();
} catch(Exception e) {
eb.setDescription("Could not determine a winner!");
mb.setEmbed(eb.build());
restJDA.editMessage(channelId, messageId, mb.build()).queue();
restJDA.sendMessage(channelId, "A winner could not be determined!").queue();
}
}
示例11: execute
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
Color color;
Config config = null;
if(event.isFromType(ChannelType.PRIVATE))
color = Color.decode("#33ff00");
else
color = event.getGuild().getSelfMember().getColor();
try
{
config = new Config();
}
catch(Exception e)
{
e.printStackTrace();
}
String title = ":information_source: Information about **"+event.getSelfUser().getName()+"**";
EmbedBuilder builder = new EmbedBuilder();
User owner = event.getJDA().getUserById(config.getOwnerId());
String ownername = owner.getName()+"#"+owner.getDiscriminator();
String ownerid = owner.getId();
builder.setDescription("Hi, I'm Endless! A multipurpose bot designed to be smart.\n"
+ "If you found a bug please contact my dad\n"
+ "("+Const.DEV+")!\n");
builder.addField(":bust_in_silhouette: Owner:", "**"+ownername+"** (**"+ownerid+"**)", false);
builder.addField("<:jda:325395909347115008> Library:", "Java Discord API (JDA) "+JDAInfo.VERSION+" and JDA Utilities "+JDAUtilitiesInfo.VERSION, false);
builder.addField("<:github:326118305062584321> GitHub:", "Did you found a bug? Want improve something?\n"
+ "Please open an Issue or create a PR on GitHub\n"
+ "**https://github.com/ArtutoGamer/Endless**\n", false);
builder.addField(":link: Support Guild:", "**[Support]("+Const.INVITE+")**\n", false);
builder.setFooter("Version: "+Const.VERSION+" | Latest Start", null);
builder.setColor(color);
builder.setTimestamp(event.getClient().getStartTime());
builder.setThumbnail(event.getSelfUser().getAvatarUrl());
event.getChannel().sendMessage(new MessageBuilder().append(title).setEmbed(builder.build()).build()).queue();
}
示例12: onGuildMessageUpdate
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void onGuildMessageUpdate(GuildMessageUpdateEvent event)
{
EmbedBuilder builder = new EmbedBuilder();
Guild guild = event.getGuild();
TextChannel tc = db.getServerlogChannel(guild);
Message message = MessagesLogging.getMsg(event.getMessageIdLong());
Message newmsg = event.getMessage();
String title;
TextChannel channel = FinderUtil.getDefaultChannel(event.getGuild());
if(!(message.getContent().equals("No cached message")) && !(tc==null) && !(event.getAuthor().isBot()))
{
if(!(tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_HISTORY)))
guild.getOwner().getUser().openPrivateChannel().queue(s -> s.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue(
null, (e) -> channel.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue()));
else
{
title = "`[Message Edited]:` :pencil2: **"+message.getAuthor().getName()+"#"+message.getAuthor().getDiscriminator()+"**'s message was edited in "+message.getTextChannel().getAsMention()+":";
builder.setAuthor(message.getAuthor().getName(), null, message.getAuthor().getEffectiveAvatarUrl());
builder.addField("Old Content:", "```"+message.getContent()+"```", false);
builder.addField("New Content:", "```"+newmsg.getContent()+"```", false);
builder.setFooter("Message ID: "+message.getId(), null);
builder.setColor(event.getGuild().getSelfMember().getColor());
builder.setTimestamp(message.getCreationTime());
tc.sendMessage(new MessageBuilder().append(title).setEmbed(builder.build()).build()).queue((m) -> {
MessagesLogging.removeMessage(newmsg.getIdLong());
MessagesLogging.addMessage(newmsg.getIdLong(), newmsg);
});
}
}
else
{
if(!(tc==null) && !(event.getAuthor().isBot()))
{
if(!(tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_HISTORY)))
guild.getOwner().getUser().openPrivateChannel().queue(s -> s.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue(
null, (e) -> tc.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue()));
else
{
title = "`[Message Edited]:` :pencil2: A message was edited:";
builder.addField("Old Content:", "```No cached message.```", false);
builder.addField("New Content:", "```"+newmsg.getContent()+"```", false);
builder.setFooter("Message ID: " + event.getMessageId(), null);
builder.setColor(event.getGuild().getSelfMember().getColor());
tc.sendMessage(new MessageBuilder().append(title).setEmbed(builder.build()).build()).queue((m) -> {
MessagesLogging.removeMessage(newmsg.getIdLong());
MessagesLogging.addMessage(newmsg.getIdLong(), newmsg);
});
}
}
}
}
示例13: onGuildMessageDelete
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void onGuildMessageDelete(GuildMessageDeleteEvent event)
{
EmbedBuilder builder = new EmbedBuilder();
Guild guild = event.getGuild();
TextChannel tc = db.getServerlogChannel(guild);
Message message = MessagesLogging.getMsg(event.getMessageIdLong());
String title;
TextChannel channel = FinderUtil.getDefaultChannel(event.getGuild());
if(!(message.getContent().equals("No cached message")) && !(tc==null) && !(message.getAuthor().isBot()))
{
if(!(tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_HISTORY)))
guild.getOwner().getUser().openPrivateChannel().queue(s -> s.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue(
null, (e) -> channel.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue()));
else
{
title = "`[Message Deleted]:` :wastebasket: **"+message.getAuthor().getName()+"#"+message.getAuthor().getDiscriminator()+"**'s message was deleted in "+message.getTextChannel().getAsMention()+":";
builder.setAuthor(message.getAuthor().getName(), null, message.getAuthor().getEffectiveAvatarUrl());
builder.setDescription("```\n"+message.getContent()+"```");
builder.setFooter("Message ID: "+message.getId(), null);
builder.setColor(event.getGuild().getSelfMember().getColor());
builder.setTimestamp(message.getCreationTime());
tc.sendMessage(new MessageBuilder().append(title).setEmbed(builder.build()).build()).queue((m) -> MessagesLogging.removeMessage(message.getIdLong()));
}
}
else
{
if(!(tc==null) && !(message.getAuthor()==null))
{
if(!(tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_HISTORY)))
guild.getOwner().getUser().openPrivateChannel().queue(s -> s.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue(
null, (e) -> tc.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue()));
else
{
title = "`[Message Deleted]:` :wastebasket: A message was deleted:";
builder.setDescription("```No cached message.```");
builder.setFooter("Message ID: " + event.getMessageId(), null);
builder.setColor(event.getGuild().getSelfMember().getColor());
tc.sendMessage(new MessageBuilder().append(title).setEmbed(builder.build()).build()).queue((m) -> MessagesLogging.removeMessage(message.getIdLong()));
}
}
}
}
示例14: createModLogEntry
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
public static void createModLogEntry(DiscordBot bot, JDA shard, Message message, Member member, String reason, String action, int id, Date expirationDate, boolean expires) {
SettingsRecord guildSettings = DatabaseUtils.getGuildSettings(bot.getDatabase(), member.getGuild());
Date now = new Date();
boolean modLogActive = guildSettings.getModlog();
String prefix = guildSettings.getPrefix();
if (!modLogActive) {
return;
}
TextChannel modLogChannel = shard.getTextChannelById(guildSettings.getModlogchannelid());
if (modLogChannel == null) {
sendMessage(message.getChannel(), "Invalid moderator log channel in guild configuration, set a proper one via `" + prefix + " settings` command.");
return;
}
EmbedBuilder embed = new EmbedBuilder();
User user = member.getUser();
TextChannel channel = message.getTextChannel();
embed.setColor(modLogColors.get(action));
embed.addField("Action ", modLogActionTexts.get(action) + " - #" + id, false);
embed.addField("User:", getUserTagAndId(user), false);
embed.addField("Reason:", reason, false);
embed.addField("Responsible Moderator:", getUserTagAndId(message.getAuthor()), false);
embed.addField("Channel", getChannelMention(channel), false);
embed.setTimestamp(now.toInstant());
if (expires) {
String dateText = expirationDate == null ? "Indefinitely" : expirationDate.toString();
String untilText = null;
switch (action) {
case "ban":
untilText = "Banned until";
break;
case "mute":
untilText = "Muted until";
break;
default:
break;
}
embed.addField(untilText, dateText, false);
}
sendMessage(modLogChannel, embed.build());
}
示例15: run
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public boolean run(DiscordBot bot, GuildMessageReceivedEvent event, String args) {
Scanner messageIterator = new Scanner(args);
JDA shard = event.getJDA();
Member member = event.getMember();
User user = event.getAuthor();
Message message = event.getMessage();
TextChannel channel = event.getChannel();
Guild guild = event.getGuild();
if (!member.hasPermission(Permission.KICK_MEMBERS)) {
DiscordUtils.failMessage(bot, message, "You don't have enough permissions to execute this command!");
return false;
}
if (!messageIterator.hasNext(DiscordUtils.USER_MENTION_PATTERN)) {
return true;
} else {
// advance the scanner one step to get rid of user mention
messageIterator.next();
}
User warnUser = message.getMentionedUsers().get(0);
Member warnMember = guild.getMember(warnUser);
if (user.getId().equals(warnUser.getId())) {
DiscordUtils.failMessage(bot, message, "You can't warn yourself, dummy!");
return false;
}
String reason = TextUtils.seekScannerToEnd(messageIterator);
reason = reason.equals("") ? "No reason specified" : reason;
Date now = new Date();
EmbedBuilder embed = new EmbedBuilder();
embed.setTitle("Warned in " + guild.getName());
embed.setColor(new Color(0x4286F4));
embed.setDescription("You were warned in " + guild.getName());
embed.addField("Reason:", reason, false);
embed.setFooter("Warned by " + DiscordUtils.getUserTagAndId(user), null);
embed.setTimestamp(now.toInstant());
try {
DiscordUtils.sendDM(warnUser, embed.build());
} catch (Exception e) {
DiscordUtils.sendMessage(channel, "Could not send a warning to the specified user via private message!");
}
DiscordUtils.successReact(bot, message);
DSLContext database = bot.getDatabase();
WarnlistRecord record = database.insertInto(Tables.WARNLIST,
Tables.WARNLIST.USERID,
Tables.WARNLIST.MODERATORUSERID,
Tables.WARNLIST.GUILDID,
Tables.WARNLIST.WARNTIME,
Tables.WARNLIST.REASON)
.values(warnUser.getId(),
user.getId(),
guild.getId(),
now.getTime() / 1000,
reason)
.returning(Tables.WARNLIST.ID)
.fetchOne();
DiscordUtils.createModLogEntry(bot, shard, message, warnMember, reason, "warn", record.getId(), null, false);
DiscordUtils.sendMessage(channel, "Warned " + DiscordUtils.getUserTagAndId(warnUser));
return false;
}