Skip to content

Commit

Permalink
fix: role
Browse files Browse the repository at this point in the history
  • Loading branch information
shijinn520 committed Aug 4, 2024
1 parent 1d5d95e commit 895e97d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions apps/GroupAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,33 @@ export const kickMember = karin.command(/^#踢$/, async (e) => {
return true
}

/** 检查bot自身是否为管理员、群主 */
const info = await e.bot.GetGroupMemberInfo(e.group_id, e.self_id)
if (!(['owner', 'admin'].includes(info.role))) {
await e.reply('少女做不到呜呜~(>_<)~')
return true
}

try {
const res = await e.bot.GetGroupMemberInfo(e.group_id, userId)
if (!res) {
await e.reply('\n这个群好像没这个人', { at: true })
return true
}

/** 检查对方的角色 */
if (res.role === 'owner') {
await e.reply('\n这个人是群主,少女做不到呜呜~(>_<)~', { at: true })
return true
}

if (res.role === 'admin') {
/** 需要是群主 */
if (info.role !== 'owner') {
await e.reply('\n这个人是管理员,少女做不到呜呜~(>_<)~', { at: true })
return true
}
}
} catch {
return e.reply('\n这个群好像没这个人', { at: true })
}
Expand Down

0 comments on commit 895e97d

Please sign in to comment.