utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArtworkHTMLCaption

func ArtworkHTMLCaption(artwork shared.ArtworkLike) string

func ArtworkInputMediaPhotos

func ArtworkInputMediaPhotos(
	ctx context.Context,
	serv *service.Service,
	meta *metautil.MetaData,
	artwork shared.ArtworkLike,
	caption string,
	start, end int) (*ioutil.Closer[[]telego.InputMedia], error)

func ArtworkInputMediaVideos

func ArtworkInputMediaVideos(ctx context.Context,
	serv *service.Service,
	meta *metautil.MetaData,
	artwork shared.UgoiraArtworkLike,
	caption string,
	start, end int) (*ioutil.Closer[[]telego.InputMedia], error)

func ArtworkPostKeyboard

func ArtworkPostKeyboard(meta *metautil.MetaData, cbId string) [][]telego.InlineKeyboardButton

func CheckPermissionForQuery

func CheckPermissionForQuery(ctx context.Context, serv *service.Service, query telego.CallbackQuery, permissions ...shared.Permission) bool

func CheckPermissionInGroup

func CheckPermissionInGroup(ctx context.Context, serv *service.Service, message telego.Message, permissions ...shared.Permission) bool

func FindSourceURLInMessage

func FindSourceURLInMessage(serv *service.Service, message *telego.Message) string

func GetMessagePhotoFile

func GetMessagePhotoFile(ctx *telegohandler.Context, message *telego.Message) ([]byte, error)

func GetMssageOriginChannel

func GetMssageOriginChannel(message *telego.Message) *telego.MessageOriginChannel

func GetPictureDocumentInputFile

func GetPictureDocumentInputFile(ctx context.Context, serv *service.Service, meta *metautil.MetaData, artwork shared.ArtworkLike, picture shared.PictureLike) (*ioutil.Closer[telego.InputFile], error)

func GetPicturePhotoInputFile

func GetPicturePhotoInputFile(ctx context.Context, serv *service.Service, meta *metautil.MetaData, picture shared.PictureLike) (*ioutil.Closer[telego.InputFile], error)

func GetPostedArtworkInlineKeyboardButton

func GetPostedArtworkInlineKeyboardButton(artwork *entity.Artwork, meta *metautil.MetaData) []telego.InlineKeyboardButton

func ParseCommandBy

func ParseCommandBy(text string, splitChar, quoteChar string) (string, string, []string)

func PostAndCreateArtwork

func PostAndCreateArtwork(
	ctx context.Context,
	bot *telego.Bot,
	serv *service.Service,
	meta *metautil.MetaData,
	artwork *entity.CachedArtworkData,
	fromChatID telego.ChatID,
	toChatID telego.ChatID,
	messageID int,
) error

func ReplyMessage

func ReplyMessage(ctx *telegohandler.Context, message telego.Message, text string) (*telego.Message, error)

func ReplyMessageWithHTML

func ReplyMessageWithHTML(ctx *telegohandler.Context, message telego.Message, text string) (*telego.Message, error)

func SendArtworkInfo

func SendArtworkInfo(ctx context.Context,
	bot *telego.Bot,
	meta *metautil.MetaData,
	serv *service.Service,
	sourceUrl string,
	chatID telego.ChatID,
	opts SendArtworkInfoOptions) error

SendArtworkInfo 将作品信息附带操作按钮发送到指定聊天, 用于提供给管理员发布或修改作品

需要区分已发布的作品, 已标记为删除的作品, 和未发布的作品

func SendArtworkPhotoMediaGroup

func SendArtworkPhotoMediaGroup(
	ctx context.Context,
	bot *telego.Bot,
	serv *service.Service,
	meta *metautil.MetaData,
	chatID telego.ChatID,
	artwork shared.ArtworkLike) ([]telego.Message, error)

func SendArtworkUgoiraMediaGroup

func SendArtworkUgoiraMediaGroup(
	ctx context.Context,
	bot *telego.Bot,
	serv *service.Service,
	meta *metautil.MetaData,
	chatID telego.ChatID,
	artwork shared.UgoiraArtworkLike,
	opt *SendOption,
) ([]telego.Message, error)

Types

type ArtworkCaptionData

type ArtworkCaptionData struct {
	ID          string
	SourceURL   string
	Title       string
	ArtistName  string
	Description template.HTML
	Tags        template.HTML
}

type CreateArtworkInfoReplyMarkupOptions

type CreateArtworkInfoReplyMarkupOptions struct {
	CreatedArtwork bool
	HasPermission  bool
}

type MediaGroupResultMessage

type MediaGroupResultMessage struct {
	Message      telego.Message
	FileID       string // Telegram file ID
	PictureIndex int    // 0-based index in artwork pictures
	UgoiraIndex  int    // 0-based index in artwork ugoiras, -1 if not ugoira
}

func SendArtworkMediaGroup

func SendArtworkMediaGroup(
	ctx context.Context,
	bot *telego.Bot,
	serv *service.Service,
	meta *metautil.MetaData,
	chatID telego.ChatID,
	artwork shared.ArtworkLike) ([]MediaGroupResultMessage, error)

type SendArtworkInfoOptions

type SendArtworkInfoOptions struct {
	AppendCaption   string
	ReplyParameters *telego.ReplyParameters
	HasPermission   bool
}

type SendOption

type SendOption struct {
	ReplyTo int
}

Jump to

Keyboard shortcuts

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