diff --git a/antiphoneclapper/antiphoneclapper.py b/antiphoneclapper/antiphoneclapper.py index 2923087..2521e8e 100644 --- a/antiphoneclapper/antiphoneclapper.py +++ b/antiphoneclapper/antiphoneclapper.py @@ -5,16 +5,8 @@ import discord 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): +class AntiPhoneClapper(commands.Cog): """This cog deletes bad GIFs that will crash phone clients.""" def __init__(self, bot): @@ -73,7 +65,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() + @commands.Cog.listener() async def on_message(self, m): if not m.attachments: return diff --git a/away/away.py b/away/away.py index 5f176d1..5ad9705 100644 --- a/away/away.py +++ b/away/away.py @@ -6,16 +6,8 @@ import re 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): +class Away(commands.Cog): """Le away cog""" default_global_settings = {"ign_servers": []} @@ -189,7 +181,7 @@ class Away(BaseCog): return True return False - @listener() + @commands.Cog.listener() async def on_message(self, message): tmp = {} guild = message.guild diff --git a/cah/cah.py b/cah/cah.py index 924835f..7323807 100644 --- a/cah/cah.py +++ b/cah/cah.py @@ -450,7 +450,7 @@ class CardsAgainstHumanity(BaseCog): member["Task"] = None continue # not enough members - send the embed - prefix = await self.bot.db.prefix() + prefix = await self.bot.get_valid_prefixes() stat_embed = discord.Embed(color=discord.Color.red()) stat_embed.set_author( name="Not enough players to continue! ({}/{})".format( diff --git a/chatchart/chatchart.py b/chatchart/chatchart.py index 7361775..db14b6c 100644 --- a/chatchart/chatchart.py +++ b/chatchart/chatchart.py @@ -16,9 +16,7 @@ plt.switch_backend("agg") from redbot.core import commands -BaseCog = getattr(commands, "Cog", object) - -class Chatchart(BaseCog): +class Chatchart(commands.Cog): """Show activity.""" def __init__(self, bot): diff --git a/dungeon/dungeon.py b/dungeon/dungeon.py index e792a81..f67dc40 100644 --- a/dungeon/dungeon.py +++ b/dungeon/dungeon.py @@ -41,7 +41,10 @@ class Dungeon(commands.Cog): dungeon_role_obj = discord.utils.get(ctx.guild.roles, id=dungeon_role_id) if blacklist: - async with self.bot.db.blacklist() as blacklist_list: + # if you are reading this to learn, DON'T do this, there will be a real way + # to interact with bot-owned data without touching config directly at some + # point in the future after Red 3.2 + async with self.bot._config.blacklist() as blacklist_list: if user.id not in blacklist_list: blacklist_list.append(user.id) diff --git a/nolinks/nolinks.py b/nolinks/nolinks.py index 9eaadf3..f83f60e 100644 --- a/nolinks/nolinks.py +++ b/nolinks/nolinks.py @@ -3,15 +3,7 @@ import re 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): +class NoLinks(commands.Cog): def __init__(self, bot): self.bot = bot self.config = Config.get_conf(self, 2740131001, force_registration=True) @@ -110,7 +102,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() + @commands.Cog.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 0309f18..8b6cbfd 100644 --- a/otherbot/otherbot.py +++ b/otherbot/otherbot.py @@ -2,15 +2,7 @@ import discord 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): +class Otherbot(commands.Cog): def __init__(self, bot): self.bot = bot self.config = Config.get_conf(self, 2730321001, force_registration=True) @@ -86,7 +78,7 @@ class Otherbot(BaseCog): f"Reporting channel set to: {ctx.message.channel.mention}. Use `{ctx.prefix}otherbot channel` to change this." ) - @listener() + @commands.Cog.listener() async def on_member_update(self, before, after): if after.guild is None or not after.bot: return diff --git a/partycrash/partycrash.py b/partycrash/partycrash.py index 568ac8c..0ab2e00 100644 --- a/partycrash/partycrash.py +++ b/partycrash/partycrash.py @@ -4,9 +4,7 @@ from redbot.core.utils.chat_formatting import box, pagify import asyncio -BaseCog = getattr(commands, "Cog", object) - -class PartyCrash(BaseCog): +class PartyCrash(commands.Cog): """Partycrash inspired by v2 Admin by Will Does not generate invites, only lists existing invites.""" diff --git a/rndstatus/rndstatus.py b/rndstatus/rndstatus.py index a33ce18..9e0f0d8 100644 --- a/rndstatus/rndstatus.py +++ b/rndstatus/rndstatus.py @@ -110,7 +110,7 @@ class RndStatus(commands.Cog): current_game = None statuses = await self.config.statuses() botstats = await self.config.botstats() - prefix = await self.bot.db.prefix() + prefix = await self.bot.get_valid_prefixes() streamer = await self.config.streamer() url = "https://www.twitch.tv/" + streamer diff --git a/trickortreat/trickortreat.py b/trickortreat/trickortreat.py index 05beacb..6b46f45 100644 --- a/trickortreat/trickortreat.py +++ b/trickortreat/trickortreat.py @@ -3,16 +3,11 @@ import datetime import discord import random import math -from typing import Union # <- Remove this at 3.2 -from babel.numbers import format_decimal # <- Remove this at 3.2 from redbot.core import commands, checks, Config, bank -from redbot.core.utils.chat_formatting import box, pagify #, humanize_number <- Will be for 3.2 +from redbot.core.utils.chat_formatting import box, pagify, humanize_number from redbot.core.utils.menus import menu, DEFAULT_CONTROLS -__version__ = "0.0.6a" - -def humanize_number(val: Union[int, float]): # <- Remove this at 3.2 - return format_decimal(val, locale="en_US") +__version__ = "0.0.7" class TrickOrTreat(commands.Cog):