Guest User

Untitled

a guest
Jun 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. import discord
  2. import asyncio
  3. import random
  4. import time
  5. import datetime
  6.  
  7. client = discord.Client()
  8.  
  9. seconds = 0
  10. minutes = 0
  11. hour = 0
  12.  
  13. @client.event
  14. async def on_message(message):
  15. if message.content.startswith('yuptime'):
  16. uptimeemb = discord.Embed(
  17. title="Uptime",
  18. color=0x000000,
  19. description="`Estou online faz {0} horas, {1} minutos e {2} segundos|{3}. `".format(hour, minutes,
  20. seconds, message.server)
  21. )
  22.  
  23. await client.send_message(message.channel, embed=uptimeemb)
  24.  
  25.  
  26. async def uptime():
  27. await client.wait_until_ready()
  28. global seconds
  29. seconds = 0
  30. global minutes
  31. minutes = 0
  32. global hour
  33. hour = 0
  34. while not client.is_closed:
  35.  
  36. seconds += 1
  37. if seconds == 60:
  38. seconds = 0
  39. minutes += 1
  40. await asyncio.sleep(1)
  41. if minutes == 60:
  42. minutes = 0
  43. hour += 1
Add Comment
Please, Sign In to add comment