# -*- coding: utf-8 -*- """ leaguespam.py ~~~~~~~~~ Script for spamming people :copyright: (c) 2015 by Alex Edwards. """ import leaguelib import os.path import time summoner_name = "LEAGUE_USERNAME" phone_number = "USERS_CELL_NUMBER" league = leaguelib.League() text = leaguelib.send_text cache_file = 'lastmatchid-' + summoner_name + '.txt' if not os.path.isfile(cache_file): f = open(cache_file,'w') f.write('0') # invalid id to start f.close() with open(cache_file,'r') as f: last_match_id = f.readline() # first line of file summoner_id = str(league.get_summoner_by_name(summoner=summoner_name)[summoner_name]['id']) while True: N_last_match_data = league.get_match_history(summoner_id)['matches'][9] N_last_match_id = N_last_match_data['matchId'] if N_last_match_id != int(last_match_id): # New match detected!!! f = open(cache_file,'w') f.write(str(N_last_match_data['matchId'])) # Write new ID f.close() last_match_id = N_last_match_id # Last match ID last_match_data = N_last_match_data last_match_data_user = last_match_data["participants"][0]["stats"] win_loss = "win you didn't deserve" if (last_match_data_user["winner"]) else "fucking loss" level = last_match_data_user["champLevel"] level = "That game must have lasted 2 hours for you to get to level %s." % level if (int(level) > 16) else "You really suck ass to have only gotten to level %s." % level deaths = last_match_data_user["deaths"] ranked = "It must be so hard playing in BRONZE 5 LOL." if (last_match_data["queueType"] == "RANKED_SOLO_5x5") else "You didn't even play ranked LOL FAGGOT." phrase = "Good job on the %s! %s Fucking pleb. %s Next time try dieing less than %s times. LOL" \ % (win_loss, level, ranked, deaths) print(phrase) print(text(phone_number, phrase)) time.sleep(61)