Documentation ¶
Index ¶
- Variables
- func Fetch(ctx ken.SubCommandContext, m data.Models, adminOnly bool) (inv *data.Inventory, err error)
- func FetchHandler(ctx ken.SubCommandContext, m data.Models, adminOnly bool) (handler *inventory.InventoryHandler, err error)
- func InventoryAuthorized(ctx ken.SubCommandContext, inv *data.Inventory, wl []*data.Whitelist) bool
- func InventoryEmbedBuilder(inv *data.Inventory, host bool) *discordgo.MessageEmbed
- func ParseAbilityString(raw string) (name string, charges int, err error)
- func UpdateInventoryMessage(sesh *discordgo.Session, i *data.Inventory) (err error)
- func UpsertAA(inv *data.Inventory, aa *data.AnyAbility, charges ...int)
- func UpsertAbility(inv *data.Inventory, aa *data.Ability, charges ...int)
- type Inventory
- func (*Inventory) Components() []*discordgo.MessageComponent
- func (*Inventory) Description() string
- func (i *Inventory) Initialize(m data.Models, s *scheduler.BetrayalScheduler)
- func (*Inventory) Name() string
- func (i *Inventory) Options() []*discordgo.ApplicationCommandOption
- func (i *Inventory) Run(ctx ken.Context) (err error)
- func (i *Inventory) Type() discordgo.ApplicationCommandType
- func (*Inventory) Version() string
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotAuthorized = errors.New("you are not an admin role")
)
errors that can occur
Functions ¶
func Fetch ¶
func Fetch(ctx ken.SubCommandContext, m data.Models, adminOnly bool) (inv *data.Inventory, err error)
Helper to attempt to fetch given user's inventory from user command option
func FetchHandler ¶
func FetchHandler(ctx ken.SubCommandContext, m data.Models, adminOnly bool) (handler *inventory.InventoryHandler, err error)
Middleware for inventory commands to fetch inventory and ensure user is authorized
func InventoryAuthorized ¶
func InventoryAuthorized( ctx ken.SubCommandContext, inv *data.Inventory, wl []*data.Whitelist, ) bool
Helper to determine if user is authorized to use inventory command based on: 1. In their confessional (and owner of inventory) 2. In a whitelisted channel (and an admin)
func InventoryEmbedBuilder ¶
func InventoryEmbedBuilder( inv *data.Inventory, host bool, ) *discordgo.MessageEmbed
Helper to build inventory embed message based off if user is host or not
func ParseAbilityString ¶
Ability strings follow the format of 'Name [#]'
func UpdateInventoryMessage ¶
Types ¶
type Inventory ¶
type Inventory struct {
// contains filtered or unexported fields
}
func (*Inventory) Components ¶
func (*Inventory) Components() []*discordgo.MessageComponent
Components implements main.BetrayalCommand.
func (*Inventory) Description ¶
Description implements ken.SlashCommand.
func (*Inventory) Initialize ¶
func (i *Inventory) Initialize(m data.Models, s *scheduler.BetrayalScheduler)
func (*Inventory) Options ¶
func (i *Inventory) Options() []*discordgo.ApplicationCommandOption
func (*Inventory) Type ¶
func (i *Inventory) Type() discordgo.ApplicationCommandType
Click to show internal directories.
Click to hide internal directories.