Documentation ¶
Index ¶
- Constants
- func GetTgBot(ctx context.Context, option TgBotOption) *tgbotapi.BotAPI
- func SendMessageDiscord(ctx context.Context, discordClient DiscordClient, message string) error
- func SendMessageSMTP(ctx context.Context, sender *Sender, message string)
- func SendMessageTG(ctx context.Context, bot *tgbotapi.BotAPI, id int64, message string) error
- func SendMessageWebHook(ctx context.Context, webhookClient WebHookClient, message string) error
- type Author
- type DiscordClient
- type DiscordClientOptions
- type Embed
- type HttpRequestDoer
- type Notifier
- type PayloadWebHook
- type PayloadWebHookDiscord
- type Sender
- func (sender Sender) SendMail(ctx context.Context, 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
- type WebHookClient
- type WebHookClientOptions
Constants ¶
View Source
const ( TELEGRAM = "telegram" DISCORD = "discord" WEBHOOK = "webhook" SMTP = "smtp" )
View Source
const (
/**
Gmail SMTP Server
**/
SMTPServer = "smtp.gmail.com"
)
Variables ¶
This section is empty.
Functions ¶
func GetTgBot ¶
func GetTgBot(ctx context.Context, option TgBotOption) *tgbotapi.BotAPI
GetTgBot get an instance of tgBot
func SendMessageDiscord ¶
func SendMessageDiscord(ctx context.Context, discordClient DiscordClient, message string) error
SendMessageDiscord send msg to discord
func SendMessageSMTP ¶
SendMessageSMTP send msg to SMTP
func SendMessageTG ¶
SendMessageTG send msg to telegram
func SendMessageWebHook ¶ added in v0.4.2
func SendMessageWebHook(ctx context.Context, webhookClient WebHookClient, message string) error
SendMessageWebHook send msg to webhook
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 PayloadWebHook ¶ added in v0.4.2
type PayloadWebHook struct { Username string `json:"username,omitempty"` Content string `json:"content,omitempty"` Message string `json:"message,omitempty"` }
func (*PayloadWebHook) ToReader ¶ added in v0.4.2
func (p *PayloadWebHook) ToReader() *strings.Reader
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
type WebHookClient ¶ added in v0.4.2
type WebHookClient interface { // PostMessage ... PostMessage(ctx context.Context, message string) error }
func NewWebHookClient ¶ added in v0.4.2
func NewWebHookClient(options WebHookClientOptions) (WebHookClient, error)
type WebHookClientOptions ¶ added in v0.4.2
Click to show internal directories.
Click to hide internal directories.