Skip to content

Commit cdf5006

Browse files
committed
Add more Walkthrough sections
1 parent 867977d commit cdf5006

83 files changed

Lines changed: 1427 additions & 169 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/account-and-app-settings.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: Account and App Settings
3+
parent: /#walkthrough
4+
walkthrough:
5+
track: user
6+
order: 25
7+
---
8+
9+
Users can manage general account behavior and retrieve Telegram app information.
10+
11+
## Updating the Profile
12+
13+
{{ "updateProfile" |> m }} changes the current user's name or bio.
14+
15+
```ts
16+
await client.updateProfile({ firstName: "Ada", bio: "Hello" });
17+
```
18+
19+
{{ "setIsOnline" |> m }} updates the account's online status.
20+
21+
```ts
22+
await client.setIsOnline(true);
23+
```
24+
25+
## Emoji Statuses
26+
27+
{{ "setEmojiStatus" |> m }} and {{ "removeEmojiStatus" |> m }} set or remove the account's status.
28+
29+
```ts
30+
await client.setEmojiStatus({ type: "customEmoji", customEmojiId });
31+
await client.removeEmojiStatus();
32+
```
33+
34+
Channels have corresponding {{ "setChannelEmojiStatus" |> m }} and {{ "removeChannelEmojiStatus" |> m }} methods.
35+
36+
```ts
37+
await client.setChannelEmojiStatus(channelId, { type: "customEmoji", customEmojiId });
38+
await client.removeChannelEmojiStatus(channelId);
39+
```
40+
41+
Recent statuses come from {{ "getRecentEmojiStatuses" |> m }} and can be cleared with {{ "clearRecentEmojiStatuses" |> m }}.
42+
43+
```ts
44+
const statuses = await client.getRecentEmojiStatuses();
45+
await client.clearRecentEmojiStatuses();
46+
```
47+
48+
## Bot Permissions
49+
50+
{{ "allowBotToSetCustomEmojiStatus" |> m }} and {{ "disallowBotToSetCustomEmojiStatus" |> m }} grant or revoke a bot's permission to change the status.
51+
52+
```ts
53+
await client.allowBotToSetCustomEmojiStatus(botId);
54+
await client.disallowBotToSetCustomEmojiStatus(botId);
55+
```
56+
57+
Attachment-menu bots are managed through {{ "addBotToAttachmentsMenu" |> m }} and {{ "removeBotFromAttachmentsMenu" |> m }}.
58+
59+
```ts
60+
await client.addBotToAttachmentsMenu(botId);
61+
await client.removeBotFromAttachmentsMenu(botId);
62+
```
63+
64+
## Paid Messages
65+
66+
Exceptions for paid incoming messages are managed by {{ "allowUnpaidMessagesFromUser" |> m }} and {{ "disallowUnpaidMessagesFromUser" |> m }}.
67+
68+
```ts
69+
await client.allowUnpaidMessagesFromUser(userId);
70+
await client.disallowUnpaidMessagesFromUser(userId);
71+
```
72+
73+
## New Chats
74+
75+
{{ "getArchiveAndMuteNewChatsFromUnknownUsers" |> m }} reads the automatic-archiving setting, and {{ "setArchiveAndMuteNewChatsFromUnknownUsers" |> m }} changes it.
76+
77+
```ts
78+
const isEnabled = await client.getArchiveAndMuteNewChatsFromUnknownUsers();
79+
await client.setArchiveAndMuteNewChatsFromUnknownUsers(true);
80+
```
81+
82+
{{ "getNewChatPrivacy" |> m }} and {{ "setNewChatPrivacy" |> m }} control who can start new chats with the account.
83+
84+
```ts
85+
const privacy = await client.getNewChatPrivacy();
86+
await client.setNewChatPrivacy({
87+
isNewChatFromNonPremiumUsersAllowed: true,
88+
messagePrice: 0,
89+
});
90+
```
91+
92+
## Gifts
93+
94+
Gift visibility is available through {{ "getGiftPrivacy" |> m }} and {{ "setGiftPrivacy" |> m }}.
95+
96+
```ts
97+
const privacy = await client.getGiftPrivacy();
98+
await client.setGiftPrivacy({
99+
isGiftButtonDisplayed: true,
100+
isRegularGiftAccepted: true,
101+
});
102+
```
103+
104+
## Sponsored Messages
105+
106+
Sponsored messages are controlled by {{ "enableSponsoredMessages" |> m }} and {{ "disableSponsoredMessages" |> m }}.
107+
108+
```ts
109+
await client.enableSponsoredMessages();
110+
await client.disableSponsoredMessages();
111+
```
112+
113+
## Deleting the Account
114+
115+
Permanently delete the current account through {{ "deleteAccount" |> m }}.
116+
117+
```ts
118+
await client.deleteAccount("No longer needed");
119+
```

src/account-auto-deletion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Users can control when an inactive account is automatically deleted.
1010

1111
## Getting the Auto-Deletion Period
1212

13-
Use {{ "getAccountTtl" |> m }} to get the period in days.
13+
{{ "getAccountTtl" |> m }} lets you get the period in days.
1414

1515
```ts
1616
const dayCount = await client.getAccountTtl();
@@ -20,7 +20,7 @@ console.log(dayCount);
2020

2121
## Setting the Auto-Deletion Period
2222

23-
Use {{ "setAccountTtl" |> m }} with the period in days.
23+
{{ "setAccountTtl" |> m }} accepts the period in days.
2424

2525
```ts
2626
await client.setAccountTtl(365);

src/administered-chats.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Administered Chats
3+
parent: /#walkthrough
4+
walkthrough:
5+
track: user
6+
order: 50
7+
---
8+
9+
{{ "getAdministeredChats" |> m }} lists chats administered by the current account.
10+
11+
```ts
12+
const chats = await client.getAdministeredChats();
13+
```

src/administration-log.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Administration Log
3+
parent: /#walkthrough
4+
walkthrough:
5+
track: user
6+
order: 49
7+
---
8+
9+
{{ "getRecentActions" |> m }} returns recent administrative actions in a chat.
10+
11+
```ts
12+
const actions = await client.getRecentActions(chatId);
13+
```

src/app-support.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: App Support
3+
parent: /#walkthrough
4+
walkthrough:
5+
track: user
6+
order: 42
7+
---
8+
9+
Users can retrieve the support information associated with their Telegram application.
10+
11+
{{ "getAppSupport" |> m }} returns the support user and message.
12+
13+
```ts
14+
const support = await client.getAppSupport();
15+
```
16+
17+
{{ "getAppSupportName" |> m }} returns the application's support name.
18+
19+
```ts
20+
const supportName = await client.getAppSupportName();
21+
```

src/application-configuration.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Application Configuration
3+
parent: /#walkthrough
4+
walkthrough:
5+
track: user
6+
order: 40
7+
---
8+
9+
{{ "getApplicationConfiguration" |> m }} returns Telegram's current application configuration.
10+
11+
```ts
12+
const configuration = await client.getApplicationConfiguration();
13+
```

src/archived-chats.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Users can move chats between the main and archived chat lists.
1010

1111
## Archiving a Chat
1212

13-
Use {{ "archiveChat" |> m }} with the chat's identifier.
13+
{{ "archiveChat" |> m }} moves a chat to the archive.
1414

1515
```ts
1616
await client.archiveChat(chatId);
1717
```
1818

1919
## Listing Archived Chats
2020

21-
Use {{ "getChats" |> m }} with `from` set to `"archived"`.
21+
{{ "getChats" |> m }} lists the archive when `from` is set to `"archived"`.
2222

2323
```ts
2424
const chats = await client.getChats({ from: "archived" });
@@ -30,8 +30,17 @@ for (const { chat } of chats) {
3030

3131
## Unarchiving a Chat
3232

33-
Use {{ "unarchiveChat" |> m }} with the chat's identifier.
33+
{{ "unarchiveChat" |> m }} moves it back to the main list.
3434

3535
```ts
3636
await client.unarchiveChat(chatId);
3737
```
38+
39+
## Moving Multiple Chats
40+
41+
{{ "archiveChats" |> m }} and {{ "unarchiveChats" |> m }} move several chats at once.
42+
43+
```ts
44+
await client.archiveChats(chatIds);
45+
await client.unarchiveChats(chatIds);
46+
```

src/authorization-sessions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Users can view and remove the account's authorization sessions.
1010

1111
## Listing Sessions
1212

13-
Use {{ "getAuthorizationSessions" |> m }} to get the sessions as {{ "AuthorizationSession" |> t }} objects.
13+
To get the sessions as {{ "AuthorizationSession" |> t }} objects, call {{ "getAuthorizationSessions" |> m }}.
1414

1515
```ts
1616
const sessions = await client.getAuthorizationSessions();
@@ -24,15 +24,15 @@ The current session has `isCurrent` set to `true`.
2424

2525
## Removing a Session
2626

27-
Use {{ "removeAuthorizationSession" |> m }} with the session's identifier.
27+
{{ "removeAuthorizationSession" |> m }} accepts the session's identifier.
2828

2929
```ts
3030
await client.removeAuthorizationSession(sessionId);
3131
```
3232

3333
## Removing Other Sessions
3434

35-
Use {{ "removeAuthorizationSessions" |> m }} to remove every session except the current one.
35+
{{ "removeAuthorizationSessions" |> m }} removes every session except the current one.
3636

3737
```ts
3838
await client.removeAuthorizationSessions();

src/birthday.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Users can set or remove the account's birthday.
1010

1111
## Setting a Birthday
1212

13-
Use {{ "setBirthday" |> m }} with the day, month, and optionally the year.
13+
{{ "setBirthday" |> m }} accepts the day, month, and optionally the year.
1414

1515
```ts
1616
await client.setBirthday({
@@ -20,8 +20,16 @@ await client.setBirthday({
2020

2121
## Removing the Birthday
2222

23-
Call {{ "setBirthday" |> m }} without a birthday.
23+
An empty {{ "setBirthday" |> m }} call removes the birthday.
2424

2525
```ts
2626
await client.setBirthday();
2727
```
28+
29+
## Suggesting a Birthday
30+
31+
{{ "suggestBirthday" |> m }} suggests a birthday to another user.
32+
33+
```ts
34+
await client.suggestBirthday(userId, { day: 1, month: 1, year: 2000 });
35+
```

src/blocked-users.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Users can block users and manage the account's block list.
1010

1111
## Blocking a User
1212

13-
Use {{ "blockUser" |> m }} with the user's identifier.
13+
{{ "blockUser" |> m }} accepts the user's identifier.
1414

1515
```ts
1616
await client.blockUser(userId);
1717
```
1818

1919
## Listing Blocked Users
2020

21-
Use {{ "getBlockedUsers" |> m }} to get a {{ "BlockedUserList" |> t }}.
21+
{{ "getBlockedUsers" |> m }} lets you get a {{ "BlockedUserList" |> t }}.
2222

2323
```ts
2424
const { blockedUsers } = await client.getBlockedUsers();
@@ -30,7 +30,7 @@ for (const { user, blockedAt } of blockedUsers) {
3030

3131
## Unblocking a User
3232

33-
Use {{ "unblockUser" |> m }} with the user's identifier.
33+
{{ "unblockUser" |> m }} accepts the user's identifier.
3434

3535
```ts
3636
await client.unblockUser(userId);

0 commit comments

Comments
 (0)