-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from razrabs-media/issue/35_help-command
issue(35): adds /help command
- Loading branch information
Showing
6 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./gracefulShutdown"; | ||
export * from "./handleErrors"; | ||
export * from "./sendVacancyTemplateMessage"; | ||
export * from "./sendHelpMessage"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { helpMessageText } from "../../constants/messages"; | ||
import logger from "../logger"; | ||
|
||
export const sendHelpMessage = async (ctx) => { | ||
try { | ||
const { username } = ctx?.update?.message?.chat || {}; | ||
|
||
logger.info(`User @${username} requests for help`); | ||
|
||
await ctx.reply(helpMessageText, { parse_mode: "HTML" }); | ||
|
||
logger.info(`Help message successfully sent to @${username}`); | ||
} catch (err) { | ||
logger.error( | ||
`Failed to send message with help info - ${ | ||
(err as Error)?.message || JSON.stringify(err) | ||
}` | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters