gogram

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

README

Gogram (Telegram Bot Framework)

Gogram is a Go framework for building Telegram bots. It simplifies bot development with features like middleware support, command management, inline buttons, and callback handling.

Features

  • Easy bot creation: Initialize your bot with a single NewBot call.
  • Middleware support: Preprocess messages, log activity, or apply filters easily.
  • Command management: Add bot commands such as /start, /help, /hello with ease.
  • Worker management: Adjust the number of concurrent workers to optimize performance.
  • Inline buttons and callback handling: Build interactive bots with Telegram inline keyboards.

Installation

go get github.com/Alsond5/gogram

Example Usage

package main

import (
	"context"
	"fmt"
	"os"
	"os/signal"

	"github.com/Alsond5/gogram"
	"github.com/Alsond5/gogram/models"
)

func main() {
	ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
	defer cancel()

	token := os.Getenv("BOT_TOKEN")

	b, err := gogram.NewBot(token)
	if err != nil {
		panic(err)
	}

	b.RegisterHandler(gogram.HandlerTypeMessageText, "hello", gogram.MatchTypeCommandStartOnly, helloHandler)

	b.Start(ctx)
}

func helloHandler(c *gogram.Context) error {
	_, err := c.Bot.SendMessageHelper(c.Ctx, fmt.Sprintf("Hello, %s", c.Update.Message.From.FirstName), c.Update.Message.Chat.Id)

	return err
}

License

Gogram is licensed under the Apache License 2.0. See the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

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

func NewBot

func NewBot(token string, options ...Option) (*Bot, error)

func (*Bot) AddStickerToSet

func (b *Bot) AddStickerToSet(ctx context.Context, params *models.AddStickerToSetRequest) (bool, error)

func (*Bot) AnswerCallbackQuery

func (b *Bot) AnswerCallbackQuery(ctx context.Context, params *models.AnswerCallbackQueryRequest) (bool, error)

func (*Bot) AnswerInlineQuery

func (b *Bot) AnswerInlineQuery(ctx context.Context, params *models.AnswerInlineQueryRequest) (bool, error)

func (*Bot) AnswerPreCheckoutQuery

func (b *Bot) AnswerPreCheckoutQuery(ctx context.Context, params *models.AnswerPreCheckoutQueryRequest) (bool, error)

func (*Bot) AnswerShippingQuery

func (b *Bot) AnswerShippingQuery(ctx context.Context, params *models.AnswerShippingQueryRequest) (bool, error)

func (*Bot) AnswerWebAppQuery

func (b *Bot) AnswerWebAppQuery(ctx context.Context, params *models.AnswerWebAppQueryRequest) (*models.SentWebAppMessage, error)

func (*Bot) ApproveChatJoinRequest

func (b *Bot) ApproveChatJoinRequest(ctx context.Context, params *models.ApproveChatJoinRequestRequest) (bool, error)

func (*Bot) ApproveSuggestedPost

func (b *Bot) ApproveSuggestedPost(ctx context.Context, params *models.ApproveSuggestedPostRequest) (bool, error)

func (*Bot) BanChatMember

func (b *Bot) BanChatMember(ctx context.Context, params *models.BanChatMemberRequest) (bool, error)

func (*Bot) BanChatSenderChat

func (b *Bot) BanChatSenderChat(ctx context.Context, params *models.BanChatSenderChatRequest) (bool, error)

func (*Bot) Close

func (b *Bot) Close(ctx context.Context) (bool, error)

func (*Bot) CloseForumTopic

func (b *Bot) CloseForumTopic(ctx context.Context, params *models.CloseForumTopicRequest) (bool, error)

func (*Bot) CloseGeneralForumTopic

func (b *Bot) CloseGeneralForumTopic(ctx context.Context, params *models.CloseGeneralForumTopicRequest) (bool, error)

func (*Bot) Command

func (b *Bot) Command(upd *models.Update) string

func (*Bot) ConvertGiftToStars

func (b *Bot) ConvertGiftToStars(ctx context.Context, params *models.ConvertGiftToStarsRequest) (bool, error)

func (*Bot) CopyMessage

func (b *Bot) CopyMessage(ctx context.Context, params *models.CopyMessageRequest) (*models.MessageId, error)

func (*Bot) CopyMessages

func (b *Bot) CopyMessages(ctx context.Context, params *models.CopyMessagesRequest) ([]models.MessageId, error)
func (b *Bot) CreateChatInviteLink(ctx context.Context, params *models.CreateChatInviteLinkRequest) (*models.ChatInviteLink, error)
func (b *Bot) CreateChatSubscriptionInviteLink(ctx context.Context, params *models.CreateChatSubscriptionInviteLinkRequest) (*models.ChatInviteLink, error)

func (*Bot) CreateForumTopic

func (b *Bot) CreateForumTopic(ctx context.Context, params *models.CreateForumTopicRequest) (*models.ForumTopic, error)
func (b *Bot) CreateInvoiceLink(ctx context.Context, params *models.CreateInvoiceLinkRequest) (string, error)

func (*Bot) CreateNewStickerSet

func (b *Bot) CreateNewStickerSet(ctx context.Context, params *models.CreateNewStickerSetRequest) (bool, error)

func (*Bot) DeclineChatJoinRequest

func (b *Bot) DeclineChatJoinRequest(ctx context.Context, params *models.DeclineChatJoinRequestRequest) (bool, error)

func (*Bot) DeclineSuggestedPost

func (b *Bot) DeclineSuggestedPost(ctx context.Context, params *models.DeclineSuggestedPostRequest) (bool, error)

func (*Bot) DeleteBusinessMessages

func (b *Bot) DeleteBusinessMessages(ctx context.Context, params *models.DeleteBusinessMessagesRequest) (bool, error)

func (*Bot) DeleteChatPhoto

func (b *Bot) DeleteChatPhoto(ctx context.Context, params *models.DeleteChatPhotoRequest) (bool, error)

func (*Bot) DeleteChatStickerSet

func (b *Bot) DeleteChatStickerSet(ctx context.Context, params *models.DeleteChatStickerSetRequest) (bool, error)

func (*Bot) DeleteForumTopic

func (b *Bot) DeleteForumTopic(ctx context.Context, params *models.DeleteForumTopicRequest) (bool, error)

func (*Bot) DeleteMessage

func (b *Bot) DeleteMessage(ctx context.Context, params *models.DeleteMessageRequest) (bool, error)

func (*Bot) DeleteMessages

func (b *Bot) DeleteMessages(ctx context.Context, params *models.DeleteMessagesRequest) (bool, error)

func (*Bot) DeleteMyCommands

func (b *Bot) DeleteMyCommands(ctx context.Context, params *models.DeleteMyCommandsRequest) (bool, error)

func (*Bot) DeleteStickerFromSet

func (b *Bot) DeleteStickerFromSet(ctx context.Context, params *models.DeleteStickerFromSetRequest) (bool, error)

func (*Bot) DeleteStickerSet

func (b *Bot) DeleteStickerSet(ctx context.Context, params *models.DeleteStickerSetRequest) (bool, error)

func (*Bot) DeleteStory

func (b *Bot) DeleteStory(ctx context.Context, params *models.DeleteStoryRequest) (bool, error)

func (*Bot) DeleteWebhook

func (b *Bot) DeleteWebhook(ctx context.Context, params *models.DeleteWebhookRequest) (bool, error)
func (b *Bot) EditChatInviteLink(ctx context.Context, params *models.EditChatInviteLinkRequest) (*models.ChatInviteLink, error)
func (b *Bot) EditChatSubscriptionInviteLink(ctx context.Context, params *models.EditChatSubscriptionInviteLinkRequest) (*models.ChatInviteLink, error)

func (*Bot) EditForumTopic

func (b *Bot) EditForumTopic(ctx context.Context, params *models.EditForumTopicRequest) (bool, error)

func (*Bot) EditGeneralForumTopic

func (b *Bot) EditGeneralForumTopic(ctx context.Context, params *models.EditGeneralForumTopicRequest) (bool, error)

func (*Bot) EditMessageCaption

func (b *Bot) EditMessageCaption(ctx context.Context, params *models.EditMessageCaptionRequest) (interface{}, error)

func (*Bot) EditMessageChecklist

func (b *Bot) EditMessageChecklist(ctx context.Context, params *models.EditMessageChecklistRequest) (*models.Message, error)

func (*Bot) EditMessageLiveLocation

func (b *Bot) EditMessageLiveLocation(ctx context.Context, params *models.EditMessageLiveLocationRequest) (interface{}, error)

func (*Bot) EditMessageMedia

func (b *Bot) EditMessageMedia(ctx context.Context, params *models.EditMessageMediaRequest) (interface{}, error)

func (*Bot) EditMessageReplyMarkup

func (b *Bot) EditMessageReplyMarkup(ctx context.Context, params *models.EditMessageReplyMarkupRequest) (interface{}, error)

func (*Bot) EditMessageText

func (b *Bot) EditMessageText(ctx context.Context, params *models.EditMessageTextRequest) (interface{}, error)

func (*Bot) EditStory

func (b *Bot) EditStory(ctx context.Context, params *models.EditStoryRequest) (*models.Story, error)

func (*Bot) EditUserStarSubscription

func (b *Bot) EditUserStarSubscription(ctx context.Context, params *models.EditUserStarSubscriptionRequest) (bool, error)
func (b *Bot) ExportChatInviteLink(ctx context.Context, params *models.ExportChatInviteLinkRequest) (string, error)

func (*Bot) ForwardMessage

func (b *Bot) ForwardMessage(ctx context.Context, params *models.ForwardMessageRequest) (*models.Message, error)

func (*Bot) ForwardMessages

func (b *Bot) ForwardMessages(ctx context.Context, params *models.ForwardMessagesRequest) ([]models.MessageId, error)

func (*Bot) GetAvailableGifts

func (b *Bot) GetAvailableGifts(ctx context.Context) (*models.Gifts, error)

func (*Bot) GetBusinessAccountGifts

func (b *Bot) GetBusinessAccountGifts(ctx context.Context, params *models.GetBusinessAccountGiftsRequest) (*models.OwnedGifts, error)

func (*Bot) GetBusinessAccountStarBalance

func (b *Bot) GetBusinessAccountStarBalance(ctx context.Context, params *models.GetBusinessAccountStarBalanceRequest) (*models.StarAmount, error)

func (*Bot) GetBusinessConnection

func (b *Bot) GetBusinessConnection(ctx context.Context, params *models.GetBusinessConnectionRequest) (*models.BusinessConnection, error)

func (*Bot) GetChat

func (b *Bot) GetChat(ctx context.Context, params *models.GetChatRequest) (*models.ChatFullInfo, error)

func (*Bot) GetChatAdministrators

func (b *Bot) GetChatAdministrators(ctx context.Context, params *models.GetChatAdministratorsRequest) ([]models.ChatMember, error)

func (*Bot) GetChatMember

func (b *Bot) GetChatMember(ctx context.Context, params *models.GetChatMemberRequest) (*models.ChatMember, error)

func (*Bot) GetChatMemberCount

func (b *Bot) GetChatMemberCount(ctx context.Context, params *models.GetChatMemberCountRequest) (int64, error)

func (*Bot) GetChatMenuButton

func (b *Bot) GetChatMenuButton(ctx context.Context, params *models.GetChatMenuButtonRequest) (*models.MenuButton, error)

func (*Bot) GetCustomEmojiStickers

func (b *Bot) GetCustomEmojiStickers(ctx context.Context, params *models.GetCustomEmojiStickersRequest) ([]models.Sticker, error)

func (*Bot) GetFile

func (b *Bot) GetFile(ctx context.Context, params *models.GetFileRequest) (*models.File, error)

func (*Bot) GetForumTopicIconStickers

func (b *Bot) GetForumTopicIconStickers(ctx context.Context) ([]models.Sticker, error)

func (*Bot) GetGameHighScores

func (b *Bot) GetGameHighScores(ctx context.Context, params *models.GetGameHighScoresRequest) ([]models.GameHighScore, error)

func (*Bot) GetMe

func (b *Bot) GetMe(ctx context.Context) (*models.User, error)

func (*Bot) GetMyCommands

func (b *Bot) GetMyCommands(ctx context.Context, params *models.GetMyCommandsRequest) ([]models.BotCommand, error)

func (*Bot) GetMyDescription

func (b *Bot) GetMyDescription(ctx context.Context, params *models.GetMyDescriptionRequest) (*models.BotDescription, error)

func (*Bot) GetMyName

func (b *Bot) GetMyName(ctx context.Context, params *models.GetMyNameRequest) (*models.BotName, error)

func (*Bot) GetMyShortDescription

func (b *Bot) GetMyShortDescription(ctx context.Context, params *models.GetMyShortDescriptionRequest) (*models.BotShortDescription, error)

func (*Bot) GetMyStarBalance

func (b *Bot) GetMyStarBalance(ctx context.Context) (*models.StarAmount, error)

func (*Bot) GetStarTransactions

func (b *Bot) GetStarTransactions(ctx context.Context, params *models.GetStarTransactionsRequest) (*models.StarTransactions, error)

func (*Bot) GetStickerSet

func (b *Bot) GetStickerSet(ctx context.Context, params *models.GetStickerSetRequest) (*models.StickerSet, error)

func (*Bot) GetUpdates

func (b *Bot) GetUpdates(ctx context.Context, params *models.GetUpdatesRequest) ([]models.Update, error)

func (*Bot) GetUserChatBoosts

func (b *Bot) GetUserChatBoosts(ctx context.Context, params *models.GetUserChatBoostsRequest) (*models.UserChatBoosts, error)

func (*Bot) GetUserProfilePhotos

func (b *Bot) GetUserProfilePhotos(ctx context.Context, params *models.GetUserProfilePhotosRequest) (*models.UserProfilePhotos, error)

func (*Bot) GetWebhookInfo

func (b *Bot) GetWebhookInfo(ctx context.Context) (*models.WebhookInfo, error)

func (*Bot) GiftPremiumSubscription

func (b *Bot) GiftPremiumSubscription(ctx context.Context, params *models.GiftPremiumSubscriptionRequest) (bool, error)

func (*Bot) HideGeneralForumTopic

func (b *Bot) HideGeneralForumTopic(ctx context.Context, params *models.HideGeneralForumTopicRequest) (bool, error)

func (*Bot) LeaveChat

func (b *Bot) LeaveChat(ctx context.Context, params *models.LeaveChatRequest) (bool, error)

func (*Bot) LogOut

func (b *Bot) LogOut(ctx context.Context) (bool, error)

func (*Bot) OnHelpCommand

func (b *Bot) OnHelpCommand(handlers ...Handler)

func (*Bot) OnStartCommand

func (b *Bot) OnStartCommand(handlers ...Handler)

func (*Bot) PinChatMessage

func (b *Bot) PinChatMessage(ctx context.Context, params *models.PinChatMessageRequest) (bool, error)

func (*Bot) PostStory

func (b *Bot) PostStory(ctx context.Context, params *models.PostStoryRequest) (*models.Story, error)

func (*Bot) PromoteChatMember

func (b *Bot) PromoteChatMember(ctx context.Context, params *models.PromoteChatMemberRequest) (bool, error)

func (*Bot) ReadBusinessMessage

func (b *Bot) ReadBusinessMessage(ctx context.Context, params *models.ReadBusinessMessageRequest) (bool, error)

func (*Bot) RefundStarPayment

func (b *Bot) RefundStarPayment(ctx context.Context, params *models.RefundStarPaymentRequest) (bool, error)

func (*Bot) RegisterCommandHandler

func (b *Bot) RegisterCommandHandler(command string, handlers ...Handler)

func (*Bot) RegisterHandler

func (b *Bot) RegisterHandler(handlerType HandlerType, pattern string, matchType MatchType, handlers ...Handler)

func (*Bot) RemoveBusinessAccountProfilePhoto

func (b *Bot) RemoveBusinessAccountProfilePhoto(ctx context.Context, params *models.RemoveBusinessAccountProfilePhotoRequest) (bool, error)

func (*Bot) RemoveChatVerification

func (b *Bot) RemoveChatVerification(ctx context.Context, params *models.RemoveChatVerificationRequest) (bool, error)

func (*Bot) RemoveUserVerification

func (b *Bot) RemoveUserVerification(ctx context.Context, params *models.RemoveUserVerificationRequest) (bool, error)

func (*Bot) ReopenForumTopic

func (b *Bot) ReopenForumTopic(ctx context.Context, params *models.ReopenForumTopicRequest) (bool, error)

func (*Bot) ReopenGeneralForumTopic

func (b *Bot) ReopenGeneralForumTopic(ctx context.Context, params *models.ReopenGeneralForumTopicRequest) (bool, error)

func (*Bot) ReplaceStickerInSet

func (b *Bot) ReplaceStickerInSet(ctx context.Context, params *models.ReplaceStickerInSetRequest) (bool, error)

func (*Bot) RestrictChatMember

func (b *Bot) RestrictChatMember(ctx context.Context, params *models.RestrictChatMemberRequest) (bool, error)
func (b *Bot) RevokeChatInviteLink(ctx context.Context, params *models.RevokeChatInviteLinkRequest) (*models.ChatInviteLink, error)

func (*Bot) SavePreparedInlineMessage

func (b *Bot) SavePreparedInlineMessage(ctx context.Context, params *models.SavePreparedInlineMessageRequest) (*models.PreparedInlineMessage, error)

func (*Bot) SendAnimation

func (b *Bot) SendAnimation(ctx context.Context, params *models.SendAnimationRequest) (*models.Message, error)

func (*Bot) SendAudio

func (b *Bot) SendAudio(ctx context.Context, params *models.SendAudioRequest) (*models.Message, error)

func (*Bot) SendChatAction

func (b *Bot) SendChatAction(ctx context.Context, params *models.SendChatActionRequest) (bool, error)

func (*Bot) SendChecklist

func (b *Bot) SendChecklist(ctx context.Context, params *models.SendChecklistRequest) (*models.Message, error)

func (*Bot) SendContact

func (b *Bot) SendContact(ctx context.Context, params *models.SendContactRequest) (*models.Message, error)

func (*Bot) SendDice

func (b *Bot) SendDice(ctx context.Context, params *models.SendDiceRequest) (*models.Message, error)

func (*Bot) SendDocument

func (b *Bot) SendDocument(ctx context.Context, params *models.SendDocumentRequest) (*models.Message, error)

func (*Bot) SendGame

func (b *Bot) SendGame(ctx context.Context, params *models.SendGameRequest) (*models.Message, error)

func (*Bot) SendGift

func (b *Bot) SendGift(ctx context.Context, params *models.SendGiftRequest) (bool, error)

func (*Bot) SendInvoice

func (b *Bot) SendInvoice(ctx context.Context, params *models.SendInvoiceRequest) (*models.Message, error)

func (*Bot) SendLocation

func (b *Bot) SendLocation(ctx context.Context, params *models.SendLocationRequest) (*models.Message, error)

func (*Bot) SendMediaGroup

func (b *Bot) SendMediaGroup(ctx context.Context, params *models.SendMediaGroupRequest) ([]models.Message, error)

func (*Bot) SendMessage

func (b *Bot) SendMessage(ctx context.Context, params *models.SendMessageRequest) (*models.Message, error)

func (*Bot) SendMessageHelper

func (b *Bot) SendMessageHelper(ctx context.Context, message string, chatId int64) (*models.Message, error)

func (*Bot) SendPaidMedia

func (b *Bot) SendPaidMedia(ctx context.Context, params *models.SendPaidMediaRequest) (*models.Message, error)

func (*Bot) SendPhoto

func (b *Bot) SendPhoto(ctx context.Context, params *models.SendPhotoRequest) (*models.Message, error)

func (*Bot) SendPoll

func (b *Bot) SendPoll(ctx context.Context, params *models.SendPollRequest) (*models.Message, error)

func (*Bot) SendSticker

func (b *Bot) SendSticker(ctx context.Context, params *models.SendStickerRequest) (*models.Message, error)

func (*Bot) SendVenue

func (b *Bot) SendVenue(ctx context.Context, params *models.SendVenueRequest) (*models.Message, error)

func (*Bot) SendVideo

func (b *Bot) SendVideo(ctx context.Context, params *models.SendVideoRequest) (*models.Message, error)

func (*Bot) SendVideoNote

func (b *Bot) SendVideoNote(ctx context.Context, params *models.SendVideoNoteRequest) (*models.Message, error)

func (*Bot) SendVoice

func (b *Bot) SendVoice(ctx context.Context, params *models.SendVoiceRequest) (*models.Message, error)

func (*Bot) SetBotCommands

func (b *Bot) SetBotCommands(ctx context.Context, commands []models.BotCommand, options ...CommandOption) error

func (*Bot) SetBusinessAccountBio

func (b *Bot) SetBusinessAccountBio(ctx context.Context, params *models.SetBusinessAccountBioRequest) (bool, error)

func (*Bot) SetBusinessAccountGiftSettings

func (b *Bot) SetBusinessAccountGiftSettings(ctx context.Context, params *models.SetBusinessAccountGiftSettingsRequest) (bool, error)

func (*Bot) SetBusinessAccountName

func (b *Bot) SetBusinessAccountName(ctx context.Context, params *models.SetBusinessAccountNameRequest) (bool, error)

func (*Bot) SetBusinessAccountProfilePhoto

func (b *Bot) SetBusinessAccountProfilePhoto(ctx context.Context, params *models.SetBusinessAccountProfilePhotoRequest) (bool, error)

func (*Bot) SetBusinessAccountUsername

func (b *Bot) SetBusinessAccountUsername(ctx context.Context, params *models.SetBusinessAccountUsernameRequest) (bool, error)

func (*Bot) SetChatAdministratorCustomTitle

func (b *Bot) SetChatAdministratorCustomTitle(ctx context.Context, params *models.SetChatAdministratorCustomTitleRequest) (bool, error)

func (*Bot) SetChatDescription

func (b *Bot) SetChatDescription(ctx context.Context, params *models.SetChatDescriptionRequest) (bool, error)

func (*Bot) SetChatMenuButton

func (b *Bot) SetChatMenuButton(ctx context.Context, params *models.SetChatMenuButtonRequest) (bool, error)

func (*Bot) SetChatPermissions

func (b *Bot) SetChatPermissions(ctx context.Context, params *models.SetChatPermissionsRequest) (bool, error)

func (*Bot) SetChatPhoto

func (b *Bot) SetChatPhoto(ctx context.Context, params *models.SetChatPhotoRequest) (bool, error)

func (*Bot) SetChatStickerSet

func (b *Bot) SetChatStickerSet(ctx context.Context, params *models.SetChatStickerSetRequest) (bool, error)

func (*Bot) SetChatTitle

func (b *Bot) SetChatTitle(ctx context.Context, params *models.SetChatTitleRequest) (bool, error)

func (*Bot) SetCustomEmojiStickerSetThumbnail

func (b *Bot) SetCustomEmojiStickerSetThumbnail(ctx context.Context, params *models.SetCustomEmojiStickerSetThumbnailRequest) (bool, error)

func (*Bot) SetGameScore

func (b *Bot) SetGameScore(ctx context.Context, params *models.SetGameScoreRequest) (interface{}, error)

func (*Bot) SetMessageReaction

func (b *Bot) SetMessageReaction(ctx context.Context, params *models.SetMessageReactionRequest) (bool, error)

func (*Bot) SetMyCommands

func (b *Bot) SetMyCommands(ctx context.Context, params *models.SetMyCommandsRequest) (bool, error)

func (*Bot) SetMyDefaultAdministratorRights

func (b *Bot) SetMyDefaultAdministratorRights(ctx context.Context, params *models.SetMyDefaultAdministratorRightsRequest) (bool, error)

func (*Bot) SetMyDescription

func (b *Bot) SetMyDescription(ctx context.Context, params *models.SetMyDescriptionRequest) (bool, error)

func (*Bot) SetMyName

func (b *Bot) SetMyName(ctx context.Context, params *models.SetMyNameRequest) (bool, error)

func (*Bot) SetMyShortDescription

func (b *Bot) SetMyShortDescription(ctx context.Context, params *models.SetMyShortDescriptionRequest) (bool, error)

func (*Bot) SetPassportDataErrors

func (b *Bot) SetPassportDataErrors(ctx context.Context, params *models.SetPassportDataErrorsRequest) (bool, error)

func (*Bot) SetStickerEmojiList

func (b *Bot) SetStickerEmojiList(ctx context.Context, params *models.SetStickerEmojiListRequest) (bool, error)

func (*Bot) SetStickerKeywords

func (b *Bot) SetStickerKeywords(ctx context.Context, params *models.SetStickerKeywordsRequest) (bool, error)

func (*Bot) SetStickerMaskPosition

func (b *Bot) SetStickerMaskPosition(ctx context.Context, params *models.SetStickerMaskPositionRequest) (bool, error)

func (*Bot) SetStickerPositionInSet

func (b *Bot) SetStickerPositionInSet(ctx context.Context, params *models.SetStickerPositionInSetRequest) (bool, error)

func (*Bot) SetStickerSetThumbnail

func (b *Bot) SetStickerSetThumbnail(ctx context.Context, params *models.SetStickerSetThumbnailRequest) (bool, error)

func (*Bot) SetStickerSetTitle

func (b *Bot) SetStickerSetTitle(ctx context.Context, params *models.SetStickerSetTitleRequest) (bool, error)

func (*Bot) SetUserEmojiStatus

func (b *Bot) SetUserEmojiStatus(ctx context.Context, params *models.SetUserEmojiStatusRequest) (bool, error)

func (*Bot) SetWebhook

func (b *Bot) SetWebhook(ctx context.Context, params *models.SetWebhookRequest) (bool, error)

func (*Bot) Start

func (b *Bot) Start(ctx context.Context)

func (*Bot) StopMessageLiveLocation

func (b *Bot) StopMessageLiveLocation(ctx context.Context, params *models.StopMessageLiveLocationRequest) (interface{}, error)

func (*Bot) StopPoll

func (b *Bot) StopPoll(ctx context.Context, params *models.StopPollRequest) (*models.Poll, error)

func (*Bot) TransferBusinessAccountStars

func (b *Bot) TransferBusinessAccountStars(ctx context.Context, params *models.TransferBusinessAccountStarsRequest) (bool, error)

func (*Bot) TransferGift

func (b *Bot) TransferGift(ctx context.Context, params *models.TransferGiftRequest) (bool, error)

func (*Bot) UnbanChatMember

func (b *Bot) UnbanChatMember(ctx context.Context, params *models.UnbanChatMemberRequest) (bool, error)

func (*Bot) UnbanChatSenderChat

func (b *Bot) UnbanChatSenderChat(ctx context.Context, params *models.UnbanChatSenderChatRequest) (bool, error)

func (*Bot) UnhideGeneralForumTopic

func (b *Bot) UnhideGeneralForumTopic(ctx context.Context, params *models.UnhideGeneralForumTopicRequest) (bool, error)

func (*Bot) UnpinAllChatMessages

func (b *Bot) UnpinAllChatMessages(ctx context.Context, params *models.UnpinAllChatMessagesRequest) (bool, error)

func (*Bot) UnpinAllForumTopicMessages

func (b *Bot) UnpinAllForumTopicMessages(ctx context.Context, params *models.UnpinAllForumTopicMessagesRequest) (bool, error)

func (*Bot) UnpinAllGeneralForumTopicMessages

func (b *Bot) UnpinAllGeneralForumTopicMessages(ctx context.Context, params *models.UnpinAllGeneralForumTopicMessagesRequest) (bool, error)

func (*Bot) UnpinChatMessage

func (b *Bot) UnpinChatMessage(ctx context.Context, params *models.UnpinChatMessageRequest) (bool, error)

func (*Bot) UpgradeGift

func (b *Bot) UpgradeGift(ctx context.Context, params *models.UpgradeGiftRequest) (bool, error)

func (*Bot) UploadStickerFile

func (b *Bot) UploadStickerFile(ctx context.Context, params *models.UploadStickerFileRequest) (*models.File, error)

func (*Bot) Use added in v0.4.0

func (b *Bot) Use(handler Handler)

func (*Bot) VerifyChat

func (b *Bot) VerifyChat(ctx context.Context, params *models.VerifyChatRequest) (bool, error)

func (*Bot) VerifyUser

func (b *Bot) VerifyUser(ctx context.Context, params *models.VerifyUserRequest) (bool, error)

type CommandOption

type CommandOption func(*commandConfig)

func WithLanguage

func WithLanguage(languageCode string) CommandOption

func WithScope

func WithScope(scope models.BotCommandScope) CommandOption

type Context added in v0.4.0

type Context struct {
	Ctx    context.Context
	Bot    *Bot
	Update *models.Update
	// contains filtered or unexported fields
}

func (*Context) Abort added in v0.4.0

func (c *Context) Abort()

func (*Context) Next added in v0.4.0

func (c *Context) Next() error

type Handler added in v0.4.0

type Handler func(c *Context) error

type HandlerType

type HandlerType int
const (
	HandlerTypeMessageText HandlerType = iota
	HandlerTypeCallbackQueryData
	HandlerTypeCallbackQueryGameShortName
	HandlerTypePhotoCaption
)

type HttpClient

type HttpClient interface {
	Do(*http.Request) (*http.Response, error)
}

type MatchFunc

type MatchFunc func(upd *models.Update) bool

type MatchType

type MatchType int
const (
	MatchTypeExact MatchType = iota
	MatchTypePrefix
	MatchTypeContains
	MatchTypeCommand
	MatchTypeCommandStartOnly
)

type Middleware

type Middleware func() Handler

type Option

type Option func(b *Bot)

func SetMiddlewares

func SetMiddlewares(middlewares ...Handler) Option

func SetWorkers

func SetWorkers(count int) Option

Directories

Path Synopsis
examples
advanced command
simple command

Jump to

Keyboard shortcuts

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