football.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Pancake-Cogs 作者: UltimatePancake 项目源码 文件源码
def _leaderboard(self, ctx: commands.Context, league_id: str, matchday: str=None):
        """Gets league leaderboard"""
        headers = [' ', 'ID', 'Team', 'Points', 'P', 'G', 'GA', 'GD']
        data = await self._get_league_leaderboard(ctx.message.server.id, league_id, matchday)
        pretty_data = []

        #  await self.bot.say('```diff\n+ ' + data['leagueCaption'] + '\n- Matchday: ' + str(data['matchday']) + '\n```')
        await self.bot.say('```diff\n+ {}\n- Matchday: {}\n```'.format(data['leagueCaption'], data['matchday']))

        if 'standing' in data:
            for team in data['standing']:
                pretty_data.append([team['rank'], team['teamId'], team['team'], team['points'], team['playedGames'], team['goals'], team['goalsAgainst'], team['goalDifference']])

            await self.bot.say(box(tabulate(pretty_data, headers=headers)))
        elif 'standings' in data:
            for group, v in data['standings'].items():
                asyncio.sleep(1)
                await self.bot.say('```diff\n+ Group ' + group + '```')
                pretty_data = []

                for team in v:
                    pretty_data.append([team['rank'], team['team'], team['points'], team['playedGames'], team['goals'], team['goalsAgainst'], team['goalDifference']])

                await self.bot.say(box(tabulate(pretty_data, headers=headers)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号