From e3e0c07fa219258f270c8d52cdd710df75e60bad Mon Sep 17 00:00:00 2001 From: kageru Date: Mon, 14 Aug 2023 10:29:27 +0200 Subject: [PATCH] find redirect target by user ID --- src/main/kotlin/moe/kageru/kagebot/Util.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/moe/kageru/kagebot/Util.kt b/src/main/kotlin/moe/kageru/kagebot/Util.kt index b002e02..5abb008 100644 --- a/src/main/kotlin/moe/kageru/kagebot/Util.kt +++ b/src/main/kotlin/moe/kageru/kagebot/Util.kt @@ -65,7 +65,7 @@ object Util { fun findChannel(idOrName: String): Either { return when { idOrName.isEntityId() -> server.channelById(idOrName).toEither { "Channel $idOrName not found" } - idOrName.startsWith('@') -> Globals.api.getCachedUserByDiscriminatedName(idOrName.removePrefix("@")).asOption() + idOrName.startsWith('@') -> Globals.api.getUserById(idOrName.removePrefix("@")).asOption() .toEither { "User $idOrName not found" } .flatMap { user -> user.openPrivateChannel().asOption().toEither { "Can’t DM user $idOrName" }