diff --git a/config.cfg b/config.cfg new file mode 100644 index 0000000..c728f0e --- /dev/null +++ b/config.cfg @@ -0,0 +1,6 @@ +[configuration] +#CONFIGURATION +#Config for the Discord pocketbot (https://git.pocketjawa.com/pocketjawa/discord-pocketbot) + +#Discord client token +token: \ No newline at end of file diff --git a/pocketbot.py b/pocketbot.py new file mode 100644 index 0000000..132ffa2 --- /dev/null +++ b/pocketbot.py @@ -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) \ No newline at end of file