Skip to content

Commit 4d0b176

Browse files
committed
Fix typos
1 parent cb9d326 commit 4d0b176

3 files changed

Lines changed: 53 additions & 2 deletions

File tree

src/bot-commands.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: Bot Commands
3+
parent: /#walkthrough
4+
walkthrough:
5+
track: bot
6+
order: 12
7+
---
8+
9+
Bots can publish a list of commands that Telegram shows to users.
10+
11+
## Setting Commands
12+
13+
Use {{ "setMyCommands" |> m }} with each command's name and description.
14+
15+
```ts
16+
await client.setMyCommands([
17+
{ command: "start", description: "Start the bot" },
18+
{ command: "help", description: "Show help" },
19+
]);
20+
```
21+
22+
This only changes the displayed command list. Register handlers separately with `client.command()`.
23+
24+
## Scoping and Localizing Commands
25+
26+
Pass a `scope` to show a command list only in specific chats. This example sets a command for group administrators.
27+
28+
```ts
29+
await client.setMyCommands(
30+
[{ command: "settings", description: "Manage this chat" }],
31+
{ scope: { type: "allChatAdministrators" } },
32+
);
33+
```
34+
35+
Pass `languageCode` to set a localized command list.
36+
37+
```ts
38+
await client.setMyCommands(
39+
[{ command: "help", description: "Hilfe anzeigen" }],
40+
{ languageCode: "de" },
41+
);
42+
```
43+
44+
## Reading and Deleting Commands
45+
46+
Use {{ "getMyCommands" |> m }} to read a command list and {{ "deleteMyCommands" |> m }} to delete it.
47+
48+
```ts
49+
const commands = await client.getMyCommands();
50+
await client.deleteMyCommands();
51+
```

src/server/making-requests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,4 @@ Raw bytes (`bytes` in TL schema files) are described with an object that has its
150150
}
151151
```
152152

153-
Results of the functions invocations are in the same format.
153+
Results of the function invocations are in the same format.

src/working-with-messages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ await client.sendDice(chat, { emoji: "🏀" }); // but you can send any valid di
141141

142142
To use the above example calls, `chat` must be replaced with a valid {{ "ID" |> t }}, and `file` must be replaced with a valid {{ "FileSource" |> t }}.
143143

144-
As previously said, the last parameters are optional and can always be omitted, so for example you can do just `await client.sendMessage(chat, "Hey!");` if you don't specify any optional parameter. Optional parameters are those parameters marked with `?` in the method documentations.
144+
As previously said, the last parameters are optional and can always be omitted, so for example you can do just `await client.sendMessage(chat, "Hey!");` if you don't specify any optional parameter. Optional parameters are those parameters marked with `?` in the method documentation.
145145

146146
Inside handlers, you can call the respective `reply*` shortcuts to easily reply the context message:
147147

0 commit comments

Comments
 (0)