Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

导出生成消息id的函数、添加新表情(热化了)、修复音乐分享 #415

Merged
merged 3 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ lib/**/*.d.ts
lib/**/*.js
!lib/**/protobuf.min.d.ts
!lib/**/protobuf.min.js
package-lock.json
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export { Message, PrivateMessage, GroupMessage, DiscussMessage, ForwardMessage,
MusicPlatform, Sendable, Anonymous, MessageElem, FileElem, ReplyElem,
TextElem, AtElem, FaceElem, BfaceElem, MfaceElem, ImageElem, MiraiElem,
FlashElem, PttElem, VideoElem, XmlElem, JsonElem, ShareElem, LocationElem, PokeElem,
parseDmMessageId, parseGroupMessageId, parseImageFileParam, getGroupImageUrl, segment } from "./message"
parseDmMessageId, parseGroupMessageId, parseImageFileParam, getGroupImageUrl, segment, genGroupMessageId, genDmMessageId } from "./message"
export { PrivateMessageEvent, GroupMessageEvent, DiscussMessageEvent, MessageRet,
MessageEvent, RequestEvent, FriendNoticeEvent, GroupNoticeEvent,
FriendRequestEvent, GroupRequestEvent, GroupInviteEvent, EventMap,
Expand Down
1 change: 1 addition & 0 deletions lib/message/face.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export const facemap: {[k: number]: string} = {
337: "/花朵脸",
338: "/我想开了",
339: "/舔屏",
340: "/热化了",
}

export const pokemap: {[k: number]: string} = {
Expand Down
7 changes: 4 additions & 3 deletions lib/message/music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function getMiGuSong(id: string) {
let a: any = await axios.get(`https://music.migu.cn/v3/api/music/audioPlayer/getSongPic?songId=${rsp.songId}`, { responseType: "json", headers: { referer: "https://music.migu.cn/v3/music/player/audio" } })
preview = a.data.smallPic || ""
} catch { }
let url: any = await axios.get(`https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/shareInfo.do?contentId=${rsp.contentId}&contentName=${rsp.songName}&resourceType=2&targetUserName=${rsp.singer}`, { responseType: "json" })
let url: any = await axios.get(`https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/shareInfo.do?contentId=${rsp.contentId}&contentName=${encodeURIComponent(rsp.songName)}&resourceType=2&targetUserName=${encodeURIComponent(rsp.singer)}`, { responseType: "json" })
let jumpUrl = url.data.url || "http://c.migu.cn/"
return {
title: rsp.songName,
Expand Down Expand Up @@ -65,12 +65,13 @@ async function getKuGouSong(id: string) {
async function getKuwoSong(id: string) {
let rsp: any = await axios.get(`http://yinyue.kuwo.cn/api/www/music/musicInfo?mid=${id}&httpsStatus=1`, { responseType: "json", headers: { csrf: id, cookie: " kw_token=" + id } })
rsp = rsp.data.data
let url: any = await axios.get(`http://yinyue.kuwo.cn/url?format=mp3&rid=${id}&response=url&type=convert_url3&from=web&t=${+new Date()}`, { responseType: "json" })
// let url: any = await axios.get(`http://yinyue.kuwo.cn/url?format=mp3&rid=${id}&response=url&type=convert_url3&from=web&t=${+new Date()}`, { responseType: "json" })
let url: any = await axios.get(`http://www.kuwo.cn/api/v1/www/music/playUrl?mid=${id}&type=music&httpsStatus=1`)
return {
title: rsp.name,
singer: rsp.artist,
jumpUrl: "http://yinyue.kuwo.cn/play_detail/" + id,
musicUrl: url.data.url || "https://win-web-ra01-sycdn.kuwo.cn",
musicUrl: url.data.data.url || "https://win-web-ra01-sycdn.kuwo.cn",
preview: rsp.pic,
} as any
}
Expand Down