Commit 806a8f39 authored by nanahira's avatar nanahira

preserve unknown fields of message

parent c2e34cc3
Pipeline #6532 passed with stages
in 12 minutes and 57 seconds
...@@ -115,15 +115,15 @@ export class MessageService extends ConsoleLogger { ...@@ -115,15 +115,15 @@ export class MessageService extends ConsoleLogger {
}; };
} }
// eslint-disable-next-line prefer-const // eslint-disable-next-line prefer-const
let { action, params, echo } = data; let { action } = data;
const isAsync = action.endsWith('_async'); const isAsync = action.endsWith('_async');
if (isAsync) action = action.replace('_async', ''); if (isAsync) action = action.replace('_async', '');
const isQueue = action.endsWith('_rate_limited'); const isQueue = action.endsWith('_rate_limited');
if (isQueue) action = action.replace('_rate_limited', ''); if (isQueue) action = action.replace('_rate_limited', '');
const task: SendTask = { bot, route, data: { action, params, echo } }; const task: SendTask = { bot, route, data: { ...data, action } };
if (route.readonly && !action.startsWith('get_')) { if (route.readonly && !action.startsWith('get_')) {
if (isAsync || isQueue) { if (isAsync || isQueue) {
return OnebotAsyncResponseWithEcho(echo); return OnebotAsyncResponseWithEcho(data.echo);
} }
return { return {
retcode: 0, retcode: 0,
...@@ -136,11 +136,11 @@ export class MessageService extends ConsoleLogger { ...@@ -136,11 +136,11 @@ export class MessageService extends ConsoleLogger {
} }
if (isQueue) { if (isQueue) {
route.addSendTask(task); route.addSendTask(task);
return OnebotAsyncResponseWithEcho(echo); return OnebotAsyncResponseWithEcho(data.echo);
} }
const prom = this.sendToBot(task); const prom = this.sendToBot(task);
if (isAsync) { if (isAsync) {
return OnebotAsyncResponseWithEcho(echo); return OnebotAsyncResponseWithEcho(data.echo);
} }
return prom; return prom;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment