From ec77731ff570ff8599881592b40ae49ccb0f713f Mon Sep 17 00:00:00 2001 From: Josh Shippam Date: Wed, 1 Feb 2023 02:43:45 +0000 Subject: [PATCH] Fix NoSuchElementException In Discord Link Command (#569) --- .../main/java/com/rs2/integrations/discord/commands/Link.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/2006Scape Server/src/main/java/com/rs2/integrations/discord/commands/Link.kt b/2006Scape Server/src/main/java/com/rs2/integrations/discord/commands/Link.kt index e180163f..72db8290 100644 --- a/2006Scape Server/src/main/java/com/rs2/integrations/discord/commands/Link.kt +++ b/2006Scape Server/src/main/java/com/rs2/integrations/discord/commands/Link.kt @@ -6,10 +6,9 @@ import org.javacord.api.listener.message.MessageCreateListener class Link : MessageCreateListener { override fun onMessageCreate(event: MessageCreateEvent) { val message = event.message - val user = message.author.asUser().get() if (message.content.equals("::link", ignoreCase = true)) { - event.channel.sendMessage(user.mentionTag + ", Please check your DM's to continue.") - user.sendMessage("Please copy/paste the following in-game to link your Discord account: \n ```::link " + user.idAsString + "```") + event.channel.sendMessage(message.author.asUser().get().mentionTag + ", Please check your DM's to continue.") + message.author.asUser().get().sendMessage("Please copy/paste the following in-game to link your Discord account: \n ```::link " + message.author.asUser().get().idAsString + "```") } } } \ No newline at end of file