Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(qq): integrate new audit structure in sending message #303

Merged
merged 1 commit into from
Jul 31, 2024
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
12 changes: 4 additions & 8 deletions adapters/qq/src/internal/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ declare module './internal' {
sendMessage(channel_id: string, data: QQ.Message.Request): Promise<{
id: string
timestamp: string
} & {
code: number
message: string
data: any
audit_id?: string
audit_tips?: string
}>
sendPrivateMessage(openid: string, data: QQ.Message.Request): Promise<{
id: string
timestamp: string
} & {
code: number
message: string
data: any
audit_id?: string
audit_tips?: string
}>
sendFilePrivate(openid: string, data: QQ.Message.File.Request): Promise<any>
sendFileGuild(group_openid: string, data: QQ.Message.File.Request): Promise<any>
Expand Down
6 changes: 3 additions & 3 deletions adapters/qq/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,16 @@ export class QQMessageEncoder<C extends Context = Context> extends MessageEncode
const resp = this.session.isDirect
? await this.bot.internal.sendPrivateMessage(this.session.channelId, data)
: await this.bot.internal.sendMessage(this.session.channelId, data)
if (resp.id) {
if (resp.id && !resp.audit_id) {
session.messageId = resp.id
session.timestamp = new Date(resp.timestamp).valueOf()
session.channelId = this.session.channelId
session.guildId = this.session.guildId
session.app.emit(session, 'send', session)
this.results.push(session.event.message)
} else if (resp.code === 304023 && this.bot.config.intents & QQ.Intents.MESSAGE_AUDIT) {
} else if (resp.audit_id && this.bot.config.intents & QQ.Intents.MESSAGE_AUDIT) {
try {
const auditData: QQ.MessageAudited = await this.audit(resp.data.message_audit.audit_id)
const auditData: QQ.MessageAudited = await this.audit(resp.audit_id)
session.messageId = auditData.message_id
session.app.emit(session, 'send', session)
this.results.push(session.event.message)
Expand Down