@satorijs/adapter-kook
Advanced tools
Comparing version 3.9.1 to 3.9.2
@@ -1,3 +0,2 @@ | ||
import { Bot, Context, Fragment, Quester, Schema, Universal } from '@satorijs/satori'; | ||
import { Method } from 'axios'; | ||
import { Bot, Context, Fragment, Quester, Schema, SendOptions, Universal } from '@satorijs/satori'; | ||
import * as Kook from './types'; | ||
@@ -12,3 +11,3 @@ import { WsClient } from './ws'; | ||
constructor(ctx: Context, config: T); | ||
request<T = any>(method: Method, path: string, data?: {}, headers?: any): Promise<T>; | ||
request<T = any>(method: Quester.Method, path: string, data?: {}, headers?: any): Promise<T>; | ||
deleteMessage(channelId: string, msg_id: string): Promise<void>; | ||
@@ -25,2 +24,3 @@ editMessage(channelId: string, msg_id: string, content: Fragment): Promise<void>; | ||
kickGroup(guild_id: string, user_id: string): Promise<void>; | ||
sendPrivateMessage(userId: string, content: Fragment, options?: SendOptions): Promise<string[]>; | ||
createReaction(channelId: string, messageId: string, emoji: string): Promise<void>; | ||
@@ -27,0 +27,0 @@ deleteReaction(channelId: string, messageId: string, emoji: string, userId?: string): Promise<void>; |
@@ -590,6 +590,2 @@ var __create = Object.create; | ||
async prepare() { | ||
if (this.session.subtype === "private") { | ||
const { code } = await this.bot.request("POST", "/user-chat/create", { target_id: this.session.channelId }); | ||
this.session.channelId = code; | ||
} | ||
if (isDirectChannel(this.session.channelId)) { | ||
@@ -808,3 +804,3 @@ this.params.chat_code = this.session.channelId; | ||
async deleteMessage(channelId, msg_id) { | ||
if (channelId.length > 30) { | ||
if (isDirectChannel(channelId)) { | ||
await this.request("POST", "/user-chat/delete-msg", { msg_id }); | ||
@@ -817,3 +813,3 @@ } else { | ||
content = import_satori5.h.normalize(content).join(""); | ||
if (channelId.length > 30) { | ||
if (isDirectChannel(channelId)) { | ||
await this.request("POST", "/user-chat/update-msg", { msg_id, content }); | ||
@@ -825,3 +821,3 @@ } else { | ||
async getMessage(channelId, msg_id) { | ||
if (channelId.length > 30) { | ||
if (isDirectChannel(channelId)) { | ||
return adaptMessage(await this.request("POST", "/user-chat/view", { msg_id })); | ||
@@ -833,3 +829,3 @@ } else { | ||
async $createReaction(channelId, msg_id, emoji) { | ||
if (channelId.length > 30) { | ||
if (isDirectChannel(channelId)) { | ||
await this.request("POST", "/direct-message/add-reaction", { msg_id, emoji }); | ||
@@ -841,3 +837,3 @@ } else { | ||
async $deleteReaction(channelId, messageId, emoji, user_id) { | ||
if (channelId.length > 30) { | ||
if (isDirectChannel(channelId)) { | ||
await this.request("POST", "/direct-message/delete-reaction", { msg_id: messageId, emoji }); | ||
@@ -871,2 +867,6 @@ } else { | ||
} | ||
async sendPrivateMessage(userId, content, options) { | ||
const { code } = await this.request("POST", "/user-chat/create", { target_id: userId }); | ||
return this.sendMessage(code, content, null, options); | ||
} | ||
createReaction(channelId, messageId, emoji) { | ||
@@ -873,0 +873,0 @@ if (isDirectChannel(channelId)) { |
{ | ||
"name": "@satorijs/adapter-kook", | ||
"description": "Kook (Kaiheila) Adapter for Satorijs", | ||
"version": "3.9.1", | ||
"version": "3.9.2", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "typings": "lib/index.d.ts", |
Sorry, the diff of this file is not supported yet
137745