Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Ideas #110

Open
KnorpelSenf opened this issue Nov 23, 2021 · 21 comments
Open

Plugin Ideas #110

KnorpelSenf opened this issue Nov 23, 2021 · 21 comments

Comments

@KnorpelSenf
Copy link
Member

KnorpelSenf commented Nov 23, 2021

Here is a list of ideas that could be turned into plugins.

You can suggest new ideas in the comments or in the group chat, and we may add them here. Once someone publishes an official plugin in version 1.0, we will remove the idea from this list. You can also decide to start working on a third-party plugin. In that case, you also need to link it on https://grammy.dev. You should be able to demonstrate that your plugin is working.

grammy-dedupe

Deduplicates updates delivered via webhooks. If users follow https://grammy.dev/guide/deployment-types.html#how-to-use-webhooks then no duplicates should appear, but advanced use cases may still require this.

  • Maybe based on Redis, but also supports storing in RAM?
  • Store lower bound of update identifiers
  • Store set of currently handled updates larger than that with their promises
  • New update: if it is lower than bound: drop, if it is in set: drop but await stored promise, else store next()'s promise behind identifier

grammy-bulk

Helps sending messages to many people, or performing other bulk operations.

  • Must survive crashes and restarts while sending
  • Must stay without flood limits at all times, maybe even dynamically adjusting to the bot's organic load

grammy-telegraph

Helps sending long messages.

  • Covers the Telegraph API
  • Allows sending long text messages by automatically creating an article from them, and sending the link instead

awilix-grammy

Helps creating complex code bases.

grammy-test

Helps writing tests for bots.

UI components based on web apps

grammy-telemetry

  • collects basic usage data about the bot
  • exports markers that can be installed in the middleware tree to easily track feature usage
  • supports custom telemetry events though the context object
  • integrates with other services like Prometheus or InfluxDB
  • is able to use storage adapters for persistence

grammy-util

grammy-progress

  • lets you display the progress of something inside a message
  • as a core primitive, has a transformer that allows you to edit a message at any rate, and it will debounce the calls internally upon rate limits, so that only the most recent edit is performed
  • performs edits as fast as possible and as slow as necessary
  • works on a chat_id/message_id basis
  • supports all methods with this property (editMessageText, editMessageCaption, editMessageMedia, editMessageLiveLocation, editMessageReplyMarkup)
  • provides utilities for rendering progress bars, so you can do
    const progress = ctx.progress(chat_id, message_id, "style")
    await progress.set(0.3) // 30 %

grammy-replies

  • improves support for replies
  • helps with support for the following things:
    • Which entities does the message that is being replied to have?
    • Does the message that is being replied to have a /start command?
    • Is the message that is being replied to an image?
    • Does the message that is being replied to have a caption that matches a regular expression?

grammy-fsm

  • FSM code is hard to read
  • Ideally, we want to view a nice flow chart diagram
  • Diagrams sucks to create with a diagram editor
  • We need to solve the problem of writing code and reading diagrams
    • Create a state machine library
    • Create a VS Code extension that parses TS files that import this library
    • Take the code behind https://rtsys.informatik.uni-kiel.de/elklive/elkgraph.html
    • Put it into the extension, and provide a live preview of the FSM that updates in real time while people type their state machine
  • create a grammY plugin that can import such FSM code, and translate it into a conversational interface library
@KnorpelSenf KnorpelSenf pinned this issue Nov 23, 2021
@LongSimple
Copy link

Is there any plan for supporting nestjs? Like telegraf has here https://www.npmjs.com/package/nestjs-telegraf

@KnorpelSenf
Copy link
Member Author

@LongSimple there's no such plan yet. I'll add it to the list. Please comment here if you're willing to start working on it!

@andrrms
Copy link

andrrms commented Jan 3, 2022

I'm working at grammy-emoji plugin. Anyone who wants to help contribute is welcome!

@KnorpelSenf
Copy link
Member Author

@LongSimple there is now https://github.com/drmikecrowe/nestjs-grammy which has good chances to become an official plugin. You are welcome to contribute. /cc @drmikecrowe

@drmikecrowe
Copy link

@LongSimple -- How close are you to wanting to test?

@drmikecrowe
Copy link

@LongSimple and all: Please see https://github.com/grammyjs/nestjs

Note ALPHA status disclaimer. I need help moving to the next level with this.

@KnorpelSenf
Copy link
Member Author

Scratching the idea of grammy-cache. The Bot API server already implements this level of caching for us. Telegram confirmed this. Hence, the plugin is superfluous.

@roziscoding
Copy link
Contributor

@FatalMerlin and I are working on the testing framework. Anyone that wants to help is welcome :)

Repo: https://github.com/FatalMerlin/Ymmarg

@mi3lix9
Copy link

mi3lix9 commented Oct 5, 2022

Suggestion: TailwindCss plugin for web app theme?

@rojvv
Copy link
Member

rojvv commented Oct 5, 2022

@mi3lix9 out-of-scope?

@KnorpelSenf
Copy link
Member Author

@mi3lix9 we're working on grammY components already. @deptyped is going to turn this into a component library for web apps in the long run. It would be great if you'd join in: https://github.com/grammyjs/components

@OfficialCodinary
Copy link

A cache library, Which uses caching system for InputFile. For example:

ctx.replyWithPhoto(...)

When i call it twice i want the second to be fast.
Idk if i've elaborated it well

@KnorpelSenf
Copy link
Member Author

That sounds cool, let me add it

@KnorpelSenf
Copy link
Member Author

@OfficialCodinary in fact, we already have a plugin for files, and your idea is in scope for that. Check this out: grammyjs/files#6

@alexander-lamdan
Copy link

alexander-lamdan commented Apr 10, 2024

Hey, I love your grammy framework, damn it's awesome, you saved my life.

How or can you add hot reload for node.js in typescript? It really nesseccary for working with bot in real-time

@KnorpelSenf
Copy link
Member Author

It's built-in with Deno, but if you use Node, then there are projects like nodemon that work well. They typically don't do true hot reloads as what you would get while developing for the frontend, but since starting a bot shouldn't take more than a tenth of a second, the turnaround time is still fast enough.

@roziscoding
Copy link
Contributor

roziscoding commented Apr 10, 2024

Just beware that, if you use any kind of in-memory state (like MemorySessionStorage, for example), you'll lose that state. Another difference from true hot reloading.

@anatoly314
Copy link

anatoly314 commented Apr 10, 2024

@alexander-lamdan I'm using tsx in this way and it works fine:

"scripts": {
    "dev": "tsx watch src/start.ts",

but like @roziscoding said if you have something in memory it will be lost between restarts

@TerrniT
Copy link

TerrniT commented Aug 28, 2024

I got the idea of using grammy with bun/elysiajs. Does anyone have such experience ?

@roziscoding
Copy link
Contributor

I got the idea of using grammy with bun/elysiajs. Does anyone have such experience ?

Someone probably does, but that's not useful information. It's better to take any issues or specific questions to the group chat

@roziscoding
Copy link
Contributor

grammy-telemetry

There's a draft of this here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests