Skip to content

Commit

Permalink
rename CommandMention to SlashCommandMention
Browse files Browse the repository at this point in the history
  • Loading branch information
sebm253 committed Aug 22, 2022
1 parent e91ec49 commit 1cbb850
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion discord/application_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (c SlashCommand) CreatedAt() time.Time {
}

func (c SlashCommand) Mention() string {
return CommandMention(c.id, c.name)
return SlashCommandMention(c.id, c.name)
}

func (SlashCommand) applicationCommand() {}
Expand Down
22 changes: 11 additions & 11 deletions discord/mentionable.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ type MentionType struct {
}

var (
MentionTypeUser = MentionType{regexp.MustCompile(`<@!?(\d+)>`)}
MentionTypeRole = MentionType{regexp.MustCompile(`<@&(\d+)>`)}
MentionTypeChannel = MentionType{regexp.MustCompile(`<#(\d+)>`)}
MentionTypeEmoji = MentionType{regexp.MustCompile(`<a?:(\w+):(\d+)>`)}
MentionTypeTimestamp = MentionType{regexp.MustCompile(`<t:(?P<time>-?\d{1,17})(?::(?P<format>[tTdDfFR]))?>`)}
MentionTypeCommand = MentionType{regexp.MustCompile(`</(\w+) ?((\w+)|(\w+ \w+)):(\d+)>`)}
MentionTypeHere = MentionType{regexp.MustCompile(`@here`)}
MentionTypeEveryone = MentionType{regexp.MustCompile(`@everyone`)}
MentionTypeUser = MentionType{regexp.MustCompile(`<@!?(\d+)>`)}
MentionTypeRole = MentionType{regexp.MustCompile(`<@&(\d+)>`)}
MentionTypeChannel = MentionType{regexp.MustCompile(`<#(\d+)>`)}
MentionTypeEmoji = MentionType{regexp.MustCompile(`<a?:(\w+):(\d+)>`)}
MentionTypeTimestamp = MentionType{regexp.MustCompile(`<t:(?P<time>-?\d{1,17})(?::(?P<format>[tTdDfFR]))?>`)}
MentionTypeSlashCommand = MentionType{regexp.MustCompile(`</(\w+) ?((\w+)|(\w+ \w+)):(\d+)>`)}
MentionTypeHere = MentionType{regexp.MustCompile(`@here`)}
MentionTypeEveryone = MentionType{regexp.MustCompile(`@everyone`)}
)

type Mentionable interface {
Expand Down Expand Up @@ -59,10 +59,10 @@ func FormattedTimestampMention(timestamp int64, style TimestampStyle) string {
return fmt.Sprintf("<t:%d:%s>", timestamp, style)
}

// CommandMention creates a command mention.
// SlashCommandMention creates a slash command mention.
// You can also pass a subcommand (and/or a subcommand group respectively) to the path.
//
// mention := CommandMention(id, "command group subcommand")
func CommandMention(id snowflake.ID, path string) string {
// mention := SlashCommandMention(id, "command group subcommand")
func SlashCommandMention(id snowflake.ID, path string) string {
return fmt.Sprintf("</%s:%d>", path, id)
}

0 comments on commit 1cbb850

Please sign in to comment.