Documentation ¶
Index ¶
- Constants
- func GetTgBot(option TgBotOption) *tgbotapi.BotAPI
- func SendMessageDiscord(discordClient DiscordClient, message string) error
- func SendMessageSMTP(sender *Sender, message string)
- func SendMessageTG(bot *tgbotapi.BotAPI, id int64, message string) error
- type Author
- type DiscordClient
- type DiscordClientOptions
- type Embed
- type HttpRequestDoer
- type Notifier
- type PayloadWebHookDiscord
- type Sender
- func (sender Sender) SendMail(Dest []string, Subject, bodyMessage string)
- func (sender Sender) WriteEmail(dest []string, contentType, subject, bodyMessage string) string
- func (sender *Sender) WriteHTMLEmail(dest []string, subject, bodyMessage string) string
- func (sender *Sender) WritePlainEmail(dest []string, subject, bodyMessage string) string
- type TgBotOption
Constants ¶
View Source
const ( TELEGRAM = "telegram" DISCORD = "discord" SMTP = "smtp" )
View Source
const (
/**
Gmail SMTP Server
**/
SMTPServer = "smtp.gmail.com"
)
Variables ¶
This section is empty.
Functions ¶
func GetTgBot ¶
func GetTgBot(option TgBotOption) *tgbotapi.BotAPI
GetTgBot get an instance of tgBot
func SendMessageDiscord ¶
func SendMessageDiscord(discordClient DiscordClient, message string) error
SendMessageDiscord send msg to discord
func SendMessageSMTP ¶
SendMessageSMTP send msg to SMTP
Types ¶
type Author ¶
type Author struct { Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` IconURL string `json:"icon_url,omitempty"` }
Author ...
type DiscordClient ¶
type DiscordClient interface { // PostMessage ... PostMessage(ctx context.Context, message string) error }
func NewDiscordClient ¶
func NewDiscordClient(options DiscordClientOptions) (DiscordClient, error)
NewDiscordClient create an instance of discord client
type DiscordClientOptions ¶
type DiscordClientOptions struct { // ServerHook url to use ServerHook string HttpClient *http.Client }
DiscordClientOptions ...
type Embed ¶
type Embed struct { Author Author `json:"author,omitempty"` Title string `json:"title,omitempty"` URL string `json:"url,omitempty"` Description string `json:"description,omitempty"` Color int64 `json:"color,omitempty"` }
Embed object that define the structure of our msg
type HttpRequestDoer ¶
type PayloadWebHookDiscord ¶
type PayloadWebHookDiscord struct { Username string `json:"username,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` Content string `json:"content,omitempty"` Embeds []Embed `json:"embeds,omitempty"` }
PayloadWebHookDiscord general payload to make request to discord Hook
func (*PayloadWebHookDiscord) ToReader ¶
func (p *PayloadWebHookDiscord) ToReader() *strings.Reader
type Sender ¶
Sender object it`s used to send SMTP request
func (Sender) WriteEmail ¶
WriteEmail an email
func (*Sender) WriteHTMLEmail ¶
WriteHTMLEmail ...
type TgBotOption ¶
TgBotOption object options for telegram service
Click to show internal directories.
Click to hide internal directories.