Skip to content

Commit

Permalink
feat: reply event_id
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeRainStarSky committed May 31, 2024
1 parent 2eab1b0 commit e3d02cc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum MusicPlatform {

export interface Quotable {
id?: string
event_id?: string
}

export interface MessageElemMap {
Expand Down
14 changes: 9 additions & 5 deletions src/entries/sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,16 @@ export class Sender {
const {type, ...data} = elem
switch (elem.type) {
case 'reply':
this.messagePayload.msg_id = elem.id
this.filePayload.msg_id = elem.id
this.messagePayload.message_reference = {
message_id: elem.id
if (elem.event_id) {
this.messagePayload.event_id = elem.event_id
this.brief += `<reply,event_id=${elem.event_id}>`
} else {
this.messagePayload.msg_id = elem.id
this.messagePayload.message_reference = {
message_id: elem.id
}
this.brief += `<reply,msg_id=${elem.id}>`
}
this.brief += `<reply,msg_id=${elem.id}>`
break;
case "at":
this.messagePayload.content += `<@${elem.user_id === 'all' ? 'everyone' : elem.user_id}>`
Expand Down
3 changes: 2 additions & 1 deletion src/event/notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ export namespace NoticeEvent {
}

export class ActionNoticeEvent extends NoticeEvent {
event_id: string
notice_id: string
data: ActionNoticeEvent.ActionData
private replied: boolean = false

constructor(bot: Bot, payload: Dict) {
super(bot, payload);
this.sub_type = 'action'
this.event_id = payload.event_id
this.notice_id = payload.id
this.data = payload.data

}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/qqBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export class QQBot extends EventEmitter {
delete config.data.message_reference
const formData=new FormData()
for(const key in config.data)
formData.set(key,config.data[key])
if (config.data[key] !== undefined)
formData.set(key,config.data[key])
config.data=formData
}
return config
Expand Down

0 comments on commit e3d02cc

Please sign in to comment.