DinoLeung / TeleDart

A Dart library interfacing with the latest Telegram Bot API.
https://pub.dev/packages/teledart
GNU General Public License v3.0
313 stars 69 forks source link

How to launch app in telegram because the provided example doesn't do so. Even it doesn't require the hosted website url anywhere. How i can fix this ? #270

Open amitjangra01 opened 6 months ago

amitjangra01 commented 6 months ago

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

void main() async { var token = 'My_Token'; final username = (await Telegram(token).getMe()).username; var teledart = TeleDart(token, Event(username!));

teledart.start();

// You can listen to messages like this teledart.onMessage(entityType: 'bot_command', keyword: 'start').listen( (message) => teledart.sendMessage(message.chat.id, 'Hello there! \n\nTesting Bot from Dart & Flutter'));

// Sick of boilerplates? Reply messages like below, nice and tidy // Short hands also available for answer query methods teledart.onCommand('glory').listen((message) => message.reply('to Ukraine!'));

// You can also utilise regular expressions teledart .onCommand(RegExp('hello', caseSensitive: false)) .listen((message) => message.reply('hi!'));

// You can even filter streams with stream processing methods // See: https://www.dartlang.org/tutorials/language/streams#methods-that-modify-a-stream teledart .onMessage(keyword: 'dart') .where((message) => message.text?.contains('telegram') ?? false) .listen((message) => message.replyPhoto( // io.File('example/dash_paper_plane.png'), 'https://raw.githubusercontent.com/DinoLeung/TeleDart/master/example/dash_paper_plane.png', caption: 'This is how Dash found the paper plane'));

// Inline mode. 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')), ]));

SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle.light.copyWith(statusBarColor: Colors.transparent)); runApp(const MyApp()); }

Expected behavior

A clear and concise description of what you expected to happen.

Additional context

Add any other context about the problem here.

DinoLeung commented 5 months ago

@amitjangra01 not sure if i understand the job to be done here, I assumed you would like the documentation/example to be improved? if so, in your opinion what would be the best to do so? would a animated gif image of the telegram client interacting with the example bot helps?

amitjangra01 commented 5 months ago

@DinoLeung Actually there is an app naming durger king on react framework which is also a telegram boat app. if you will look into it, you'll see that we are able to launch our hosted website inside telegram app and that's what i want to implement here. can we also do that here in flutter ?