qqbot/bin/channel-core/index.js

45 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-06-02 00:50:48 +08:00
import { messageCreate, messageDelete } from "../message/index.js";
import { ws } from "./base.js";
// 消息监听
ws.on('READY', (wsdata) => {
console.log('[READY] 事件接收 :', wsdata);
});
ws.on('ERROR', (data) => {
console.log('[ERROR] 事件接收 :', data);
});
ws.on('GUILDS', (data) => {
console.log('[GUILDS] 事件接收 :', data);
});
ws.on('GUILD_MEMBERS', (data) => {
console.log('[GUILD_MEMBERS] 事件接收 :', data);
});
ws.on('GUILD_MESSAGES', (data) => {
2022-06-02 15:45:35 +08:00
console.log('[GUILD_MESSAGES] 事件接收 :', JSON.stringify(data));
2022-06-02 00:50:48 +08:00
if(data.eventType == "MESSAGE_CREATE"){
2022-06-02 15:45:35 +08:00
messageCreate(data)
2022-06-02 00:50:48 +08:00
}else if(data.eventType == "MESSAGE_DELETE"){
2022-06-02 15:45:35 +08:00
messageDelete(data)
2022-06-02 00:50:48 +08:00
}
});
ws.on('GUILD_MESSAGE_REACTIONS', (data) => {
console.log('[GUILD_MESSAGE_REACTIONS] 事件接收 :', data);
});
ws.on('DIRECT_MESSAGE', (data) => {
console.log('[DIRECT_MESSAGE] 事件接收 :', data);
});
ws.on('INTERACTION', (data) => {
console.log('[INTERACTION] 事件接收 :', data);
});
ws.on('MESSAGE_AUDIT', (data) => {
console.log('[MESSAGE_AUDIT] 事件接收 :', data);
});
ws.on('FORUMS_EVENT', (data) => {
console.log('[FORUMS_EVENT] 事件接收 :', data);
});
ws.on('AUDIO_ACTION', (data) => {
console.log('[AUDIO_ACTION] 事件接收 :', data);
});
ws.on('PUBLIC_GUILD_MESSAGES', (data) => {
console.log('[PUBLIC_GUILD_MESSAGES] 事件接收 :', data);
});