arguments

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: ISC Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmojiRegex = regexp.MustCompile(`<(a?):(.+?):(\d+)>`)

	ErrInvalidEmoji = errors.New("Invalid emoji")
)
View Source
var (
	ChannelRegex = regexp.MustCompile(`<#(\d+)>`)
	UserRegex    = regexp.MustCompile(`<@!?(\d+)>`)
	RoleRegex    = regexp.MustCompile(`<@&(\d+)>`)
)
View Source
var FlagName = "command"
View Source
var Regex = regexp.MustCompile(
	`https://(ptb\.|canary\.)?discord(?:app)?\.com/channels/(\d+)/(\d+)/(\d+)`,
)

(empty) so it matches standard links | OR canary. matches canary MessageURL 3 `(\d+)` for guild ID, channel ID and message ID

Functions

This section is empty.

Types

type ChannelMention

type ChannelMention discord.Snowflake

func (*ChannelMention) ID added in v0.0.9

func (*ChannelMention) Mention added in v0.0.11

func (m *ChannelMention) Mention() string

func (*ChannelMention) Parse

func (m *ChannelMention) Parse(arg string) error

func (*ChannelMention) Usage

func (m *ChannelMention) Usage() string

type Emoji

type Emoji struct {
	ID   discord.Snowflake
	Name string

	Custom   bool
	Animated bool
}

func (Emoji) APIString added in v0.0.11

func (e Emoji) APIString() string

func (*Emoji) Parse

func (e *Emoji) Parse(arg string) error

func (Emoji) String added in v0.0.11

func (e Emoji) String() string

func (Emoji) URL added in v0.0.11

func (e Emoji) URL() string

func (*Emoji) Usage added in v0.3.0

func (e *Emoji) Usage() string

type Flag

type Flag []string

func (Flag) Args

func (f Flag) Args() []string

func (*Flag) ParseContent

func (f *Flag) ParseContent(arguments []string) error

func (Flag) Usage

func (f Flag) Usage() string

func (Flag) With

func (f Flag) With(fs *flag.FlagSet) error

type FlagSet

type FlagSet struct {
	*flag.FlagSet
}

func NewFlagSet

func NewFlagSet() *FlagSet

func (*FlagSet) Usage

func (fs *FlagSet) Usage() string

type Joined added in v0.6.0

type Joined string

Joined implements ManualParseable, in case you want all arguments but joined in a uniform way with spaces.

func (*Joined) ParseContent added in v0.6.0

func (j *Joined) ParseContent(args []string) error

type MessageURL added in v0.3.0

type MessageURL struct {
	GuildID   discord.Snowflake
	ChannelID discord.Snowflake
	MessageID discord.Snowflake
}

MessageURL contains info from a MessageURL

func ParseMessageURL added in v0.3.0

func ParseMessageURL(url string) *MessageURL

ParseMessageURL parses the MessageURL into a smartlink

func (*MessageURL) Parse added in v0.3.0

func (url *MessageURL) Parse(arg string) error

func (*MessageURL) Usage added in v0.3.0

func (url *MessageURL) Usage() string

type RoleMention

type RoleMention discord.Snowflake

func (*RoleMention) ID added in v0.0.9

func (m *RoleMention) ID() discord.Snowflake

func (*RoleMention) Mention added in v0.0.11

func (m *RoleMention) Mention() string

func (*RoleMention) Parse

func (m *RoleMention) Parse(arg string) error

func (*RoleMention) Usage

func (m *RoleMention) Usage() string

type UserMention

type UserMention discord.Snowflake

func (*UserMention) ID added in v0.0.9

func (m *UserMention) ID() discord.Snowflake

func (*UserMention) Mention added in v0.0.11

func (m *UserMention) Mention() string

func (*UserMention) Parse

func (m *UserMention) Parse(arg string) error

func (*UserMention) Usage

func (m *UserMention) Usage() string

Jump to

Keyboard shortcuts

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