Documentation ¶
Index ¶
- func AddGroupCommand(cmd string, groupsToWorkIn []string, ...)
- func AddTextCommand(cmd string, functionToExecute func(whatsapp.TextMessage))
- func AddUserByJid(jid string)
- func ChangeUserSettings(jid string, settings interface{})
- func CreateNewSettingsOption(settings interface{})
- func DeactivateAutoSaving()
- func DisplayTextMessagesInConsole(display bool)
- func GetPhoneNumber() string
- func GetUserIndex(message whatsapp.TextMessage) int
- func GetUserNickname(jid string) string
- func GetUserSettings(jid string) interface{}
- func IsUserRegistered(jid string) bool
- func JidToGroupID(jid string) string
- func JidToGroupName(jid string) string
- func JidToName(jid string) string
- func MessageToGroupID(message whatsapp.TextMessage) string
- func MessageToJid(message whatsapp.TextMessage) string
- func MessageToName(message whatsapp.TextMessage) string
- func NameToJid(name string) string
- func PrintContacList()
- func SaveUsersToDisk() bool
- func SendImageMessage(caption string, img io.Reader, imgType string, remoteJid string)
- func SendStickerMessage(img *os.File, remoteJid string)
- func SetAutosaveInterval(interval time.Duration)
- func SetDefaultTextHandleFunction(functionToExecute func(whatsapp.TextMessage))
- func SetEncryptionKey(key []byte) bool
- func SetErrorTimeout(timeout time.Duration)
- func SetImageHandler(functionToExecute func(whatsapp.ImageMessage))
- func SetNicknameUseage(allowNicknames bool, output string)
- func SetQRFilePath(path string)
- func SetSessionFilePath(path string)
- func SetStickerHandler(functionToExecute func(whatsapp.StickerMessage))
- func SetUserNickname(jid string, nickname string)
- func SetUsersFilePath(path string)
- func StartBot(longConnectionName, shortConnectionName string) (whatsapp.Session, *whatsapp.Conn, error)
- func UseContactNames(use bool)
- func UseSaveData(savedata BotUserList)
- func WriteTextMessage(text string, remoteJid string)
- type BotUser
- type BotUserList
- type Command
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddGroupCommand ¶
func AddGroupCommand(cmd string, groupsToWorkIn []string, functionToExecute func(whatsapp.TextMessage))
AddGroupCommand adds a command that only works on certain groups
func AddTextCommand ¶
func AddTextCommand(cmd string, functionToExecute func(whatsapp.TextMessage))
AddTextCommand adds a command that only works in all groups
func ChangeUserSettings ¶
func ChangeUserSettings(jid string, settings interface{})
ChangeUserSettings a users settings
func CreateNewSettingsOption ¶
func CreateNewSettingsOption(settings interface{})
CreateNewSettingsOption adds the interface to the general BotUser struct
func DeactivateAutoSaving ¶
func DeactivateAutoSaving()
DeactivateAutoSaving disables automatic saving
func DisplayTextMessagesInConsole ¶
func DisplayTextMessagesInConsole(display bool)
DisplayTextMessagesInConsole toggles visibility in console
func GetUserIndex ¶
func GetUserIndex(message whatsapp.TextMessage) int
GetUserIndex returns a Users index within the Array
func GetUserNickname ¶
GetUserNickname returns a users nickname
func GetUserSettings ¶
func GetUserSettings(jid string) interface{}
GetUserSettings returns the settings of a specific user
func IsUserRegistered ¶
IsUserRegistered checks if the given jid exists in the array
func JidToGroupID ¶
JidToGroupID returns a group's id according to the jid
func JidToGroupName ¶
JidToGroupName returns a chat's name according to the jid (can also check groups)
func MessageToGroupID ¶
func MessageToGroupID(message whatsapp.TextMessage) string
MessageToGroupID returns the jid of a group. If the message is from outside a group it returns ""
func MessageToJid ¶
func MessageToJid(message whatsapp.TextMessage) string
MessageToJid find the right Jid in a message
func MessageToName ¶
func MessageToName(message whatsapp.TextMessage) string
MessageToName Converts and entire message to the corresponding name -> allows finding the name in groups
func NameToJid ¶
NameToJid returns a corresponding contact's jid. n general, you want to use MessageToJid() instead
func SendImageMessage ¶
SendImageMessage takes img type like "image/png" / If caption len is 0 there won't be a text
func SendStickerMessage ¶
SendStickerMessage only uses .webp files
func SetAutosaveInterval ¶
SetAutosaveInterval - interval of userdata saving
func SetDefaultTextHandleFunction ¶
func SetDefaultTextHandleFunction(functionToExecute func(whatsapp.TextMessage))
SetDefaultTextHandleFunction calls the given function when no commands have fit
func SetEncryptionKey ¶
SetEncryptionKey replaces the standard encryption Key
- Key has to be 16 Byte long
- Returns false if the key is bad
func SetErrorTimeout ¶
SetErrorTimeout sets the default time to reconnect after an error caused the program to disconnect
func SetImageHandler ¶
func SetImageHandler(functionToExecute func(whatsapp.ImageMessage))
SetImageHandler calls the given function when receiving an img
func SetNicknameUseage ¶
SetNicknameUseage changes the users abbility to use nicknames (false by default) - string will be the output. "" for no output
func SetQRFilePath ¶
func SetQRFilePath(path string)
SetQRFilePath changes the location the users will be saved in ([folder/]filename)
func SetSessionFilePath ¶
func SetSessionFilePath(path string)
SetSessionFilePath changes the name a file should be saved in ([folder/]filename)
func SetStickerHandler ¶
func SetStickerHandler(functionToExecute func(whatsapp.StickerMessage))
SetStickerHandler calls the given function when receiving an img
func SetUserNickname ¶
SetUserNickname sets a users nickname
func SetUsersFilePath ¶
func SetUsersFilePath(path string)
SetUsersFilePath changes the location the users will be saved in ([folder/]filename)
func StartBot ¶
func StartBot(longConnectionName, shortConnectionName string) (whatsapp.Session, *whatsapp.Conn, error)
StartBot initiates and starts the bot - Takes in the name of the group to be run in func StartBot(roomName string) (whatsapp.Session, *whatsapp.Conn) { TODO Only speficied groups
func UseContactNames ¶
func UseContactNames(use bool)
UseContactNames tells the bot to use names saved in contacts (or not)
func WriteTextMessage ¶
WriteTextMessage sends a given string as text
Types ¶
type BotUser ¶
type BotUser struct { Contact whatsapp.Contact Nickname string Settings interface{} }
BotUser contains the contact and his personal settings
type BotUserList ¶
type BotUserList struct {
BotUsers []*BotUser
}
BotUserList saves the BotUser-Array - easy to save&load
func GetSaveData ¶
func GetSaveData() (BotUserList, bool)
GetSaveData returns the stored savedata -> bool is false if there was no data