telegram

package
v0.8.25 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func SetUser

func SetUser(ctx context.Context, user User) context.Context

func Username added in v0.7.11

func Username(username string) string

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func (Auth) Middleware

func (a Auth) Middleware(next http.Handler) http.Handler

func (Auth) UnaryServerInterceptor

func (a Auth) UnaryServerInterceptor(
	ctx context.Context,
	in any,
	_ *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (any, error)

func (Auth) Validate

func (obj Auth) Validate() error

type AuthOption

type AuthOption c.Option[Auth]

func WithAuthBotTokens

func WithAuthBotTokens(botTokens map[string]string) AuthOption

func WithAuthLogger

func WithAuthLogger(logger *zap.Logger) AuthOption

func WithAuthNoBotAllowed added in v0.7.7

func WithAuthNoBotAllowed() AuthOption

func WithAuthNoSignatureCheck added in v0.7.7

func WithAuthNoSignatureCheck(noSignatureCheck bool) AuthOption

type BotConfig added in v0.8.6

type BotConfig struct {
	Token string `validate:"required"`
}

type Config

type Config struct {
	WebApp WebAppConfig `yaml:"webapp"`
	Bot    BotConfig    `yaml:"bot"`
}

type PrivateChat added in v0.8.5

type PrivateChat struct {
	ID      int64
	Enabled bool
}

type User

type User struct {
	Username     string
	FirstName    string
	LastName     string
	AuthorityBot string `validate:"required"`
	ID           int64  `validate:"required"`
	IsBot        bool
	PrivateChat  PrivateChat
}

func GetUser

func GetUser(ctx context.Context) (User, error)

func (User) String added in v0.7.11

func (u User) String() string

type WebAppAuthConfig added in v0.8.6

type WebAppAuthConfig struct {
	BotTokens        map[string]string `yaml:"bot_tokens" validate:"required,dive,keys,required,endkeys,required"` //nolint:lll
	NoSignatureCheck bool              `yaml:"no_signature_check"`
}

type WebAppConfig

type WebAppConfig struct {
	Auth WebAppAuthConfig
}

Jump to

Keyboard shortcuts

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