Documentation ¶
Index ¶
- Constants
- Variables
- func Replace(s string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string
- type Alias
- type Ban
- type Cmd
- type Commands
- type Echo
- type Kick
- type List
- type Ping
- type Replacer
- type Say
- type SayPrivate
- type Set
- type Settings
- type Time
- type Trigger
- type Unban
- type Uptime
- type Where
- type Who
- type Whoami
- type Whois
Constants ¶
View Source
const ( MsgNoUserFound = "No user found with that name" MsgMoreUserFound = "Found more than one user with that name" MsgNoChanges = "No changes made" MsgNoPermission = "No permission to perform action" MsgInternalError = "Internal error prevented correct execution" )
Messages
Variables ¶
View Source
var Placeholders = map[string]Replacer{ "%CMD%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return t.Cmd }, "%RAW%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return strings.Join(t.Raw, "") }, "%ARGS%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return strings.Join(t.Arg, " ") }, "%NARGS%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return fmt.Sprintf("%d", len(t.Arg)) }, "%UID%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return t.User.ID }, "%USTR%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return t.User.Name }, "%ULVL%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return t.User.Access.String() }, "%GWID%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return gw.ID() }, "%GWDIS%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return gw.Discriminator() }, "%GWDEL%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { return gateway.Delimiter }, "%RARG000%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { idx, err := strconv.Atoi(replacersInt.FindString(m)) if err != nil || idx <= 0 || len(t.Raw) <= idx { return m } return t.Raw[idx-1] }, "%..RARG000%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { idx, err := strconv.Atoi(replacersInt.FindString(m)) if err != nil || idx <= 0 || len(t.Raw) <= idx { return m } return strings.Join(t.Raw[:idx-1], "") }, "%RARG000..%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { idx, err := strconv.Atoi(replacersInt.FindString(m)) if err != nil || idx <= 0 || len(t.Raw) <= idx { return m } return strings.Join(t.Raw[idx-1:], "") }, "%ARG000%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { idx, err := strconv.Atoi(replacersInt.FindString(m)) if err != nil || idx <= 0 || len(t.Arg) <= idx { return m } return t.Arg[idx-1] }, "%..ARG000%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { idx, err := strconv.Atoi(replacersInt.FindString(m)) if err != nil || idx <= 0 || len(t.Arg) <= idx { return m } return strings.Join(t.Arg[:idx-1], " ") }, "%ARG000..%": func(m string, t *gateway.Trigger, gw gateway.Gateway, g *goop.Goop) string { idx, err := strconv.Atoi(replacersInt.FindString(m)) if err != nil || idx <= 0 || len(t.Arg) <= idx { return m } return strings.Join(t.Arg[idx-1:], " ") }, }
Placeholders map
Functions ¶
Types ¶
type Alias ¶
type Alias struct { Cmd Exe string Arg []string ArgExpected int WithPriviledge gateway.AccessLevel }
Alias abbreviates a command
type Ban ¶
type Ban struct { Cmd AccessProtect gateway.AccessLevel AccessOverride gateway.AccessLevel }
Ban user
type Cmd ¶
type Cmd struct { Disabled bool Priviledge gateway.AccessLevel }
Cmd is command base struct that implements Command.CanExecute
type Commands ¶
type Commands struct { Trigger Trigger Whoami Whoami Whois Whois Settings Settings List List Echo Echo Say Say SayPrivate SayPrivate Set Set Kick Kick Ban Ban Unban Unban Where Where Who Who Ping Ping Time Time Uptime Uptime }
Commands listing
type Kick ¶
type Kick struct { Cmd AccessProtect gateway.AccessLevel AccessOverride gateway.AccessLevel }
Kick user
type Unban ¶
type Unban struct { Cmd AccessProtect gateway.AccessLevel AccessOverride gateway.AccessLevel }
Unban user
Click to show internal directories.
Click to hide internal directories.