discord-pocketbot/pocketbot.py

36 lines
1.1 KiB
Python

#!/usr/bin/env python3.4
import discord
import asyncio
import configparser
#Import config file
config = configparser.ConfigParser()
config.read("/srv/discord-pocketbot/config.cfg")
token = config.get("configuration", "token")
bot_channel_id = discord.Object(id=config.get("configuration", "bot_channel_id"))
client = discord.Client()
@client.event
@asyncio.coroutine
def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
yield from client.send_message(bot_channel_id, "This isn't Tatooine...")
@client.event
@asyncio.coroutine
def on_message(message):
if message.content.lower().startswith('!maki'):
yield from client.send_message(message.channel, 'http://maki.pocketjawa.com/monday.png')
elif message.content.lower().startswith('!sleep'):
yield from asyncio.sleep(5)
yield from client.send_message(message.channel, 'Done sleeping')
elif message.content.lower().startswith('!mixes'):
yield from client.send_message(message.channel, 'You can download mp3s of any of my mixes at http://maki.pocketjawa.com/mixes/')
client.run(token)