-
Notifications
You must be signed in to change notification settings - Fork 230
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 #580 from Telegram-Mini-Apps/feature/v8-emoji-status
Emoji status-related functions
- Loading branch information
Showing
19 changed files
with
361 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@telegram-apps/sdk": minor | ||
--- | ||
|
||
Add emoji status-related functionality. |
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,5 @@ | ||
--- | ||
"@telegram-apps/bridge": minor | ||
--- | ||
|
||
Add methods and events connected with custom emoji set. |
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
56 changes: 56 additions & 0 deletions
56
apps/docs/packages/telegram-apps-sdk/2-x/utils/emoji-status.md
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,56 @@ | ||
# Emoji Status | ||
|
||
## `requestEmojiStatusAccess` | ||
|
||
To request access to user emoji status update, use the `requestEmojiStatusAccess` function: | ||
|
||
::: code-group | ||
|
||
```ts [Using isAvailable] | ||
import { requestEmojiStatusAccess } from '@telegram-apps/sdk'; | ||
|
||
if (requestEmojiStatusAccess.isAvailable()) { | ||
const status = await requestEmojiStatusAccess(); | ||
} | ||
``` | ||
|
||
```ts [Using ifAvailable] | ||
import { requestEmojiStatusAccess } from '@telegram-apps/sdk'; | ||
|
||
const status = await requestEmojiStatusAccess.ifAvailable(); | ||
``` | ||
|
||
::: | ||
|
||
## `setEmojiStatus` | ||
|
||
To set an emoji status on user's behalf, use the `setEmojiStatus` function. | ||
|
||
As the first argument, it accepts a custom emoji id. Optionally, you can pass the second | ||
argument determining for how many seconds the status must be set. | ||
|
||
::: code-group | ||
|
||
```ts [Using isAvailable] | ||
import { setEmojiStatus } from '@telegram-apps/sdk'; | ||
|
||
if (setEmojiStatus.isAvailable()) { | ||
// Set for unlimited period of time. | ||
await setEmojiStatus('5361800828313167608'); | ||
|
||
// Set for 1 day. | ||
await setEmojiStatus('5361800828313167608', 86400); | ||
} | ||
``` | ||
|
||
```ts [Using ifAvailable] | ||
import { setEmojiStatus } from '@telegram-apps/sdk'; | ||
|
||
// Set for unlimited period of time. | ||
await setEmojiStatus.ifAvailable('5361800828313167608'); | ||
|
||
// Set for 1 day. | ||
await setEmojiStatus.ifAvailable('5361800828313167608', 86400); | ||
``` | ||
|
||
::: |
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
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
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
Oops, something went wrong.