mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-15 19:33:17 +00:00
Added Mention methods to arguments
This commit is contained in:
parent
586c6ceaa4
commit
4dcb6178c8
|
@ -13,6 +13,8 @@ var (
|
|||
RoleRegex = regexp.MustCompile(`<@&(\d+)>`)
|
||||
)
|
||||
|
||||
//
|
||||
|
||||
type ChannelMention discord.Snowflake
|
||||
|
||||
func (m *ChannelMention) Parse(arg string) error {
|
||||
|
@ -28,6 +30,12 @@ func (m *ChannelMention) ID() discord.Snowflake {
|
|||
return discord.Snowflake(*m)
|
||||
}
|
||||
|
||||
func (m *ChannelMention) Mention() string {
|
||||
return "<#" + m.ID().String() + ">"
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
type UserMention discord.Snowflake
|
||||
|
||||
func (m *UserMention) Parse(arg string) error {
|
||||
|
@ -43,6 +51,12 @@ func (m *UserMention) ID() discord.Snowflake {
|
|||
return discord.Snowflake(*m)
|
||||
}
|
||||
|
||||
func (m *UserMention) Mention() string {
|
||||
return "<@" + m.ID().String() + ">"
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
type RoleMention discord.Snowflake
|
||||
|
||||
func (m *RoleMention) Parse(arg string) error {
|
||||
|
@ -58,6 +72,12 @@ func (m *RoleMention) ID() discord.Snowflake {
|
|||
return discord.Snowflake(*m)
|
||||
}
|
||||
|
||||
func (m *RoleMention) Mention() string {
|
||||
return "<&" + m.ID().String() + ">"
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
func grabFirst(reg *regexp.Regexp,
|
||||
item, input string, output *discord.Snowflake) error {
|
||||
|
||||
|
|
Loading…
Reference in a new issue