HighestMasteryCommand.py done done done done done
This commit is contained in:
parent
58fa6e0823
commit
36a8795245
1 changed files with 24 additions and 27 deletions
|
|
@ -28,37 +28,34 @@ class HighestMastery(APICommands.Command.Command, ABC):
|
|||
return
|
||||
listlen = int(message.content.split(" ")[1]) if firstIsInt else 10
|
||||
try:
|
||||
output = getChampionMasteryList(sumname, listlen)
|
||||
output = self.getChampionMasteryList(sumname, listlen)
|
||||
for i in output:
|
||||
await message.channel.send(i)
|
||||
except:
|
||||
await self.usage(message)
|
||||
|
||||
async def info(self, message: discord.Message):
|
||||
pass
|
||||
|
||||
async def info(self, message: discord.Message):
|
||||
pass
|
||||
async def usage(self, message: discord.Message):
|
||||
await message.channel.send("Wrong usage of" + self.commandName + "!\nUsage: " + self.pref + "hm [count] ["
|
||||
"Summonername]")
|
||||
|
||||
|
||||
async def usage(self, message: discord.Message):
|
||||
await message.channel.send("Wrong usage of" + self.commandName + "!\nUsage: " + self.pref + "hm [count] ["
|
||||
"Summonername]")
|
||||
|
||||
|
||||
def getChampionMasteryList(sumname, listlen):
|
||||
output = ["Der Spieler " + sumname + " hat den höchsten Mastery auf diesen " + str(
|
||||
listlen) + " Champions\n"]
|
||||
count = 0
|
||||
response = self.api.champion_mastery.by_summoner(self.region, self.getEncryptedSummonerID(sumname))[
|
||||
:listlen]
|
||||
championsJSON = getChampionsJSON()
|
||||
for i in response:
|
||||
champname = championIdToName(i["championId"], championsJSON)
|
||||
mpoints = i["championPoints"]
|
||||
mastery = i["championLevel"]
|
||||
out = "**" + champname + "**" + " Points: " + str(mpoints) + " Level: " + str(
|
||||
mastery) + "\n"
|
||||
if len(output[count]) + len(out) >= 2000:
|
||||
output.append("")
|
||||
count += 1
|
||||
output[count] += out
|
||||
return output
|
||||
def getChampionMasteryList(self, sumname, listlen):
|
||||
output = ["Der Spieler " + sumname + " hat den höchsten Mastery auf diesen " + str(
|
||||
listlen) + " Champions\n"]
|
||||
count = 0
|
||||
response = self.api.champion_mastery.by_summoner(self.region, self.getEncryptedSummonerID(sumname))[
|
||||
:listlen]
|
||||
championsJSON = getChampionsJSON()
|
||||
for i in response:
|
||||
champname = championIdToName(i["championId"], championsJSON)
|
||||
mpoints = i["championPoints"]
|
||||
mastery = i["championLevel"]
|
||||
out = "**" + champname + "**" + " Points: " + str(mpoints) + " Level: " + str(
|
||||
mastery) + "\n"
|
||||
if len(output[count]) + len(out) >= 2000:
|
||||
output.append("")
|
||||
count += 1
|
||||
output[count] += out
|
||||
return output
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue