Archiviert
1
0

Fix privateChat with Bot

Dieser Commit ist enthalten in:
yoyosource 2021-07-29 17:04:07 +02:00
Ursprung a8d00de1e2
Commit b7164cf005
2 geänderte Dateien mit 22 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -65,16 +65,20 @@ public class AuthManager {
builder.setContent(":white_check_mark: Dein Discord Konto wurde mit **" + user.getUserName() + "** verknüpft");
builder.setActionRows(ActionRow.of(Button.success("tada", Emoji.fromUnicode("U+1F389")), Button.danger("invalid", "Ich war das nicht")));
member.getUser().openPrivateChannel().complete().sendMessage(builder.build()).complete();
if(member.getNickname() == null) {
try {
member.getGuild().modifyNickname(member, user.getUserName()).complete();
} catch (Exception e) {
// Ignored
try {
member.getUser().openPrivateChannel().complete().sendMessage(builder.build()).complete();
if (member.getNickname() == null) {
try {
member.getGuild().modifyNickname(member, user.getUserName()).complete();
} catch (Exception e) {
// Ignored
}
}
TOKENS.remove(code);
return member;
} catch (Exception e) {
return null;
}
TOKENS.remove(code);
return member;
} else {
return null;
}

Datei anzeigen

@ -46,7 +46,11 @@ public class DiscordSchemAlert {
MessageBuilder messageBuilder = new MessageBuilder();
messageBuilder.setEmbeds(builder.build());
dcUser.openPrivateChannel().complete().sendMessage(messageBuilder.build()).complete();
try {
dcUser.openPrivateChannel().complete().sendMessage(messageBuilder.build()).complete();
} catch (Exception e) {
// Ignored
}
}
}
@ -63,7 +67,11 @@ public class DiscordSchemAlert {
MessageBuilder messageBuilder = new MessageBuilder();
messageBuilder.setEmbeds(builder.build());
messageBuilder.setActionRows(ActionRow.of(Button.success("tada", Emoji.fromUnicode("U+1F389"))));
dcUser.openPrivateChannel().complete().sendMessage(messageBuilder.build()).complete();
try {
dcUser.openPrivateChannel().complete().sendMessage(messageBuilder.build()).complete();
} catch (Exception e) {
// Ignored
}
}
}
}