utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCtxNotSet    = errors.New("ulib.telebot: context not set")
	ErrNoSuperGroup = errors.New("ulib.telebot: Cannot be non-supergroup type")
)

Functions

This section is empty.

Types

type AdminInfo

type AdminInfo struct {
	User   User   `json:"user"`
	Status string `json:"status"`
	AdminPerm
}

type AdminPerm

type AdminPerm struct {
	CanBeEdited         bool `json:"can_be_edited"`
	CanManageChat       bool `json:"can_manage_chat"`
	CanChangeInfo       bool `json:"can_change_info"`
	CanDeleteMessages   bool `json:"can_delete_messages"`
	CanInviteUsers      bool `json:"can_invite_users"`
	CanRestrictMembers  bool `json:"can_restrict_members"`
	CanPinMessages      bool `json:"can_pin_messages"`
	CanManageTopics     bool `json:"can_manage_topics"`
	CanPromoteMembers   bool `json:"can_promote_members"`
	CanManageVideoChats bool `json:"can_manage_video_chats"`
	IsAnonymous         bool `json:"is_anonymous"`
	CanManageVoiceChats bool `json:"can_manage_voice_chats"`
}

type SendMode

type SendMode string
const (
	ModeDefault SendMode = SendMode(tele.ModeDefault)
	ModeHTML    SendMode = SendMode(tele.ModeHTML)
	ModeMD      SendMode = SendMode(tele.ModeMarkdown)
	ModeMD2     SendMode = SendMode(tele.ModeMarkdownV2)
	ModeFile    SendMode = SendMode("File")
)

type Use

type Use struct {
	Context         tele.Context
	ChatId          int64
	AutoDeleteTimer time.Duration
	AutoDelete      bool
	ShowAlert       bool
	DeleteCommand   bool
	Threads         bool
	ParseMode       string
	Btn             *tele.ReplyMarkup
	SendOptions     *tele.SendOptions
}

func New

func New() *Use

func (*Use) Alert

func (n *Use) Alert(text string) error

Pop-ups

func (*Use) Delete

func (n *Use) Delete(message int) error

Delete Message

func (*Use) GetAdminList

func (n *Use) GetAdminList() (map[int64]AdminInfo, error)

Get the list of group administrators

It is now recommended to use `telebot.Context.Bot().Adminsof()` method.

func (*Use) GetChatMember

func (n *Use) GetChatMember(uid int64) (int, error)

GetChatMember Status

0 error, 1 Not in Chat, 2 In Chat, 3 Banned

func (*Use) ImportOpts

func (n *Use) ImportOpts(v *tele.SendOptions) *Use

func (*Use) Leave

func (n *Use) Leave(v ...*tele.Chat) error

Leave makes bot leave a group, supergroup or channel.

func (*Use) Send

func (n *Use) Send(v any) (i *tele.Message, e error)

Send Message

func (*Use) SetAutoDelete

func (n *Use) SetAutoDelete(t time.Duration) *Use

func (*Use) SetBtn

func (n *Use) SetBtn(btn *tele.ReplyMarkup) *Use

func (*Use) SetChatID

func (n *Use) SetChatID(c int64) *Use

func (*Use) SetContext

func (n *Use) SetContext(c tele.Context) *Use

func (*Use) SetDeleteCommand

func (n *Use) SetDeleteCommand() *Use

func (*Use) SetDisableWebPreview

func (n *Use) SetDisableWebPreview() *Use

For text messages, disables previews for links in this message.

func (*Use) SetModes

func (n *Use) SetModes(s ...SendMode) *Use

func (*Use) SetShowAlert

func (n *Use) SetShowAlert() *Use

func (*Use) SetTopicID

func (n *Use) SetTopicID(v int64) *Use

type User

type User struct {
	ID        int64  `json:"id"`
	IsBot     bool   `json:"is_bot"`
	IsPremium bool   `json:"is_premium"`
	Language  string `json:"language_code"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Username  string `json:"username"`
}

Jump to

Keyboard shortcuts

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