update: 填补类型声明

This commit is contained in:
ningmengchongshui 2024-06-14 11:01:30 +08:00
parent 503942cc0d
commit 19a54257a6
2 changed files with 82 additions and 22 deletions

View File

@ -8,6 +8,7 @@ import moment from 'moment'
import path from 'node:path'
import Runtime from './plugins/runtime.js'
import Handler from './plugins/handler.js'
import { EventType } from './plugins/types.js'
/**
*
@ -267,7 +268,7 @@ class PluginsLoader {
* https://oicqjs.github.io/oicq/interfaces/GroupMessageEvent.html
* @param e icqq Events
*/
async deal(e) {
async deal(e: EventType) {
/**
*
*/
@ -658,7 +659,7 @@ class PluginsLoader {
* ,
* @param e
*/
reply(e) {
reply(e: EventType) {
/**
*
*/
@ -927,7 +928,7 @@ class PluginsLoader {
* @param e
* @returns
*/
checkLimit(e) {
checkLimit(e: EventType) {
/** 禁言中 */
if (e.isGroup && e?.group?.mute_left > 0) return false
/**
@ -938,7 +939,7 @@ class PluginsLoader {
/**
*
*/
let config = cfg.getGroup(e.group_id)
let config = cfg.getGroup(String(e.group_id))
/**
*
@ -984,7 +985,7 @@ class PluginsLoader {
* @param e
* @returns
*/
setLimit(e) {
setLimit(e: EventType) {
/**
*
*/
@ -992,7 +993,7 @@ class PluginsLoader {
/**
*
*/
let config = cfg.getGroup(e.group_id)
let config = cfg.getGroup(String(e.group_id))
/**
*
@ -1017,10 +1018,10 @@ class PluginsLoader {
* @param e
* @returns
*/
onlyReplyAt(e) {
onlyReplyAt(e: EventType) {
if (!e.message || e.isPrivate) return true
let groupCfg = cfg.getGroup(e.group_id)
let groupCfg = cfg.getGroup(String(e.group_id))
/** 模式0未开启前缀 */
if (groupCfg.onlyReplyAt == 0 || !groupCfg.botAlias) return true
@ -1042,7 +1043,7 @@ class PluginsLoader {
* @param e
* @returns
*/
checkGuildMsg(e) {
checkGuildMsg(e: EventType) {
return cfg.getOther().disableGuildMsg && e.detail_type == 'guild'
}
@ -1051,7 +1052,7 @@ class PluginsLoader {
* @param e
* @returns
*/
checkBlack(e) {
checkBlack(e: EventType) {
/**
*
*/

View File

@ -1,5 +1,6 @@
import { type GroupMessage, Client } from 'icqq'
import { PrivateMessage } from 'oicq'
import { type GroupMessage } from 'icqq'
// import { Client } from 'icqq'
// import { PrivateMessage } from 'oicq'
interface EventTypeBase {
/**
@ -29,7 +30,7 @@ interface EventTypeBase {
file: any;
/**
*/
bot: typeof Client.prototype;
bot: any;
/**
*
*/
@ -42,10 +43,38 @@ interface EventTypeBase {
*
*/
logText: any;
}
/**
*
*/
isSr?: boolean
/**
*
*/
isGs?: boolean
/**
*
*/
self_id?: any
/**
*
*/
game?: any
/**
*
*/
logFnc?: any
/**
*
*/
detail_type?: any
/**
*
*/
at?: any
interface EventTypeGroup extends EventTypeBase, GroupMessage {
isGroup: true;
/**
*
*/
@ -62,18 +91,48 @@ interface EventTypeGroup extends EventTypeBase, GroupMessage {
recallMsg: (...arg: any[]) => any;
getMemberMap: any;
quit: any;
mute_left: any
pickMember: any
sendMsg: any
};
/**
*
*/
atBot: any;
/**
*
*/
isPrivate?: any
/**
*
*/
hasAlias?: any
/**
*
*/
replyNew?: any
/**
*
*/
isGuild?: any
/**
*
*/
friend?: any
}
interface EventTypePrivate extends EventTypeBase, PrivateMessage {
isGroup: false;
}
export type EventType = EventTypeGroup | EventTypePrivate;
export interface EventType extends EventTypeBase, GroupMessage { }
/**
*