timeconvert.py 文件源码

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

项目:apex-sigma-plugins 作者: lu-ci 项目源码 文件源码
def timeconvert(cmd, message, args):
    if args:
        conv_input = ' '.join(args).split('>')
        if len(conv_input) == 2:
            from_pieces = conv_input[0].split()
            if len(from_pieces) == 2:
                from_time = from_pieces[0]
                from_zone = from_pieces[1]
                to_zone = conv_input[1]
                from_string = f'{arrow.utcnow().format("YYYY-MM-DD")} {from_time}:00'
                from_arrow = arrow.get(arrow.get(from_string).datetime, from_zone)
                to_arrow = from_arrow.to(to_zone)
                time_out = to_arrow.format('YYYY-MM-DD HH:mm:ss (ZZ GMT)')
                response = discord.Embed(color=0x696969, title=f'?? {time_out}')
            else:
                response = discord.Embed(color=0xBE1931, title='? Invalid first argument.')
        else:
            response = discord.Embed(color=0xBE1931, title='? Invalid input arguments.')
    else:
        response = discord.Embed(color=0xBE1931, title='? Nothing inputted.')
    await message.channel.send(embed=response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号