entities

package
v0.0.0-...-e550578 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	ID int64 `json:"ID"`
}

Chat contains an ID of a chat with a bot and its messages

type Message

type Message struct {
	ID            int64         `json:"message_id" db:"ID"`
	FromID        int64         `db:"FromID,omitempty"`
	ChatID        int64         `db:"ChatID,omitempty"`
	Chat          Chat          `json:"chat" db:"-"`
	From          User          `json:"from" db:"-"`
	Date          int64         `json:"date" db:"-"`
	Text          string        `json:"text" db:"Text,omitempty"`
	PrevID        sql.NullInt64 `db:"PrevID,omitempty"`
	NextID        sql.NullInt64 `db:"NextID,omitempty"`
	ActionTrigger string        `db:"ActionTrigger"`
}

Message contains info about received message, autor and chat ID

func (*Message) ArgsAfterCommand

func (m *Message) ArgsAfterCommand(command string) (result string)

ArgsAfterCommand - returns text after command. If a message contains one

func (*Message) ChatLastMessage

func (m *Message) ChatLastMessage() db.Result

ChatLastMessage Grabs a last message from current Chat

func (*Message) SetActionTrigger

func (m *Message) SetActionTrigger(action string) (err error)

SetActionTrigger - Marks a message as an action trigger to know, what to do with the next one

type Subscription

type Subscription struct {
	ID          int64  `db:"ID"`
	UserID      int64  `db:"UserID"`
	ChannelID   string `db:"ChannelID"`
	ChannelName string `db:"ChannelName"`
	ChannelInfo string `db:"ChannelInfo"`
}

Subscription contains an info of subscribed channels

func (*Subscription) Subscribe

func (sub *Subscription) Subscribe() (err error)

Subscribe current channel for new vids

func (*Subscription) Unsubscribe

func (sub *Subscription) Unsubscribe() (err error)

Unsubscribe current channel for new vids

type User

type User struct {
	ID        int64  `json:"id" db:"ID"`
	IsBot     bool   `json:"is_bot" db:"-"`
	FirstName string `json:"first_name" db:"FirstName"`
}

User contains basic info about message sender

type Webhook

type Webhook struct {
	ID            int64   `json:"update_id"`
	Message       Message `json:"message,omitempty"`
	EditedMessage Message `json:"edited_message,omitempty"`
	CallbackQuery struct {
		ID      string  `json:"id,omitempty"`
		Message Message `json:"message,omitempty"`
		Data    string  `json:"data,omitempty"`
	} `json:"callback_query,omitempty"`
}

Webhook contains all the info

func (*Webhook) StoreWebhookInfo

func (wh *Webhook) StoreWebhookInfo() (Message, error)

StoreWebhookInfo saves information from webhooks into DB

type YTChannel

type YTChannel struct {
	ChannelID   string `json:"callback_data" db:"YTChannelID"`
	ChannelName string `json:"text" db:"ChannelName"`
	ChannelInfo string `db:"ChannelInfo" json:"-"`
}

YTChannel contains basic info of YT channel itself

Jump to

Keyboard shortcuts

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