Skip to content

Commit 36c327a

Browse files
committed
discord kinda works
1 parent b30258f commit 36c327a

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ dependencies {
155155

156156
// Add dependencies on the required Kotlin modules.
157157
includeLib("io.github.classgraph:classgraph:${classGraphVersion}")
158-
includeLib("com.github.emyfops:KDiscordIPC:$discordIPCVersion")
158+
includeLib("com.github.caoimhebyrne:KDiscordIPC:$discordIPCVersion")
159159
includeLib("com.pngencoder:pngencoder:$pngEncoderVersion")
160160

161161
includeLib("io.github.spair:imgui-java-binding:$spairVersion")

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ kotlinVersion=2.2.0
3434
pngEncoderVersion=0.16.0
3535
javaVersion=21
3636
baritoneVersion=1.14.0
37-
discordIPCVersion=6f6b6cce17
37+
discordIPCVersion=0.2.3
3838
classGraphVersion=4.8.179
3939
ktorVersion=3.1.2
4040
mockitoKotlin=5.4.0

src/main/kotlin/com/lambda/module/modules/client/Discord.kt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.lambda.Lambda
2121
import com.lambda.Lambda.LOG
2222
import com.lambda.context.SafeContext
2323
import com.lambda.event.EventFlow
24+
import com.lambda.event.events.TickEvent
2425
import com.lambda.event.events.WorldEvent
2526
import com.lambda.event.listener.SafeListener.Companion.listenOnce
2627
import com.lambda.module.Module
@@ -61,26 +62,22 @@ object Discord : Module(
6162
var discordAuth: AuthenticatePacket.Data? = null; private set
6263

6364
init {
64-
listenOnce<WorldEvent.Join> {
65-
if (rpc.connected) return@listenOnce false
66-
67-
runConcurrent {
68-
start()
69-
handleLoop()
70-
}
65+
// ts is fucked frfr
66+
listenOnce<TickEvent.Pre> {
67+
runConcurrent { handleLoop() }
7168

7269
return@listenOnce true
7370
}
7471

75-
onEnable { runConcurrent { start(); handleLoop() } }
72+
onEnable { runConcurrent { start() } }
73+
runConcurrent { start() }
7674
onDisable { stop() }
7775
}
7876

7977
private suspend fun start() {
8078
if (rpc.connected) return
8179

82-
runConcurrent { rpc.connect() }
83-
delay(1000)
80+
rpc.connect()
8481

8582
val auth = rpc.applicationManager.authenticate()
8683

@@ -107,7 +104,7 @@ object Discord : Module(
107104

108105
largeImage("lambda", Lambda.VERSION)
109106
smallImage("https://mc-heads.net/avatar/${mc.gameProfile.id}/nohelm", mc.gameProfile.name)
110-
button("Download", "https://github.com/lambda-client/lambda")
107+
//button("Download", "https://github.com/lambda-client/lambda")
111108

112109
if (showTime) timestamps(startup)
113110
}

0 commit comments

Comments
 (0)