Commit 80d828d3 authored by nanahira's avatar nanahira

delete menu when no

parent ae03a267
......@@ -62,7 +62,22 @@ export class WeComBot extends Bot<BotConfig> {
}
private async initializeMenu() {
if (!this.config.menus?.length) return true;
if (!this.config.menus?.length) {
const data = await this.http.get<WecomSendMessageResponse>(
'https://qyapi.weixin.qq.com/cgi-bin/menu/delete',
{
params: {
access_token: await this.getToken(),
agentid: this.config.agentId,
},
},
);
if (data.errcode) {
this.logger.error(`Failed to remove menu: ${data.errmsg}`);
return false;
}
return true;
}
const button = this.config.menus.map((menu) =>
adaptMenu(menu, this.buttonKeyMap),
);
......
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