diff --git a/APICommands/F2PCommand.py b/APICommands/F2PCommand.py index 350ee8d..b4f8fd2 100644 --- a/APICommands/F2PCommand.py +++ b/APICommands/F2PCommand.py @@ -4,6 +4,7 @@ import discord import riotwatcher import APICommands.Command +from APICommands.Command import getSummonerNameFromMessage, getChampionsJSON, championIdToName class Free2Play(APICommands.Command.Command, ABC): @@ -16,10 +17,41 @@ class Free2Play(APICommands.Command.Command, ABC): super().__init__(pref, api, region, additionalKeywords) async def execute(self, message: discord.Message): - pass + sumname = "" + output = "Derzeitige F2P Champions" + rot = self.api.champion.rotations(self.region)["freeChampionIds"] + championsJSON = getChampionsJSON() + try: + sumname = getSummonerNameFromMessage(message, 1) + except: + await self.usage(message) + + if sumname != "": + if not await self.checkSumname(sumname, message): + return + output += " auf denen **" + sumname + "** noch keine Punkte hast: \n" + response = self.api.champion_mastery.by_summoner(self.region, + self.api.summoner.by_name(self.region, + sumname)["id"]) + allIds = [] + for i in response: + allIds.append(i["championId"]) + + for i in rot: + if i not in allIds: + output += ("ㅤ\t- **" + championIdToName(i, championsJSON) + "**\n") + else: + output += ":\n" + for i in rot: + output += ("ㅤ\t- **" + championIdToName(i, championsJSON) + "**\n") + + await message.channel.send(output) + if len(output.split("\n")) <= 2: + await message.channel.send("ㅤ\t- **Keine**") async def info(self, message: discord.Message): pass async def usage(self, message: discord.Message): - pass + await message.channel.send("Wrong usage of" + self.commandName + "!\nUsage: " + self.pref + "f2p [Summoner (" + "optional)]") diff --git a/iLeague.py b/iLeague.py index 5e96881..4223268 100644 --- a/iLeague.py +++ b/iLeague.py @@ -9,9 +9,6 @@ from riotwatcher import LolWatcher from APICommands import ChampionMasteryCommand, HighestMasteryCommand, SummonerLevelCommand, PrefixCommand, SummonerRankCommand - - - class MyClient(discord.Client): api: LolWatcher region: str @@ -58,8 +55,6 @@ class MyClient(discord.Client): command.log(message) await command.execute(message) - - # HUBA if message.content == self.pref + "huba": self.log("Huawa", message) @@ -67,48 +62,6 @@ class MyClient(discord.Client): "Julian Huber (17) ist ein Kinderschänder, welcher in Wahrheit schwul ist und seine sexuelle " "Orientierung hinter einer Beziehung mit einem weiblichen Kind versteckt.") - if True: - return - - # FREE CHAMPS - elif self.getContentFromMessageWithPrefixCommand(message, ["f2p", "rotation", "F2P", "ROTATION"]): - self.log("F2P rotation", message) - await self.requestFreeChampRot(message) - - async def requestFreeChampRot(self, message: discord.Message): - err = "Something went wrong.\nUsage: " + self.pref + "f2p [Summonername]" - sumname = "" - output = "Derzeitige F2P Champions" - rot = self.api.champion.rotations(self.region)["freeChampionIds"] - championsJSON = getChampionsJSON() - try: - sumname = self.getSummonerNameFromMessage(message, 1) - except Exception: - pass - - if sumname != "": - if not await self.checkSumname(sumname, message): - return - output += " auf denen **" + sumname + "** noch keine Punkte hast: \n" - response = self.api.champion_mastery.by_summoner(self.region, - self.api.summoner.by_name(self.region, - sumname)["id"]) - allIds = [] - for i in response: - allIds.append(i["championId"]) - - for i in rot: - if not i in allIds: - output += ("ㅤ\t- **" + championIdToName(i, championsJSON) + "**\n") - else: - output += ":\n" - for i in rot: - output += ("ㅤ\t- **" + championIdToName(i, championsJSON) + "**\n") - - await message.channel.send(output) - if len(output.split("\n")) <= 2: - await message.channel.send("ㅤ\t- **Keine**") -