Handle special characters in event names (#1)
Co-authored-by: Layla <layla@layla.gg> Reviewed-on: https://gitea.sumulayla.synology.me/layla/birdbot/pulls/1
This commit was merged in pull request #1.
This commit is contained in:
@@ -22,6 +22,10 @@ func GenerateEventChannelName(eventName string, location string, dateTime time.T
|
||||
city := GetCityFromLocation(location)
|
||||
year := dateTime.Year()
|
||||
|
||||
// Remove special characters
|
||||
eventName = regexp.MustCompile(`[^a-zA-Z0-9 ]+`).ReplaceAllString(eventName, "")
|
||||
eventName = strings.Trim(eventName, " ")
|
||||
|
||||
channel := fmt.Sprint(month, "-", day, city, "-", eventName, "-", year)
|
||||
channel = strings.ReplaceAll(channel, " ", "-")
|
||||
channel = strings.ToLower(channel)
|
||||
|
||||
Reference in New Issue
Block a user