televerse 1.12.7 copy "televerse: ^1.12.7" to clipboard
televerse: ^1.12.7 copied to clipboard

Televerse lets you create your own efficient Telegram bots with ease in Dart. Supports latest Telegram Bot API - 7.0!

example/main.dart

import 'dart:io';

import 'package:televerse/telegram.dart';
import 'package:televerse/televerse.dart';

void main(List<String> args) {
  final bot = Bot(Platform.environment["BOT_TOKEN"]!);

  bot.onInlineQuery((ctx) async {
    await ctx.answer([
      InlineQueryResultArticle(
        id: "x2k",
        title: "Bro is testing",
        inputMessageContent: InputTextMessageContent(
          messageText: "Dude, click me and see if it works",
        ),
        replyMarkup: InlineKeyboard()..add("Click Me", "click-me"),
      ),
    ]);
  });

  bot.callbackQuery("click-me", (ctx) async {
    if (ctx.callbackQuery.inlineMessageId == null) {
      await ctx.answer(text: "Oh no, I can't answer you");
      return;
    }
    await ctx.answer(text: "You clicked me!");

    await ctx.api.editInlineMessageReplyMarkup(
      ctx.callbackQuery.inlineMessageId!,
      replyMarkup: InlineKeyboard()..add("Clicked", "clicked"),
    );
  });

  bot.start();
}
67
likes
0
pub points
82%
popularity

Publisher

verified publisherxooniverse.com

Televerse lets you create your own efficient Telegram bots with ease in Dart. Supports latest Telegram Bot API - 7.0!

Repository (GitHub)
View/report issues

Topics

#telegram #bot #chat #telegram-bot-api #bot-framework

License

unknown (license)

Dependencies

dio

More

Packages that depend on televerse