async def setup(self, ctx, channel: discord.TextChannel, search: str, *, name: str): await channel.trigger_typing() async with aiohttp.ClientSession() as session: if search.lower() == "-search": async with session.get( f"https://stats.foldingathome.org/api/teams?name={name}&search_type=exact" ) as resp: firstjson = await resp.json() try: teamnumber = str(firstjson["results"][0]["team"]) except: return await ctx.send("**Error:** Invalid Team Name") else: teamnumber = name async with session.get( f"https://stats.foldingathome.org/api/team/{teamnumber}" ) as resp: teamjson = await resp.json() number = 1 message = str() total = teamjson["credit"] for donor in teamjson["donors"][:10]: message += f"**{number}. {donor['name']}:** {donor['credit']:,}\n" number += 1 embed = discord.Embed( title=f"{teamjson['name']}'s Team Stats", url=f"https://stats.foldingathome.org/team/{teamnumber}", color=0xfe6215) embed.set_footer( text= "Top 10 Leaderboard, made by Gnome!#6669! https://discord.gg/zWPWwQC" ) embed.set_thumbnail( url= "https://foldingathome.org/wp-content/uploads/2016/09/folding-at-home-logo.png" ) embed.add_field(name="**Leaderboard**", value=message, inline=False) embed.add_field(name="Total", value=f"{int(total):,}", inline=True) embed.add_field(name="Team Number", value=teamnumber, inline=True) messagemade = await channel.send(embed=embed) settings.set(ctx.guild, "channel", messagemade.channel.id) settings.set(ctx.guild, "message", messagemade.id) settings.set(ctx.guild, "teamnumber", teamnumber)
async def setup(self, ctx, channel: discord.TextChannel): settings.set(ctx.guild, "channel", channel.id) await ctx.send( f"Setup complete, {channel.mention} will now accept -join and -leave!" )
async def botignore(self, ctx, value: bool): settings.set(ctx.guild, "bot_ignore", value) await ctx.send(f"Ignoring Bots is now: {to_enabled[value]}")
async def autojoin(self, ctx, value: bool): settings.set(ctx.guild, "auto_join", value) await ctx.send(f"Auto Join is now: {to_enabled[value]}")
async def xsaid(self, ctx, value: bool): settings.set(ctx.guild, "xsaid", value) await ctx.send(f"xsaid is now: {to_enabled[value]}")