televerse 1.12.7 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!
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();
}