Documentation
¶
Index ¶
- Variables
- func ParseCommandArguments(argsList []string, argDefinitions map[string]Argument) (map[string]any, error)
- type App
- func (app *App) AddNewCategory(category string)
- func (app *App) AddNewCommand(command Command)
- func (app *App) AddNewMiddleware(middleware context.MiddlewareFunc)
- func (app *App) Client() *whatsmeow.Client
- func (app *App) ClientJID() waTypes.JID
- func (app *App) FindMessageByID(jid waTypes.JID, id string) *events.Message
- func (app *App) GetAllChats() []*events.Message
- func (app *App) GetChatInJID(jid waTypes.JID) []*events.Message
- func (app *App) GetStatusMessages() []*events.Message
- func (app *App) HandleEvents(event any)
- func (app *App) InitializeClient() error
- func (app *App) SendMessage(to waTypes.JID, message *waProto.Message, extra ...whatsmeow.SendRequestExtra) (whatsmeow.SendResponse, error)
- func (app *App) Shutdown()
- func (app *App) UpsertMessages(jid waTypes.JID, message []*events.Message)
- type Argument
- type ArgumentOptions
- type ArgumentType
- type Command
- func (c *Command) AddArgument(name, description string, argType ArgumentType, required bool, ...)
- func (c *Command) AddSubCommands(cmd *Command)
- func (c *Command) SetAdditionalValues(value map[string]any)
- func (c *Command) SetAliases(values []string)
- func (c *Command) SetCategory(value string)
- func (c *Command) SetDescription(value string)
- func (c *Command) SetGroupOnly(value bool)
- func (c *Command) SetHideFromHelp(value bool)
- func (c *Command) SetOnlyAdminGroup(value bool)
- func (c *Command) SetOnlyIfBotAdmin(value bool)
- func (c *Command) SetPrivateOnly(value bool)
- func (c *Command) SetRunFunc(fn context.RunFunc)
- func (c *Command) Use(fn context.MiddlewareFunc)
- func (c *Command) UseCache(value bool)
- func (c *Command) Validate()
- type Muxer
- func (muxer *Muxer) AddCommand(cmd *Command)
- func (muxer *Muxer) AddCommandParser(context func(str string) (prefix string, cmd string, ok bool))
- func (muxer *Muxer) AddGlobalMiddleware(middleware context.MiddlewareFunc)
- func (muxer *Muxer) AddMiddleware(middleware context.MiddlewareFunc)
- func (muxer *Muxer) CacheAllGroup()
- func (muxer *Muxer) Clean()
- func (muxer *Muxer) FindGroupByJid(groupJid waTypes.JID) (group *waTypes.GroupInfo, err error)
- func (muxer *Muxer) GenerateSuggestionModel()
- func (muxer *Muxer) GetActiveCommand() []*Command
- func (muxer *Muxer) GetActiveGlobalMiddleware() []context.MiddlewareFunc
- func (muxer *Muxer) GetActiveMiddleware() []context.MiddlewareFunc
- func (muxer *Muxer) GetAllGroups() (group []*waTypes.GroupInfo, err error)
- func (muxer *Muxer) IsClientGroupAdmin(chat waTypes.JID) (bool, error)
- func (muxer *Muxer) IsGroupAdmin(chat waTypes.JID, jid any) (bool, error)
- func (muxer *Muxer) RunCommand(c *whatsmeow.Client, evt *events.Message)
- func (muxer *Muxer) SendEmojiMessage(event *events.Message, emoji string)
- func (muxer *Muxer) SuggestCommand(event *events.Message, prefix, command string)
- func (muxer *Muxer) UnCacheOneGroup(info *events.GroupInfo, joined *events.JoinedGroup)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Commands types.Embed[*Command] GlobalMiddlewares types.Embed[context.MiddlewareFunc] Middlewares types.Embed[context.MiddlewareFunc] Categories types.Embed[string] )
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) AddNewCategory ¶
func (*App) AddNewCommand ¶
func (*App) AddNewMiddleware ¶
func (app *App) AddNewMiddleware(middleware context.MiddlewareFunc)
func (*App) FindMessageByID ¶
func (*App) GetAllChats ¶
func (*App) GetStatusMessages ¶
func (*App) HandleEvents ¶
func (*App) InitializeClient ¶
func (*App) SendMessage ¶
func (app *App) SendMessage(to waTypes.JID, message *waProto.Message, extra ...whatsmeow.SendRequestExtra) (whatsmeow.SendResponse, error)
type ArgumentOptions ¶
type ArgumentType ¶
type ArgumentType int
const ( ArgumentInt ArgumentType = iota ArgumentFloat ArgumentString ArgumentBool )
type Command ¶
type Command struct {
Name string
Aliases []string
Description string
Category string
Cache bool
HideFromHelp bool
GroupOnly bool
PrivateOnly bool
OnlyAdminGroup bool
OnlyIfBotAdmin bool
AdditionalValues map[string]any
SubCommands map[string]*Command
Arguments map[string]Argument
RunFunc context.RunFunc
Middleware context.MiddlewareFunc
}
func NewCommand ¶
func (*Command) AddArgument ¶
func (c *Command) AddArgument(name, description string, argType ArgumentType, required bool, options ...ArgumentOptions)
func (*Command) AddSubCommands ¶
func (*Command) SetAdditionalValues ¶
func (*Command) SetAliases ¶
func (*Command) SetCategory ¶
func (*Command) SetDescription ¶
func (*Command) SetGroupOnly ¶
func (*Command) SetHideFromHelp ¶
func (*Command) SetOnlyAdminGroup ¶
func (*Command) SetOnlyIfBotAdmin ¶
func (*Command) SetPrivateOnly ¶
func (*Command) SetRunFunc ¶
func (*Command) Use ¶
func (c *Command) Use(fn context.MiddlewareFunc)
type Muxer ¶
type Muxer struct {
Options *options.Options `json:"options,omitempty"`
Log waLog.Logger `json:"log,omitempty"`
MessageTimeout time.Duration `json:"message_timeout,omitempty"`
Categories *xsync.MapOf[string, string] `json:"categories,omitempty"`
GlobalMiddlewares *xsync.MapOf[string, context.MiddlewareFunc] `json:"global_middlewares,omitempty"`
Middlewares *xsync.MapOf[string, context.MiddlewareFunc] `json:"middlewares,omitempty"`
Commands *xsync.MapOf[string, *Command] `json:"commands,omitempty"`
CommandResponseCache *xsync.MapOf[string, *waProto.Message] `json:"command_response_cache,omitempty"`
QuestionState *xsync.MapOf[string, *context.QuestionState] `json:"question_state,omitempty"`
PollingState *xsync.MapOf[string, *context.PollingState] `json:"polling_state,omitempty"`
GroupCache *xsync.MapOf[string, []*waTypes.GroupInfo] `json:"group_cache,omitempty"`
Locals *xsync.MapOf[string, string] `json:"locals,omitempty"`
QuestionChan chan *context.QuestionState `json:"question_chan,omitempty"`
PollingChan chan *context.PollingState `json:"polling_chan,omitempty"`
SuggestionModel *fuzzy.Model `json:"suggestion_model,omitempty"`
CommandParser func(str string) (prefix string, cmd string, ok bool) `json:"command_parser,omitempty"`
types.AppMethods
}
func (*Muxer) AddCommand ¶
func (*Muxer) AddCommandParser ¶
func (*Muxer) AddGlobalMiddleware ¶
func (muxer *Muxer) AddGlobalMiddleware(middleware context.MiddlewareFunc)
func (*Muxer) AddMiddleware ¶
func (muxer *Muxer) AddMiddleware(middleware context.MiddlewareFunc)
func (*Muxer) CacheAllGroup ¶
func (muxer *Muxer) CacheAllGroup()
func (*Muxer) FindGroupByJid ¶
func (*Muxer) GenerateSuggestionModel ¶
func (muxer *Muxer) GenerateSuggestionModel()
func (*Muxer) GetActiveCommand ¶
func (*Muxer) GetActiveGlobalMiddleware ¶
func (muxer *Muxer) GetActiveGlobalMiddleware() []context.MiddlewareFunc
func (*Muxer) GetActiveMiddleware ¶
func (muxer *Muxer) GetActiveMiddleware() []context.MiddlewareFunc
func (*Muxer) GetAllGroups ¶
func (*Muxer) IsClientGroupAdmin ¶
func (*Muxer) IsGroupAdmin ¶
func (*Muxer) SendEmojiMessage ¶
func (*Muxer) SuggestCommand ¶
func (*Muxer) UnCacheOneGroup ¶
func (muxer *Muxer) UnCacheOneGroup(info *events.GroupInfo, joined *events.JoinedGroup)
Click to show internal directories.
Click to hide internal directories.