update: 填补类型声明
This commit is contained in:
parent
503942cc0d
commit
19a54257a6
|
@ -8,6 +8,7 @@ import moment from 'moment'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import Runtime from './plugins/runtime.js'
|
import Runtime from './plugins/runtime.js'
|
||||||
import Handler from './plugins/handler.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
|
* 参数文档 https://oicqjs.github.io/oicq/interfaces/GroupMessageEvent.html
|
||||||
* @param e icqq Events
|
* @param e icqq Events
|
||||||
*/
|
*/
|
||||||
async deal(e) {
|
async deal(e: EventType) {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -658,7 +659,7 @@ class PluginsLoader {
|
||||||
* 处理回复,捕获发送失败异常
|
* 处理回复,捕获发送失败异常
|
||||||
* @param e
|
* @param e
|
||||||
*/
|
*/
|
||||||
reply(e) {
|
reply(e: EventType) {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -927,7 +928,7 @@ class PluginsLoader {
|
||||||
* @param e
|
* @param e
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
checkLimit(e) {
|
checkLimit(e: EventType) {
|
||||||
/** 禁言中 */
|
/** 禁言中 */
|
||||||
if (e.isGroup && e?.group?.mute_left > 0) return false
|
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
|
* @param e
|
||||||
* @returns
|
* @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
|
* @param e
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onlyReplyAt(e) {
|
onlyReplyAt(e: EventType) {
|
||||||
if (!e.message || e.isPrivate) return true
|
if (!e.message || e.isPrivate) return true
|
||||||
|
|
||||||
let groupCfg = cfg.getGroup(e.group_id)
|
let groupCfg = cfg.getGroup(String(e.group_id))
|
||||||
|
|
||||||
/** 模式0,未开启前缀 */
|
/** 模式0,未开启前缀 */
|
||||||
if (groupCfg.onlyReplyAt == 0 || !groupCfg.botAlias) return true
|
if (groupCfg.onlyReplyAt == 0 || !groupCfg.botAlias) return true
|
||||||
|
@ -1042,7 +1043,7 @@ class PluginsLoader {
|
||||||
* @param e
|
* @param e
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
checkGuildMsg(e) {
|
checkGuildMsg(e: EventType) {
|
||||||
return cfg.getOther().disableGuildMsg && e.detail_type == 'guild'
|
return cfg.getOther().disableGuildMsg && e.detail_type == 'guild'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,7 +1052,7 @@ class PluginsLoader {
|
||||||
* @param e
|
* @param e
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
checkBlack(e) {
|
checkBlack(e: EventType) {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { type GroupMessage, Client } from 'icqq'
|
import { type GroupMessage } from 'icqq'
|
||||||
import { PrivateMessage } from 'oicq'
|
// import { Client } from 'icqq'
|
||||||
|
// import { PrivateMessage } from 'oicq'
|
||||||
|
|
||||||
interface EventTypeBase {
|
interface EventTypeBase {
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +30,7 @@ interface EventTypeBase {
|
||||||
file: any;
|
file: any;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
bot: typeof Client.prototype;
|
bot: any;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -42,10 +43,38 @@ interface EventTypeBase {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
logText: any;
|
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;
|
|
||||||
/**
|
/**
|
||||||
* 群号
|
* 群号
|
||||||
*/
|
*/
|
||||||
|
@ -53,7 +82,7 @@ interface EventTypeGroup extends EventTypeBase, GroupMessage {
|
||||||
/**
|
/**
|
||||||
* 群名
|
* 群名
|
||||||
*/
|
*/
|
||||||
group_name:string
|
group_name: string
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -62,18 +91,48 @@ interface EventTypeGroup extends EventTypeBase, GroupMessage {
|
||||||
recallMsg: (...arg: any[]) => any;
|
recallMsg: (...arg: any[]) => any;
|
||||||
getMemberMap: any;
|
getMemberMap: any;
|
||||||
quit: any;
|
quit: any;
|
||||||
|
mute_left: any
|
||||||
|
|
||||||
|
pickMember: any
|
||||||
|
|
||||||
|
|
||||||
|
sendMsg: any
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
atBot: any;
|
atBot: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
isPrivate?: any
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
hasAlias?: any
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
replyNew?: any
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
isGuild?: any
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
friend?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EventTypePrivate extends EventTypeBase, PrivateMessage {
|
export interface EventType extends EventTypeBase, GroupMessage { }
|
||||||
isGroup: false;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type EventType = EventTypeGroup | EventTypePrivate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 函数式回调类型
|
* 函数式回调类型
|
||||||
|
|
Loading…
Reference in New Issue