-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* banned words
- Loading branch information
Showing
7 changed files
with
140 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package main | ||
|
||
import "github.com/zmb3/spotify/v2" | ||
|
||
func containsBannedWord(word string) bool { | ||
var bannedWords []BannedWord | ||
|
||
result := db.Where("word LIKE ?", "%"+word+"%").Find(&bannedWords) | ||
|
||
if result.Error != nil { | ||
return false | ||
} | ||
if len(bannedWords) == 0 { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
func addBannedWord(word string) (BannedWord, error) { | ||
bannedWord := BannedWord{Word: word} | ||
result := db.Create(&bannedWord) | ||
if result.Error != nil { | ||
return bannedWord, result.Error | ||
} | ||
return bannedWord, nil | ||
} | ||
|
||
func isBannedTrack(trackUri spotify.URI) bool { | ||
var bannedTracks []BannedTrack | ||
|
||
result := db.Where("track_uri LIKE ?", "%"+trackUri+"%").Find(&bannedTracks) | ||
|
||
if result.Error != nil { | ||
return false | ||
} | ||
if len(bannedTracks) == 0 { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
func addBannedTrack(trackUri spotify.URI) (BannedTrack, error) { | ||
bannedTrack := BannedTrack{TrackURI: trackUri} | ||
result := db.Create(&bannedTrack) | ||
if result.Error != nil { | ||
return bannedTrack, result.Error | ||
} | ||
return bannedTrack, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
spotify:track:6rsoBvxrlxdmqJyGPPciyq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fart | ||
cum | ||
ram ranch | ||
orgasm | ||
beats by talent |