V3.0 + V3.1 compability (#44)

* Update away.py

* Update dungeon.py

* V3.0 + V3.1 compability

* V3.0 + V3.1 compability

* V3.0 + V3.1 compability

* V3.0 + V3.1 compability

* V3.0 + V3.1 compability

* V3.0 + V3.1 compability
This commit is contained in:
Ellie
2019-05-22 17:06:40 +02:00
committed by aikaterna
parent 7e5d88a253
commit 831740f18c
7 changed files with 47 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -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"]):

View File

@@ -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)

View File

@@ -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