+6
-7
@@ -61,17 +61,16 @@ class General(commands.Cog):
|
|||||||
print("No permission to delete message")
|
print("No permission to delete message")
|
||||||
yield from ctx.channel.send(ctx.author.mention, file=discord.File('test.png', 'tex.png'))
|
yield from ctx.channel.send(ctx.author.mention, file=discord.File('test.png', 'tex.png'))
|
||||||
|
|
||||||
|
def get_aww_post(self):
|
||||||
|
raww = self.r.subreddit('aww+catloaf+tuckedinkitties+babyelephantgifs+babybigcatgifs+blep+holdmynip+gingerkitty+cathighfive+catsstandingup+catsareassholes+eyebleach')
|
||||||
|
listing = list(raww.top(time_filter='month'))
|
||||||
|
return random.choice(listing)
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def aww(self, ctx):
|
def aww(self, ctx):
|
||||||
""" iets schattigs... """
|
""" iets schattigs... """
|
||||||
print(type(ctx.message.channel))
|
post = self.get_aww_post()
|
||||||
raww = self.r.subreddit('aww+catloaf+tuckedinkitties+babyelephantgifs+babybigcatgifs+blep+holdmynip+gingerkitty+cathighfive+catsstandingup+catsareassholes+eyebleach')
|
|
||||||
post = raww.top('month', limit=250)
|
|
||||||
listing = list(post)
|
|
||||||
random.shuffle(listing)
|
|
||||||
post = listing[0]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield from ctx.message.delete()
|
yield from ctx.message.delete()
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -29,3 +29,9 @@ class TestGeneral(unittest.TestCase):
|
|||||||
self.assertIsInstance(data, requests.Response)
|
self.assertIsInstance(data, requests.Response)
|
||||||
with self.subTest(msg="Does not convert to json"):
|
with self.subTest(msg="Does not convert to json"):
|
||||||
self.assertIsInstance(json.loads(data.content), dict)
|
self.assertIsInstance(json.loads(data.content), dict)
|
||||||
|
|
||||||
|
def test_aww(self):
|
||||||
|
if not isinstance(self.cog.r, praw.Reddit):
|
||||||
|
self.skipTest("PRAW Reddit instance failed to create")
|
||||||
|
post = self.cog.get_aww_post()
|
||||||
|
self.assertIsInstance(post.url, str)
|
||||||
|
|||||||
Reference in New Issue
Block a user