Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@gramio/keyboards
Advanced tools
Framework-agnostic Telegram bot keyboard (and inline query result) builder with many cool features!
npm i @gramio/keyboards
import { Keyboard } from "@gramio/keyboards";
const keyboard = new Keyboard()
.text("first row")
.row()
.text("second row")
.build(); // NOTE: In GramIO, you don't have to use the ".build" method
import { Bot, Keyboard } from "gramio"; // import from GramIO package!!
const bot = new Bot(process.env.TOKEN as string);
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (ctx) => {
return ctx.reply("test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla"),
});
});
import { Keyboard } from "@gramio/keyboards";
import { Bot } from "grammy";
const bot = new Bot(process.env.TOKEN as string);
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (ctx) => {
return ctx.reply("test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla")
.build(),
});
});
bot.start();
[!WARNING] The
node-telegram-bot-api
does not support the latest version of Bot API
import { Keyboard } from "@gramio/keyboards";
import { Telegraf } from "telegraf";
const bot = new Telegraf(process.env.TOKEN as string);
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (ctx) => {
return ctx.reply("test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla")
.build(),
});
});
bot.launch();
import { Telegram } from "puregram";
import { Keyboard } from "@gramio/keyboards";
const bot = new Telegram({
token: process.env.TOKEN as string,
});
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (ctx) => {
return ctx.reply("test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla"),
});
});
bot.updates.startPolling();
[!WARNING] The
node-telegram-bot-api
does not support the latest version of Bot API and the types are badly written, so the types may not match
import { Keyboard } from "@gramio/keyboards";
import TelegramBot from "node-telegram-bot-api";
const bot = new TelegramBot(process.env.TOKEN as string, { polling: true });
const data = ["Apple", "Realme", "Tesla", "Xiaomi"];
bot.on("message", (msg) => {
return bot.sendMessage(msg.chat.id, "test", {
reply_markup: new Keyboard()
.columns(1)
.text("simple keyboard")
.add(...data.map((x) => Keyboard.text(x)))
.filter(({ button }) => button.text !== "Tesla")
.build(),
});
});
{
"keyboard": [
[
{
"text": "simple keyboard"
}
],
[
{
"text": "Apple"
}
],
[
{
"text": "Realme"
}
],
[
{
"text": "Xiaomi"
}
]
],
"one_time_keyboard": false,
"is_persistent": false,
"selective": false,
"resize_keyboard": true
}
FAQs
Framework-agnostic Telegram bot keyboard builder with many cool features!
The npm package @gramio/keyboards receives a total of 108 weekly downloads. As such, @gramio/keyboards popularity was classified as not popular.
We found that @gramio/keyboards demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.