Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Notifier] Add documentation for telegram options#14503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
OskarStark merged 1 commit intosymfony:5.2fromCyberJack:14044-telegram-options
Dec 8, 2020
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletionsnotifier/chatters.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -98,8 +98,6 @@ some interactive options called `Block elements`_::

$chatter->send($chatMessage);

.. _`Block elements`: https://api.slack.com/reference/block-kit/block-elements

Adding Interactions to a Discord Message
----------------------------------------

Expand DownExpand Up@@ -151,4 +149,38 @@ some interactive options called `Embed elements`_::

$chatter->send($chatMessage);

Adding Interactions to a Telegram Message
-----------------------------------------

With a Telegram message, you can use the
:class:`Symfony\\Component\\Notifier\\Bridge\\Telegram\\TelegramOptions` class
to add `message options`_::

use Symfony\Component\Notifier\Bridge\Telegram\Reply\Markup\Button\InlineKeyboardButton;
use Symfony\Component\Notifier\Bridge\Telegram\Reply\Markup\InlineKeyboardMarkup;
use Symfony\Component\Notifier\Bridge\Telegram\TelegramOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('');

// Create Telegram options
$telegramOptions = (new TelegramOptions())
->chatId('@symfonynotifierdev')
->parseMode('MarkdownV2')
->disableWebPagePreview(true)
->disableNotification(true)
->replyMarkup((new InlineKeyboardMarkup())
->inlineKeyboard([
(new InlineKeyboardButton('Visit symfony.com'))
->url('https://symfony.com/'),
])
);

// Add the custom options to the chat message and send the message
$chatMessage->options($telegramOptions);

$chatter->send($chatMessage);

.. _`Block elements`: https://api.slack.com/reference/block-kit/block-elements
.. _`Embed elements`: https://discord.com/developers/docs/resources/webhook
.. _`message options`: https://core.telegram.org/bots/api

[8]ページ先頭

©2009-2025 Movatter.jp