32 lines
780 B
Python
32 lines
780 B
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")
|
|
|
|
client = discord.Client()
|
|
|
|
@client.event
|
|
@asyncio.coroutine
|
|
def on_ready():
|
|
print('Logged in as')
|
|
print(client.user.name)
|
|
print(client.user.id)
|
|
print('------')
|
|
|
|
@client.event
|
|
@asyncio.coroutine
|
|
def on_message(message):
|
|
if message.content.startswith('!maki'):
|
|
yield from client.send_message(message.channel, 'http://maki.pocketjawa.com/monday.png')
|
|
elif message.content.startswith('!sleep'):
|
|
yield from asyncio.sleep(5)
|
|
yield from client.send_message(message.channel, 'Done sleeping')
|
|
|
|
|
|
client.run(token) |