minor code refactoring
This commit is contained in:
parent
36a8795245
commit
169599dff5
6 changed files with 56 additions and 54 deletions
|
|
@ -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(" ")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue