Skip to content

Commit

Permalink
fix: pnpm锁文件判断错误,修正onebot11语音类型错误
Browse files Browse the repository at this point in the history
  • Loading branch information
CakmLexi committed Jul 12, 2024
1 parent d389a54 commit 6ad9312
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/adapter/onebot/11/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function AdapterConvertKarin (data: Array<OB11Segment>): Array<KarinEleme
elements.push(segment.image(i.data.url || i.data.file, { file_type: i.data.type }))
break
case 'record':
elements.push(segment.voice(i.data.url || i.data.file, i.data.magic === 1))
elements.push(segment.record(i.data.url || i.data.file, i.data.magic === 1))
break
case 'video':
elements.push(segment.video(i.data.url || i.data.file))
Expand Down
2 changes: 1 addition & 1 deletion src/utils/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class KarinInit {
* 获取当前的包管理器 根据锁文件判断
*/
getRegistry (): 'pnpm' | 'cnpm' | 'yarn' | 'npm' {
if (fs.existsSync('./pnpm-lock')) return 'pnpm'
if (fs.existsSync('./pnpm-lock.yaml')) return 'pnpm'
if (fs.existsSync('./yarn.lock')) return 'yarn'
if (fs.existsSync('./package-lock.json')) return 'npm'
// cnpm 没有锁文件
Expand Down
10 changes: 5 additions & 5 deletions src/utils/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
FaceElement,
BubbleFaceElement,
ReplyElement,
VoiceElement,
VideoElement,
BasketballElement,
DiceElement,
Expand All @@ -29,6 +28,7 @@ import {
NodeElement,
KarinElement,
LongMsgElement,
RecordElement,
} from 'karin/types'

export const segment = new (class Segment {
Expand Down Expand Up @@ -164,9 +164,9 @@ export const segment = new (class Segment {
* @param name - 语音名称
* @returns {VoiceElement} 语音元素
*/
record (file: string, magic = false, md5 = '', name = ''): VoiceElement {
record (file: string, magic = false, md5 = '', name = ''): RecordElement {
return {
type: 'voice',
type: 'record',
file,
magic,
md5,
Expand All @@ -183,9 +183,9 @@ export const segment = new (class Segment {
* @returns {VoiceElement} 语音元素
* @deprecated 即将废弃 请使用segment.record
*/
voice (file: string, magic = false, md5 = '', name = ''): VoiceElement {
voice (file: string, magic = false, md5 = '', name = ''): RecordElement {
return {
type: 'voice',
type: 'record',
file,
magic,
md5,
Expand Down

0 comments on commit 6ad9312

Please sign in to comment.