Documentation
¶
Index ¶
- type Chat
- type ChatBot
- func (c *ChatBot) GetClient() utopiago.Client
- func (c *ChatBot) GetOwnContact() (structs.OwnContactData, error)
- func (c *ChatBot) GetOwnPubkey() (string, error)
- func (c *ChatBot) RequestDonate(channelID string) *DonateService
- func (c *ChatBot) SendChannelMessage(channel, msgText string) error
- func (c *ChatBot) SendChannelPrivateMessage(channel, userPubkeyHash, msgText string)
- func (c *ChatBot) SendCoins(currency CurrencyType, pubkey string, amount float64)
- func (c *ChatBot) SendCoinsFromCard(currency CurrencyType, pubkey string, amount float64, fromCard string)
- func (c *ChatBot) SendContactMessage(userPubkey string, msgText string)
- func (c *ChatBot) SendWelcomeMessage(userPubkey string)
- func (c *ChatBot) SetAccountNickname(nick string) error
- func (c *ChatBot) SetReadonly(channelID string, readOnly bool) error
- func (c *ChatBot) Wait()
- type ChatBotCallbacks
- type ChatBotData
- type CurrencyType
- type DonateService
- type EventBufferLimiters
- type EventBuffersCapacity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatBot ¶
type ChatBot struct {
// contains filtered or unexported fields
}
func NewChatBot ¶
func NewChatBot(data ChatBotData) (*ChatBot, error)
NewChatBot - create new chatbot and connect to Utopia. the bot will try to join the list of the specified chats and subscribe to messages
func (*ChatBot) GetOwnContact ¶ added in v1.6.0
func (c *ChatBot) GetOwnContact() (structs.OwnContactData, error)
GetOwnContact - get account data
func (*ChatBot) GetOwnPubkey ¶ added in v1.1.2
GetOwnPubkey - get account public key
func (*ChatBot) RequestDonate ¶ added in v1.10.0
func (c *ChatBot) RequestDonate(channelID string) *DonateService
RequestDonate - ask chat users to support the channel author
func (*ChatBot) SendChannelMessage ¶ added in v1.5.2
SendChannelMessage - send message to channel
func (*ChatBot) SendChannelPrivateMessage ¶ added in v1.1.0
SendChannelPrivateMessage - send message to contact in channel (in private chat). it works with queue (buffer)
func (*ChatBot) SendCoins ¶ added in v1.4.0
func (c *ChatBot) SendCoins(currency CurrencyType, pubkey string, amount float64)
SendCoins from main account
func (*ChatBot) SendCoinsFromCard ¶ added in v1.4.0
func (c *ChatBot) SendCoinsFromCard(currency CurrencyType, pubkey string, amount float64, fromCard string)
SendCoins from crypto card
func (*ChatBot) SendContactMessage ¶ added in v1.0.5
SendContactMessage - send message to contact. it works with queue (buffer)
func (*ChatBot) SendWelcomeMessage ¶ added in v1.0.5
func (*ChatBot) SetAccountNickname ¶ added in v1.6.0
SetAccountNickname - set account new nickname
func (*ChatBot) SetReadonly ¶ added in v1.0.1
SetReadonly - enable or disable channel readonly mode
type ChatBotCallbacks ¶
type ChatBotCallbacks struct { // required OnContactMessage func(structs.InstantMessage) OnChannelMessage func(structs.WsChannelMessage) OnPrivateChannelMessage func(structs.WsChannelMessage) // optional WelcomeMessage func(userPubkey string) string }
type ChatBotData ¶
type ChatBotData struct { // required Config utopiago.Config `json:"client"` Chats []Chat `json:"chats"` // channel ids Callbacks ChatBotCallbacks // optional SkipConnectionCheck bool `json:"skipConnCheck"` Notifications string `json:"notifications"` // by default: all UseErrorCallback bool `json:"useErrorCallback"` EnableWsSSL bool `json:"enableSSL"` // SSL for websocket connection BuffersCapacity EventBuffersCapacity `json:"buffersCapacity"` RateLimiters EventBufferLimiters `json:"rateLimiters"` DisableEvents bool `json:"disableEvents"` ErrorCallback func(err error) `json:"-"` }
type CurrencyType ¶ added in v1.4.0
type CurrencyType string
const ( CurrencyCrypton CurrencyType = "CRP" CurrencyUUSD CurrencyType = "UUSD" )
type DonateService ¶ added in v1.10.0
type DonateService struct {
// contains filtered or unexported fields
}
func (*DonateService) Do ¶ added in v1.10.0
func (srv *DonateService) Do() error
func (*DonateService) EnableUCode ¶ added in v1.10.0
func (srv *DonateService) EnableUCode(enabled bool, comment string) *DonateService
EnableUCode - add uCode with address to message
func (*DonateService) GetDonateMessage ¶ added in v1.11.0
func (srv *DonateService) GetDonateMessage() (string, string, error)
GetDonateMessage returns ownerPubkey, message, error
func (*DonateService) SetMessage ¶ added in v1.10.0
func (srv *DonateService) SetMessage(newMessage string) *DonateService
SetMessage - set a custom message that will appear before the payment address
type EventBufferLimiters ¶ added in v1.0.6
type EventBufferLimiters struct { InstantMessages int `json:"instantMessages"` ChannelPrivateMessages int `json:"channelPrivateMessages"` }
for limit max events per second