[V3] RC1 Compliance, fixes

RC1 changes on all cogs. Tools has inrole fixed, now will display appropriately if 0 people are in the specified role. Timezone: removed the time place command as timezoneapi.io has changed to a paid service.
This commit is contained in:
aikaterna
2018-10-06 12:06:54 -07:00
parent 7129b52ee6
commit d8cd36f8ff
15 changed files with 52 additions and 56 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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 <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>"
)
@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):

View File

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

View File

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