本文整理汇总了Java中net.dv8tion.jda.core.EmbedBuilder.setAuthor方法的典型用法代码示例。如果您正苦于以下问题:Java EmbedBuilder.setAuthor方法的具体用法?Java EmbedBuilder.setAuthor怎么用?Java EmbedBuilder.setAuthor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dv8tion.jda.core.EmbedBuilder
的用法示例。
在下文中一共展示了EmbedBuilder.setAuthor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGuildMemberNickChange
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void onGuildMemberNickChange(GuildMemberNickChangeEvent e) {
if (!Bot.isReady)
return;
GuildObject g = GuildObject.guildMap.get(e.getGuild().getId());
EmbedBuilder em = new EmbedBuilder();
em.setColor(Color.CYAN)
.setTimestamp(Instant.now());
if (!g.getSpecialChannels().getLog().equals("")) {
if (e.getPrevNick() != null && e.getNewNick() != null) {
em.setDescription("**" + e.getPrevNick() + "** to **" + e.getNewNick() + "**");
em.setAuthor(e.getMember().getUser().getName() + " changed their nickname",
null, e.getMember().getUser().getAvatarUrl());
} else if (e.getPrevNick() != null && e.getNewNick() == null) {
em.setDescription("**" + e.getPrevNick() + "** to **" + e.getMember().getUser().getName() + "**");
em.setAuthor(e.getMember().getUser().getName() + " removed their nickname",
null, e.getMember().getUser().getAvatarUrl());
} else {
em.setDescription("**" + e.getMember().getUser().getName() + "** to **" + e.getNewNick() + "**");
em.setAuthor(e.getMember().getUser().getName() + " added a nickname", null,
e.getMember().getUser().getAvatarUrl());
}
MessageUtils.sendMessage(g.getSpecialChannels().getLog(), em.build());
}
}
示例2: onGuildMemberLeave
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void onGuildMemberLeave(GuildMemberLeaveEvent event) {
if (bannedUsers.contains(event.getUser().getIdLong())) {
return;
}
if (!isEventEnabled(event.getGuild(), LogEventKeys.BAN))
return;
TextChannel textChannel = getLogChannel(event.getGuild());
if (textChannel == null)
return;
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor("A member left the server", null, event.getMember().getUser().getAvatarUrl());
embedBuilder.setDescription("**" + event.getMember().getEffectiveName() + " (" + event.getMember().getUser().getId() + ")** left the server");
embedBuilder.setColor(evLeaveColor);
sendLog(textChannel, embedBuilder);
}
示例3: listWarns
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
public static EmbedBuilder listWarns(User user, Guild guild) {
String[] emotes = {
":one:",
":two:",
":three:",
":four:",
":five:",
":six:",
":seven:",
":eight:",
":nine:",
":keycap_ten:"
};
List<Warn> warnList = new WarnSQL().getWarns(user, guild);
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(user.getName() + "'s warns", null, user.getAvatarUrl());
embedBuilder.setColor(Colors.COLOR_PRIMARY);
if (warnList.size() == 0) {
embedBuilder.setDescription("User has no warns.");
} else {
int warnCount = 0;
for (Warn warn : warnList) {
embedBuilder.addField(emotes[warnCount] + " " + warn.getReason(), "Executor: " + warn.getExecutor().getName() + "\n" +
"Date: " + new SimpleDateFormat("MM.dd.yyyy HH:mm:ss").format(warn.getDate()), false);
warnCount++;
if(warnCount == 10)
break;
}
}
return embedBuilder;
}
示例4: sendPortalNotification
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
private void sendPortalNotification(Guild guild, String message) {
EmbedBuilder builder = new EmbedBuilder();
builder.setAuthor("Portal Notification", null, guild.getIconUrl());
builder.setDescription(message);
builder.setColor(Colors.COLOR_PRIMARY);
guild.getOwner().getUser().openPrivateChannel().queue(privateChannel -> privateChannel.sendMessage(builder.build()).queue());
}
示例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: executeUse
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void executeUse(Guild guild, Member member, MessageChannel channel) {
Long guildID = guild.getIdLong();
Long userID = member.getUser().getIdLong();
LinkedList<RankUp> rankUps;
try {
rankUps = dbMan.addUserExp(guildID, userID, expGain);
if (!rankUps.isEmpty()) {
EmbedBuilder newEmbed = new EmbedBuilder();
Color color = new Color(50, 255, 50);
newEmbed.setAuthor(member.getEffectiveName(), null, member.getUser().getAvatarUrl());
newEmbed.setTitle(localize(channel, "item.exp_boost.rank_up"));
newEmbed.setColor(color);
for (RankUp newRank : rankUps) {
newEmbed.addField(member.getEffectiveName(), localize(channel, "item.exp_boost.field.rank_up", newRank.rankName), false);
if (newRank.expRequired != null) {
newEmbed.addField("", localize(channel, "item.exp_boost.field.xp_needed", newRank.expRequired), false);
} else {
newEmbed.addField("", localize(channel, "item.exp_boost.field.max_reached"), false);
}
}
channel.sendMessage(newEmbed.build()).queue();
}
dbMan.removeItemFromUser(this.getItemID());
} catch (SQLException e) {
e.printStackTrace();
}
}
示例7: execute
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void execute(MessageReceivedEvent event, String[] args) {
EmbedBuilder eb = new EmbedBuilder();
eb.setTitle("LegendaryBot");
eb.setAuthor("Greatman", "https://github.com/greatman/legendarybot", "https://avatars3.githubusercontent.com/u/95754?v=3&s=460");
String prefix = bot.getGuildSettings(event.getGuild()).getSetting("PREFIX");
if (prefix == null) {
prefix = "!";
}
eb.setDescription(bot.getTranslateManager().translate(event.getGuild(), "command.info.text", prefix) + " https://discordbots.org/bot/Legendarybot");
event.getChannel().sendMessage(eb.build()).queue();
}
示例8: createWelcomeMessage
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
private MessageEmbed createWelcomeMessage(Guild guild) {
Function<String, String> m = messageService::getMessage;
String webPage = m.apply("about.support.page");
String discordServer = m.apply("about.support.server");
String githubPage = m.apply("about.support.github");
EmbedBuilder builder = messageService.getBaseEmbed(true);
builder.setDescription(messageService.getMessage("welcome.guild.message",
guild.getOwner().getEffectiveName(),
guild.getName()) + NEW_LINE);
User self = guild.getJDA().getSelfUser();
builder.setAuthor(self.getName(), webPage, self.getAvatarUrl());
builder.addField(m.apply("welcome.fields.common.title"),
m.apply("welcome.fields.common.content") + NEW_LINE, false);
builder.addField(m.apply("welcome.fields.ranking.title"),
m.apply("welcome.fields.ranking.content") + NEW_LINE, false);
builder.addField(m.apply("welcome.fields.welcome.title"),
m.apply("welcome.fields.welcome.content") + NEW_LINE, false);
builder.addField(m.apply("welcome.fields.commands.title"),
m.apply("welcome.fields.commands.content") + NEW_LINE, false);
builder.addField(m.apply("welcome.fields.custom.title"),
m.apply("welcome.fields.custom.content") + NEW_LINE, false);
builder.addField(m.apply("welcome.fields.api.title"),
m.apply("welcome.fields.api.content") + NEW_LINE, false);
builder.addField(m.apply("welcome.fields.support.title"),
messageService.getMessage("welcome.fields.support.content", webPage, discordServer, githubPage),
false);
return builder.build();
}
示例9: handleSettingsDisplay
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
private void handleSettingsDisplay(DiscordBot bot, GuildMessageReceivedEvent event) {
JDA shard = event.getJDA();
TextChannel channel = event.getChannel();
Message message = event.getMessage();
SelfUser selfUser = shard.getSelfUser();
String output = getSettingsString(bot, event);
EmbedBuilder embed = new EmbedBuilder();
embed.setAuthor("Safety Jim", null, selfUser.getAvatarUrl());
embed.addField("Guild Settings", output, false);
embed.setColor(new Color(0x4286F4));
DiscordUtils.successReact(bot, message);
DiscordUtils.sendMessage(channel, embed.build());
}
示例10: compileEmbed
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
private void compileEmbed(EmbedBuilder embed) {
embed.setAuthor("ZLevels", "https://github.com/ZP4RKER/zlevels", null);
embed.addField("Name", "ZLevels", true);
embed.addField("Version", ZLevels.VERSION, true);
embed.addField("Commands", ZLevels.handler.getCommands().size() + "", true);
embed.addField("Author", "<@145064570237485056>", true);
embed.addField("Description", "An open-source Discord bot, which adds a levelling system to your server.", false);
embed.setColor(Color.decode(Config.EMBED_COLOUR));
}
示例11: run
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public boolean run(DiscordBot bot, GuildMessageReceivedEvent event, String args) {
JDA shard = event.getJDA();
EmbedBuilder embed = new EmbedBuilder();
embed.setAuthor("Safety Jim " + DiscordUtils.getShardString(shard.getShardInfo()), null, shard.getSelfUser().getAvatarUrl());
embed.setDescription(":ping_pong: Ping: " + shard.getPing() + "ms");
embed.setColor(new Color(0x4286F4));
DiscordUtils.successReact(bot, event.getMessage());
DiscordUtils.sendMessage(event.getChannel(), embed.build());
return false;
}
示例12: onUserAvatarUpdate
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void onUserAvatarUpdate(UserAvatarUpdateEvent event)
{
List<Guild> guilds = event.getUser().getMutualGuilds();
EmbedBuilder builder = new EmbedBuilder();
User user = event.getUser();
String title = "`[Avatar Update]:` :frame_photo: **"+user.getName()+"#"+user.getDiscriminator()+"** changed their avatar: ";
if(!(guilds.isEmpty()) && !(user.isBot()))
{
for(Guild guild : guilds)
{
TextChannel tc = db.getServerlogChannel(guild);
TextChannel channel = FinderUtil.getDefaultChannel(guild);
if(!(tc==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) -> channel.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue()));
else
{
builder.setAuthor(user.getName(), null, user.getEffectiveAvatarUrl());
builder.setThumbnail(event.getPreviousAvatarUrl());
builder.setImage(user.getEffectiveAvatarUrl());
builder.setColor(guild.getSelfMember().getColor());
tc.sendMessage(new MessageBuilder().append(title).setEmbed(builder.build()).build()).queue();
}
}
}
}
}
示例13: execute
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
User user = parsedCommandInvocation.getMessage().getAuthor();
EmbedBuilder builder = new EmbedBuilder();
builder.setColor(Colors.COLOR_PRIMARY);
builder.setAuthor(user.getName(), null, user.getAvatarUrl());
builder.addField("Points", RubiconBot.getMySQL().getUserValue(user, "points"), true);
builder.addField("Level", RubiconBot.getMySQL().getUserValue(user, "level"), true);
builder.addField("Ruby's", RubiconBot.getMySQL().getUserValue(user, "money"), true);
return new MessageBuilder().setEmbed(builder.build()).build();
}
示例14: onGuildVoiceLeave
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void onGuildVoiceLeave(GuildVoiceLeaveEvent event) {
if (!isEventEnabled(event.getGuild(), LogEventKeys.VOICE))
return;
TextChannel textChannel = getLogChannel(event.getGuild());
if (textChannel == null)
return;
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor("A member closed voice connection", null, event.getMember().getUser().getAvatarUrl());
embedBuilder.setDescription("**" + event.getMember().getEffectiveName() + " (" + event.getMember().getUser().getId() + ")** left `" + event.getChannelLeft().getName() + "`");
embedBuilder.setColor(evVoiceLog);
sendLog(textChannel, embedBuilder);
}
示例15: onGuildVoiceMove
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void onGuildVoiceMove(GuildVoiceMoveEvent event) {
if (!isEventEnabled(event.getGuild(), LogEventKeys.VOICE))
return;
TextChannel textChannel = getLogChannel(event.getGuild());
if (textChannel == null)
return;
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor("A member changed the channel", null, event.getMember().getUser().getAvatarUrl());
embedBuilder.setDescription("**" + event.getMember().getEffectiveName() + " (" + event.getMember().getUser().getId() + ")** went from `" + event.getChannelLeft().getName() + "` to `" + event.getChannelJoined().getName() + "`");
embedBuilder.setColor(evVoiceLog);
sendLog(textChannel, embedBuilder);
}