Added required setup function
This commit is contained in:
parent
fe54231352
commit
7a5f26a6ff
1 changed files with 51 additions and 41 deletions
10
cogs/da.py
10
cogs/da.py
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue