Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Mar 9, 2022
1 parent ecb4ccf commit 4f1a023
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,15 @@ const telegram = new TelegramAPI("token"); // bot token api
// listen for the message event

telegram.onMessage(async (message) => {
if (message.text === "Hi")
await telegram.sendMessage(message.chat.id, "Hi there!"); // sendMessage will return an instance of IMessage
if (message.text === "Hi bot!")
await telegram.sendMessage(message.chat.id, "Hi there, human!"); // sendMessage will return an instance of IMessage
});

// OR

telegram.on("message", async (message) => {
if (message.text === "Hi bot!")
await telegram.sendMessage(message.chat.id, "Hi there, human!"); // sendMessage will return an instance of IMessage
});

// fetch new updates from the api
Expand Down
3 changes: 3 additions & 0 deletions src/structure/TelegramAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,7 @@ export class TelegramAPI {
* Use this method to change the list of the bot's commands. for more details about bot commands. Returns True on success.
* @see https://core.telegram.org/bots#commands
* @param commands A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
* @param options setMyCommandsOptions
* @returns boolean
*/

Expand Down Expand Up @@ -1199,8 +1200,10 @@ export class TelegramAPI {

/**
* Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.
* @param options setMyCommandsOptions
* @returns boolean
*/

async deleteMyCommands(options?: setMyCommandsOptions) {
let params = {};

Expand Down

0 comments on commit 4f1a023

Please sign in to comment.