3 Commits

Author SHA1 Message Date
Nico Wunder 6d71fc2605 handling empty command, fixing #3 2023-02-28 17:23:02 +01:00
Nico Wunder c49a32a741 check to compare exact IDs of Tracks while add #1 2023-02-24 00:25:06 +01:00
Nico Wunder e62ddaa19c adding vscode-ish .gitignore file 2023-02-24 00:21:40 +01:00
3 changed files with 19 additions and 43 deletions
-37
View File
@@ -1,37 +0,0 @@
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: 7
-2
View File
@@ -3,8 +3,6 @@ Spotigram
_Wenns' gut werden muss_
[![build status](https://git.jonasmoeller.de/aledjones/spotigram/actions/workflows/go.yaml/badge.svg)](https://git.jonasmoeller.de/aledjones/spotigram)
## Was ist Spotigram?
Spotigram ist eine `/command` basierte Bridge zwischen Telegram und Spotify.
+17 -2
View File
@@ -101,8 +101,22 @@ It is not planned to extend this in the future.`,
err = viper.WriteConfig()
cobra.CheckErr(err)
}
results, err := client.Search(ctx, strings.TrimPrefix(update.Message.Text, "/spotigram "), spotify.SearchTypeTrack)
var results *spotify.SearchResult
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 {
@@ -145,7 +159,8 @@ It is not planned to extend this in the future.`,
track.Name,
track.Artists[0].Name)
} else {
}
if !contains(trackIDs, results.Tracks.Tracks[0].ID) {
track := results.Tracks.Tracks[0]
addTrackResponse, err := client.AddTracksToPlaylist(ctx,