filter

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package filter provides built-in filter implementations for TGBox.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(_ *tgbox.Context, _ *tgbox.Update) bool

All always returns true.

func And

func And(filters ...tgbox.Filter) tgbox.Filter

And combines multiple filters with logical AND.

func Command

func Command(cmds ...string) tgbox.Filter

Command passes if the message starts with one of the given commands, optionally suffixed with a bot mention ("/start@my_bot").

func Group

func Group(_ *tgbox.Context, update *tgbox.Update) bool

Group passes if the update is a message from a group or supergroup/channel.

func Incoming

func Incoming(_ *tgbox.Context, update *tgbox.Update) bool

Incoming passes for updates that were not produced by this client's own outgoing RPC calls.

func Not

func Not(f tgbox.Filter) tgbox.Filter

Not negates a filter.

func Or

func Or(filters ...tgbox.Filter) tgbox.Filter

Or combines multiple filters with logical OR.

func Private

func Private(_ *tgbox.Context, update *tgbox.Update) bool

Private passes if the update is a message from a private chat.

func State

func State(sm tgbox.StateManager, expected string) tgbox.Filter

State passes if the current user's conversational state in the provided StateManager matches expected. It is 100% non-blocking, safe against nil contexts, and relies strictly on the underlying storage driver. Retrieval errors or expired states are safely treated as no match.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL