arguments

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: ISC Imports: 9 Imported by: 11

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

func (*ChannelMention) Mention

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

func (e Emoji) APIString() string

func (*Emoji) Parse

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

func (Emoji) String

func (e Emoji) String() string

func (Emoji) URL

func (e Emoji) URL() string

func (*Emoji) Usage

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

type Joined string

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

func (*Joined) ParseContent

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

type MessageURL

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

MessageURL contains info from a MessageURL

func ParseMessageURL

func ParseMessageURL(url string) *MessageURL

ParseMessageURL parses the MessageURL into a smartlink

func (*MessageURL) Parse

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

func (*MessageURL) Usage

func (url *MessageURL) Usage() string

type RoleMention

type RoleMention discord.RoleID

func (*RoleMention) ID

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

func (*RoleMention) Mention

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

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

func (*UserMention) Mention

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