Skip to content

Commit 976fea2

Browse files
authored
Merge pull request #1 from M-ximilian/patch-1
/open default
2 parents 056f992 + 5f43659 commit 976fea2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,20 @@ manager.isOpen().then((_) => {
120120
}
121121
});
122122

123-
bot.on('message', (msg) => {
123+
bot.onText(/^\/help$/, async (msg) => {
124124
const chatId = msg.chat.id;
125-
const commands = ["/open", "/notify", "/notify_closed"];
125+
bot.sendMessage(chatId, HELP_MASSAGE);
126+
});
127+
128+
bot.on('message', async (msg) => {
129+
const chatId = msg.chat.id;
130+
const commands = ["/open", "/notify", "/notify_closed", "/help"];
126131
if(commands.includes(msg.text)){
127132
return;
128133
}
129-
bot.sendMessage(chatId, HELP_MASSAGE);
134+
const isOpen = await manager.isOpen();
135+
const resp = isOpen ? OPEN_MESSAGE : CLOSED_MESSAGE;
136+
bot.sendMessage(chatId, resp);
130137
});
131138
});
132139

0 commit comments

Comments
 (0)