country.py 文件源码

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

项目:Socrates 作者: Curlybear 项目源码 文件源码
def mppsraw(self, ctx):
        logger.info('!mppsraw - User: ' + str(ctx.message.author))
        mpp_text = ''
        r = requests.get('https://api.erepublik-deutschland.de/' + apiKey + '/countries/details/all')
        obj = json.loads(r.text)
        for country in obj['countries']:
            mpps = obj['countries'][country]['military']['mpps']
            if mpps:
                mpps.sort(key=lambda x: x['expires'][0:10])
                for mpp in mpps:
                    mpp_text += self.utils.get_country_name(country) + ';' + self.utils.get_country_name(
                        mpp['country_id']) + ';' + mpp['expires'][0:10] + '\n'

        link = PythonGists.Gist(description='eRepublik MPPs', content=mpp_text, name='mpps' + datetime.datetime.now().strftime("%d-%m-%Y") + '.csv')
        em = discord.Embed(title='All MPPs',
                           description=link, colour=0x0042B9)
        await self.bot.send_message(ctx.message.channel, '', embed=em)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号