1
0
Fork 0
mirror of synced 2024-09-30 09:17:13 +13:00

Added required setup function

This commit is contained in:
Phxntxm 2016-10-07 17:56:44 -05:00
parent fe54231352
commit 7a5f26a6ff

View file

@ -14,6 +14,13 @@ class Deviantart:
self.headers = {"User-Agent": "Bonfire/1.0.0"} self.headers = {"User-Agent": "Bonfire/1.0.0"}
self.session = aiohttp.ClientSession() self.session = aiohttp.ClientSession()
bot.loop.create_task(self.get_token()) bot.loop.create_task(self.get_token())
# Lets start the task a few seconds after, to ensure our token gets set
bot.loop.call_later(5, self.post_task)
async def post_task(self):
while(True):
await check_posts()
await asyncio.sleep(300)
async def get_token(self): async def get_token(self):
# We need a token to create requests, it doesn't seem this token goes away # We need a token to create requests, it doesn't seem this token goes away
@ -117,3 +124,6 @@ class Deviantart:
await self.bot.say("You have just unsubscribed from {}!".format(username)) await self.bot.say("You have just unsubscribed from {}!".format(username))
else: else:
await self.bot.say("You are not subscribed to that user!") await self.bot.say("You are not subscribed to that user!")
def setup(bot):
bot.add_cog(Deviantart(bot))