HighestMasteryCommand.py refactored
This commit is contained in:
parent
6b177b7343
commit
06964afae6
1 changed files with 37 additions and 48 deletions
|
|
@ -19,7 +19,6 @@ class HighestMastery(APICommands.Command.Command, ABC):
|
||||||
sumname = ""
|
sumname = ""
|
||||||
firstIsInt = intTryParse(message.content.split(" ")[1])[1]
|
firstIsInt = intTryParse(message.content.split(" ")[1])[1]
|
||||||
|
|
||||||
if len(message.content.split(" ")) > 2 and firstIsInt: # If number is given
|
|
||||||
try:
|
try:
|
||||||
sumname = APICommands.Command.getSummonerNameFromMessage(message, 2)
|
sumname = APICommands.Command.getSummonerNameFromMessage(message, 2)
|
||||||
except:
|
except:
|
||||||
|
|
@ -27,34 +26,24 @@ class HighestMastery(APICommands.Command.Command, ABC):
|
||||||
if sumname != "":
|
if sumname != "":
|
||||||
if not await self.checkSumname(sumname, message):
|
if not await self.checkSumname(sumname, message):
|
||||||
return
|
return
|
||||||
|
listlen = int(message.content.split(" ")[1]) if firstIsInt else 10
|
||||||
try:
|
try:
|
||||||
listlen = int(message.content.split(" ")[1])
|
|
||||||
output = self.getChampionMasteryList(sumname, listlen)
|
|
||||||
for i in output:
|
|
||||||
await message.channel.send(i)
|
|
||||||
except:
|
|
||||||
await self.usage(message)
|
|
||||||
elif not firstIsInt: # no number given
|
|
||||||
try:
|
|
||||||
sumname = APICommands.Command.getSummonerNameFromMessage(message, 1)
|
|
||||||
except:
|
|
||||||
await self.usage(message)
|
|
||||||
if sumname != "":
|
|
||||||
try:
|
|
||||||
listlen = 10
|
|
||||||
output = self.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):
|
async def info(self, message: discord.Message):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
async def usage(self, message: discord.Message):
|
async def usage(self, message: discord.Message):
|
||||||
await message.channel.send("Wrong usage of" + self.commandName + "!\nUsage: " + self.pref + "hm [count] ["
|
await message.channel.send("Wrong usage of" + self.commandName + "!\nUsage: " + self.pref + "hm [count] ["
|
||||||
"Summonername]")
|
"Summonername]")
|
||||||
|
|
||||||
|
|
||||||
def getChampionMasteryList(self, sumname, listlen):
|
def getChampionMasteryList(self, sumname, listlen):
|
||||||
output = ["Der Spieler " + sumname + " hat den höchsten Mastery auf diesen " + str(
|
output = ["Der Spieler " + sumname + " hat den höchsten Mastery auf diesen " + str(
|
||||||
listlen) + " Champions\n"]
|
listlen) + " Champions\n"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue