GithubHelp home page GithubHelp logo

handler description & help about telebot HOT 3 CLOSED

tucnak avatar tucnak commented on August 16, 2024
handler description & help

from telebot.

Comments (3)

tucnak avatar tucnak commented on August 16, 2024

Automatic /help handler is a sound idea very much indeed. That said, I find myself implementing /help differently every single time. Sometimes you want to have some sort of a FAQ, sometimes it's just a brief explanation of core mechanics, but usually you don't want it auto-generated.

I also believe that such auto-generated /help implementation must also account for Telegram's recent i18n support (see language_code within User) and at this point I can't really tell whether such feature is worth it.

adding more arguments to the Handle func would be a breaking change

Not necessarily. Handle is a set-up function and isn't supposed to be used heavily (only a handful of times, during the bot init process), we can rely on reflection to add "optional" arguments:

// Definition
func (b *Bot) Handle(prefix string, features ...interface{}) {}

// Uses
bot.Handle("/action", func (c Context) {})
bot.Handle("/action", "Description", func (c Context) {})

from telebot.

irgendwr avatar irgendwr commented on August 16, 2024

That said, I find myself implementing /help differently every single time. Sometimes you want to have some sort of a FAQ, sometimes it's just a brief explanation of core mechanics, but usually you don't want it auto-generated.

I think most of the implementations I've seen (ie. BotFather) would fit in a basic modular scheme:

<optional Title>
<optional Text>(possibly a summary of the bots purpose and general use cases)

<optional Category Title>
<optional Category Text>
    <optional Command> - <optional short command description>

I also believe that such auto-generated /help implementation must also account for Telegram's recent i18n support (see language_code within User) and at this point I can't really tell whether such feature is worth it.

Language support could also be done if each text was a map[string]string. (although even Telegram themselves don't seem to use this feature afaik)

That said... You are probably right, it might not be worth the time to implement such a feature.

from telebot.

tucnak avatar tucnak commented on August 16, 2024

Closing for the time being. We might bring it back for v2.1 or whatever.

from telebot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.