PaulSonOfLars / gotgbot

Autogenerated Go wrapper for the telegram API. Inspired by the python-telegram-bot library.
MIT License
442 stars 105 forks source link

Update message.go #147

Closed TG-BOTSNETWORK closed 5 months ago

TG-BOTSNETWORK commented 5 months ago

which is used to filter preformatted code entities based on their programming language. The filter will return true if it finds a preformatted code entity with the specified language, otherwise false.

TG-BOTSNETWORK commented 5 months ago

here is the example to how to use this

package main

import (
    "log"

    "github.com/veerpratap6870/gotgbot"
    "github.com/veerpratap6870/gotgbot/filters"
)

func main() {
    bot, err := gotgbot.NewBot("BOT_TOKEN", &gotgbot.BotOpts{})
    if err != nil {
        log.Fatal(err)
    }

    // Example of MessageEntityPre filter
    offset := 0
    length := 10
    language := "python"
    filter := filters.MessageEntityPre(offset, length, language)

    bot.Dispatcher.AddHandler(filter, func(ctx *gotgbot.CallbackContext) {
        // You can access the message that matched the filter using ctx.EffectiveMessage
        ctx.Reply("Message matches the criteria.")
    })

    err = bot.StartPolling()
    if err != nil {
        log.Fatal(err)
    }
}
PaulSonOfLars commented 5 months ago

@TG-BOTSNETWORK While I appreciate the example, CI is still failing on this PR, which makes me doubt that any of it has been tested

PaulSonOfLars commented 5 months ago

Closing because filter is too niche to make sense in the library