check full discord members

This commit is contained in:
Amazed 2020-09-07 21:50:12 +02:00
parent 562f7c8f88
commit 6fefe381f8

View File

@ -104,7 +104,24 @@ class WynncraftCog(commands.Cog):
}
}
default_global = {
"log": True
"log": True,
"xp_guide": [
# 1-10
["Autour de Ragni (-718,-1580).",
"Faire les métiers (fishing, mining, farming, et woodcutting) jusqu'au niveau 10",
"Around the Identifier, just a little East of Ragni (-551,-1578).",
"Down the road from Ragni where there are two small Zombie ruins, one with level 1-3 mobs, and the other with level 5+ mobs, pick your position! (-547, -1568 and -530,-1624)",
"The Decrepit Sewers northwards of Ragni, it provides quite a hefty sum of experience and Emeralds! (-900,-1880)",
"Inside the Nivla Woods, it is quite full of low level Spiders and Zombies (-200,-1600)."],
# 11-20
["Ancient Nemract's level 17 Colosseum (250,-1950).",
"Do your quests.",
"Ancient Nemract has a lot of level 17+ Skeletons, you should grind those for rapid experience.",
"Farm Pigmen underground at (-610,-1580).",
"The level 12 mushroom cave on the Black Road between Ternaves and Detlas."],
# 21-30
[""]
]
}
self.config.register_guild(**default_guild)
self.config.register_global(**default_global)
@ -132,8 +149,12 @@ class WynncraftCog(commands.Cog):
@commands.command()
@checks.admin_or_permissions(manage_guild=True)
async def set_guild(self, ctx, guild_name):
await self.config.guild(ctx.guild).guild_name.set(guild_name)
await ctx.send(":white_check_mark: Votre guilde est désormais **%s**" % guild_name)
if guild_name == "no":
await self.config.guild(ctx.guild).guild_name.set(False)
await ctx.send(":white_check_mark: Check sur les membres de la guilde désactivé")
else:
await self.config.guild(ctx.guild).guild_name.set(guild_name)
await ctx.send(":white_check_mark: Votre guilde est désormais **%s**" % guild_name)
@commands.command()
async def player(self, ctx, player_name):
@ -189,10 +210,12 @@ class WynncraftCog(commands.Cog):
try:
guild_name = await self.config.guild(guild).guild_name()
if not guild_name:
continue
r = requests.get("https://api.wynncraft.com/public_api.php?action=guildStats&command=%s" % guild_name).json()
for member in r["members"]:
member_name = member["name"]
members = [a.display_name for a in guild.members]
else:
r = requests.get("https://api.wynncraft.com/public_api.php?action=guildStats&command=%s" % guild_name).json()
members = [a["name"] for a in r["members"]]
for member_name in members:
await self._log("calling API for player %s" % member_name)
r = requests.get("https://api.wynncraft.com/v2/player/%s/stats" % member_name).json()
@ -337,4 +360,4 @@ class WynncraftCog(commands.Cog):
except:
if await self.config.log():
traceback.print_exc()
await asyncio.sleep(30)
await asyncio.sleep(3600)