no message

This commit is contained in:
2017-11-10 23:20:24 +01:00
parent a805194142
commit 13d1c4e083
-43
View File
@@ -1,43 +0,0 @@
import asyncio
import discord
from discord.ext import commands
import os
import praw
from random import randint
class Porno(object):
"""Porno commando's. Jij weet wat er aan is."""
def __init__(self, bot):
self.bot = bot
self.voice_states = {}
self.fileIndex = {}
self.r = praw.Reddit(
user_agent='StroopwafelBot',
client_secret='Z4K17T8TC26cNAgDSRxCkE9jYR4',
client_id='aWeyKpzdHMtmJQ'
)
self.r.read_only = True
def __check(self, ctx): #Todo: Is dit het porno kanaal?
return True
def randomJpgFromFolder(self, dir):
if dir not in self.fileIndex.keys():
self.fileIndex[dir] = [] #empty list
for dirname, dirnames, filenames in os.walk('./'+ dir):
for filename in filenames:
if filename.endswith('.jpg'):
self.fileIndex[dir].append(os.path.join(dirname, filename))
#now we should have an index for the selected folder, but it might still be empty (i.e. empty folder given)
if self.fileIndex[dir]:
return self.fileIndex[dir][randint(0,len(self.fileIndex[dir])-1)] #get a random element from the newly created index
else:
return 'default file here'
@commands.command(pass_context=True)
@asyncio.coroutine
def nsfw(self, ctx):
""" random post uit een nsfw subreddit, for reasons.. """
randnsfw = self.r.subreddit('randnsfw')
post = randnsfw.random()
yield from self.bot.say(post.url)