Documentation ¶
Overview ¶
rolecommands is a plugin which allows users to assign roles to themselves
Index ¶
- Constants
- func AssignRole(ctx context.Context, ms *dstate.MemberState, cmd *models.RoleCommand) (gaveRole bool, err error)
- func CanAssignRoleCmdTo(r *models.RoleCommand, memberRoles []int64) error
- func CanRole(ctx context.Context, ms *dstate.MemberState, cmd *models.RoleCommand) (can bool, err error)
- func CheckIgnoredRoles(ignore []int64, has []int64) error
- func CheckRequiredRoles(requireOneOf []int64, has []int64) bool
- func CheckToggleRole(ctx context.Context, ms *dstate.MemberState, cmd *models.RoleCommand) (gaveRole bool, err error)
- func CmdFuncListCommands(parsed *dcmd.Data) (interface{}, error)
- func CmdFuncRole(parsed *dcmd.Data) (interface{}, error)
- func ContinueRoleMenuSetup(ctx context.Context, rm *models.RoleMenu, emoji *discordgo.Emoji, userID int64) (resp string, err error)
- func FindRolemenuFull(ctx context.Context, mID int64, guildID int64) (*models.RoleMenu, error)
- func FindToggleRole(ctx context.Context, ms *dstate.MemberState, name string) (gaveRole bool, err error)
- func GetAllRoleCommandsSorted(ctx context.Context, guildID int64) (groups []*models.RoleGroup, ...)
- func GroupCanRole(ctx context.Context, ms *dstate.MemberState, targetRole *models.RoleCommand) (can bool, err error)
- func GroupMaybeScheduleRoleRemoval(ctx context.Context, ms *dstate.MemberState, targetRole *models.RoleCommand) error
- func GroupToggleRole(ctx context.Context, ms *dstate.MemberState, targetRole *models.RoleCommand) (gaveRole bool, err error)
- func HandleGetGroup(groupID int64, w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error)
- func HandleGetIndex(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error)
- func HandleMoveCommand(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func HandleNewCommand(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func HandleNewGroup(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func HandleRemoveCommand(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func HandleRemoveGroup(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
- func HandleUpdateCommand(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error)
- func HandleUpdateGroup(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error)
- func HumanizeAssignError(guild *dstate.GuildState, err error) (string, error)
- func IsRoleCommandError(err error) bool
- func MemberChooseOption(ctx context.Context, rm *models.RoleMenu, gs *dstate.GuildState, ...) (resp string, err error)
- func MenuReactedNotDone(ctx context.Context, rm *models.RoleMenu, emoji *discordgo.Emoji, userID int64) (resp string, err error)
- func NewGroupError(msg string, group *models.RoleGroup) error
- func NewLmitError(msg string, limit int) error
- func NewRoleError(msg string, role int64) error
- func NewSimpleError(format string, args ...interface{}) error
- func NextRoleMenuSetupStep(ctx context.Context, rm *models.RoleMenu, first bool) (resp string, err error)
- func OptionsLessFunc(slice []*models.RoleMenuOption) func(int, int) bool
- func RegisterPlugin()
- func RemoveRole(ctx context.Context, ms *dstate.MemberState, cmd *models.RoleCommand) (removedRole bool, err error)
- func RoleCommandsLessFunc(slice []*models.RoleCommand) func(int, int) bool
- func StrFlags(rm *models.RoleMenu) string
- func StringCommands(cmds []*models.RoleCommand) string
- func ToggleRole(ms *dstate.MemberState, role int64) (gaveRole bool, err error)
- func UpdateMenu(parsed *dcmd.Data, menu *models.RoleMenu) (interface{}, error)
- func UpdateRoleMenuMessage(ctx context.Context, rm *models.RoleMenu) error
- type FormCommand
- type FormGroup
- type GroupError
- type LmitError
- type Plugin
- type RoleError
- type ScheduledMemberRoleRemoveData
- type SimpleError
Constants ¶
View Source
const ( GroupModeNone = iota GroupModeSingle GroupModeMultiple )
View Source
const ( RoleMenuStateSettingUp = 0 RoleMenuStateDone = 1 RoleMenuStateEditingOptionSelecting = 2 RoleMenuStateEditingOptionReplacing = 3 )
View Source
const DBSchema = `` /* 2986-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func AssignRole ¶
func AssignRole(ctx context.Context, ms *dstate.MemberState, cmd *models.RoleCommand) (gaveRole bool, err error)
func CanAssignRoleCmdTo ¶
func CanAssignRoleCmdTo(r *models.RoleCommand, memberRoles []int64) error
func CanRole ¶ added in v1.7.0
func CanRole(ctx context.Context, ms *dstate.MemberState, cmd *models.RoleCommand) (can bool, err error)
func CheckIgnoredRoles ¶
func CheckRequiredRoles ¶
func CheckToggleRole ¶ added in v1.7.0
func CheckToggleRole(ctx context.Context, ms *dstate.MemberState, cmd *models.RoleCommand) (gaveRole bool, err error)
AssignRole attempts to assign the given role command, returns an error if the role does not exists or is unable to receie said role
func CmdFuncListCommands ¶
func CmdFuncRole ¶
func ContinueRoleMenuSetup ¶
func FindRolemenuFull ¶ added in v1.8.0
func FindToggleRole ¶ added in v1.7.0
func GroupCanRole ¶ added in v1.7.0
func GroupCanRole(ctx context.Context, ms *dstate.MemberState, targetRole *models.RoleCommand) (can bool, err error)
func GroupMaybeScheduleRoleRemoval ¶ added in v1.13.1
func GroupMaybeScheduleRoleRemoval(ctx context.Context, ms *dstate.MemberState, targetRole *models.RoleCommand) error
func GroupToggleRole ¶ added in v1.7.0
func GroupToggleRole(ctx context.Context, ms *dstate.MemberState, targetRole *models.RoleCommand) (gaveRole bool, err error)
AssignRoleToMember attempts to assign the given role command, part of this group to the member
func HandleGetGroup ¶ added in v1.4.1
func HandleGetGroup(groupID int64, w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error)
func HandleGetIndex ¶ added in v1.4.1
func HandleGetIndex(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error)
func HandleMoveCommand ¶
func HandleMoveCommand(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func HandleNewCommand ¶
func HandleNewCommand(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func HandleNewGroup ¶
func HandleNewGroup(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func HandleRemoveCommand ¶
func HandleRemoveCommand(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func HandleRemoveGroup ¶
func HandleRemoveGroup(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func HandleUpdateCommand ¶
func HandleUpdateCommand(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error)
func HandleUpdateGroup ¶
func HandleUpdateGroup(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error)
func HumanizeAssignError ¶
func HumanizeAssignError(guild *dstate.GuildState, err error) (string, error)
func IsRoleCommandError ¶
func MemberChooseOption ¶
func MenuReactedNotDone ¶ added in v1.8.0
func NewLmitError ¶
func NewRoleError ¶
func NewSimpleError ¶
func NextRoleMenuSetupStep ¶
func OptionsLessFunc ¶ added in v1.8.0
func OptionsLessFunc(slice []*models.RoleMenuOption) func(int, int) bool
func RegisterPlugin ¶
func RegisterPlugin()
func RemoveRole ¶ added in v1.7.0
func RemoveRole(ctx context.Context, ms *dstate.MemberState, cmd *models.RoleCommand) (removedRole bool, err error)
func RoleCommandsLessFunc ¶
func RoleCommandsLessFunc(slice []*models.RoleCommand) func(int, int) bool
func StringCommands ¶
func StringCommands(cmds []*models.RoleCommand) string
StringCommands pretty formats a bunch of commands into a string
func ToggleRole ¶
func ToggleRole(ms *dstate.MemberState, role int64) (gaveRole bool, err error)
ToggleRole toggles the role of a guildmember, adding it if the member does not have the role and removing it if they do
Types ¶
type FormCommand ¶
type GroupError ¶
func (*GroupError) Error ¶
func (r *GroupError) Error() string
type Plugin ¶
type Plugin struct{}
func (*Plugin) AddCommands ¶ added in v1.4.1
func (p *Plugin) AddCommands()
func (*Plugin) LoadServerHomeWidget ¶ added in v1.17.0
func (p *Plugin) LoadServerHomeWidget(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func (*Plugin) PluginInfo ¶ added in v1.17.0
func (p *Plugin) PluginInfo() *common.PluginInfo
type ScheduledMemberRoleRemoveData ¶ added in v1.13.1
type SimpleError ¶
type SimpleError string
Just a simple type but distinguishable from errors.Error
func (SimpleError) Error ¶
func (s SimpleError) Error() string
Click to show internal directories.
Click to hide internal directories.