diff --git a/General.py b/General.py index fb966a4..5010928 100644 --- a/General.py +++ b/General.py @@ -1,6 +1,7 @@ import asyncio import discord import sys, os +import praw from discord.ext import commands from sympy import latex, symbols, preview, Symbol #for LaTeX images @@ -10,6 +11,15 @@ class General(object): def __init__(self, bot): self.bot = bot self.voice_states = {} + self.r = praw.Reddit( + user_agent='StroopwafelBot', + client_secret='Z4K17T8TC26cNAgDSRxCkE9jYR4', + client_id='aWeyKpzdHMtmJQ' + ) + self.r.read_only = True + f = open("password.txt","r") + self.rebootPW = f.readline() + def __check(self, ctx): #Todo: Is dit het porno kanaal? return True @commands.command() @@ -30,11 +40,25 @@ class General(object): print("No permission to delete message") yield from ctx.channel.send(ctx.author.mention, file=discord.File('test.png', 'tex.png')) + @commands.command(pass_context=True) + @asyncio.coroutine + def aww(self, ctx): + """ iets schattigs... """ + print(type(ctx.message.channel)) + raww = self.r.subreddit('aww') + post = raww.random() + try: + yield from ctx.message.delete() + except: + print("No permission to delete message") + yield from ctx.channel.send(ctx.author.mention + ' ' + post.url) + @commands.command(pass_context=True, hidden=True) @asyncio.coroutine def reboot(self, ctx, password=""): """ Reboot.. """ - if password == "please": + print(self.rebootPW) + if password == self.rebootPW: yield from ctx.channel.send("Rebooting.. brb!") os.execv(sys.executable, ['python3'] + sys.argv) else: