mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: #785
This commit is contained in:
@@ -13,11 +13,10 @@ type Payload = Static<typeof SchemaData>;
|
|||||||
export default class SetGroupBan extends OneBotAction<Payload, null> {
|
export default class SetGroupBan extends OneBotAction<Payload, null> {
|
||||||
override actionName = ActionName.SetGroupBan;
|
override actionName = ActionName.SetGroupBan;
|
||||||
override payloadSchema = SchemaData;
|
override payloadSchema = SchemaData;
|
||||||
|
|
||||||
async _handle(payload: Payload): Promise<null> {
|
async _handle(payload: Payload): Promise<null> {
|
||||||
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||||
if (!uid) throw new Error('uid error');
|
if (!uid) throw new Error('uid error');
|
||||||
// 例如无管理员权限时 result: 120101005 errMsg: 'ERR_NOT_GROUP_ADMIN'
|
// 例如无管理员权限时 result为 120101005 errMsg为 'ERR_NOT_GROUP_ADMIN'
|
||||||
let ret = await this.core.apis.GroupApi.banMember(payload.group_id.toString(),
|
let ret = await this.core.apis.GroupApi.banMember(payload.group_id.toString(),
|
||||||
[{ uid: uid, timeStamp: +payload.duration }]);
|
[{ uid: uid, timeStamp: +payload.duration }]);
|
||||||
if (ret.result !== 0) throw new Error(ret.errMsg);
|
if (ret.result !== 0) throw new Error(ret.errMsg);
|
||||||
|
Reference in New Issue
Block a user