viewperms

package
v1.19.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &commands.YAGCommand{
	CmdCategory: commands.CategoryDebug,
	Name:        "ViewPerms",
	Description: "Shows you or the targets permissions in this channel",
	Arguments: []*dcmd.ArgDef{
		&dcmd.ArgDef{Name: "target", Type: dcmd.UserID, Default: int64(0)},
	},
	RunFunc: func(data *dcmd.Data) (interface{}, error) {
		target := data.Args[0].Int64()
		if target == 0 {
			target = data.Msg.Author.ID
		}

		perms, err := data.GS.MemberPermissions(true, data.CS.ID, target)
		if err != nil {
			return "Unable to calculate perms (unknown user maybe?)", err
		}

		humanized := common.HumanizePermissions(int64(perms))
		return fmt.Sprintf("`%d`\n%s", perms, strings.Join(humanized, ", ")), nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL