diff --git a/antiphoneclapper/antiphoneclapper.py b/antiphoneclapper/antiphoneclapper.py index 0257356..f6e6b84 100644 --- a/antiphoneclapper/antiphoneclapper.py +++ b/antiphoneclapper/antiphoneclapper.py @@ -7,6 +7,12 @@ from redbot.core import commands, checks, Config BaseCog = getattr(commands, "Cog", object) +listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad +if listener is None: + + def listener(name=None): + return lambda x: x + class AntiPhoneClapper(BaseCog): """This cog deletes bad GIFs that will crash phone clients.""" @@ -67,6 +73,7 @@ class AntiPhoneClapper(BaseCog): tile_sizes.append(im.tile[0][1][2:]) return any([x[0] > limit[0] or x[1] > limit[1] for x in tile_sizes]) + @listener() async def on_message(self, m): if not m.attachments: return diff --git a/away/away.py b/away/away.py index b2cfe96..ecd49ea 100644 --- a/away/away.py +++ b/away/away.py @@ -8,6 +8,12 @@ IMAGE_LINKS = re.compile(r"(http[s]?:\/\/[^\"\']*\.(?:png|jpg|jpeg|gif|png))") BaseCog = getattr(commands, "Cog", object) +listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad +if listener is None: + + def listener(name=None): + return lambda x: x + class Away(BaseCog): """Le away cog""" @@ -183,6 +189,7 @@ class Away(BaseCog): return True return False + @listener() async def on_message(self, message): tmp = {} guild = message.guild diff --git a/dungeon/dungeon.py b/dungeon/dungeon.py index 3c48054..1c8b056 100644 --- a/dungeon/dungeon.py +++ b/dungeon/dungeon.py @@ -7,6 +7,12 @@ from redbot.core.data_manager import cog_data_path BaseCog = getattr(commands, "Cog", object) +listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad +if listener is None: + + def listener(name=None): + return lambda x: x + class Dungeon(BaseCog): """Auto-quarantine suspicious users.""" @@ -348,6 +354,7 @@ class Dungeon(BaseCog): embed = discord.Embed(colour=ctx.guild.me.top_role.colour, description=msg) return await ctx.send(embed=embed) + @listener() async def on_member_join(self, member): default_avatar = False toggle = await self.config.guild(member.guild).toggle() diff --git a/nolinks/nolinks.py b/nolinks/nolinks.py index a3fca41..9eaadf3 100644 --- a/nolinks/nolinks.py +++ b/nolinks/nolinks.py @@ -5,6 +5,12 @@ from redbot.core import Config, commands, checks BaseCog = getattr(commands, "Cog", object) +listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad +if listener is None: + + def listener(name=None): + return lambda x: x + class NoLinks(BaseCog): def __init__(self, bot): self.bot = bot @@ -104,6 +110,7 @@ class NoLinks(BaseCog): await self.config.guild(ctx.guild).watching.set(channel_list) await ctx.send(f"{self.bot.get_channel(channel.id).mention} will not have links removed.") + @listener() async def on_message(self, message): if isinstance(message.channel, discord.abc.PrivateChannel): return diff --git a/otherbot/otherbot.py b/otherbot/otherbot.py index cd05e28..7f8e215 100644 --- a/otherbot/otherbot.py +++ b/otherbot/otherbot.py @@ -4,6 +4,11 @@ from redbot.core import commands, checks, Config BaseCog = getattr(commands, "Cog", object) +listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad +if listener is None: + + def listener(name=None): + return lambda x: x class Otherbot(BaseCog): def __init__(self, bot): @@ -75,6 +80,7 @@ class Otherbot(BaseCog): f"Reporting channel set to: {ctx.message.channel.mention}. Use `{ctx.prefix}otherbot channel` to change this." ) + @listener() async def on_member_update(self, before, after): data = await self.config.guild(after.guild).all() if after.status == discord.Status.offline and (after.id in data["watching"]): diff --git a/seen/seen.py b/seen/seen.py index 3934069..47dce26 100644 --- a/seen/seen.py +++ b/seen/seen.py @@ -7,6 +7,12 @@ from redbot.core import Config, commands BaseCog = getattr(commands, "Cog", object) +listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad +if listener is None: + + def listener(name=None): + return lambda x: x + class Seen(BaseCog): """Shows last time a user was seen in chat""" def __init__(self, bot): @@ -58,6 +64,7 @@ class Seen(BaseCog): d, h = divmod(h, 24) return (d, h, m) + @listener() async def on_message(self, message): if ( not isinstance(message.channel, discord.abc.PrivateChannel) diff --git a/trickortreat/trickortreat.py b/trickortreat/trickortreat.py index aac7878..a4be5f7 100644 --- a/trickortreat/trickortreat.py +++ b/trickortreat/trickortreat.py @@ -9,6 +9,11 @@ from redbot.core.utils.menus import menu, DEFAULT_CONTROLS __version__ = "0.0.5" BaseCog = getattr(commands, "Cog", object) +listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad +if listener is None: + + def listener(name=None): + return lambda x: x class TrickOrTreat(BaseCog): def __init__(self, bot): @@ -423,6 +428,7 @@ class TrickOrTreat(BaseCog): f"Trick or Treat, version {__version__}\n\n*0.0.5 updates:*\n**Save values before waiting on messages:\nQuick commands will not overwrite other values**\n\n*0.0.4 updates:*\n**+2% star chance on trick or treat (6% total)\n+5% lollipop chance on trick or treat (25% total)\nMore RP messages\nFix for steal mechanic freezing\n**" ) + @listener() async def on_message(self, message): if isinstance(message.channel, discord.abc.PrivateChannel): return