reformatting done :)

This commit is contained in:
s-prechtl 2022-03-21 02:43:00 +01:00
parent 6ddb040f89
commit 241219b575
2 changed files with 34 additions and 49 deletions

View file

@ -4,6 +4,7 @@ import discord
import riotwatcher import riotwatcher
import APICommands.Command import APICommands.Command
from APICommands.Command import getSummonerNameFromMessage, getChampionsJSON, championIdToName
class Free2Play(APICommands.Command.Command, ABC): class Free2Play(APICommands.Command.Command, ABC):
@ -16,10 +17,41 @@ class Free2Play(APICommands.Command.Command, ABC):
super().__init__(pref, api, region, additionalKeywords) super().__init__(pref, api, region, additionalKeywords)
async def execute(self, message: discord.Message): 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): async def info(self, message: discord.Message):
pass pass
async def usage(self, message: discord.Message): async def usage(self, message: discord.Message):
pass await message.channel.send("Wrong usage of" + self.commandName + "!\nUsage: " + self.pref + "f2p [Summoner ("
"optional)]")

View file

@ -9,9 +9,6 @@ from riotwatcher import LolWatcher
from APICommands import ChampionMasteryCommand, HighestMasteryCommand, SummonerLevelCommand, PrefixCommand, SummonerRankCommand from APICommands import ChampionMasteryCommand, HighestMasteryCommand, SummonerLevelCommand, PrefixCommand, SummonerRankCommand
class MyClient(discord.Client): class MyClient(discord.Client):
api: LolWatcher api: LolWatcher
region: str region: str
@ -58,8 +55,6 @@ class MyClient(discord.Client):
command.log(message) command.log(message)
await command.execute(message) await command.execute(message)
# HUBA # HUBA
if message.content == self.pref + "huba": if message.content == self.pref + "huba":
self.log("Huawa", message) 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 " "Julian Huber (17) ist ein Kinderschänder, welcher in Wahrheit schwul ist und seine sexuelle "
"Orientierung hinter einer Beziehung mit einem weiblichen Kind versteckt.") "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**")