-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.py
31 lines (24 loc) · 1.06 KB
/
status.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
import requests
import discord
token = ('XXXXXXXX BOT TOKEN XXXXXXXXXXX')
c1 = ('https://X.X.X.X:YYY/')
class MyClient(discord.Client):
async def on_ready(self):
print('Logged in as')
print(self.user.name)
print(self.user.id)
print('------')
async def on_message(self, message):
# we do not want the bot to reply to itself
# if message.author.id == self.user.id:
# return
if message.content.startswith('!CLIENT'):
check = requests.get(c1, verify = False)
status = check.status_code
if status == 200:
await message.channel.send('Hello {0.author.mention}, the server is UP :flushed:.'.format(message))
elif status != 200:
await message.channel.send('Hello {0.author.mention}, the server is DOWN. :100: '.format(message))
client = MyClient()
client.run(token)