feat: 全新的客户端协议库!
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import LingChairClient, { User, UserMySelf } from "./LingChairClient.ts"
|
||||
import LingChairClient, { Chat, UserMySelf } from "./LingChairClient.ts"
|
||||
import OnMessageData from "./type/OnMessageData.ts"
|
||||
|
||||
const client = new LingChairClient({
|
||||
@@ -9,7 +9,10 @@ await client.auth({
|
||||
account: '满月',
|
||||
password: '满月',
|
||||
})
|
||||
client.on('Client.onMessage', (data: OnMessageData) => {
|
||||
console.log(data)
|
||||
client.on('Client.onMessage', async (data: OnMessageData) => {
|
||||
const chat = await Chat.getById(client, data.chat)
|
||||
const regexp = /^test (.*)/g.exec(data.msg.text)
|
||||
if (regexp?.[0] != null) {
|
||||
chat?.sendMessage(`Hello, ${regexp[1]}`)
|
||||
}
|
||||
})
|
||||
console.log(await (await UserMySelf.getMySelf(client))?.getMyRecentChatBeans())
|
||||
|
||||
Reference in New Issue
Block a user