Initial commit

dev
pocketjawa 2017-02-21 04:27:12 +00:00
parent e80ed60ffa
commit 7b74cf167e
2 changed files with 38 additions and 0 deletions

6
config.cfg Normal file
View File

@ -0,0 +1,6 @@
[configuration]
#CONFIGURATION
#Config for the Discord pocketbot (https://git.pocketjawa.com/pocketjawa/discord-pocketbot)
#Discord client token
token:

32
pocketbot.py Normal file
View File

@ -0,0 +1,32 @@
#!/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)