Milen/util/magic.go

20 lines
422 B
Go

2020-05-11 05:30:07 +07:00
package util
import (
"strings"
)
func ParseRole(roleString string) string {
if !strings.HasPrefix(roleString, "<@&") || !strings.HasSuffix(roleString, ">") {
return ""
}
return roleString[3 : len(roleString)-1]
}
func ParseEmoji(emojiString string) string {
if !strings.HasPrefix(emojiString, "<:") || !strings.HasSuffix(emojiString, ">") {
return emojiString
}
return emojiString[2 : len(emojiString)-1]
}