[V3] __unload -> cog_unload

This commit is contained in:
aikaterna
2019-06-25 10:49:17 -07:00
parent ed1aa25490
commit f296c65ef2
5 changed files with 12 additions and 21 deletions

View File

@@ -113,5 +113,5 @@ class AntiPhoneClapper(BaseCog):
else:
return
def __unload(self):
def cog_unload(self):
self.bot.loop.create_task(self.session.close())

View File

@@ -20,9 +20,7 @@ darkblurple = (78, 93, 148)
white = (255, 255, 255)
BaseCog = getattr(commands, "Cog", object)
class Blurplefy(BaseCog):
class Blurplefy(commands.Cog):
def __init__(self, bot):
"""Blurplefy images and check content of images."""
self.bot = bot
@@ -437,5 +435,5 @@ class Blurplefy(BaseCog):
msg = ""
return msg.format(d, h, m, s)
def __unload(self):
self.session.close()
def cog_unload(self):
self.bot.loop.create_task(self.session.close())

View File

@@ -3,9 +3,7 @@ import discord
from redbot.core import commands
BaseCog = getattr(commands, "Cog", object)
class Inspirobot(BaseCog):
class Inspirobot(commands.Cog):
"""Posts images generated by https://inspirobot.me"""
def __init__(self, bot):
self.bot = bot
@@ -25,5 +23,5 @@ class Inspirobot(BaseCog):
except Exception as e:
await ctx.send(f"Oops, there was a problem: {e}")
def __unload(self):
self.session.close()
def cog_unload(self):
self.bot.loop.create_task(self.session.close())

View File

@@ -12,9 +12,7 @@ import re
import unicodedata
BaseCog = getattr(commands, "Cog", object)
class Retrosign(BaseCog):
class Retrosign(commands.Cog):
"""Make an 80s retro sign. Originally by Anismash"""
def __init__(self, bot):
self.bot = bot
@@ -79,5 +77,5 @@ class Retrosign(BaseCog):
image = discord.File(fp=temp_image, filename="image.png")
await ctx.channel.send(file=image)
def __unload(self):
self.session.detach()
def cog_unload(self):
self.bot.loop.create_task(self.session.close())

View File

@@ -5,10 +5,7 @@ from redbot.core.utils.chat_formatting import box
import xml.etree.ElementTree as ET
BaseCog = getattr(commands, "Cog", object)
class Wolfram(BaseCog):
class Wolfram(commands.Cog):
"""Ask Wolfram Alpha any question."""
def __init__(self, bot):
@@ -55,5 +52,5 @@ class Wolfram(BaseCog):
await self.config.WOLFRAM_API_KEY.set(key)
await ctx.send("Key set.")
def __unload(self):
def cog_unload(self):
self.bot.loop.create_task(self.session.close())