npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tgpeetees

v0.1.2

Published

Tgpeetees.js is a framework based on [Telegraf.js](https://telegraf.js.org/) designed for creating GPTs in Telegram. It leverages the capabilities of the OpenAI GPT models to enable advanced conversational bots within the Telegram platform.

Downloads

22

Readme

Tgpeetees.js

Tgpeetees.js is a framework based on Telegraf.js designed for creating GPTs in Telegram. It leverages the capabilities of the OpenAI GPT models to enable advanced conversational bots within the Telegram platform.

Table of Contents

Installation

To install Tgpeetees.js, use npm:

npm install telegraf openai tgpeetees

Usage

Here is a basic example of how to use Tgpeetees.js:

import { Tgpeetees } from 'tgpeetees';

const bot = new Tgpeetees({
  botToken: 'YOUR_TELEGRAM_BOT_TOKEN',
  openaiApiKey: 'YOUR_OPENAI_API_KEY',
  model: 'gpt-4'
});

bot.addHelp('This is a help message');

bot.addBotCommand({
  name: 'start',
  callback: (ctx) => ctx.reply('Hello, I am your GPT bot!')
});

bot.init();

API Documentation

Constructor

constructor(params: {
  botToken: string,
  openaiApiKey?: string,
  model?: string,
})
  • botToken: string - Your Telegram bot token.
  • openaiApiKey: string (optional) - Your OpenAI API key.
  • model: string (optional) - The OpenAI model to use (default is gpt-4).

init

public async init()

Initializes and starts the bot. It also sets up graceful stop handlers.

addHelp

public async addHelp(msg: string, keyboard?: any)

Adds a help message that is shown when the /help command is used.

  • msg: string - The help message to display.
  • keyboard: any (optional) - Custom keyboard layout.

addBotAction

public addBotAction(action: {
  name: string,
  callback: any,
})

Adds a custom action for the bot.

  • name: string - The name of the action.
  • callback: any - The callback function to execute when the action is triggered.

addBotCommand

public addBotCommand(command: {
  name: string,
  callback: any,
})

Adds a custom command for the bot.

  • name: string - The name of the command.
  • callback: any - The callback function to execute when the command is used.

botTyping

public async botTyping(ctx: any)

Sends a "typing" action to the chat to indicate the bot is processing.

  • ctx: any - The context object from Telegraf.

getUserId

public getUserId(ctx: any)

Gets the user ID from the context.

  • ctx: any - The context object from Telegraf.

sendToGpt

public async sendToGpt(messages: any[], params?: any)

Sends messages to the GPT model and returns the response.

  • messages: any[] - The array of messages to send to the GPT model.
  • params: any (optional) - Additional parameters for the GPT model.

addChatGpt

private async addChatGpt(token: string)

Sets up the OpenAI integration.

  • token: string - Your OpenAI API key.

Example

Here is a more detailed example showing how to create a GPT-enabled Telegram bot:

import { Tgpeetees } from 'tgpeetees';

const bot = new Tgpeetees({
  botToken: 'YOUR_TELEGRAM_BOT_TOKEN',
  openaiApiKey: 'YOUR_OPENAI_API_KEY',
  model: 'gpt-4'
});

bot.addHelp('This bot can chat with you using OpenAI GPT-4.');

bot.addBotCommand({
  name: 'start',
  callback: async (ctx) => {
    await bot.botTyping(ctx);
    ctx.reply('Hello, I am your GPT bot!');
  }
});


bot.init();