modules

package
v0.0.0-...-5d98cc1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 74 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OTHER filters.Message = func(msg *gotgbot.Message) bool {
		return msg.Game != nil || msg.Sticker != nil || message.Animation(msg)
	}
	MEDIA filters.Message = func(msg *gotgbot.Message) bool {
		return msg.Audio != nil || msg.Document != nil || msg.VideoNote != nil || msg.Video != nil || msg.Voice != nil || msg.Photo != nil
	}
	MESSAGES filters.Message = func(msg *gotgbot.Message) bool {
		return msg.Text != "" || msg.Contact != nil || msg.Location != nil || msg.Venue != nil || MEDIA(msg) || OTHER(msg)
	}

	PREVIEW filters.Message = hasURLEntity
)
View Source
var ConnectionsModule = moduleStruct{/* contains filtered or unexported fields */}
View Source
var MutedPermissions = gotgbot.ChatPermissions{
	CanSendMessages:       false,
	CanSendPhotos:         false,
	CanSendVideos:         false,
	CanSendAudios:         false,
	CanSendDocuments:      false,
	CanSendVideoNotes:     false,
	CanSendVoiceNotes:     false,
	CanAddWebPagePreviews: false,
	CanChangeInfo:         false,
	CanInviteUsers:        false,
	CanPinMessages:        false,
	CanManageTopics:       helpers.Ptr(false),
	CanSendPolls:          false,
	CanSendOtherMessages:  false,
}

MutedPermissions represents a fully restricted user - all sending capabilities disabled

Functions

func DefaultHelpRegistry

func DefaultHelpRegistry() *moduleStruct

DefaultHelpRegistry returns the default help registry.

func HandleAnonymousAdmin

func HandleAnonymousAdmin(b *gotgbot.Bot, ctx *ext.Context, command string) error

HandleAnonymousAdmin routes an anonymous admin command to the appropriate handler.

func HandleDeepLink(b *gotgbot.Bot, ctx *ext.Context, user *gotgbot.User, arg string) error

HandleDeepLink routes a deep link argument to the appropriate handler.

func LoadAdmin

func LoadAdmin(dispatcher *ext.Dispatcher)

LoadAdmin registers all admin module command handlers with the dispatcher. Sets up commands for promotion, demotion, title setting, and admin management.

func LoadAllModules

func LoadAllModules(dispatcher *ext.Dispatcher)

LoadAllModules sorts registered modules by ascending priority and calls each loader.

func LoadAntiRaid

func LoadAntiRaid(dispatcher *ext.Dispatcher)

func LoadAntiflood

func LoadAntiflood(dispatcher *ext.Dispatcher)

LoadAntiflood registers all antiflood module handlers with the dispatcher. Sets up flood detection commands and message monitoring handlers.

func LoadAntispam

func LoadAntispam(dispatcher *ext.Dispatcher)

LoadAntispam registers the antispam message handler with the dispatcher. Sets up spam detection monitoring for all incoming messages.

func LoadApprovals

func LoadApprovals(dispatcher *ext.Dispatcher)

LoadApprovals registers all approvals module handlers with the dispatcher.

func LoadBackup

func LoadBackup(dispatcher *ext.Dispatcher)

LoadBackup registers all backup module handlers with the dispatcher.

func LoadBans

func LoadBans(dispatcher *ext.Dispatcher)

LoadBans registers all ban-related command handlers with the dispatcher. Sets up ban, kick, restrict commands and their associated callback handlers.

func LoadBlacklists

func LoadBlacklists(dispatcher *ext.Dispatcher)

LoadBlacklists registers all blacklist module handlers with the dispatcher. Sets up commands for managing blacklists and the message watcher for enforcement.

func LoadBotUpdates

func LoadBotUpdates(dispatcher *ext.Dispatcher)

LoadBotUpdates registers bot event handlers for group management. Sets up handlers for bot joins, admin updates, and anonymous admin verification.

func LoadCaptcha

func LoadCaptcha(dispatcher *ext.Dispatcher)

LoadCaptcha registers all captcha module handlers with the dispatcher.

func LoadConnections

func LoadConnections(dispatcher *ext.Dispatcher)

LoadConnections registers all connection module handlers with the dispatcher. Sets up commands for managing remote chat connections and their callbacks.

func LoadDev

func LoadDev(dispatcher *ext.Dispatcher)

LoadDev registers all development-related command handlers with the dispatcher. Sets up admin commands for bot management, user management, and statistics.

func LoadDisabling

func LoadDisabling(dispatcher *ext.Dispatcher)

LoadDisabling registers all disabling-related command handlers with the dispatcher. Sets up commands for managing which bot commands are enabled or disabled in chats.

func LoadFilters

func LoadFilters(dispatcher *ext.Dispatcher)

LoadFilters registers all filter-related handlers with the dispatcher. Sets up commands for managing filters and the message watcher for automatic responses.

func LoadGreetings

func LoadGreetings(dispatcher *ext.Dispatcher)

LoadGreetings registers all greeting-related handlers with the dispatcher. Sets up welcome/goodbye messages, join requests, and service message cleanup.

func LoadHelp

func LoadHelp(dispatcher *ext.Dispatcher)

LoadHelp registers all help-related command and callback handlers. Sets up the help system including start, about, donate, and configuration commands.

func LoadLanguage

func LoadLanguage(dispatcher *ext.Dispatcher)

LoadLanguage registers language-related command and callback handlers. Sets up language selection commands and keyboard navigation for internationalization.

func LoadLocks

func LoadLocks(dispatcher *ext.Dispatcher)

LoadLocks registers all locks module handlers with the dispatcher, including commands and message filters for lock enforcement.

func LoadMisc

func LoadMisc(dispatcher *ext.Dispatcher)

LoadMisc registers all miscellaneous module handlers with the dispatcher, including utility commands for IDs, ping, translation, and stats.

func LoadMkdCmd

func LoadMkdCmd(dispatcher *ext.Dispatcher)

LoadMkdCmd registers markdown and formatting command handlers with the dispatcher. Sets up help commands and callback handlers for formatting assistance.

func LoadMutes

func LoadMutes(dispatcher *ext.Dispatcher)

LoadMutes registers all mute module handlers with the dispatcher, including various mute commands and their variants.

func LoadNotes

func LoadNotes(dispatcher *ext.Dispatcher)

LoadNotes registers all notes module handlers with the dispatcher, including note management commands and the notes watcher.

func LoadPin

func LoadPin(dispatcher *ext.Dispatcher)

LoadPin registers all pins module handlers with the dispatcher, including pin management commands and channel message monitoring.

func LoadPurges

func LoadPurges(dispatcher *ext.Dispatcher)

LoadPurges registers all purges module handlers with the dispatcher, including message deletion commands and callback handlers.

func LoadReactions

func LoadReactions(dispatcher *ext.Dispatcher)

LoadReactions loads the reactions module with all command handlers

func LoadReports

func LoadReports(dispatcher *ext.Dispatcher)

LoadReports registers all reports module handlers with the dispatcher, including report commands and @admin mention monitoring.

func LoadRules

func LoadRules(dispatcher *ext.Dispatcher)

LoadRules registers all rules module handlers with the dispatcher, including rules management and display commands.

func LoadUsers

func LoadUsers(dispatcher *ext.Dispatcher)

LoadUsers registers the user logging handler with the dispatcher to automatically track users and chats across all messages.

func LoadWarns

func LoadWarns(dispatcher *ext.Dispatcher)

LoadWarns registers all warns module handlers with the dispatcher, including warning commands and callback handlers.

func RegisterAnonymousAdminHandler

func RegisterAnonymousAdminHandler(command string, handler AnonymousAdminHandler)

RegisterAnonymousAdminHandler registers a handler for an anonymous admin command.

func RegisterDeepLinkHandler

func RegisterDeepLinkHandler(prefix string, handler DeepLinkHandler)

RegisterDeepLinkHandler registers a handler for a deep link prefix.

func RegisterExactDeepLinkHandler

func RegisterExactDeepLinkHandler(arg string, handler DeepLinkHandler)

RegisterExactDeepLinkHandler registers a handler for an exact deep link match.

func RegisterLegacyModule

func RegisterLegacyModule(name string, priority int, load func(*ext.Dispatcher))

RegisterLegacyModule registers a module loader. Duplicate registrations are silently ignored to prevent double-loading handlers.

func SendCaptcha

func SendCaptcha(bot *gotgbot.Bot, ctx *ext.Context, userID int64, userName string) error

SendCaptcha sends a captcha challenge to a new member. Called when a new member joins a group with captcha enabled.

func SendWelcomeMessage

func SendWelcomeMessage(bot *gotgbot.Bot, ctx *ext.Context, userID int64, firstName string) error

SendWelcomeMessage sends the configured welcome message for a user in a chat. This is extracted as a separate function to be reusable after captcha verification.

func StartAntiRaidExpiryPoller

func StartAntiRaidExpiryPoller()

StartAntiRaidExpiryPoller starts the background expiry poller after cache is available.

func StopAntiRaidExpiryPoller

func StopAntiRaidExpiryPoller()

StopAntiRaidExpiryPoller stops the background expiry poller.

Types

type AnonymousAdminHandler

type AnonymousAdminHandler func(b *gotgbot.Bot, ctx *ext.Context) error

AnonymousAdminHandler processes an anonymous admin command.

type DeepLinkHandler

type DeepLinkHandler func(b *gotgbot.Bot, ctx *ext.Context, user *gotgbot.User, arg string) error

DeepLinkHandler processes a deep link argument.

type PurgeWorker

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

PurgeWorker manages concurrent message deletion with rate limiting

Jump to

Keyboard shortcuts

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