diff --git a/away/away.py b/away/away.py index 90ea1a6..9bd5c4c 100644 --- a/away/away.py +++ b/away/away.py @@ -2,7 +2,9 @@ import discord from redbot.core import Config, commands, checks -class Away: +BaseCog = getattr(commands, "Cog", object) + +class Away(BaseCog): """Le away cog""" default_global_settings = {"ign_servers": []} diff --git a/blurplefy/blurplefy.py b/blurplefy/blurplefy.py index 7495876..0c67eef 100644 --- a/blurplefy/blurplefy.py +++ b/blurplefy/blurplefy.py @@ -20,7 +20,9 @@ darkblurple = (78, 93, 148) white = (255, 255, 255) -class Blurplefy: +BaseCog = getattr(commands, "Cog", object) + +class Blurplefy(BaseCog): def __init__(self, bot): """Blurplefy images and check content of images.""" self.bot = bot diff --git a/chatchart/chatchart.py b/chatchart/chatchart.py index 2df9a7a..d22a617 100644 --- a/chatchart/chatchart.py +++ b/chatchart/chatchart.py @@ -16,7 +16,9 @@ plt.switch_backend("agg") from redbot.core import commands -class Chatchart: +BaseCog = getattr(commands, "Cog", object) + +class Chatchart(BaseCog): """Show activity.""" def __init__(self, bot): diff --git a/dungeon/dungeon.py b/dungeon/dungeon.py index 78da9b6..f499cb9 100644 --- a/dungeon/dungeon.py +++ b/dungeon/dungeon.py @@ -5,7 +5,9 @@ from redbot.core import Config, commands, checks, modlog from redbot.core.data_manager import cog_data_path -class Dungeon: +BaseCog = getattr(commands, "Cog", object) + +class Dungeon(BaseCog): """Auto-quarantine suspicious users.""" def __init__(self, bot): diff --git a/inspirobot/inspirobot.py b/inspirobot/inspirobot.py index da90335..ac9b74e 100644 --- a/inspirobot/inspirobot.py +++ b/inspirobot/inspirobot.py @@ -3,7 +3,9 @@ import discord from redbot.core import commands -class Inspirobot: +BaseCog = getattr(commands, "Cog", object) + +class Inspirobot(BaseCog): """Posts images generated by https://inspirobot.me""" def __init__(self, bot): self.bot = bot diff --git a/nolinks/nolinks.py b/nolinks/nolinks.py index b137d9c..7916918 100644 --- a/nolinks/nolinks.py +++ b/nolinks/nolinks.py @@ -3,7 +3,9 @@ import re from redbot.core import Config, commands, checks -class NoLinks: +BaseCog = getattr(commands, "Cog", object) + +class NoLinks(BaseCog): def __init__(self, bot): self.bot = bot self.config = Config.get_conf(self, 2740131001, force_registration=True) diff --git a/otherbot/otherbot.py b/otherbot/otherbot.py index 1dd5b74..a747ac4 100644 --- a/otherbot/otherbot.py +++ b/otherbot/otherbot.py @@ -2,7 +2,9 @@ import discord from redbot.core import commands, checks, Config -class Otherbot: +BaseCog = getattr(commands, "Cog", object) + +class Otherbot(BaseCog): def __init__(self, bot): self.bot = bot self.config = Config.get_conf(self, 2730321001, force_registration=True) diff --git a/partycrash/partycrash.py b/partycrash/partycrash.py index cd14aa0..568ac8c 100644 --- a/partycrash/partycrash.py +++ b/partycrash/partycrash.py @@ -4,7 +4,9 @@ from redbot.core.utils.chat_formatting import box, pagify import asyncio -class PartyCrash: +BaseCog = getattr(commands, "Cog", object) + +class PartyCrash(BaseCog): """Partycrash inspired by v2 Admin by Will Does not generate invites, only lists existing invites.""" diff --git a/pingtime/pingtime.py b/pingtime/pingtime.py index 042abd2..1cf553a 100644 --- a/pingtime/pingtime.py +++ b/pingtime/pingtime.py @@ -1,7 +1,9 @@ from redbot.core import commands -class Pingtime: +BaseCog = getattr(commands, "Cog", object) + +class Pingtime(BaseCog): """🏓""" def __init__(self, bot): self.bot = bot diff --git a/retrosign/retrosign.py b/retrosign/retrosign.py index 132859c..6611b5d 100644 --- a/retrosign/retrosign.py +++ b/retrosign/retrosign.py @@ -12,7 +12,9 @@ import re import unicodedata -class Retrosign: +BaseCog = getattr(commands, "Cog", object) + +class Retrosign(BaseCog): """Make an 80s retro sign. Originally by Anismash""" def __init__(self, bot): self.bot = bot diff --git a/rndstatus/rndstatus.py b/rndstatus/rndstatus.py index eb6d73e..7deae03 100644 --- a/rndstatus/rndstatus.py +++ b/rndstatus/rndstatus.py @@ -4,7 +4,9 @@ from random import choice as rndchoice import time -class RndStatus: +BaseCog = getattr(commands, "Cog", object) + +class RndStatus(BaseCog): """Cycles random statuses or displays bot stats. If a custom status is already set, it won't change it until diff --git a/seen/seen.py b/seen/seen.py index 5918f79..3934069 100644 --- a/seen/seen.py +++ b/seen/seen.py @@ -4,7 +4,10 @@ import time from datetime import datetime from redbot.core import Config, commands -class Seen: + +BaseCog = getattr(commands, "Cog", object) + +class Seen(BaseCog): """Shows last time a user was seen in chat""" def __init__(self, bot): self.bot = bot diff --git a/timezone/timezone.py b/timezone/timezone.py index bb9ed19..1b8ffd6 100644 --- a/timezone/timezone.py +++ b/timezone/timezone.py @@ -8,7 +8,9 @@ from pytz import country_timezones from redbot.core import Config, commands, checks -class Timezone: +BaseCog = getattr(commands, "Cog", object) + +class Timezone(BaseCog): """Gets times across the world...""" def __init__(self, bot): @@ -107,42 +109,6 @@ class Timezone: "**Error:** Unrecognized timezone. Try `[p]time me Continent/City`: see " ) - @time.command() - async def place(self, ctx, *, city): - """Shows what time it is in other places.""" - city = city.replace(" ", "%20") - - async with self.session.request("GET", f"https://timezoneapi.io/api/address/?{city}") as r: - place_json = await r.json() - - if place_json["data"]["addresses_found"] != "0": - execution_time = place_json["meta"]["execution_time"] - city_state_country = place_json["data"]["addresses"]["formatted_address"] - twelve_hour_first = place_json["data"]["addresses"]["datetime"]["hour_12_wolz"] - twelve_hour_second = place_json["data"]["addresses"]["datetime"]["minutes"] - date_month_name = place_json["data"]["addresses"]["datetime"]["month_full"] - date_day_number = place_json["data"]["addresses"]["datetime"]["day"] - am_pm = place_json["data"]["addresses"]["datetime"]["hour_am_pm"] - day_name = place_json["data"]["addresses"]["datetime"]["day_full"] - part_of_day = place_json["data"]["addresses"]["datetime"]["timeday_spe"] - timezone = place_json["data"]["addresses"]["datetime"]["offset_tzid"] - timezone_short = place_json["data"]["addresses"]["datetime"]["offset_tzab"] - gmt = place_json["data"]["addresses"]["datetime"]["offset_gmt"] - - part_of_day = part_of_day.replace("_", " ") - part_of_day = part_of_day.capitalize() - timezone = timezone.replace("_", " ").replace("/", " - ") - - embed = discord.Embed() - embed = discord.Embed( - colour=await ctx.embed_colour(), title=f"{city_state_country} - {part_of_day}" - ) - embed.description = f"{day_name}, {date_month_name} {date_day_number}, {twelve_hour_first}:{twelve_hour_second} {am_pm}\n{timezone} ({timezone_short}) {gmt} UTC" - await ctx.send(embed=embed) - - if place_json["data"]["addresses_found"] == "0": - ctx.send("No result") - @time.command() @checks.admin_or_permissions(manage_server=True) async def set(self, ctx, user: discord.Member, *, tz): diff --git a/tools/tools.py b/tools/tools.py index 36c845e..5850707 100644 --- a/tools/tools.py +++ b/tools/tools.py @@ -12,7 +12,9 @@ from tabulate import tabulate from contextlib import suppress as sps -class Tools: +BaseCog = getattr(commands, "Cog", object) + +class Tools(BaseCog): """Mod and Admin tools.""" def __init__(self, bot): @@ -324,10 +326,11 @@ class Tools: ), colour=await ctx.embed_colour(), ) - member.add_field( - name="Users", - value="\n".join(m.display_name for m in guild.members if role in m.roles), - ) + if len([m for m in guild.members if role in m.roles]) != 0: + member.add_field( + name="Users", + value="\n".join(m.display_name for m in guild.members if role in m.roles), + ) await awaiter.edit(embed=member) elif len([m for m in guild.members if role in m.roles]) > 50: @@ -436,7 +439,7 @@ class Tools: await ctx.send(f"**{rolename} ID:** {role.id}") @commands.command() - async def rinfo(self, ctx, *, rolename): + async def rinfo(self, ctx, *, rolename): """Shows role info.""" channel = ctx.channel guild = ctx.guild diff --git a/wolfram/wolfram.py b/wolfram/wolfram.py index 9571e30..926ddf6 100644 --- a/wolfram/wolfram.py +++ b/wolfram/wolfram.py @@ -4,7 +4,9 @@ from redbot.core import Config, commands, checks import xml.etree.ElementTree as ET -class Wolfram: +BaseCog = getattr(commands, "Cog", object) + +class Wolfram(BaseCog): """Ask Wolfram Alpha a question.""" def __init__(self, bot):