### Handle Bot Commands (Long Way) Source: https://github.com/dinoleung/teledart/blob/master/README.md Shows how to handle bot commands by filtering messages based on their entity type ('bot_command') and a specific keyword, such as 'start'. ```dart teledart.onMessage(entityType: 'bot_command', keyword: 'start') .listen((message) => teledart.sendMessage(message.chat.id, 'Hello TeleDart!')); ``` -------------------------------- ### Initialize TeleDart Bot Source: https://github.com/dinoleung/teledart/blob/master/README.md Demonstrates how to initialize a TeleDart bot using your Telegram bot token. It retrieves the bot's username and sets up the event handler for incoming messages. ```dart import 'package:teledart/teledart.dart'; import 'package:teledart/telegram.dart'; void main() { var BOT_TOKEN = 'YOUR_BOT_TOKEN_FROM_BOT_FATHER'; final username = (await Telegram(BOT_TOKEN).getMe()).username; var teledart = TeleDart(BOT_TOKEN, Event(username!)); teledart.start() ``` -------------------------------- ### Handle Bot Commands (Short Way) Source: https://github.com/dinoleung/teledart/blob/master/README.md Provides a more concise method for handling bot commands using the `onCommand` listener, which directly targets commands like 'glory'. ```dart teledart.onCommand('glory') .listen((message) => message.reply('to Ukraine!')); ``` -------------------------------- ### Handle Inline Queries Source: https://github.com/dinoleung/teledart/blob/master/README.md Responds to inline queries by providing a list of `InlineQueryResultArticle` objects. Each article has a unique ID, title, and content with specified parse mode. ```dart teledart.onInlineQuery().listen((inlineQuery) => inlineQuery.answer([ InlineQueryResultArticle( id: 'ping', title: 'ping', inputMessageContent: InputTextMessageContent( messageText: '*pong*', parseMode: 'MarkdownV2')), InlineQueryResultArticle( id: 'ding', title: 'ding', inputMessageContent: InputTextMessageContent( messageText: '*_dong_*', parseMode: 'MarkdownV2')), ])); ``` -------------------------------- ### Reply to Specific Message Keyword Source: https://github.com/dinoleung/teledart/blob/master/README.md Listens for incoming messages that contain the exact keyword 'Fight for freedom' and automatically replies with a predefined message. ```dart teledart.onMessage(keyword: 'Fight for freedom') .listen((message) => message.reply('Stand with Hong Kong')); ``` -------------------------------- ### Filter and Reply with Photo Source: https://github.com/dinoleung/teledart/blob/master/README.md Filters messages containing 'dart' and further checks if the text also contains 'telegram'. If both conditions are met, it replies with a photo from a URL, including a caption. ```dart teledart .onMessage(keyword: 'dart') .where((message) => message.text?.contains('telegram') ?? false) .listen((message) => message.replyPhoto( 'https://raw.githubusercontent.com/DinoLeung/TeleDart/master/example/dash_paper_plane.png', caption: 'This is how the Dart Bird and Telegram are met')); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.