Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove getAsTag as thats obsolete with the new usernames. #288

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ protected File handle(Member member) {
// Set the text for the svg fields
doc.getElementById("level").getFirstChild().setTextContent(String.valueOf(levelInfo.getLevel()));
doc.getElementById("name").getFirstChild().setTextContent(user.getName());
doc.getElementById("discriminator").getFirstChild().setTextContent("#" + user.getDiscriminator());
doc.getElementById("xp").getFirstChild().setTextContent(BotHelpers.coolFormat(levelInfo.getXp()));
doc.getElementById("xpnext").getFirstChild().setTextContent(BotHelpers.coolFormat(levelInfo.getXpForNextLevel()));
doc.getElementById("avatar").setAttributeNS("http://www.w3.org/1999/xlink", "href", user.getAvatarUrl().replace(".gif", ".png"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected MessageEmbed handle(Member member) {
}

return new EmbedBuilder()
.setAuthor(user.getAsTag(), null, user.getAvatarUrl())
.setAuthor(user.getName(), null, user.getAvatarUrl())
.setDescription(user.getAsMention())
.addField("Joined", TimeFormat.DATE_TIME_LONG.format(member.getTimeJoined()), true)
.addField("Registered", TimeFormat.DATE_TIME_LONG.format(member.getTimeCreated()), true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {

if (foundMatch) {
ServerSettings.getLogChannel(event.getGuild()).sendMessageEmbeds(new EmbedBuilder()
.setAuthor(event.getAuthor().getAsTag(), null, event.getAuthor().getAvatarUrl())
.setAuthor(event.getAuthor().getName(), null, event.getAuthor().getAvatarUrl())
.setDescription("**Link removed, sent by** " + event.getAuthor().getAsMention() + " **deleted in** " + event.getChannel().getAsMention() + "\n" + event.getMessage().getContentRaw())
.addField("Link", link, false)
.addField("Matched domain", foundDomain, false)
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/org/geysermc/discordbot/listeners/LogHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void onGuildMemberJoin(@NotNull GuildMemberJoinEvent event) {
try {
ServerSettings.getLogChannel(event.getGuild()).sendMessageEmbeds(new EmbedBuilder()
.setAuthor("Member Joined", null, event.getUser().getAvatarUrl())
.setDescription(event.getUser().getAsMention() + " " + event.getUser().getAsTag())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was mention removed here?

.setDescription(event.getUser().getName())
.addField("Account Created", TimeFormat.RELATIVE.format(event.getUser().getTimeCreated().toInstant()), false)
.setThumbnail(event.getUser().getAvatarUrl())
.setFooter("ID: " + event.getUser().getId())
Expand All @@ -179,7 +179,7 @@ public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) {
try {
ServerSettings.getLogChannel(event.getGuild()).sendMessageEmbeds(new EmbedBuilder()
.setAuthor("Member Left", null, event.getUser().getAvatarUrl())
.setDescription(event.getUser().getAsMention() + " " + event.getUser().getAsTag())
.setDescription(event.getUser().getAsMention() + " " + event.getUser().getName())
.setFooter("ID: " + event.getUser().getId())
.setTimestamp(Instant.now())
.setColor(BotColors.WARNING.getColor())
Expand Down Expand Up @@ -207,7 +207,7 @@ public void onMessageUpdate(@NotNull MessageUpdateEvent event) {

try {
ServerSettings.getLogChannel(event.getGuild()).sendMessageEmbeds(new EmbedBuilder()
.setAuthor(event.getAuthor().getAsTag(), null, event.getAuthor().getAvatarUrl())
.setAuthor(event.getAuthor().getName(), null, event.getAuthor().getAvatarUrl())
.setDescription("**Message edited in **" + event.getChannel().getAsMention() + " [Jump to Message](" + event.getMessage().getJumpUrl() + ")")
.addField("Before", cachedMessage != null ? BotHelpers.trim(cachedMessage.getContentRaw(), 450) : "*Old message not cached*", false)
.addField("After", BotHelpers.trim(event.getMessage().getContentRaw(), 450), false)
Expand Down Expand Up @@ -239,9 +239,9 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) {

try {
ServerSettings.getLogChannel(event.getGuild()).sendMessageEmbeds(new EmbedBuilder()
.setAuthor(event.getAuthor().getAsTag(), null, event.getAuthor().getAvatarUrl())
.setAuthor(event.getAuthor().getName(), null, event.getAuthor().getAvatarUrl())
.setDescription("**Invite posted for " + invite.getGuild().getName() + "** " + event.getChannel().getAsMention() + "\n" + invite.getUrl())
.addField("Inviter", invite.getInviter() != null ? invite.getInviter().getAsTag() : "Unknown", true)
.addField("Inviter", invite.getInviter() != null ? invite.getInviter().getName() : "Unknown", true)
.addField("Channel", invite.getChannel() != null ? invite.getChannel().getName() : "Group", true)
.addField("Members", invite.getGuild().getOnlineCount() + "/" + invite.getGuild().getMemberCount(), true)
.setFooter("ID: " + event.getAuthor().getId())
Expand Down Expand Up @@ -283,7 +283,7 @@ public void onMessageDelete(@NotNull MessageDeleteEvent event) {
return;
}

authorTag = cachedMessage.getAuthor().getAsTag();
authorTag = cachedMessage.getAuthor().getName();
authorMention = cachedMessage.getAuthor().getAsMention();
authorAvatar = cachedMessage.getAuthor().getAvatarUrl();
authorId = cachedMessage.getAuthor().getId();
Expand Down Expand Up @@ -321,7 +321,7 @@ public void onGuildVoiceUpdate(@NotNull GuildVoiceUpdateEvent event) {

try {
ServerSettings.getLogChannel(event.getGuild()).sendMessageEmbeds(new EmbedBuilder()
.setAuthor(event.getMember().getUser().getAsTag(), null, event.getMember().getUser().getAvatarUrl())
.setAuthor(event.getMember().getUser().getName(), null, event.getMember().getUser().getAvatarUrl())
.setDescription(description)
.setFooter("ID: " + event.getMember().getId())
.setTimestamp(Instant.now())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void handle(@NotNull GenericEvent event) {
private void buildMessageScope(Scope scope, net.dv8tion.jda.api.entities.User author, Guild server, MessageChannel channel, String messageId) {
User user = new User();
user.setId(author.getId());
user.setUsername(author.getAsTag());
user.setUsername(author.getName());
scope.setUser(user);

scope.setExtra("guild_id", server == null ? "null" : server.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private SentryEvent buildEvent(Command command, User author, MessageChannel chan

io.sentry.protocol.User user = new io.sentry.protocol.User();
user.setId(author.getId());
user.setUsername(author.getAsTag());
user.setUsername(author.getName());
sentryEvent.setUser(user);

sentryEvent.setExtra("guild_id", server == null ? "null" : server.getId());
Expand Down