time.py 文件源码

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

项目:jinux-discord 作者: Atomicbeast101 项目源码 文件源码
def ex(dclient, channel, mention, a, cmd_char):
    if len(a) > 0:
        g = geocoders.GoogleV3()
        try:
            place, (lat, lng) = g.geocode(a)
            timezone = g.timezone((lat, lng))
            time_now = datetime.now(timezone)
            await dclient.send_message(channel, 'It is `{:%H:%M:%S}` or `{:%I:%M:%S %p}` in `{}` right now.'
                                       .format(time_now, time_now, a))
        except Exception:
            await dclient.send_message(channel, 'Location `{}` unknown! Please try to be more specific! I rely on '
                                                'Google maps to get the coordinates for the timezone, {}!'
                                       .format(a, mention))
    else:
        await dclient.send_message(channel, '{}, **USAGE:** {}time <location>'.format(mention, cmd_char))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号