HighestMasteryCommand.py done done
This commit is contained in:
parent
ca28bebbcf
commit
8a880de0e5
1 changed files with 10 additions and 12 deletions
|
|
@ -17,15 +17,13 @@ class HighestMastery(APICommands.Command.Command, ABC):
|
||||||
|
|
||||||
async def execute(self, message: discord.Message):
|
async def execute(self, message: discord.Message):
|
||||||
sumname = ""
|
sumname = ""
|
||||||
err = "Something went wrong.\nUsage: " + self.pref + "hm [count] [Summonername]"
|
|
||||||
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
|
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 Exception as e:
|
except:
|
||||||
await message.channel.send(err)
|
await self.usage(message)
|
||||||
print("Exception in Mastery " + str(e))
|
|
||||||
if sumname != "":
|
if sumname != "":
|
||||||
if not await self.checkSumname(sumname, message):
|
if not await self.checkSumname(sumname, message):
|
||||||
return
|
return
|
||||||
|
|
@ -34,9 +32,8 @@ class HighestMastery(APICommands.Command.Command, ABC):
|
||||||
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 Exception as e:
|
except:
|
||||||
await message.channel.send(err)
|
await self.usage(message)
|
||||||
print("Exception in Mastery " + str(e))
|
|
||||||
elif not firstIsInt: # no number given
|
elif not firstIsInt: # no number given
|
||||||
try:
|
try:
|
||||||
sumname = APICommands.Command.getSummonerNameFromMessage(message, 1)
|
sumname = APICommands.Command.getSummonerNameFromMessage(message, 1)
|
||||||
|
|
@ -49,12 +46,16 @@ class HighestMastery(APICommands.Command.Command, ABC):
|
||||||
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 Exception as e:
|
except:
|
||||||
await message.channel.send(err)
|
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):
|
||||||
|
await message.channel.send("Wrong usage of" + self.commandName + "!\nUsage: " + self.pref + "hm [count] ["
|
||||||
|
"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"]
|
||||||
|
|
@ -73,6 +74,3 @@ class HighestMastery(APICommands.Command.Command, ABC):
|
||||||
count += 1
|
count += 1
|
||||||
output[count] += out
|
output[count] += out
|
||||||
return output
|
return output
|
||||||
|
|
||||||
async def usage(self, message: discord.Message):
|
|
||||||
pass
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue