Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e71040b838 | |||
| 296ad3ddfe | |||
| c4b571c91b | |||
| 2cf4799887 | |||
| 9e8e6d696d | |||
| 8b0cc231d0 | |||
| 799cc904a8 | |||
| 45f23d0463 | |||
| 8280162a04 | |||
| 3d480acc9f | |||
| 193aa655f0 | |||
| 80fc1d135e | |||
| 815a66eb8c | |||
| c3d49e3473 |
@@ -0,0 +1,40 @@
|
|||||||
|
# This workflow will build a golang project
|
||||||
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
|
||||||
|
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ["darwin","linux","windows"]
|
||||||
|
arch: ["amd64","arm64"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: 1.19
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
go get .
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o spotigram_${{ matrix.os }}_${{ matrix.arch }} -v main.go
|
||||||
|
|
||||||
|
- name: upload artifacts
|
||||||
|
uses: actions/upload-artifact@v3.1.2
|
||||||
|
with:
|
||||||
|
name: spotigram_${{ matrix.os }}_${{ matrix.arch }}
|
||||||
|
path: spotigram_${{ matrix.os }}_${{ matrix.arch }}
|
||||||
|
retention-days: 90
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
Spotigram
|
Spotigram
|
||||||
=========
|
=========
|
||||||
|
|
||||||
_Wenns' gut werden muss_
|
_Wenns' gut werden muss_
|
||||||
|
|
||||||
|
[](https://git.jonasmoeller.de/aledjones/spotigram)
|
||||||
|
|
||||||
## Was ist Spotigram?
|
## Was ist Spotigram?
|
||||||
|
|
||||||
|
|||||||
+3
-18
@@ -101,22 +101,8 @@ It is not planned to extend this in the future.`,
|
|||||||
err = viper.WriteConfig()
|
err = viper.WriteConfig()
|
||||||
cobra.CheckErr(err)
|
cobra.CheckErr(err)
|
||||||
}
|
}
|
||||||
|
results, err := client.Search(ctx, strings.TrimPrefix(update.Message.Text, "/spotigram "), spotify.SearchTypeTrack)
|
||||||
var results *spotify.SearchResult
|
cobra.CheckErr(err)
|
||||||
|
|
||||||
if strings.HasPrefix(update.Message.Text, "/spotigram ") {
|
|
||||||
results, err = client.Search(ctx, strings.TrimPrefix(update.Message.Text, "/spotigram "), spotify.SearchTypeTrack)
|
|
||||||
cobra.CheckErr(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !strings.HasPrefix(update.Message.Text, "/spotigram ") {
|
|
||||||
msg.Text = "⛔ Ooops, du musst einen Titel angeben!\n <code>/spotigram [Titel]</code>"
|
|
||||||
msg.ParseMode = "HTML"
|
|
||||||
_, err = bot.Send(msg)
|
|
||||||
cobra.CheckErr(err)
|
|
||||||
|
|
||||||
fmt.Printf("Command used incorrectly.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if results != nil {
|
if results != nil {
|
||||||
|
|
||||||
@@ -159,8 +145,7 @@ It is not planned to extend this in the future.`,
|
|||||||
track.Name,
|
track.Name,
|
||||||
track.Artists[0].Name)
|
track.Artists[0].Name)
|
||||||
|
|
||||||
}
|
} else {
|
||||||
if !contains(trackIDs, results.Tracks.Tracks[0].ID) {
|
|
||||||
track := results.Tracks.Tracks[0]
|
track := results.Tracks.Tracks[0]
|
||||||
|
|
||||||
addTrackResponse, err := client.AddTracksToPlaylist(ctx,
|
addTrackResponse, err := client.AddTracksToPlaylist(ctx,
|
||||||
|
|||||||
Reference in New Issue
Block a user