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

@operad-io/telegram

v0.5.1

Published

talk to your bots and get pending items in Telegram

Readme

@operad-io/telegram

The Telegram plugin: the first channel and the first outside source.

A new home turns it on; a home made before needs operad plugin enable telegram. operad serve starts it; without a token it is not set up and does nothing.

{
  "plugins": {
    "telegram": {
      "settings": {
        "users": [123456789],
        "bot": "default",
        "pending": []
      }
    }
  }
}

| key | default | meaning | |---|---|---| | users | [] | The Telegram user ids whose private messages become chat messages. A message from anyone else, and every group message, is recorded and starts nothing. | | bot | "default" | The bot a chat is opened on when a listed user writes first. | | pending | [] | The plugins whose pending items are also sent to Telegram. Items of a chat bound to Telegram are always sent. |

The Bot API token is the plugin's secret:

operad secret set telegram token

The token never reaches a fact, a log line or an error.

A listed user's first private message opens a chat on the configured bot and binds it through the chat's channels (telegram:<Telegram chat id>); later messages go to the same chat. A closed chat is replaced on the next message. One user's messages never land in another user's chat.

The long-poll offset lives in <home>/telegram/state.json. Dedupe does not rely on it: each update is recorded once as a telegram event keyed by its update_id, and a message is written only when the bound chat holds no message whose source ref is that update id. A killed operad serve that starts again reads the same update without writing a second message or starting a second reply. A poll that returns is followed at once; only a failed poll waits a second before the next try.

Each new assistant reply of a chat bound to Telegram is sent to that Telegram chat once, and so is the line that says a reply failed. Markdown is reduced to what Telegram accepts (bold, italic, code, links; headings and lists become plain lines) and a long reply goes out as several messages. A failed send is retried with growing waits; when it gives up, the plugin records a telegram/send_failed event for the chat (in the run log's inputs) and writes a line in its own log; the chat's messages are not touched. The event does not show in operad history of the chat or in the chat's History section: those list only the chat's runs and the actions people ran on it, and read no source event. Showing it there needs a kernel change. What was sent is kept in <home>/telegram/sent.json, so a restart neither resends a reply nor skips one written while it was down. Replies from before the plugin first ran are not sent. A full sweep moves the point before which messages are not new, and the done records more than a day behind it are dropped; an unfinished send stays.

While a reply is written, one progress message per reply is edited to the transcript's unfinished part: the text so far and the tool calls in progress. It changes at most once every two seconds and only when the text changed; a long text shows its end within Telegram's 4096 characters, reduced like a reply so an open code fence is closed. When the reply is recorded, the final reply is sent as new message(s) and the progress message is deleted. A failed progress edit never stops the final reply. The progress message id is kept in <home>/telegram/progress.json, so a restart deletes a message a killed serve left behind.

What waits for a person

An item waiting in a chat bound to Telegram goes to that Telegram chat. An item of a plugin listed in the pending setting goes to every user in users. Nothing else is sent, so dev's items stay out until pending lists dev. Each item is one message with one button per option. An action that needs a note (such as reject) has no button: reply to the item's message and the reply is the note (with several such actions, begin the reply with reject:). A question with no choices is answered the same way, by replying; text that is not a reply stays an ordinary chat message. Only a listed user's tap or reply counts, and it is given through the client API with the actor { via: "telegram", id }. A tap on a button whose action asks to confirm counts as the confirmation. After an answer from anywhere the buttons go and the message ends "answered: X", X being the action or choice; a tap on an item already answered says so and changes nothing. Where an item was answered somewhere else and no action shows what it was, the message ends "answered". What was sent is kept in <home>/telegram/pending.json. The file keeps the open items and the newest 100 answered ones; older answered items are dropped when the file is read and when an answer is settled.