message-group-telegram-bot

1.0.2 • Public • Published

Messaging Telegram Bot API

This package is created by using Telegram Bot API to send message to public Telegram group via installed Bot.

  • TelegramBotMemberGroup use to confirm the existence of telegram group and also confirmed that bot is already installed
  • TelegramBot use to send the message to telegram group where bot is already installed

Installation

npm install message-group-telegram-bot

Usage

TelegramBotMemberGroup
const { TelegramBotMemberGroup } = require("message-group-telegram-bot");

const token = "YOUR TOKEN";
const options = {
  method: "sendMessage",
  action: "member_access",
  chat_id: "YOUR GROUP_ID",
  tg_bot_username: "bot username ",
  bot_dsiplay_name: "Bot display name",
};
async function confirmTelegramGroupChannelExistence() {
  try {
    const bot = new TelegramBotMemberGroup(token, options);
    const response = await bot.sendRequest();
    console.log("response: ", response);
  } catch (error) {
    console.log("error", error);
  }
}

confirmTelegramGroupChannelExistence();
TelegramBot
const { TelegramBot } = require("message-group-telegram-bot");
const token = "bot_token_here";
const content = `Send message to group telegram`;

const options = {
  method: "sendMessage",
  action: "send",
  message: {
    chat_id: "YOUR GROUP_ID",
    content,
  },
};
async function sendTelegramTestMessage() {
  try {
    const bot = new TelegramBot(token, options);
    const response = await bot.sendRequest();
    console.log("response:", response);
  } catch (error) {
    console.log("error:", error);
  }
}

sendTelegramTestMessage();

Package Sidebar

Install

npm i message-group-telegram-bot

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

12.3 kB

Total Files

8

Last publish

Collaborators

  • ductai.dev