This repository has been archived by the owner on Aug 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f61f6d
commit 7952453
Showing
9 changed files
with
149 additions
and
5 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...a/com/tencent/qqnt/kernel/nativeinterface/IGProFetchChannelInvisibleRoleListCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.tencent.qqnt.kernel.nativeinterface; | ||
|
||
import java.util.ArrayList; | ||
|
||
public interface IGProFetchChannelInvisibleRoleListCallback { | ||
void onFetchChannelInvisibleRoleList(int code, String reason, ArrayList<GProGuildRole> roles); | ||
} |
7 changes: 7 additions & 0 deletions
7
...va/com/tencent/qqnt/kernel/nativeinterface/IGProFetchChannelLiveableRoleListCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.tencent.qqnt.kernel.nativeinterface; | ||
|
||
import java.util.ArrayList; | ||
|
||
public interface IGProFetchChannelLiveableRoleListCallback { | ||
void onFetchChannelLiveableRoleList(int code, String reason, int seq, ArrayList<GProGuildRole> roles); | ||
} |
7 changes: 7 additions & 0 deletions
7
...in/java/com/tencent/qqnt/kernel/nativeinterface/IGProFetchRoleListPermissionCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.tencent.qqnt.kernel.nativeinterface; | ||
|
||
import java.util.ArrayList; | ||
|
||
public interface IGProFetchRoleListPermissionCallback { | ||
void onFetchRoleListPermissionCallback(int code, String msg, ArrayList<GProGuildRole> roles, ArrayList<GProGuildRole> lvRoles, ArrayList<Long> myRoles, long unused); | ||
} |
7 changes: 7 additions & 0 deletions
7
...c/main/java/com/tencent/qqnt/kernel/nativeinterface/IGProFetchRolePermissionCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.tencent.qqnt.kernel.nativeinterface; | ||
|
||
import java.util.ArrayList; | ||
|
||
public interface IGProFetchRolePermissionCallback { | ||
void onFetchRolePermissionCallback(int code, String msg, GProGuildRole role, GProRolePermission permission, ArrayList<GProRolePermissionDesc> permissionDescs, ArrayList<GProRolePermissionCategory> permissionCategories); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/GetGuildRoles.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package moe.fuqiuluo.shamrock.remote.action.handlers | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.json.JsonElement | ||
import moe.fuqiuluo.qqinterface.servlet.GProSvc | ||
import moe.fuqiuluo.shamrock.remote.action.ActionSession | ||
import moe.fuqiuluo.shamrock.remote.action.IActionHandler | ||
import moe.fuqiuluo.shamrock.remote.action.handlers.GetGuildMemberProfile.Permission | ||
import moe.fuqiuluo.shamrock.tools.EmptyJsonString | ||
import moe.fuqiuluo.symbols.OneBotHandler | ||
|
||
@OneBotHandler("get_guild_roles") | ||
internal object GetGuildRoles: IActionHandler() { | ||
override suspend fun internalHandle(session: ActionSession): String { | ||
val guildId = session.getString("guild_id").toULong() | ||
return invoke(guildId, session.echo) | ||
} | ||
|
||
suspend operator fun invoke(guildId: ULong, echo: JsonElement = EmptyJsonString): String { | ||
val result = GProSvc.getGuildRoles(guildId).onFailure { | ||
return error(it.message ?: "unable to fetch guild roles", echo) | ||
}.getOrThrow() | ||
return ok(GetGuildRolesResult(result.map { | ||
GuildRole( | ||
color = it.color, | ||
disabled = it.count <= 0, | ||
independent = it.isChannelRole, | ||
maxCount = it.memberLimit, | ||
memberCount = it.count, | ||
owned = it.bHoist, | ||
roleId = it.roleId, | ||
roleName = it.name, | ||
permission = it.rolePermissions.permissionList.map { | ||
Permission(it.rootId, it.childIds) | ||
}, | ||
) | ||
}), echo = echo) | ||
} | ||
|
||
override val requiredParams: Array<String> = arrayOf("guild_id") | ||
|
||
@Serializable | ||
data class GetGuildRolesResult( | ||
@SerialName("roles") val roles: List<GuildRole> | ||
) | ||
|
||
@Serializable | ||
data class GuildRole( | ||
@SerialName("argb_color") val color: Long, | ||
@SerialName("disabled") val disabled: Boolean, | ||
@SerialName("independent") val independent: Boolean, | ||
@SerialName("max_count") val maxCount: Int, | ||
@SerialName("member_count") val memberCount: Int, | ||
@SerialName("owned") val owned: Boolean, | ||
@SerialName("role_id") val roleId: Long, | ||
@SerialName("role_name") val roleName: String, | ||
@SerialName("permission") val permission: List<Permission>, | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters