arguments

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 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.ChannelID

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.EmojiID
	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.GuildID
	ChannelID discord.ChannelID
	MessageID discord.MessageID
}

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.RoleID

func (*RoleMention) ID added in v0.0.9

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

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.UserID

func (*UserMention) ID added in v0.0.9

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

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