Skip to content

Commit

Permalink
更新依赖版本
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoMengXinX committed Dec 11, 2021
1 parent 1ea9361 commit 7930d6b
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 31 deletions.
18 changes: 8 additions & 10 deletions bot/1_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func getLocalVersion() (meta metadata, err error) {
return meta, err
}
err = json.Unmarshal(content, &meta)
return meta, err
} else {
meta.VersionCode, _ = strconv.Atoi(config["BinVersionCode"])
meta.Version = config["BinVersionName"]
}
return meta, err
}
Expand All @@ -61,14 +63,10 @@ func checkUpdate(versionData []versions) (meta metadata, err error) {
var versionName string
var versionCode int
currentVersion, _ := getLocalVersion()
if currentVersion.VersionCode != 0 {
versionCode = currentVersion.VersionCode
versionName = currentVersion.Version
meta = currentVersion
} else {
versionCode, _ = strconv.Atoi(config["BinVersionCode"])
versionName = config["BinVersionName"]
}

versionCode = currentVersion.VersionCode
versionName = currentVersion.Version
meta = currentVersion

latest := func() versions {
for _, v := range versionData {
Expand Down Expand Up @@ -109,7 +107,7 @@ func checkUpdate(versionData []versions) (meta metadata, err error) {
}

func getVersions() (versionData []versions, err error) {
updateData, err := getFile(fmt.Sprintf("https://raw.githubusercontent.com/%s/versions.json", config["rawRepoPath"]))
updateData, err := getFile(fmt.Sprintf("https://raw.githubusercontent.com/%s/versions_v2.2.json", config["rawRepoPath"]))
if err != nil {
return versionData, err
}
Expand Down
9 changes: 4 additions & 5 deletions bot/2_processMusic.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,10 @@ func processMusic(musicID int, message tgbotapi.Message, bot *tgbotapi.BotAPI) (
Json: api.CreateSongURLJson(api.SongURLConfig{Ids: []int{musicID}}),
},
)
_, _, err = b.Do(data)
if err != nil {
if b.Do(data).Error != nil {
return err
}
result := b.Parse()
_, result := b.Parse()

var songDetail types.SongsDetailData
_ = json.Unmarshal([]byte(result[api.SongDetailAPI]), &songDetail)
Expand Down Expand Up @@ -297,7 +296,7 @@ func sendMusic(songInfo util.SongInfo, musicPath, picPath string, message tgbota
if songInfo.FileID != "" {
newAudio = tgbotapi.NewAudio(message.Chat.ID, tgbotapi.FileID(songInfo.FileID))
} else {
newAudio = tgbotapi.NewAudio(message.Chat.ID, musicPath)
newAudio = tgbotapi.NewAudio(message.Chat.ID, tgbotapi.FilePath(musicPath))
}
newAudio.Caption = fmt.Sprintf(musicInfo, songInfo.SongName, songInfo.SongArtists, songInfo.SongAlbum, songInfo.FileExt, float64(songInfo.BitRate)/1000, botName)
newAudio.Title = fmt.Sprintf("%s", songInfo.SongName)
Expand All @@ -308,7 +307,7 @@ func sendMusic(songInfo util.SongInfo, musicPath, picPath string, message tgbota
newAudio.Thumb = tgbotapi.FileID(songInfo.ThumbFileID)
}
if picPath != "" {
newAudio.Thumb = picPath
newAudio.Thumb = tgbotapi.FilePath(picPath)
}
audio, err = bot.Send(newAudio)
return audio, err
Expand Down
1 change: 1 addition & 0 deletions bot/5_bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func Start(conf map[string]string, ext func(*tgbotapi.BotAPI, tgbotapi.Update) e
}
return 2
}
fmt.Println(meta.VersionCode)
if meta.VersionCode < 20200 {
for _, i := range botAdmin {
msg := tgbotapi.NewMessage(int64(i), updateBinVersion)
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/XiaoMengXinX/Music163bot-Go/v2
go 1.17

require (
github.com/XiaoMengXinX/CloudMusicDownloader v1.1.2
github.com/XiaoMengXinX/Music163Api-Go v0.1.15
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.0.2-0.20210820200834-309d612d7095
github.com/XiaoMengXinX/CloudMusicDownloader v1.2.0
github.com/XiaoMengXinX/Music163Api-Go v0.1.17
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.0
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/sirupsen/logrus v1.8.1
github.com/traefik/yaegi v0.10.0
Expand All @@ -22,6 +22,6 @@ require (
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.2 // indirect
github.com/mattn/go-sqlite3 v1.14.9 // indirect
golang.org/x/sys v0.0.0-20211023085530-d6a326fbbf70 // indirect
golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c // indirect
golang.org/x/text v0.3.7 // indirect
)
21 changes: 13 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
github.com/XiaoMengXinX/CloudMusicDownloader v1.1.2 h1:ZOtdSwyjlOAd7vbYuImhFmpS8xNQ68skwZmHgb2xZzM=
github.com/XiaoMengXinX/CloudMusicDownloader v1.1.2/go.mod h1:tDkLgbnBg6TrIxb/kbeYGJgWmgJ9G79HP7UYrzoq8bY=
github.com/XiaoMengXinX/Music163Api-Go v0.1.15 h1:0DGtsC9Fei4zts/WncEUStDaHeViMBJB33PUqFMM4YI=
github.com/XiaoMengXinX/Music163Api-Go v0.1.15/go.mod h1:4lcWLPwXMsTiwcyM6JBEAHkU7NUvYJOMPtfiUj9X0Jw=
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
github.com/XiaoMengXinX/CloudMusicDownloader v1.2.0 h1:re0xAoxfAwG1x3bXL1X++qVCEnzppgJsLg2bE7lekPg=
github.com/XiaoMengXinX/CloudMusicDownloader v1.2.0/go.mod h1:tTGKbdf5kLJxE4NiRaVhMTC1c4Vk+yTwYqW+QI4sQN8=
github.com/XiaoMengXinX/Music163Api-Go v0.1.17 h1:iO4nZeYkyWHSvTH3PnQBNxGcOEZaK9EzK849HfH8y8A=
github.com/XiaoMengXinX/Music163Api-Go v0.1.17/go.mod h1:4lcWLPwXMsTiwcyM6JBEAHkU7NUvYJOMPtfiUj9X0Jw=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
github.com/bogem/id3v2 v1.2.0 h1:hKDF+F1gOgQ5r1QmBCEZUk4MveJbKxCeIDSBU7CQ4oI=
github.com/bogem/id3v2 v1.2.0/go.mod h1:t78PK5AQ56Q47kizpYiV6gtjj3jfxlz87oFpty8DYs8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -15,8 +17,8 @@ github.com/go-flac/flacvorbis v0.1.0 h1:xStJfPrZ/IoA2oBUEwgrlaSf+Opo6/YuQfkqVhkP
github.com/go-flac/flacvorbis v0.1.0/go.mod h1:70N9vVkQ4Jew0oBWkwqDMIE21h7pMUtQJpnMD0js6XY=
github.com/go-flac/go-flac v0.3.1 h1:BWA7HdO67S4ZLWSVHCxsDHuedFFu5RiV/wmuhvO6Hxo=
github.com/go-flac/go-flac v0.3.1/go.mod h1:jG9IumOfAXr+7J40x0AiQIbJzXf9Y7+Zs/2CNWe4LMk=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.0.2-0.20210820200834-309d612d7095 h1:oIT1xkRYsax2LkiKiq2Z6SvgAYEdEx4gqMmDaDNaUrg=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.0.2-0.20210820200834-309d612d7095/go.mod h1:5+h9c5l1Z/+Pi+5boa1Fmr4Q+FImsXYnifor92ljaVs=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.0 h1:BtndtqqCQfPsL2uMkYmduOip1+dPcSmh40l82mBUPKk=
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.0/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
Expand All @@ -25,6 +27,7 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI=
github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA=
github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
Expand All @@ -40,9 +43,11 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/traefik/yaegi v0.10.0 h1:c/0rhUcj5+KJhJX++eCrPeKXnJaOZ17X8gYCznU9Xxc=
github.com/traefik/yaegi v0.10.0/go.mod h1:RuCwD8/wsX7b6KoQHOaIFUfuH3gQIK4KWnFFmJMw5VA=
github.com/vbauerster/mpb/v5 v5.4.0/go.mod h1:fi4wVo7BVQ22QcvFObm+VwliQXlV1eBT8JDaKXR4JGI=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211023085530-d6a326fbbf70 h1:SeSEfdIxyvwGJliREIJhRPPXvW6sDlLT+UQ3B0hD0NA=
golang.org/x/sys v0.0.0-20211023085530-d6a326fbbf70/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20201218084310-7d0127a74742/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c h1:+8miTPjMCTXwih7BQmvWwd0PjdBZq2MKp/qQaahSzEM=
golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
Expand Down
20 changes: 20 additions & 0 deletions symbols/github_com-XiaoMengXinX-Music163Api-Go-api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7930d6b

Please sign in to comment.