1
0
Fork 0
mirror of https://github.com/uhIgnacio/EmoteManager.git synced 2024-08-15 02:23:13 +00:00

migrate to new cog changes

This commit is contained in:
Benjamin Mintz 2019-03-14 00:19:14 +00:00
parent f17bfa379d
commit 0d9b93e54a
2 changed files with 5 additions and 5 deletions

View file

@ -22,7 +22,7 @@ from utils.paginator import ListPaginator
logger = logging.getLogger(__name__)
class Emotes:
class Emotes(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.http = aiohttp.ClientSession(loop=self.bot.loop, read_timeout=30, headers={
@ -34,7 +34,7 @@ class Emotes:
# keep track of paginators so we can end them when the cog is unloaded
self.paginators = weakref.WeakSet()
def __unload(self):
def cog_unload(self):
self.bot.loop.create_task(self.http.close())
self.bot.loop.create_task(self.aioec.close())
@ -44,7 +44,7 @@ class Emotes:
self.bot.loop.create_task(stop_all_paginators())
async def __local_check(self, context):
async def cog_check(self, context):
if not context.guild or not isinstance(context.author, discord.Member):
raise commands.NoPrivateMessage
@ -62,6 +62,7 @@ class Emotes:
return True
@commands.Cog.listener()
async def on_command_error(self, context, error):
if isinstance(error, (errors.EmoteManagerError, errors.MissingManageEmojisPermission)):
await context.send(str(error))

View file

@ -6,8 +6,7 @@ import contextlib
import discord
from discord.ext import commands
class Meta:
class Meta(commands.Cog):
def __init__(self, bot):
self.bot = bot