fix: scope proposals to chat users
This commit is contained in:
+5
-5
@@ -139,25 +139,25 @@ export class Gateway {
|
||||
switch (command.kind) {
|
||||
case "help": return HELP_TEXT;
|
||||
case "status": {
|
||||
const status = this.runtime.status(message.platform, message.chatId);
|
||||
const status = this.runtime.status(message.platform, message.chatId, message.userId);
|
||||
return `OK\n${Object.entries(status).map(([key, value]) => `${key}=${value}`).join("\n")}`;
|
||||
}
|
||||
case "list": {
|
||||
if (!this.runtime.listProposals) return "当前运行时不支持列出提案。";
|
||||
const proposals = this.runtime.listProposals(message.platform, message.chatId);
|
||||
const proposals = this.runtime.listProposals(message.platform, message.chatId, message.userId);
|
||||
if (proposals.length === 0) return "当前没有提案。";
|
||||
return proposals.map((proposal) => `${proposal.id} [${proposal.status}] ${proposal.title}`).join("\n");
|
||||
}
|
||||
case "confirm": {
|
||||
if (!this.runtime.confirm) return "当前运行时不支持确认操作。";
|
||||
return await this.runtime.confirm(message.platform, message.chatId) ? "已确认,继续执行。" : "当前没有待确认的提案。";
|
||||
return await this.runtime.confirm(message.platform, message.chatId, message.userId) ? "已确认,继续执行。" : "当前没有待确认的提案。";
|
||||
}
|
||||
case "stop": {
|
||||
if (!this.runtime.stop) return "当前运行时不支持停止操作。";
|
||||
return await this.runtime.stop(message.platform, message.chatId) ? "已停止当前任务。" : "当前没有正在执行的任务。";
|
||||
return await this.runtime.stop(message.platform, message.chatId, message.userId) ? "已停止当前任务。" : "当前没有正在执行的任务。";
|
||||
}
|
||||
case "cancel":
|
||||
return await this.runtime.cancel(message.platform, message.chatId) ? "已取消最近的提案。" : "没有可取消的提案。";
|
||||
return await this.runtime.cancel(message.platform, message.chatId, message.userId) ? "已取消最近的提案。" : "没有可取消的提案。";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user