Initial commit
parent
e80ed60ffa
commit
7b74cf167e
|
@ -0,0 +1,6 @@
|
|||
[configuration]
|
||||
#CONFIGURATION
|
||||
#Config for the Discord pocketbot (https://git.pocketjawa.com/pocketjawa/discord-pocketbot)
|
||||
|
||||
#Discord client token
|
||||
token:
|
|
@ -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)
|
Loading…
Reference in New Issue