cleanup of new base cog
This commit is contained in:
parent
02fa32cb1c
commit
9dd6fc1e1b
2 changed files with 4 additions and 5 deletions
|
|
@ -6,15 +6,13 @@ import logging
|
|||
class BotBaseCog(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.class_name = __name__
|
||||
self.working_dir = f"tmp/{self.class_name}"
|
||||
self.data_dir = f"data/{self.class_name}"
|
||||
self.cog_name = __name__
|
||||
self.working_dir = f"tmp/{self.cog_name}"
|
||||
self.data_dir = f"data/{self.cog_name}"
|
||||
self.folder_setup()
|
||||
|
||||
self.http_session = self.create_aiohttp_session()
|
||||
self.logger = logging.getLogger("bot")
|
||||
|
||||
|
||||
def create_aiohttp_session(self):
|
||||
return aiohttp.ClientSession()
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class Meme(BotBaseCog):
|
|||
brief="Generate a meme"
|
||||
)
|
||||
async def meme(self, ctx):
|
||||
self.logger.info(f"Meme command called by {ctx.author.name}")
|
||||
async def generate_random_meme(topic):
|
||||
async with self.http_session.get('https://api.imgflip.com/get_memes') as resp:
|
||||
response_data = await resp.json()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue