chatbot

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPI

func GetAPI(
	url string,
	queries map[string]string,
	header LoginData,
	target interface{}) error

func PostAPI

func PostAPI(
	url string,
	jsonStr []byte,
	header LoginData,
	target interface{}) error

Types

type Attachment added in v0.5.0

type Attachment struct {
	Title     string `json:"title"`
	TitleLink string `json:"title_link"`
	ImageUrl  string `json:"image_url"`
}

type Channel added in v0.5.0

type Channel struct {
	Id         string `json:"_id"`
	Name       string `json:"name"`
	Msgs       int    `json:"msgs"`
	UsersCount int    `json:"usersCount"`
}

See: https://docs.rocket.chat/api/rest-api/methods/channels/info

type ChannelsInfoResult added in v0.5.0

type ChannelsInfoResult struct {
	Channel Channel `json:"channel"`
	Success bool    `json:"success"`
}

type ChannelsMsgResult

type ChannelsMsgResult struct {
	Success  bool      `json:"success"`
	Messages []Message `json:"messages"`
	Total    int       `json:"total"`
}

See: https://rocket.chat/docs/developer-guides/rest-api/channels/messages/

type ChatBot

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

func New

func New() ChatBot

func (ChatBot) DeleteMsg added in v0.5.0

func (bot ChatBot) DeleteMsg(
	roomId string,
	msgId string) error

func (*ChatBot) Login

func (bot *ChatBot) Login() error

func (ChatBot) PostMsg

func (bot ChatBot) PostMsg(
	botTarget string,
	message string,
	imageUrl string) error

func (*ChatBot) ReplyMeme

func (bot *ChatBot) ReplyMeme() error

type DeleteMsgResult added in v0.5.0

type DeleteMsgResult struct {
	Success bool `json:"success"`
	Ts      int  `json:"ts"`
}

See: https://docs.rocket.chat/api/rest-api/methods/chat/delete

type LoginData

type LoginData struct {
	AuthToken string `json:"authToken" default:""`
	UserId    string `json:"userId" default:""`
}

type LoginResult

type LoginResult struct {
	Status string    `json:"status"`
	Data   LoginData `json:"data"`
}

See: https://rocket.chat/docs/developer-guides/rest-api/authentication/login/

type Message

type Message struct {
	Id          string                 `json:"_id"`
	Msg         string                 `json:"msg"`
	User        User                   `json:"u"`
	Alias       string                 `json:"alias"`
	Reactions   map[string]interface{} `json:"reactions"`
	Attachments []Attachment           `json:"attachments"`
}

type PostMsgResult

type PostMsgResult struct {
	Success bool   `json:"success"`
	Channel string `json:"channel"`
}

See: https://rocket.chat/docs/developer-guides/rest-api/chat/postmessage/

type SearchItem

type SearchItem struct {
	Title string `json:"title"`
	Link  string `json:"link"`
}

See: https://developers.google.com/custom-search/v1/reference/rest/v1/Search

type SearchResult

type SearchResult struct {
	Items []SearchItem `json:"items"`
}

type User

type User struct {
	Id       string `json:"_id"`
	Username string `json:"username"`
	Name     string `json:"name"`
}

Jump to

Keyboard shortcuts

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