New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grammy-mail

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grammy-mail

Send your mails to users in the grammY framework

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Mailing users

This library was created for mailing users in the grammY framework

How to use

  1. Install library
yarn add grammy-mail
// or
npm i grammy-mail
  1. Use library
import { mailUsers } from 'grammy-mail';

bot.command('mail', async (ctx: Context) => {
  const users = [1, 2, 3]; // user ids you want to mail
  
  mailUsers<Context>(ctx, users, { // start mail
    text: 'Hello, world!', // mail text
    other: { parse_mode: 'HTML' }, // add other params to message (grammY api .reply)
    messageSender: (userId: number) =>  // or use custom mail function
      ctx.api.sendMessage(userId, 'Hello, world!', { parse_mode: 'HTML' }),
    onSend: (userId: number, isSuccess: boolean) => // callback on every mail
      console.log(userId, isSuccess ? 'recieved' : 'not recieved', 'mail'),
    onEnd: (success: number, failed: number) => // callback on mail end
      ctx.reply(`Mail end. ${success} - success mails, ${failed} - failed mails`),
  });
});

Keywords

FAQs

Package last updated on 08 Dec 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc