Skip to content

Commit

Permalink
feat: alert on pinned message by user
Browse files Browse the repository at this point in the history
  • Loading branch information
ilbertt committed Aug 20, 2021
1 parent e242428 commit 027f926
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ bot.on('text', async (ctx) => {
}
});

bot.on('pinned_message', async (ctx) => {
return ctx.replyWithMarkdown(constants.pinnedMessageAlert(ctx.chat.id));
});

bot.catch((err, ctx) => {
return ctx.reply(`Ooops, encountered an error for ${ctx.updateType}`, err);
});
Expand Down
4 changes: 4 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const moveFileMessage = 'MOVE FILE:\n';
const fileSystemNotFound = 'Filesystem not found';
const genericError = 'Error!\nUse one of the available commands instead:';

const pinnedMessageAlert = (chatId) => `Please, make sure that the *last* pinned message is always the \`filesystem${chatId}.json\` file, otherwise _the bot won't work_!`;

/* INLINE BUTTONS */
const mkdirInlineButton = Markup.button.callback(
'+ New Directory',
Expand Down Expand Up @@ -84,6 +86,8 @@ module.exports = {
fileSystemNotFound,
genericError,

pinnedMessageAlert,

mkdirInlineButton,
parentDirInlineButton,
thisDirInlineButton,
Expand Down

0 comments on commit 027f926

Please sign in to comment.