dotastats.py 文件源码

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

项目:MangoByte 作者: mdiller 项目源码 文件源码
def dotagif(self, ctx, match_id : int, start, end, ms_per_second : int = 100):
        """Creates a gif of a specific part of a dota match

        The part of the match that you specify must be less than 10 minutes long

        `ms_per_second` is how many miliseconds between frames of the gif (each frame is 1 dota second)

        **Example:**
        `{cmdpfx}dotagif 3370877768 28:37 30:30`"""
        await ctx.channel.trigger_typing()

        match = await get_match(match_id)
        if not is_parsed(match):
            raise MatchNotParsedError(match_id, "get laning info")

        stratz_match = await get_stratz_match(match_id)
        if not is_stratz_parsed(stratz_match):
            raise UserError(f"It looks like match `{match_id}` hasn't been parsed by STRATZ")


        start = int(get_time(start))
        end = int(get_time(end))

        if end - start > 600:
            raise UserError("The length of this clip must be less than 10 minutes")

        if ms_per_second < 1 or ms_per_second > 655350:
            raise UserError("That is outside the bounds of the `ms_per_second` value")


        async with ctx.channel.typing():
            await thinker.think(ctx.message)
            try:
                image = discord.File(await drawdota.create_dota_gif(match, stratz_match, start, end, ms_per_second), "map.gif")
                await ctx.send(file=image)
            finally:
                await thinker.stop_thinking(ctx.message)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号