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
|
return
|
||||||
listlen = int(message.content.split(" ")[1]) if firstIsInt else 10
|
listlen = int(message.content.split(" ")[1]) if firstIsInt else 10
|
||||||
try:
|
try:
|
||||||
output = getChampionMasteryList(sumname, listlen)
|
output = self.getChampionMasteryList(sumname, listlen)
|
||||||
for i in output:
|
for i in output:
|
||||||
await message.channel.send(i)
|
await message.channel.send(i)
|
||||||
except:
|
except:
|
||||||
await self.usage(message)
|
await self.usage(message)
|
||||||
|
|
||||||
|
async def info(self, message: discord.Message):
|
||||||
|
pass
|
||||||
|
|
||||||
async def info(self, message: discord.Message):
|
async def usage(self, message: discord.Message):
|
||||||
pass
|
await message.channel.send("Wrong usage of" + self.commandName + "!\nUsage: " + self.pref + "hm [count] ["
|
||||||
|
"Summonername]")
|
||||||
|
|
||||||
|
def getChampionMasteryList(self, sumname, listlen):
|
||||||
async def usage(self, message: discord.Message):
|
output = ["Der Spieler " + sumname + " hat den höchsten Mastery auf diesen " + str(
|
||||||
await message.channel.send("Wrong usage of" + self.commandName + "!\nUsage: " + self.pref + "hm [count] ["
|
listlen) + " Champions\n"]
|
||||||
"Summonername]")
|
count = 0
|
||||||
|
response = self.api.champion_mastery.by_summoner(self.region, self.getEncryptedSummonerID(sumname))[
|
||||||
|
:listlen]
|
||||||
def getChampionMasteryList(sumname, listlen):
|
championsJSON = getChampionsJSON()
|
||||||
output = ["Der Spieler " + sumname + " hat den höchsten Mastery auf diesen " + str(
|
for i in response:
|
||||||
listlen) + " Champions\n"]
|
champname = championIdToName(i["championId"], championsJSON)
|
||||||
count = 0
|
mpoints = i["championPoints"]
|
||||||
response = self.api.champion_mastery.by_summoner(self.region, self.getEncryptedSummonerID(sumname))[
|
mastery = i["championLevel"]
|
||||||
:listlen]
|
out = "**" + champname + "**" + " Points: " + str(mpoints) + " Level: " + str(
|
||||||
championsJSON = getChampionsJSON()
|
mastery) + "\n"
|
||||||
for i in response:
|
if len(output[count]) + len(out) >= 2000:
|
||||||
champname = championIdToName(i["championId"], championsJSON)
|
output.append("")
|
||||||
mpoints = i["championPoints"]
|
count += 1
|
||||||
mastery = i["championLevel"]
|
output[count] += out
|
||||||
out = "**" + champname + "**" + " Points: " + str(mpoints) + " Level: " + str(
|
return output
|
||||||
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