bot

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// User state, Used to indicate the status of the current user operation
	UserState map[int64]fsm.UserStatus = make(map[int64]fsm.UserStatus)

	// B telebot
	B *tb.Bot
)

Functions

func BroadcastNews

func BroadcastNews(source *model.Source, subs []*model.Subscribe, contents []*model.Content)

BroadcastNews send new contents message to subscriber

func BroadcastSourceError

func BroadcastSourceError(source *model.Source)

BroadcastSourceError send fetcher updata error message to subscribers

func CheckAdmin

func CheckAdmin(upd *tb.Update) bool

CheckAdmin check user is admin of group/channel

func CheckURL

func CheckURL(s string) bool

CheckURL check if the string is a URL

func FeedForChannelRegister

func FeedForChannelRegister(m *tb.Message, url string, channelMention string)

FeedForChannelRegister register fetcher for channel

func GetMentionFromMessage

func GetMentionFromMessage(m *tb.Message) (mention string)

GetMentionFromMessage get message mention

func GetURLAndMentionFromMessage

func GetURLAndMentionFromMessage(m *tb.Message) (url string, mention string)

GetURLAndMentionFromMessage get URL and mention from message

func HasAdminType

func HasAdminType(t tb.ChatType) bool

HasAdminType check if the message is sent in the group/channel environment

func SendError

func SendError(c *tb.Chat)

SendError send error user

func Start

func Start()

Start bot

func ToOPML

func ToOPML(sources []model.Source) (string, error)

ToOPML dump OPML to opml file

func UserIsAdminChannel

func UserIsAdminChannel(userID int, channelChat *tb.Chat) (isAdmin bool)

UserIsAdminChannel check if the user is the administrator of channel

Types

type Body

type Body struct {
	Outlines []Outline `xml:"outline"`
}

Body opml body

type Head struct {
	Title           string `xml:"title"`
	DateCreated     string `xml:"dateCreated,omitempty"`
	DateModified    string `xml:"dateModified,omitempty"`
	OwnerName       string `xml:"ownerName,omitempty"`
	OwnerEmail      string `xml:"ownerEmail,omitempty"`
	OwnerID         string `xml:"ownerId,omitempty"`
	Docs            string `xml:"docs,omitempty"`
	ExpansionState  string `xml:"expansionState,omitempty"`
	VertScrollState string `xml:"vertScrollState,omitempty"`
	WindowTop       string `xml:"windowTop,omitempty"`
	WindowBottom    string `xml:"windowBottom,omitempty"`
	WindowLeft      string `xml:"windowLeft,omitempty"`
	WindowRight     string `xml:"windowRight,omitempty"`
}

Head opml head

type OPML

type OPML struct {
	XMLName xml.Name `xml:"opml"`
	Version string   `xml:"version,attr"`
	Head    Head     `xml:"head"`
	Body    Body     `xml:"body"`
}

OPML opml struct

func GetOPMLByURL

func GetOPMLByURL(fileURL string) (*OPML, error)

GetOPMLByURL get OPML form url

func NewOPML

func NewOPML(b []byte) (*OPML, error)

NewOPML gen OPML form []byte

func (OPML) GetFlattenOutlines

func (o OPML) GetFlattenOutlines() ([]Outline, error)

GetFlattenOutlines make all outline at the same xml level

func (OPML) XML

func (o OPML) XML() (string, error)

XML dump OPML to xml file

type Outline

type Outline struct {
	Outlines     []Outline `xml:"outline"`
	Text         string    `xml:"text,attr"`
	Type         string    `xml:"type,attr,omitempty"`
	IsComment    string    `xml:"isComment,attr,omitempty"`
	IsBreakpoint string    `xml:"isBreakpoint,attr,omitempty"`
	Created      string    `xml:"created,attr,omitempty"`
	Category     string    `xml:"category,attr,omitempty"`
	XMLURL       string    `xml:"xmlUrl,attr,omitempty"`
	HTMLURL      string    `xml:"htmlUrl,attr,omitempty"`
	URL          string    `xml:"url,attr,omitempty"`
	Language     string    `xml:"language,attr,omitempty"`
	Title        string    `xml:"title,attr,omitempty"`
	Version      string    `xml:"version,attr,omitempty"`
	Description  string    `xml:"description,attr,omitempty"`
}

Outline opml outline

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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