#!/usr/bin/env python3.4 import discord import asyncio import configparser import datetime #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() #Subroutine to get UPS Status @asyncio.coroutine def ups_check(): while not client.is_closed: yield from asyncio.create_subprocess_exec("/bin/bash", "/srv/discord-pocketbot/ups_status.sh") yield from asyncio.sleep(60) @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...") yield from client.change_presence(game=discord.Game(name='with some droids')) @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('!help'): helpfile = open("/srv/discord-pocketbot/helpcommand.txt","r") yield from client.send_message(message.channel, helpfile.read()) 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/') elif message.content.lower().startswith('!pokeme'): yield from client.send_message(message.channel, "_pokes <@"+message.author.id+">_") elif message.content.lower().startswith('!wtf'): yield from client.send_typing(message.channel) yield from asyncio.sleep(3) yield from client.send_message(message.channel, 'What the fuck did you just fucking say about me, you little bitch? I’ll have you know I graduated top of my class in the Navy Seals, and I’ve been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I’m the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You’re fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that’s just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little “clever” comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn’t, you didn’t, and now you’re paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You’re fucking dead, kiddo.') elif message.content.lower().startswith('!switch'): now = datetime.datetime.now() switchdate = datetime.datetime(2017, 3, 3) switchdelta = switchdate - now switchmsg = "<:switchl:283809380137435139>Only **%s** until the Switch comes out!<:switchr:283809391835349004>" % (switchdelta) yield from client.send_message(message.channel, switchmsg) elif message.content.lower().startswith('!ups'): ups_status = open("/tmp/ups_status.txt","r") yield from client.send_message(message.channel, ups_status.read()) client.loop.create_task(ups_check()) client.run(token)