modules

package
v1.0.1-i18n-fix Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GIF   filters.Message = message.Animation
	OTHER filters.Message = func(msg *gotgbot.Message) bool {
		return msg.Game != nil || msg.Sticker != nil || GIF != nil
	}
	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 != nil || OTHER != nil
	}
	PREVIEW filters.Message = func(msg *gotgbot.Message) bool {
		for _, s := range msg.Entities {
			if s.Url != "" {
				return true
			}
		}
		return false
	}
)
View Source
var ConnectionsModule = moduleStruct{/* contains filtered or unexported fields */}
View Source
var HelpModule = moduleStruct{

	AbleMap:        moduleEnabled{},
	AltHelpOptions: make(map[string][]string),
	// contains filtered or unexported fields
}
View Source
var PinsEnumFuncMap = map[int]func(b *gotgbot.Bot, ctx *ext.Context, pinT pinType, keyb *gotgbot.InlineKeyboardMarkup, replyMsgId int64) (*gotgbot.Message, error){
	db.TEXT: func(b *gotgbot.Bot, ctx *ext.Context, pinT pinType, keyb *gotgbot.InlineKeyboardMarkup, replyMsgId int64) (*gotgbot.Message, error) {
		return b.SendMessage(
			ctx.EffectiveChat.Id,
			pinT.MsgText,
			&gotgbot.SendMessageOpts{
				ParseMode: helpers.HTML,
				LinkPreviewOptions: &gotgbot.LinkPreviewOptions{
					IsDisabled: true,
				},
				ReplyMarkup: keyb,
				ReplyParameters: &gotgbot.ReplyParameters{
					MessageId:                replyMsgId,
					AllowSendingWithoutReply: true,
				},
				MessageThreadId: ctx.EffectiveMessage.MessageThreadId,
			},
		)
	},
	db.STICKER: func(b *gotgbot.Bot, ctx *ext.Context, pinT pinType, keyb *gotgbot.InlineKeyboardMarkup, replyMsgId int64) (*gotgbot.Message, error) {
		return b.SendSticker(
			ctx.EffectiveChat.Id,
			gotgbot.InputFileByID(pinT.FileID),
			&gotgbot.SendStickerOpts{
				ReplyParameters: &gotgbot.ReplyParameters{
					MessageId:                replyMsgId,
					AllowSendingWithoutReply: true,
				},
				ReplyMarkup:     keyb,
				MessageThreadId: ctx.EffectiveMessage.MessageThreadId,
			},
		)
	},
	db.DOCUMENT: func(b *gotgbot.Bot, ctx *ext.Context, pinT pinType, keyb *gotgbot.InlineKeyboardMarkup, replyMsgId int64) (*gotgbot.Message, error) {
		return b.SendDocument(
			ctx.EffectiveChat.Id,
			gotgbot.InputFileByID(pinT.FileID),
			&gotgbot.SendDocumentOpts{
				ReplyParameters: &gotgbot.ReplyParameters{
					MessageId:                replyMsgId,
					AllowSendingWithoutReply: true,
				},
				ParseMode:       helpers.HTML,
				ReplyMarkup:     keyb,
				Caption:         pinT.MsgText,
				MessageThreadId: ctx.EffectiveMessage.MessageThreadId,
			},
		)
	},
	db.PHOTO: func(b *gotgbot.Bot, ctx *ext.Context, pinT pinType, keyb *gotgbot.InlineKeyboardMarkup, replyMsgId int64) (*gotgbot.Message, error) {
		return b.SendPhoto(
			ctx.EffectiveChat.Id,
			gotgbot.InputFileByID(pinT.FileID),
			&gotgbot.SendPhotoOpts{
				ReplyParameters: &gotgbot.ReplyParameters{
					MessageId:                replyMsgId,
					AllowSendingWithoutReply: true,
				},
				ParseMode:       helpers.HTML,
				ReplyMarkup:     keyb,
				Caption:         pinT.MsgText,
				MessageThreadId: ctx.EffectiveMessage.MessageThreadId,
			},
		)
	},
	db.AUDIO: func(b *gotgbot.Bot, ctx *ext.Context, pinT pinType, keyb *gotgbot.InlineKeyboardMarkup, replyMsgId int64) (*gotgbot.Message, error) {
		return b.SendAudio(
			ctx.EffectiveChat.Id,
			gotgbot.InputFileByID(pinT.FileID),
			&gotgbot.SendAudioOpts{
				ReplyParameters: &gotgbot.ReplyParameters{
					MessageId:                replyMsgId,
					AllowSendingWithoutReply: true,
				},
				ParseMode:       helpers.HTML,
				ReplyMarkup:     keyb,
				Caption:         pinT.MsgText,
				MessageThreadId: ctx.EffectiveMessage.MessageThreadId,
			},
		)
	},
	db.VOICE: func(b *gotgbot.Bot, ctx *ext.Context, pinT pinType, keyb *gotgbot.InlineKeyboardMarkup, replyMsgId int64) (*gotgbot.Message, error) {
		return b.SendVoice(
			ctx.EffectiveChat.Id,
			gotgbot.InputFileByID(pinT.FileID),
			&gotgbot.SendVoiceOpts{
				ReplyParameters: &gotgbot.ReplyParameters{
					MessageId:                replyMsgId,
					AllowSendingWithoutReply: true,
				},
				ParseMode:       helpers.HTML,
				ReplyMarkup:     keyb,
				Caption:         pinT.MsgText,
				MessageThreadId: ctx.EffectiveMessage.MessageThreadId,
			},
		)
	},
	db.VIDEO: func(b *gotgbot.Bot, ctx *ext.Context, pinT pinType, keyb *gotgbot.InlineKeyboardMarkup, replyMsgId int64) (*gotgbot.Message, error) {
		return b.SendVideo(
			ctx.EffectiveChat.Id,
			gotgbot.InputFileByID(pinT.FileID),
			&gotgbot.SendVideoOpts{
				ReplyParameters: &gotgbot.ReplyParameters{
					MessageId:                replyMsgId,
					AllowSendingWithoutReply: true,
				},
				ParseMode:       helpers.HTML,
				ReplyMarkup:     keyb,
				Caption:         pinT.MsgText,
				MessageThreadId: ctx.EffectiveMessage.MessageThreadId,
			},
		)
	},
	db.VideoNote: func(b *gotgbot.Bot, ctx *ext.Context, pinT pinType, keyb *gotgbot.InlineKeyboardMarkup, replyMsgId int64) (*gotgbot.Message, error) {
		return b.SendVideoNote(
			ctx.EffectiveChat.Id,
			gotgbot.InputFileByID(pinT.FileID),
			&gotgbot.SendVideoNoteOpts{
				ReplyParameters: &gotgbot.ReplyParameters{
					MessageId:                replyMsgId,
					AllowSendingWithoutReply: true,
				},
				ReplyMarkup:     keyb,
				MessageThreadId: ctx.EffectiveMessage.MessageThreadId,
			},
		)
	},
}

PinsEnumFuncMap A rather very complicated PinsEnumFuncMap Variable made by me to send filters in an appropriate way

Functions

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 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 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 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 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.

Types

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