Last active
June 30, 2021 17:59
-
-
Save NanoAi/8d9e60c76ec034d42227ccb4bbf02bd1 to your computer and use it in GitHub Desktop.
This requires lcu_driver from https://github.com/sousa-andre/lcu-driver to work, if it doesn't work you're probably missing that requirement.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lcu_driver import Connector | |
import sys, time | |
# WARNING: THIS WILL START CLEANING WHEN YOU RUN IT! | |
# For friends you want to keep, just add any note to them. | |
# You can also put them in a category called "Friends". | |
def out(string): | |
print(string, flush=True) | |
conn = Connector() | |
# Fired when LCU API is ready to be used | |
@conn.ready | |
async def connect(conn): | |
out(f'Nuking Friends List!') | |
friendsList = await conn.request('get', '/lol-chat/v1/friends') | |
friendsList = await friendsList.json() | |
rates = 0 | |
for friend in friendsList: | |
if friend['groupName'] == "Friends": | |
continue | |
if friend['note'] != "": | |
continue | |
sid = friend['id'] | |
sys.stdout.buffer.write(f"REMOVING: {friend['name']}\n".encode('utf8')) | |
data = await conn.request('delete', f'/lol-chat/v1/friends/{sid}') | |
data = await data.json() | |
out(data) | |
time.sleep(0.5) | |
rates += 1 | |
if rates > 9: | |
rates = 0 | |
time.sleep(1) | |
# Fired when League Client is closed (or disconnected from websocket) | |
@conn.close | |
async def disconnect(_): | |
await conn.stop() | |
quit() | |
# starts the connector | |
conn.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script isn’t endorsed by Riot Games and doesn’t reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.