Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async def status():
- msg = bot.get_channel(574233934066483201)
- urllib.request.urlretrieve('http://live.albiononline.com/status.txt', 'status.txt')
- online = open('online.txt','r')
- status = open('status.txt','r')
- last = open('last.txt','r')
- st = status.read()
- onl = online.read()
- la = last.read()
- if st == onl:
- if st == la:
- pass
- else:
- laste = open('last.txt','w')
- laste.write(st)
- laste.close()
- embed = discord.Embed(title="Albion Status Information", description="Server status just changed to online", color=0xeee657)
- embed.add_field(name="Message", value=st.replace('{ "status": "online", "message": "','').replace('" }',''))
- await msg.send(embed=embed)
- # await msg.send('Server has already started!')
- else:
- if st == la:
- pass
- else:
- laste = open('last.txt','w')
- laste.write(st)
- laste.close()
- embedo = discord.Embed(title="Albion Status Information", description="Server status just changed to offline", color=0xff0000)
- embedo.add_field(name="Message", value=st.replace('{ "status": "offline", "message": "','').replace('" }',''))
- await msg.send(embed=embedo)
- #await msg.send('Server has already stoped!')
- online.close()
- status.close()
- last.close()
- scheduler.add_job(status, 'interval', seconds=60)
- scheduler.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement