minor code refactoring

This commit is contained in:
s-prechtl 2022-03-17 14:34:30 +01:00
parent 36a8795245
commit 169599dff5
6 changed files with 56 additions and 54 deletions

View file

@ -1,3 +1,4 @@
import json
from abc import abstractmethod, ABCMeta
from datetime import datetime
@ -6,6 +7,25 @@ import requests
import riotwatcher
def championIdToName(id, championsText):
champions = json.loads(championsText)['data']
for j in dict(champions):
if id == int(champions[j]["key"]):
return j
def getChampionsJSON():
return requests.get("http://ddragon.leagueoflegends.com/cdn/11.19.1/data/en_US/champion.json").text
def intTryParse(value):
try:
return int(value), True
except ValueError:
return value, False
def getSummonerNameFromMessage(message: discord.Message, argumentstart=1):
ret = ""
inp = message.content.split(" ")