
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
@grammyjs/commands
Advanced tools
This plugin provides a convenient way to define and manage commands for your grammY bot. It simplifies the process of setting up commands with scopes and localization.
npm i @grammyjs/commands
The main functionality of this plugin is to define your commands, localize them, and give them handlers for each scope, like so:
import { Bot } from "grammy";
import { CommandGroup } from "@grammyjs/commands";
const bot = new Bot("<telegram token>");
const myCommands = new CommandGroup();
myCommands.command("start", "Initializes bot configuration")
.localize("pt", "start", "Inicializa as configurações do bot")
.addToScope(
{ type: "all_private_chats" },
(ctx) => ctx.reply(`Hello, ${ctx.chat.first_name}!`),
)
.addToScope(
{ type: "all_group_chats" },
(ctx) => ctx.reply(`Hello, members of ${ctx.chat.title}!`),
);
// Calls `setMyCommands`
await myCommands.setCommands(bot);
// Registers the command handlers
bot.use(myCommands);
bot.start();
It is very important that you call bot.use
with your instance of the Commands
class. Otherwise, the command handlers
will not be registered, and your bot will not respond to those commands.
This plugin provides a shortcut for setting the commands for the current chat. To use it, you need to install the commands flavor and the plugin itself, like so:
import { Bot, Context } from "grammy";
import { CommandGroup, commands, CommandsFlavor } from "@grammyjs/commands";
type BotContext = CommandsFlavor;
const bot = new Bot<BotContext>("<telegram_token>");
bot.use(commands());
bot.on("message", async (ctx) => {
const cmds = new CommandGroup();
cmds.command("start", "Initializes bot configuration")
.localize("pt", "start", "Inicializa as configurações do bot");
await ctx.setMyCommands(cmds);
return ctx.reply("Commands set!");
});
bot.start();
FAQs
grammY Commands Plugin
The npm package @grammyjs/commands receives a total of 1,184 weekly downloads. As such, @grammyjs/commands popularity was classified as popular.
We found that @grammyjs/commands demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.