-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
189 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @file plugins Mys request getEmojis.ts | ||
* @description Mys 表情包请求函数集合 | ||
* @author BTMuli <[email protected]> | ||
* @since Beta v0.3.0 | ||
*/ | ||
|
||
// tauri | ||
import { http } from "@tauri-apps/api"; | ||
|
||
/** | ||
* @description 获取表情包列表 | ||
* @since Beta v0.3.0 | ||
* @return {Promise<Record<string,string>|TGApp.BBS.Response.Base>} | ||
*/ | ||
export async function getEmojis(): Promise<Record<string, string> | TGApp.BBS.Response.Base> { | ||
const url = "https://bbs-api-static.miyoushe.com/misc/api/emoticon_set"; | ||
return await http.fetch<TGApp.Plugins.Mys.Emoji.Response>(url).then((res) => { | ||
if (res.data.retcode === 0) { | ||
const emojis: Record<string, string> = {}; | ||
res.data.data.list.forEach((series) => { | ||
series.list.forEach((emoji) => { | ||
emojis[emoji.name] = emoji.icon; | ||
}); | ||
}); | ||
return emojis; | ||
} | ||
return res.data; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/** | ||
* @file plugins Mys types Emoji.d.ts | ||
* @description Mys 表情包类型声明文件 | ||
* @author BTMuli <[email protected]> | ||
* @since Beta v0.3.0 | ||
*/ | ||
|
||
/** | ||
* @description Mys 表情包类型 | ||
* @since Beta v0.3.0 | ||
* @namespace Emoji | ||
* return Emoji | ||
*/ | ||
declare namespace TGApp.Plugins.Mys.Emoji { | ||
/** | ||
* @description 获取表情包列表返回 | ||
* @since Beta v0.3.0 | ||
* @interface Response | ||
* @extends TGApp.Plugins.Mys.Base.Response | ||
* @property {Series[]} data.list 表情包列表 | ||
* @property {unknown} data.recently_emoticon 最近使用的表情包 | ||
* @return Response | ||
*/ | ||
export interface Response extends TGApp.Plugins.Mys.Base.Response { | ||
data: { | ||
list: Series[]; | ||
recently_emoticon: unknown; | ||
}; | ||
} | ||
|
||
/** | ||
* @description 表情包系列 | ||
* @since Beta v0.3.0 | ||
* @interface Series | ||
* @property {number} id 表情包系列 ID | ||
* @property {string} name 表情包系列名称 | ||
* @property {string} icon 表情包系列图标 | ||
* @property {number} sort_order 表情包系列排序 | ||
* @property {number} num 表情包系列数量 | ||
* @property {string} status 表情包系列状态 | ||
* @property {EmojiItem[]} list 表情包系列列表 | ||
* @property {number} updated_at 表情包系列更新时间 | ||
* @property {boolean} is_available 表情包系列是否可用 | ||
* @return Series | ||
*/ | ||
export interface Series { | ||
id: number; | ||
name: string; | ||
icon: string; | ||
sort_order: number; | ||
num: number; | ||
status: string; | ||
list: EmojiItem[]; | ||
updated_at: number; | ||
is_available: boolean; | ||
} | ||
|
||
/** | ||
* @description 表情包 | ||
* @since Beta v0.3.0 | ||
* @interface EmojiItem | ||
* @property {number} id 表情包 ID | ||
* @property {string} name 表情包名称 | ||
* @property {string} icon 表情包图标 | ||
* @property {number} sort_order 表情包排序 | ||
* @property {string} static_icon 表情包静态图标 | ||
* @property {number} updated_at 表情包更新时间 | ||
* @property {boolean} is_available 表情包是否可用 | ||
* @property {string} status 表情包状态 | ||
* @property {unknown[]} keywords 表情包关键词 | ||
* @return EmojiItem | ||
*/ | ||
export interface EmojiItem { | ||
id: number; | ||
name: string; | ||
icon: string; | ||
sort_order: number; | ||
static_icon: string; | ||
updated_at: number; | ||
is_available: boolean; | ||
status: string; | ||
keywords: unknown[]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters