Skip to content

Instantly share code, notes, and snippets.

@Nikitaw99
Created March 3, 2017 18:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nikitaw99/10d96eebb0c43309f9bed190c1ce4ace to your computer and use it in GitHub Desktop.
Save Nikitaw99/10d96eebb0c43309f9bed190c1ce4ace to your computer and use it in GitHub Desktop.
discord.py time command (based on orangestation-bot)
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
@LoRdStyRiX
Copy link

it not work

@ks0001LOL
Copy link

it not work

its old

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment