Created
March 3, 2017 18:13
-
-
Save Nikitaw99/10d96eebb0c43309f9bed190c1ce4ace to your computer and use it in GitHub Desktop.
discord.py time command (based on orangestation-bot)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elif message.content.startswith("AI, time"): | |
# UTC | |
tmp1 = datetime.datetime.now() | |
utcnow = datetime.time(hour=tmp1.hour, minute=tmp1.minute, second=tmp1.second) | |
del tmp1 | |
utcfulltime = "{}:{}:{}".format(utcnow.hour, utcnow.minute, utcnow.second) | |
# SMT | |
tmp1 = datetime.timedelta(hours=4) | |
smt = datetime.timezone(tmp1) | |
tmp2 = datetime.datetime.now(smt) | |
smtnow = datetime.time(hour=tmp2.hour, minute=tmp2.minute, second=tmp2.second) | |
del tmp1 | |
del tmp2 | |
del smt | |
smtfulltime = "{}:{}:{}".format(smtnow.hour, smtnow.minute, smtnow.second) | |
# Print the timezones... | |
yield from client.send_message(message.channel, "```UTC: {}\nSMT: {}```".format(utcfulltime, smtfulltime)) | |
# cleaning up | |
del utcnow | |
del smtnow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it not work