Skip to content
This repository was archived by the owner on Jan 3, 2026. It is now read-only.

Commit 04b4f41

Browse files
committed
* Update WebRequest function
* Update TODO LIST * Update logs message for Auto Chat * Get OP.GG token only once
1 parent badd3db commit 04b4f41

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

LeagueClient/Requests.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,11 @@ public static string WebRequest(string url)
7575
{
7676
using HttpClient client = new();
7777
HttpResponseMessage response = client.GetAsync(url).Result;
78-
if (response.IsSuccessStatusCode)
79-
{
80-
HttpContent responseContent = response.Content;
81-
string responseString = responseContent.ReadAsStringAsync().Result;
82-
return responseString;
83-
}
78+
if (!response.IsSuccessStatusCode) return null;
8479

85-
throw new Exception($"The request failed with status code {response.StatusCode}");
80+
HttpContent responseContent = response.Content;
81+
string responseString = responseContent.ReadAsStringAsync().Result;
82+
return responseString;
8683
}
8784

8885
public static void AnalyzeSession()

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ My Discord: `devRael#0123` *`(ID: 728231238707445801)`*
5858
## `🧾 Todo List`
5959

6060
- [ ] Create PicknBan system with all roles (top, jungle, mid, adc, support)
61-
- [ ] Update OP.GG Token system (check if OP.GG token exist and catch error in op.gg request to get new token if needed)
6261

6362
## `📝 License`
6463

Tools/AutoChat.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ public static void HandleChampSelectAutoChat()
1313
{
1414
GetChatId();
1515

16-
Log(LogType.AutoChat, $"Sending {Settings.ChatMessages.Count} messages in chat...");
16+
Log(LogType.AutoChat, $"Sending {Settings.ChatMessages.Count} message(s) in chat...");
17+
18+
int count = 0;
1719
string timestamp = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ");
1820
foreach (string message in Settings.ChatMessages)
1921
{
@@ -28,11 +30,12 @@ public static void HandleChampSelectAutoChat()
2830
string[] response = Requests.ClientRequest("POST", "lol-chat/v1/conversations/" + Global.LastChatRoom + "/messages", true, body);
2931
attempts++;
3032
httpRes = response[0];
33+
if (httpRes == "200") count++;
3134
Thread.Sleep(attempts * 100);
3235
}
3336
}
3437

35-
Log(LogType.AutoChat, "Messages sended successfully !");
38+
Log(LogType.AutoChat, $"{count} message(s) sended successfully !");
3639
}
3740

3841
public static string FormatMessage(string message)

Tools/LobbyRevealer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private static void GetPlayers(string req)
7272
Global.PlayerList.Add(p);
7373
}
7474

75-
GetTokenOpGg();
75+
if (_opggtoken == null) GetTokenOpGg();
7676

7777
string stats = Requests.WebRequest($"https://www.op.gg/_next/data/{_opggtoken}/multisearch/{Global.Region}.json?summoners={names}&region={Global.Region}");
7878
if (stats == null) return;

0 commit comments

Comments
 (0)