29 lines
800 B
Python
29 lines
800 B
Python
#!/bin/python
|
|
|
|
import discord
|
|
from discord.ext import commands
|
|
from parse_data import get_current_data
|
|
|
|
|
|
class MyClient(discord.Client):
|
|
async def on_ready(self):
|
|
print('Logged on as', self.user)
|
|
|
|
async def on_message(self, message):
|
|
# don't respond to ourselves
|
|
if(message.author == self.user):
|
|
return
|
|
|
|
if(message.content == 'ping'):
|
|
await message.channel.send('pong')
|
|
|
|
if(message.content == 'report'):
|
|
with open('.keys/report_channel_id') as cid:
|
|
channel = self.get_channel(int(cid.readline().strip()))
|
|
await channel.send(get_current_data())
|
|
|
|
|
|
if(__name__ == '__main__'):
|
|
with open('.keys/bot_api.key') as key:
|
|
client = MyClient()
|
|
client.run(key.readline().strip())
|