Skip to content

Commit

Permalink
fix: export type & @example for doc
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Jul 6, 2022
1 parent b820395 commit 9e4e75d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "mirai-ts",
"version": "2.3.5",
"description": "Mirai TypeScript SDK",
"packageManager": "pnpm@7.5.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion src/mirai-api-http/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import type { AxiosResponse } from 'axios'
import type { MiraiApiHttp } from './index'

interface CommandInfo {
export interface CommandInfo {
name: string
sender: number
group: number
Expand Down
2 changes: 1 addition & 1 deletion src/mirai-api-http/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type FileInfoResponse = AxiosResponse<
Api.Response.ResponseType<FileInfo>
>

interface BaseFileOptions {
export interface BaseFileOptions {
/**
* 文件 ID
*/
Expand Down
8 changes: 4 additions & 4 deletions src/mirai-api-http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export * from './file'
export * from './resp'
export * from './utils'

interface WsCallbackMap {
export interface WsCallbackMap {
message: (msg: MessageType.ChatMessage) => any
event: (event: EventType.Event) => any
all: (data: EventType.Event | MessageType.ChatMessage) => any
Expand Down Expand Up @@ -144,7 +144,7 @@ export class MiraiApiHttp {

/**
* 使用此方法获取插件的信息,如版本号
* data.data: { "version": "v1.0.0" }
* @example data.data: { "version": "v1.0.0" }
*/
async about() {
const { data } = await this.axios.get<
Expand Down Expand Up @@ -214,7 +214,7 @@ export class MiraiApiHttp {
// 获取 Bot 收到的消息和事件
/**
* 使用此方法获取 bot 接收到的最老消息和最老各类事件(会从 MiraiApiHttp 消息记录中删除)
* { code: 0, data: [] }
* @example { code: 0, data: [] }
* @param count 获取消息和事件的数量
*/
async fetchMessage(count = 10) {
Expand Down Expand Up @@ -305,7 +305,7 @@ export class MiraiApiHttp {
* @param messageChain 消息链,是一个消息对象构成的数组
* @param target 发送消息目标好友的 QQ 号
* @param quote 引用一条消息的messageId进行回复
* @returns '{ code: 0, msg: "success", messageId: 123456 }' messageId 一个Int类型属性,标识本条消息,用于撤回和引用回复
* @returns { code: 0, msg: "success", messageId: 123456 } messageId 一个Int类型属性,标识本条消息,用于撤回和引用回复
*/
async sendFriendMessage(
messageChain: string | MessageType.MessageChain,
Expand Down
6 changes: 3 additions & 3 deletions src/mirai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ export type MessageAndEventType =
/**
* 数据类型
*/
type Data<
export type Data<
T extends 'message' | EventType.EventType | MessageType.ChatMessageType,
> = T extends EventType.EventType
? EventType.EventMap[T]
: T extends MessageType.ChatMessageType
? MessageType.ChatMessageMap[T]
: MessageType.ChatMessage

type SendMessageType = 'friend' | 'group'
export type SendMessageType = 'friend' | 'group'

/**
* Mirai SDK 初始化类
Expand Down Expand Up @@ -205,7 +205,7 @@ export class Mirai {
* 绑定事件列表
* message: FriendMessage | GroupMessage | TempMessage
* [mirai-api-http事件类型一览](https://github.com/project-mirai/mirai-api-http/blob/master/docs/EventType.md)
* mirai.on('MemberMuteEvent', ()=>{})
* @example mirai.on('MemberMuteEvent', ()=>{})
* @param type
* @param callback
*/
Expand Down
2 changes: 1 addition & 1 deletion src/utils/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface CardInfo {

/**
* 生成卡片 XML 消息模版
* Example:
* @example
* msg.reply([
* Message.Xml(
* template.card({
Expand Down

0 comments on commit 9e4e75d

Please sign in to comment.