Advertisement
Guest User

untitled

a guest
Jun 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. async def status():
  2. msg = bot.get_channel(574233934066483201)
  3. urllib.request.urlretrieve('http://live.albiononline.com/status.txt', 'status.txt')
  4. online = open('online.txt','r')
  5. status = open('status.txt','r')
  6. last = open('last.txt','r')
  7. st = status.read()
  8. onl = online.read()
  9. la = last.read()
  10. if st == onl:
  11. if st == la:
  12. pass
  13. else:
  14. laste = open('last.txt','w')
  15. laste.write(st)
  16. laste.close()
  17. embed = discord.Embed(title="Albion Status Information", description="Server status just changed to online", color=0xeee657)
  18. embed.add_field(name="Message", value=st.replace('{ "status": "online", "message": "','').replace('" }',''))
  19. await msg.send(embed=embed)
  20. # await msg.send('Server has already started!')
  21. else:
  22. if st == la:
  23. pass
  24. else:
  25. laste = open('last.txt','w')
  26. laste.write(st)
  27. laste.close()
  28. embedo = discord.Embed(title="Albion Status Information", description="Server status just changed to offline", color=0xff0000)
  29. embedo.add_field(name="Message", value=st.replace('{ "status": "offline", "message": "','').replace('" }',''))
  30. await msg.send(embed=embedo)
  31. #await msg.send('Server has already stoped!')
  32. online.close()
  33. status.close()
  34. last.close()
  35.  
  36. scheduler.add_job(status, 'interval', seconds=60)
  37. scheduler.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement