@@ -46,7 +46,7 @@ public TeamCommand(IConfiguration configuration, ILoggerFactory loggerFactory, I
4646 if ( ! string . IsNullOrEmpty ( TwitchTokenConfig . Tokens ? . access_token ) )
4747 {
4848 _HttpClient = httpClientFactory . CreateClient ( "TeamLookup" ) ;
49- _HttpClient . BaseAddress = new Uri ( $ "https://api.twitch.tv/kraken /teams/ ") ;
49+ _HttpClient . BaseAddress = new Uri ( $ "https://api.twitch.tv/helix /teams") ;
5050 _HttpClient . DefaultRequestHeaders . Add ( "Client-ID" , configuration [ "StreamServices:Twitch:ClientId" ] ) ;
5151 _HttpClient . DefaultRequestHeaders . Add ( "Accept" , "application/vnd.twitchtv.v5+json" ) ;
5252
@@ -65,9 +65,11 @@ public TeamCommand(IConfiguration configuration, ILoggerFactory loggerFactory, I
6565 private void SendNotificationsToWidget ( )
6666 {
6767
68- while ( true ) {
68+ while ( true )
69+ {
6970
70- if ( _TeammateNotifications . TryPeek ( out var _ ) ) {
71+ if ( _TeammateNotifications . TryPeek ( out var _ ) )
72+ {
7173
7274 _Context . Clients . All . SendAsync ( "Teammate" , _TeammateNotifications . Dequeue ( ) ) ;
7375 Task . Delay ( 5000 ) . GetAwaiter ( ) . GetResult ( ) ; // TODO: This notification needs to go into a queue
@@ -111,53 +113,41 @@ public async Task Execute(IChatService chatService, string userName, string full
111113 private async Task GetTeammates ( )
112114 {
113115
114- var response = await _HttpClient . GetStringAsync ( _TeamName ) ;
116+ var response = await _HttpClient . GetStringAsync ( $ "?name= { _TeamName } " ) ;
115117 var team = JsonConvert . DeserializeObject < TeamResponse > ( response ) ;
116118
117- _Teammates = team . users . Select ( u => u . name ) . ToHashSet ( ) ;
119+ _Teammates = team . data . First ( ) . users . Select ( u => u . user_name ) . ToHashSet ( ) ;
118120
119121 }
120122
121123
122- internal class TeamResponse
124+ public class TeamResponse
123125 {
124- public int _id { get ; set ; }
125- public object background { get ; set ; }
126- public string banner { get ; set ; }
127- public DateTime created_at { get ; set ; }
128- public string display_name { get ; set ; }
129- public string info { get ; set ; }
130- public string logo { get ; set ; }
131- public string name { get ; set ; }
132- public DateTime updated_at { get ; set ; }
133- public User [ ] users { get ; set ; }
126+ public TeamSummary [ ] data { get ; set ; }
134127 }
135128
136-
137- internal class User
129+ public class TeamSummary
138130 {
139- public int _id { get ; set ; }
140- public string broadcaster_language { get ; set ; }
131+ public User [ ] users { get ; set ; }
132+ public object background_image_url { get ; set ; }
133+ public object banner { get ; set ; }
141134 public DateTime created_at { get ; set ; }
142- public string display_name { get ; set ; }
143- public int followers { get ; set ; }
144- public string game { get ; set ; }
145- public string language { get ; set ; }
146- public string logo { get ; set ; }
147- public bool mature { get ; set ; }
148- public string name { get ; set ; }
149- public bool partner { get ; set ; }
150- public string profile_banner { get ; set ; }
151- public object profile_banner_background_color { get ; set ; }
152- public string status { get ; set ; }
153135 public DateTime updated_at { get ; set ; }
154- public string url { get ; set ; }
155- public object video_banner { get ; set ; }
156- public int views { get ; set ; }
136+ public string info { get ; set ; }
137+ public string thumbnail_url { get ; set ; }
138+ public string team_name { get ; set ; }
139+ public string team_display_name { get ; set ; }
140+ public string id { get ; set ; }
141+ }
142+
143+ public class User
144+ {
145+ public string user_id { get ; set ; }
146+ public string user_name { get ; set ; }
147+ public string user_login { get ; set ; }
157148 }
158149
159150
160151 }
161152
162-
163153}
0 commit comments