mirror of
				https://github.com/chev2/tf2-voice-ban-bots.git
				synced 2025-10-30 08:12:33 +00:00 
			
		
		
		
	Add my list
This commit is contained in:
		
							parent
							
								
									c29f605939
								
							
						
					
					
						commit
						0a5f4e9663
					
				
					 1 changed files with 27 additions and 7 deletions
				
			
		|  | @ -1,31 +1,52 @@ | ||||||
| import os #path/file opening |  | ||||||
| import json #json parse | import json #json parse | ||||||
| import requests #http requests | import os #path/file opening | ||||||
| import re #regex | import re #regex | ||||||
|  | import requests #http requests | ||||||
| 
 | 
 | ||||||
| tf2_playerlist_url = "https://raw.githubusercontent.com/PazerOP/tf2_bot_detector/master/staging/cfg/playerlist.official.json" #Pazer's list of bots | tf2_playerlist_url = "https://raw.githubusercontent.com/PazerOP/tf2_bot_detector/master/staging/cfg/playerlist.official.json" #Pazer's list of bots | ||||||
|  | tf2_playerlist_url_2 = "https://raw.githubusercontent.com/chev2/tf2-voice-ban-bots/master/voice_ban_users.json" #My list of bots | ||||||
| github_headers = { | github_headers = { | ||||||
|     'User-Agent': 'tf2-voice-ban-bots/1.0 (Python script - written by github.com/chev2)' |     'User-Agent': 'tf2-voice-ban-bots/1.0 (Python script - written by github.com/chev2)' | ||||||
| } | } | ||||||
| steamid3_regex = r'(\[U:1:\d+\])' | steamid3_regex = r'(\[U:1:\d+\])' | ||||||
| cwd = os.getcwd() | cwd = os.getcwd() | ||||||
|  | players = [] | ||||||
| 
 | 
 | ||||||
| print("Attempting connection to bots list...") | print("Attempting connection to bots list...") | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | #Pazer's bot list | ||||||
| r = requests.get(tf2_playerlist_url, headers=github_headers) | r = requests.get(tf2_playerlist_url, headers=github_headers) | ||||||
| 
 | 
 | ||||||
| if r.status_code != 200: | if r.status_code != 200: | ||||||
|     print("HTTP Error {0} has occured".format(r.status_code)) |     print(f"HTTP Error {r.status_code} to Pazer's bot list has occured.") | ||||||
| else: | else: | ||||||
|     print("Connection successful") |     print("Connection to Pazer's bot list successful.") | ||||||
| 
 | 
 | ||||||
| json_info = r.json() | json_info = r.json() | ||||||
| 
 | 
 | ||||||
| players = [] |  | ||||||
| for player in json_info["players"]: | for player in json_info["players"]: | ||||||
|     players.append(player["steamid"]) |     players.append(player["steamid"]) | ||||||
| 
 | 
 | ||||||
| print("{0} bots found in json".format(len(players))) | print("{0} bots found in Pazer's list.".format(len(players))) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #My bot list | ||||||
|  | r = requests.get(tf2_playerlist_url_2, headers=github_headers) | ||||||
|  | 
 | ||||||
|  | if r.status_code != 200: | ||||||
|  |     print(f"HTTP Error {r.status_code} to Chev's bot list has occured.") | ||||||
|  | else: | ||||||
|  |     print("Connection to Chev's bot list successful.") | ||||||
|  | 
 | ||||||
|  | json_info = r.json() | ||||||
|  | 
 | ||||||
|  | for player in json_info: | ||||||
|  |     players.append(player) | ||||||
|  | 
 | ||||||
|  | print("{0} bots found in Chev's list.".format(len(json_info))) | ||||||
|  | 
 | ||||||
|  | print("{0} bots found in total.".format(len(players))) | ||||||
| 
 | 
 | ||||||
| mergefilequery = None | mergefilequery = None | ||||||
| path = None | path = None | ||||||
|  | @ -70,4 +91,3 @@ while writetofile not in ("y", "n"): | ||||||
|         print("Wrote players to {0}\\voice_ban.dt".format(cwd)) |         print("Wrote players to {0}\\voice_ban.dt".format(cwd)) | ||||||
|     elif writetofile.lower() == "n": |     elif writetofile.lower() == "n": | ||||||
|         print("Exitting...") |         print("Exitting...") | ||||||
| 
 |  | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Chev
						Chev