Documentation ¶
Index ¶
- type AccountNotFoundErr
- type BotCli
- func (self *BotCli) AddCommand(cmd *cobra.Command, callback Callback)
- func (self *BotCli) AdminChat(bot *deltachat.Bot, accId deltachat.AccountId) (deltachat.ChatId, error)
- func (self *BotCli) GetAccount(rpc *deltachat.Rpc, addr string) (deltachat.AccountId, error)
- func (self *BotCli) GetAddress(rpc *deltachat.Rpc, accId deltachat.AccountId) (string, error)
- func (self *BotCli) GetConfig(bot *deltachat.Bot, accId deltachat.AccountId, key string) (option.Option[string], error)
- func (self *BotCli) GetLogger(accId deltachat.AccountId) *zap.SugaredLogger
- func (self *BotCli) GetOrCreateAccount(rpc *deltachat.Rpc, addr string) (deltachat.AccountId, error)
- func (self *BotCli) IsAdmin(bot *deltachat.Bot, accId deltachat.AccountId, contactId deltachat.ContactId) (bool, error)
- func (self *BotCli) OnBotInit(callback Callback)
- func (self *BotCli) OnBotStart(callback Callback)
- func (self *BotCli) ResetAdminChat(bot *deltachat.Bot, accId deltachat.AccountId) (deltachat.ChatId, error)
- func (self *BotCli) SetConfig(bot *deltachat.Bot, accId deltachat.AccountId, key string, ...) error
- func (self *BotCli) Start() error
- type BotNotConfiguredErr
- type Callback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountNotFoundErr ¶ added in v0.5.0
type AccountNotFoundErr struct{ Addr string }
The account was not found.
func (*AccountNotFoundErr) Error ¶ added in v0.5.0
func (self *AccountNotFoundErr) Error() string
type BotCli ¶
type BotCli struct { AppName string // AppDir can be set by the --folder flag in command line AppDir string // SelectedAddr can be set by the --account flag in command line, if empty it means "all accounts" SelectedAddr string RootCmd *cobra.Command Logger *zap.SugaredLogger // contains filtered or unexported fields }
A CLI program, with subcommands that help configuring and running a Delta Chat bot.
func (*BotCli) AddCommand ¶
Add a subcommand to the CLI. The given callback will be executed when the command is used.
func (*BotCli) AdminChat ¶ added in v0.4.0
func (self *BotCli) AdminChat(bot *deltachat.Bot, accId deltachat.AccountId) (deltachat.ChatId, error)
Get the group of bot administrators.
func (*BotCli) GetAccount ¶ added in v0.5.0
Get account for address, if no account exists with the given address, an error is returned
func (*BotCli) GetAddress ¶ added in v0.5.0
Get the address of the given account
func (*BotCli) GetConfig ¶ added in v0.4.0
func (self *BotCli) GetConfig(bot *deltachat.Bot, accId deltachat.AccountId, key string) (option.Option[string], error)
Get a custom program setting from the given bot. The setting is specific to your application.
The setting is retrieved using Bot.GetUiConfig() and the key is prefixed with BotCli.AppName.
func (*BotCli) GetLogger ¶ added in v0.5.0
func (self *BotCli) GetLogger(accId deltachat.AccountId) *zap.SugaredLogger
Get a logger for the given account.
func (*BotCli) GetOrCreateAccount ¶ added in v0.5.0
func (self *BotCli) GetOrCreateAccount(rpc *deltachat.Rpc, addr string) (deltachat.AccountId, error)
Get account for address, if no account exists create a new one
func (*BotCli) IsAdmin ¶ added in v0.4.0
func (self *BotCli) IsAdmin(bot *deltachat.Bot, accId deltachat.AccountId, contactId deltachat.ContactId) (bool, error)
Returns true if contact is in the bot administrators group, false otherwise.
func (*BotCli) OnBotStart ¶
Register function to be called if the bot is about to start serving requests.
func (*BotCli) ResetAdminChat ¶ added in v0.4.0
func (self *BotCli) ResetAdminChat(bot *deltachat.Bot, accId deltachat.AccountId) (deltachat.ChatId, error)
Reset the group of bot administrators, all the members of the old group are no longer admins.
func (*BotCli) SetConfig ¶ added in v0.4.0
func (self *BotCli) SetConfig(bot *deltachat.Bot, accId deltachat.AccountId, key string, value option.Option[string]) error
Store a custom program setting in the given bot. The setting is specific to your application.
The setting is stored using Bot.SetUiConfig() and the key is prefixed with BotCli.AppName.
type BotNotConfiguredErr ¶ added in v0.4.0
type BotNotConfiguredErr struct{}
The bot is not configured yet.
func (*BotNotConfiguredErr) Error ¶ added in v0.4.0
func (self *BotNotConfiguredErr) Error() string