quit
quit
CC#
Created by quit on 3/12/2023 in #help
❔ Nedd help with callbackdata telegram
[TelegramCommand("ping", false, false, "BUTTON:Ping")]
public static async Task Ping(Update update, List<string> args)
{
// Create a new inline keyboard button with the text "Ping" and the callback data "ping"
var button = new InlineKeyboardButton
{
Text = "Ping",
CallbackData = "ping"
};

// Create a new inline keyboard markup with the button we just created
var keyboard = new InlineKeyboardMarkup(new[] { new[] { button } });

// Send a message with the text "🤖 Bot is online" and the inline keyboard markup we just created
await Telegram.client.SendMessageAsync(update.Message.Chat.Id, "🤖 Bot is online", replyMarkup: keyboard);
}
[TelegramCommand("ping", false, false, "BUTTON:Ping")]
public static async Task Ping(Update update, List<string> args)
{
// Create a new inline keyboard button with the text "Ping" and the callback data "ping"
var button = new InlineKeyboardButton
{
Text = "Ping",
CallbackData = "ping"
};

// Create a new inline keyboard markup with the button we just created
var keyboard = new InlineKeyboardMarkup(new[] { new[] { button } });

// Send a message with the text "🤖 Bot is online" and the inline keyboard markup we just created
await Telegram.client.SendMessageAsync(update.Message.Chat.Id, "🤖 Bot is online", replyMarkup: keyboard);
}
4 replies
CC#
Created by quit on 3/9/2023 in #help
✅ Need help fixing CallbackData
[TelegramCommand("ping", false, false)]
public static async Task Ping(Update update, List<string> args)
{
// Create a new inline keyboard button with the text "Ping" and the callback data "ping"
var button = new InlineKeyboardButton
{
Text = "Ping",
CallbackData = "ping"
};

// Create a new inline keyboard markup with the button we just created
var keyboard = new InlineKeyboardMarkup(new[] { new[] { button } });

// Send a message with the text ":robot: Bot is online" and the inline keyboard markup we just created
await Telegram.client.SendMessageAsync(update.Message.Chat.Id, ":robot: Bot is online", replyMarkup: keyboard);
}
[TelegramCommand("ping", false, false)]
public static async Task Ping(Update update, List<string> args)
{
// Create a new inline keyboard button with the text "Ping" and the callback data "ping"
var button = new InlineKeyboardButton
{
Text = "Ping",
CallbackData = "ping"
};

// Create a new inline keyboard markup with the button we just created
var keyboard = new InlineKeyboardMarkup(new[] { new[] { button } });

// Send a message with the text ":robot: Bot is online" and the inline keyboard markup we just created
await Telegram.client.SendMessageAsync(update.Message.Chat.Id, ":robot: Bot is online", replyMarkup: keyboard);
}
72 replies