discord-pocketbot/pocketbot.py

70 lines
4.4 KiB
Python
Raw Normal View History

2017-02-21 04:27:12 +00:00
#!/usr/bin/env python3.4
import discord
import asyncio
import configparser
2017-02-22 02:47:03 +00:00
import datetime
import random
2017-02-21 04:27:12 +00:00
#Import config file
config = configparser.ConfigParser()
config.read("/srv/discord-pocketbot/config.cfg")
token = config.get("configuration", "token")
2017-02-21 05:21:00 +00:00
bot_channel_id = discord.Object(id=config.get("configuration", "bot_channel_id"))
2017-02-21 04:27:12 +00:00
client = discord.Client()
2017-02-25 01:22:55 +00:00
#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)
2017-02-21 04:27:12 +00:00
@client.event
@asyncio.coroutine
def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
2017-02-21 05:21:00 +00:00
yield from client.send_message(bot_channel_id, "This isn't Tatooine...")
2017-02-22 04:23:25 +00:00
yield from client.change_presence(game=discord.Game(name='with some droids'))
2017-02-21 04:27:12 +00:00
@client.event
@asyncio.coroutine
def on_message(message):
if message.content.lower().startswith('!maki'):
2017-02-21 04:27:12 +00:00
yield from client.send_message(message.channel, 'http://maki.pocketjawa.com/monday.png')
2017-02-22 04:15:15 +00:00
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'):
2017-02-21 04:27:12 +00:00
yield from asyncio.sleep(5)
yield from client.send_message(message.channel, 'Done sleeping')
elif message.content.lower().startswith('!mixes'):
2017-02-21 05:31:02 +00:00
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? Ill have you know I graduated top of my class in the Navy Seals, and Ive been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and Im 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. Youre fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and thats 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 couldnt, you didnt, and now youre paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. Youre fucking dead, kiddo.')
2017-02-22 02:47:03 +00:00
elif message.content.lower().startswith('!switch'):
now = datetime.datetime.now()
switchdate = datetime.datetime(2017, 3, 3)
switchdelta = switchdate - now
2017-02-22 04:00:32 +00:00
switchmsg = "<:switchl:283809380137435139>Only **%s** until the Switch comes out!<:switchr:283809391835349004>" % (switchdelta)
2017-02-22 02:47:03 +00:00
yield from client.send_message(message.channel, switchmsg)
2017-02-25 01:22:55 +00:00
elif message.content.lower().startswith('!ups'):
ups_status = open("/tmp/ups_status.txt","r")
yield from client.send_message(message.channel, ups_status.read())
elif message.content.lower().startswith('!tohru'):
tohru_list_file = open("/srv/discord-pocketbot/lists/tohru_images.txt", "r")
tohru_pics = tohru_list_file.read().split()
yield from client.send_message(message.channel, random.choice(tohru_pics))
2017-02-21 04:27:12 +00:00
2017-02-25 01:22:55 +00:00
client.loop.create_task(ups_check())
2017-02-21 04:27:12 +00:00
client.run(token)