caoimhebyrne / KDiscordIPC

A Kotlin library for interacting with Discord via IPC
MIT License
49 stars 8 forks source link

Not working on Linux #7

Closed KTibow closed 2 years ago

KTibow commented 2 years ago

Disclaimer: I am using another library that wraps this one. There's a good chance that it's a problem with the other one, but I thought I should check here. Whenever I try to open the connection, I get this error (I'm accessing it through Mozilla Rhino):

Error loading module DynPresence
org.mozilla.javascript.WrappedException: Wrapped SocketConnectionException(reason=org.newsclub.net.unix.AFUNIXSocketAddress.of(Ljava/io/File;)Lorg/newsclub/net/unix/AFUNIXSocketAddress;) (file:/home/kendell/.local/share/multimc/instances/1.8.9/.minecraft/config/ChatTriggers/modules/RichPresence/index.js#35)
    at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1897)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:139)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:215)
    at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:92)
    at RichPresence_index_js_169._c_RichPresence_1(RichPresence/index.js:35)
    at RichPresence_index_js_169.call(RichPresence/index.js)
    at org.mozilla.javascript.BaseFunction.construct(BaseFunction.java:436)
    at RichPresence_index_js_169.construct(RichPresence/index.js)
    at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2960)
    at DynPresence_index_js_168._c_script_0(DynPresence/index.js:3)
    at DynPresence_index_js_168.call(DynPresence/index.js)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:342)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3951)
    at DynPresence_index_js_168.call(DynPresence/index.js)
    at DynPresence_index_js_168.exec(DynPresence/index.js)
    at org.mozilla.javascript.commonjs.module.Require.executeModuleScript(Require.java:351)
    at org.mozilla.javascript.commonjs.module.Require.getExportedModuleInterface(Require.java:302)
    at com.chattriggers.ctjs.engine.langs.js.JSLoader$CTRequire.loadCTModule(JSLoader.kt:326)
Caused by: SocketConnectionException(reason=org.newsclub.net.unix.AFUNIXSocketAddress.of(Ljava/io/File;)Lorg/newsclub/net/unix/AFUNIXSocketAddress;)
    at dev.cbyrne.kdiscordipc.socket.impl.UnixSystemSocket.connect(UnixSystemSocket.kt:47)
    at dev.cbyrne.kdiscordipc.socket.DiscordSocket.connect(DiscordSocket.kt:67)
    at dev.cbyrne.kdiscordipc.DiscordIPC.connect(DiscordIPC.kt:96)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:117)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:215)
    at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:92)
    at org.mozilla.javascript.gen.file__home_kendell__local_share_multimc_instances_1_8_9__minecraft_config_ChatTriggers_modules_RichPresence_index_js_169._c_RichPresence_1(file:/home/kendell/.local/share/multimc/instances/1.8.9/.minecraft/config/ChatTriggers/modules/RichPresence/index.js:35)
    at org.mozilla.javascript.gen.file__home_kendell__local_share_multimc_instances_1_8_9__minecraft_config_ChatTriggers_modules_RichPresence_index_js_169.call(file:/home/kendell/.local/share/multimc/instances/1.8.9/.minecraft/config/ChatTriggers/modules/RichPresence/index.js)
    at org.mozilla.javascript.BaseFunction.construct(BaseFunction.java:436)
    at org.mozilla.javascript.gen.file__home_kendell__local_share_multimc_instances_1_8_9__minecraft_config_ChatTriggers_modules_RichPresence_index_js_169.construct(file:/home/kendell/.local/share/multimc/instances/1.8.9/.minecraft/config/ChatTriggers/modules/RichPresence/index.js)
    at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2960)
    at org.mozilla.javascript.gen.file__home_kendell__local_share_multimc_instances_1_8_9__minecraft___config_ChatTriggers_modules_DynPresence_index_js_168._c_script_0(file:/home/kendell/.local/share/multimc/instances/1.8.9/.minecraft/./config/ChatTriggers/modules/DynPresence/index.js:3)
    at org.mozilla.javascript.gen.file__home_kendell__local_share_multimc_instances_1_8_9__minecraft___config_ChatTriggers_modules_DynPresence_index_js_168.call(file:/home/kendell/.local/share/multimc/instances/1.8.9/.minecraft/./config/ChatTriggers/modules/DynPresence/index.js)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:342)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3951)
    at org.mozilla.javascript.gen.file__home_kendell__local_share_multimc_instances_1_8_9__minecraft___config_ChatTriggers_modules_DynPresence_index_js_168.call(file:/home/kendell/.local/share/multimc/instances/1.8.9/.minecraft/./config/ChatTriggers/modules/DynPresence/index.js)
    at org.mozilla.javascript.gen.file__home_kendell__local_share_multimc_instances_1_8_9__minecraft___config_ChatTriggers_modules_DynPresence_index_js_168.exec(file:/home/kendell/.local/share/multimc/instances/1.8.9/.minecraft/./config/ChatTriggers/modules/DynPresence/index.js)
    at org.mozilla.javascript.commonjs.module.Require.executeModuleScript(Require.java:351)
    at org.mozilla.javascript.commonjs.module.Require.getExportedModuleInterface(Require.java:302)
    at com.chattriggers.ctjs.engine.langs.js.JSLoader$CTRequire.loadCTModule(JSLoader.kt:326)
    at com.chattriggers.ctjs.engine.langs.js.JSLoader.entryPass(JSLoader.kt:153)
    at com.chattriggers.ctjs.engine.module.ModuleManager.entryPass(ModuleManager.kt:100)
    at com.chattriggers.ctjs.engine.module.ModuleManager.entryPass$default(ModuleManager.kt:89)
    at com.chattriggers.ctjs.Reference$loadCT$1.invoke(Reference.kt:74)
    at com.chattriggers.ctjs.Reference$loadCT$1.invoke(Reference.kt:72)
    at com.chattriggers.ctjs.Reference$conditionalThread$1.invoke(Reference.kt:111)
    at com.chattriggers.ctjs.Reference$conditionalThread$1.invoke(Reference.kt:109)
    at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

Do you have any ideas what's going on? Other programs can access Discord Rich Presence just fine.

caoimhebyrne commented 2 years ago

Hi, thanks for the report. I can't reproduce this issue however, @KTibow.

KTibow commented 2 years ago

Thanks for helping, as I still haven't found any way that works.

caoimhebyrne commented 2 years ago

This is weird. Do you have discord? It would be easier to debug over there @KTibow

KTibow commented 2 years ago

I'm KTibow#3960 there.

caoimhebyrne commented 2 years ago

Fixed in the rewrite