Skip to content

Commit

Permalink
fix:新增踢用户
Browse files Browse the repository at this point in the history
  • Loading branch information
yusheng929 committed Aug 4, 2024
1 parent de2ffb1 commit 5552b3f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
27 changes: 27 additions & 0 deletions apps/GroupAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export class UserBing extends Plugin {
{
reg: '^#(申请|我要)头衔',
fnc: 'SetGroupTitle'
},
{
reg: '^#踢(\\d+)?$',
fnc: 'KickMember'
}
]
})
Expand Down Expand Up @@ -85,4 +89,27 @@ export class UserBing extends Plugin {
e.reply(`已将你的头衔更换为「${Title}」`, true)
return true
}
async KickMember (e) {
if (!(UserID.A.role === 'admin' || UserID.A.role === 'owner' || e.isMaster)) return e.reply('暂无权限,只有管理员才能操作')

let qq
e.at.forEach(at => {
if (at === e.self_id) return false
qq = at
})
if (!qq) qq = e.msg.replace(/#/g, '').trim()
if (!qq || !(/\d{5,}/.test(qq))) return e.reply('你QQ号真的输入正确了吗?')
try {
await e.bot.GetGroupMemberList(e.group_id, qq, true)
} catch {
return e.reply('这个群好像没这个人')
}
try {
await e.bot.KickMember(e.group_id, qq)
e.reply (`已经将用户『${qq}』踢出群聊`)
} catch {
return e.reply('错误: 未知原因❌', true)
}
return true
}
}
29 changes: 0 additions & 29 deletions apps/Update.js

This file was deleted.

0 comments on commit 5552b3f

Please sign in to comment.