Hopefully fix it

This commit is contained in:
2025-04-04 10:52:37 +02:00
parent dafe838a8a
commit bfdc9c118a
@@ -73,12 +73,13 @@ public class DiscordChannel extends Chatter.PlayerlessChatter {
if (getChannel() instanceof TextChannel && message.contains("»")) { if (getChannel() instanceof TextChannel && message.contains("»")) {
String[] strings = message.split("»", 2); String[] strings = message.split("»", 2);
String userName = strings[0]; String userName = strings[0];
message = strings[1]; String sendMessage = strings[1];
strings = userName.split(" "); strings = userName.split(" ");
String ingameName = strings[strings.length - 1]; String ingameName = strings[strings.length - 1];
SteamwarUser user = SteamwarUser.get(ingameName); SteamwarUser user = SteamwarUser.get(ingameName);
System.out.println(ingameName + " " + user);
if (user != null) { if (user != null) {
send(new MessageCreateBuilder() send(new MessageCreateBuilder()
.setContent(message)); .setContent(message));
@@ -93,12 +94,11 @@ public class DiscordChannel extends Chatter.PlayerlessChatter {
} }
TextChannel textChannel = (TextChannel) getChannel(); TextChannel textChannel = (TextChannel) getChannel();
String finalMessage = message;
try { try {
textChannel.createWebhook(userName) textChannel.createWebhook(userName)
.setAvatar(Icon.from(avatarUrl.download(128).get())) .setAvatar(Icon.from(avatarUrl.download(128).get()))
.onSuccess(webhook -> { .onSuccess(webhook -> {
webhook.sendMessage(finalMessage) webhook.sendMessage(sendMessage)
.onSuccess(__ -> { .onSuccess(__ -> {
webhook.delete().queue(); webhook.delete().queue();
}) })
@@ -107,6 +107,7 @@ public class DiscordChannel extends Chatter.PlayerlessChatter {
.queue(); .queue();
return; return;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
// Ignore and send message as normal! // Ignore and send message as normal!
} }
} }