Skip to content

Commit

Permalink
o
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhorner committed Jul 11, 2020
1 parent 4d40d1e commit 068b4db
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.go
Expand Up @@ -67,7 +67,7 @@ func main() {
for _, sound := range sounds {
res := tgbotapi.NewInlineQueryResultAudio(
sound.ID,
sound.Link(),
sound.Link(useSubdomain),
sound.Who,
)

Expand Down
17 changes: 15 additions & 2 deletions sounds.go
Expand Up @@ -19,9 +19,22 @@ type Sound struct {
Folder string `json:"folder"`
}

func (s *Sound) Link() string {
var cdnLinkMap = map[string]string{
"www": "sound",
"dlc": "sound_dlc1",
"dlc2": "sound_dlc2",
"p2music": "music_portal2",
"p1": "sound_portal1",
"p1music": "music_portal1",
"tf2": "sound_tf2",
"tf2music": "tf2_songs",
}

func (s *Sound) Link(subdomain string) string {
folder := cdnLinkMap[subdomain]
return fmt.Sprintf(
"https://cdn.frustra.org/sounds/sound/%s/%s.mp3?id=%s",
"https://cdn.frustra.org/sounds/%s/%s/%s.mp3?id=%s",
folder,
s.Folder,
strings.ReplaceAll(s.ValveID, ".", "/"),
s.ID,
Expand Down

0 comments on commit 068b4db

Please sign in to comment.