feat: enhance role handling by updating reply structure and adding role assignment functionality

This commit is contained in:
MythEclipse
2026-05-16 00:32:29 +07:00
parent c6ee7bb8c6
commit 41c6b567a6
6 changed files with 38 additions and 18 deletions
+7 -3
View File
@@ -37,7 +37,11 @@ export function attachBotHandlers(client: Client, config: AppConfig): void {
});
}
function resolveAnchorPosition(guild: { roles: { cache: { get(id: string): { position: number } | undefined } } }, anchorRoleId: string | null): number {
if (!anchorRoleId) return 1;
return guild.roles.cache.get(anchorRoleId)?.position ?? 1;
function resolveAnchorPosition(guild: { members: { me: { roles: { highest: { position: number } } } | null }; roles: { cache: { get(id: string): { position: number } | undefined } } }, anchorRoleId: string | null): number {
if (!anchorRoleId) return botRolePosition(guild);
return guild.roles.cache.get(anchorRoleId)?.position ?? botRolePosition(guild);
}
function botRolePosition(guild: { members: { me: { roles: { highest: { position: number } } } | null } }): number {
return guild.members.me?.roles.highest.position ?? 1;
}