Skip to content

Commit

Permalink
### Summary of Most Important Changes
Browse files Browse the repository at this point in the history
The code changes primarily focus on improving the robustness and user feedback of the `TwitchHandler.cs` file, specifically in handling track fetching and adding tracks to a playlist. Additionally, the version number in `AssemblyInfo.cs` has been incremented.

### List of Changes

1. **Version Number Update**:
   - The version numbers in `AssemblyInfo.cs` have been updated from `1.6.4.5` to `1.6.4.6`.
   - **Reference**: `AssemblyInfo.cs`

2. **Null Check for Track Object**:
   - A null check for the `track` object has been added after fetching the track using `SpotifyApiHandler.GetTrack(trackId)`. If the track is null, a chat message indicating no track was found is sent, and the function returns early.
   - **Reference**: `TwitchHandler.cs`

3. **Success Response Message**:
   - A line has been added to send a chat message with the success response after adding the track to the playlist and before uploading it to the queue.
   - **Reference**: `TwitchHandler.cs`

4. **Handling Spotify Availability in Russia**:
   - A fix has been added to handle the case where Spotify is not available in Russia. If the track has an error with status 403, a specific message "Track has been added to the queue." is returned.
   - **Reference**: `TwitchHandler.cs`
  • Loading branch information
Inzaniity committed Aug 1, 2024
1 parent c17660d commit d1d18b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Songify Slim/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.4.5")]
[assembly: AssemblyFileVersion("1.6.4.5")]
[assembly: AssemblyVersion("1.6.4.6")]
[assembly: AssemblyFileVersion("1.6.4.6")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: Guid("442379e3-32d8-42d1-ab09-cba229672453")]
7 changes: 7 additions & 0 deletions Songify Slim/Util/Songify/TwitchHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ private static async void AddSong(string trackId, OnMessageReceivedArgs e)

FullTrack track = await SpotifyApiHandler.GetTrack(trackId);


if (track == null)
{
SendChatMessage(Settings.Settings.TwChannel, CreateNoTrackFoundResponse(e));
Expand Down Expand Up @@ -667,6 +668,7 @@ private static async void AddSong(string trackId, OnMessageReceivedArgs e)
await AddToPlaylist(track.Id);

response = CreateSuccessResponse(track, e.ChatMessage.DisplayName);

SendChatMessage(e.ChatMessage.Channel, response);
await UploadToQueue(track, e.ChatMessage.DisplayName);
GlobalObjects.QueueUpdateQueueWindow();
Expand Down Expand Up @@ -1755,6 +1757,11 @@ private static string CreateSuccessResponse(FullTrack track, string displayName)
string response = Settings.Settings.BotRespSuccess;
string artists = "";
string singleArtist = "";

//Fix for russia where Spotify is not available
if (track.HasError() && track.Error.Status == 403)
return "Track has been added to the queue.";

try
{
artists = string.Join(", ", track.Artists.Select(o => o.Name).ToList());
Expand Down

0 comments on commit d1d18b0

Please sign in to comment.