mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-16 14:17:09 +02:00
fea(scripting/messaging): snapchatter info
This commit is contained in:
parent
b378bdde87
commit
8f06688f55
@ -8,6 +8,7 @@ import me.rhunk.snapenhance.core.ModContext
|
||||
import me.rhunk.snapenhance.core.features.impl.messaging.Messaging
|
||||
import me.rhunk.snapenhance.core.wrapper.impl.Message
|
||||
import me.rhunk.snapenhance.core.wrapper.impl.SnapUUID
|
||||
import me.rhunk.snapenhance.core.wrapper.impl.Snapchatter
|
||||
import org.mozilla.javascript.Scriptable
|
||||
import org.mozilla.javascript.annotations.JSFunction
|
||||
|
||||
@ -15,7 +16,8 @@ import org.mozilla.javascript.annotations.JSFunction
|
||||
class CoreMessaging(
|
||||
private val modContext: ModContext
|
||||
) : AbstractBinding("messaging", BindingSide.CORE) {
|
||||
private val conversationManager get() = modContext.feature(Messaging::class).conversationManager
|
||||
private val messaging by lazy { modContext.feature(Messaging::class) }
|
||||
private val conversationManager get() = messaging.conversationManager
|
||||
|
||||
@JSFunction
|
||||
fun isPresent() = conversationManager != null
|
||||
@ -144,5 +146,12 @@ class CoreMessaging(
|
||||
modContext.messageSender.sendChatMessage(listOf(SnapUUID.fromString(conversationId)), message, onSuccess = { result(null) }, onError = { result(it.toString()) })
|
||||
}
|
||||
|
||||
@JSFunction
|
||||
fun fetchSnapchatterInfos(
|
||||
userIds: List<String>
|
||||
): List<Snapchatter> {
|
||||
return messaging.fetchSnapchatterInfos(userIds = userIds)
|
||||
}
|
||||
|
||||
override fun getObject() = this
|
||||
}
|
||||
|
@ -1,19 +1,28 @@
|
||||
package me.rhunk.snapenhance.core.wrapper.impl
|
||||
|
||||
import me.rhunk.snapenhance.core.wrapper.AbstractWrapper
|
||||
|
||||
import org.mozilla.javascript.annotations.JSGetter
|
||||
import org.mozilla.javascript.annotations.JSSetter
|
||||
|
||||
|
||||
class BitmojiInfo(obj: Any?) : AbstractWrapper(obj) {
|
||||
@get:JSGetter @set:JSSetter
|
||||
var avatarId by field<String?>("mAvatarId")
|
||||
@get:JSGetter @set:JSSetter
|
||||
var backgroundId by field<String?>("mBackgroundId")
|
||||
@get:JSGetter @set:JSSetter
|
||||
var sceneId by field<String?>("mSceneId")
|
||||
@get:JSGetter @set:JSSetter
|
||||
var selfieId by field<String?>("mSelfieId")
|
||||
}
|
||||
|
||||
class Snapchatter(obj: Any?) : AbstractWrapper(obj) {
|
||||
@get:JSGetter
|
||||
val bitmojiInfo by field<BitmojiInfo?>("mBitmojiInfo")
|
||||
@get:JSGetter @set:JSSetter
|
||||
var displayName by field<String?>("mDisplayName")
|
||||
@get:JSGetter @set:JSSetter
|
||||
var userId by field("mUserId") { SnapUUID(it) }
|
||||
@get:JSGetter @set:JSSetter
|
||||
var username by field<String>("mUsername")
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user