Skip to content

Commit

Permalink
Merge branch 'dpy2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiDuncan committed Jan 3, 2023
2 parents aaafaa1 + 9617c5c commit 413bb38
Show file tree
Hide file tree
Showing 37 changed files with 80 additions and 77 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ zip_safe = yes
include_package_data = True
install_requires =
colored==1.4.2
discord.py==1.5.1
discord.py==2.1.0
appdirs==1.4.3
toml==0.10.0
numpy==1.23.1
Expand Down
4 changes: 2 additions & 2 deletions sizebot/cogs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ async def sudo(self, ctx, victim: discord.Member, *, command):
await self.bot.process_commands(new_message)


def setup(bot):
bot.add_cog(AdminCog(bot))
async def setup(bot):
await bot.add_cog(AdminCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,5 @@ async def changeTask(self):
logger.error(e)


def setup(bot):
bot.add_cog(ChangeCog(bot))
async def setup(bot):
await bot.add_cog(ChangeCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,5 @@ async def on_message(self, m):
await nickmanager.nick_update(m.author)


def setup(bot):
bot.add_cog(EdgeCog(bot))
async def setup(bot):
await bot.add_cog(EdgeCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ async def evil(self, ctx, *, evalStr):
await ctx.author.send(emojis.warning + f" ` {utils.formatError(err)} `")


def setup(bot):
bot.add_cog(EvalCog(bot))
async def setup(bot):
await bot.add_cog(EvalCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ async def on_message(self, message):
await cont.invoke(self.bot.get_command("digipee"))


def setup(bot):
bot.add_cog(FunCog(bot))
async def setup(bot):
await bot.add_cog(FunCog(bot))
12 changes: 6 additions & 6 deletions sizebot/cogs/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from datetime import datetime
from packaging import version

from discord import Embed, Webhook, AsyncWebhookAdapter
from discord import Embed, Webhook
from discord.ext import commands

from sizebot import __version__
Expand Down Expand Up @@ -41,7 +41,7 @@

async def post_report(report_type, message, report_text):
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url(conf.bugwebhookurl, adapter=AsyncWebhookAdapter(session))
webhook = Webhook.from_url(conf.bugwebhookurl, session = session)
guild_name = "DM" if not message.channel.guild else message.channel.guild.name
await webhook.send(
f"**{report_type}** from <@{message.author.id}> in {guild_name}:\n"
Expand Down Expand Up @@ -110,7 +110,7 @@ async def send_summary_help(self, ctx):

embed = Embed(title=f"Help [SizeBot {__version__}]")
embed.set_footer(text = "Select an emoji to see details about a category.")
embed.set_author(name = f"requested by {ctx.author.name}", icon_url = ctx.author.avatar_url)
embed.set_author(name = f"requested by {ctx.author.name}", icon_url = ctx.author.avatar)

# Add each category to a field
for cat in categories:
Expand Down Expand Up @@ -145,7 +145,7 @@ async def send_summary_help(self, ctx):
async def send_category_help(self, ctx, category, cmds):
# Prepare the embed for the category
embed = Embed(title=f"{category.name} Help [SizeBot {__version__}]")
embed.set_author(name = ctx.author.name, icon_url = ctx.author.avatar_url)
embed.set_author(name = ctx.author.name, icon_url = ctx.author.avatar)

command_texts = [f"`{c.name}` {c.alias_string}\n{c.short_doc}" for c in cmds]
embed.add_field(value=f"**{category.emoji}{category.name}**", inline=False)
Expand Down Expand Up @@ -412,5 +412,5 @@ def __init__(self, cid: str, name: str, description: str, emoji: str):
]


def setup(bot):
bot.add_cog(HelpCog(bot))
async def setup(bot):
await bot.add_cog(HelpCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/holiday.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ async def secretsanta(self, ctx):
alreadyclaimed.add(userid)


def setup(bot):
bot.add_cog(HolidayCog(bot))
async def setup(bot):
await bot.add_cog(HolidayCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/keypad.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ def check(reaction, reacter):
await outputmsg.clear_reactions()


def setup(bot):
bot.add_cog(KeypadCog(bot))
async def setup(bot):
await bot.add_cog(KeypadCog(bot))
6 changes: 3 additions & 3 deletions sizebot/cogs/limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logger = logging.getLogger("sizebot")


class EdgeCog(commands.Cog):
class LimitCog(commands.Cog):
"""Commands to create or clear edge users."""

def __init__(self, bot):
Expand Down Expand Up @@ -116,5 +116,5 @@ async def on_message(self, m):
await nickmanager.nick_update(m.author)


def setup(bot):
bot.add_cog(EdgeCog(bot))
async def setup(bot):
await bot.add_cog(LimitCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ async def sofar(self, ctx, *, who = None):
await ctx.send(out)


def setup(bot):
bot.add_cog(LoopCog(bot))
async def setup(bot):
await bot.add_cog(LoopCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/multiplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,5 @@ async def steal(self, ctx, amount: Union[SV, WV], victim: discord.Member, thief:
await ctx.send(embed = e)


def setup(bot):
bot.add_cog(MPCog(bot))
async def setup(bot):
await bot.add_cog(MPCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/naptime.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ async def nannyTask(self):
logger.error(e)


def setup(bot):
bot.add_cog(NaptimeCog(bot))
async def setup(bot):
await bot.add_cog(NaptimeCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,5 +400,5 @@ async def tags(self, ctx):
await ctx.send(out)


def setup(bot):
bot.add_cog(ObjectsCog(bot))
async def setup(bot):
await bot.add_cog(ObjectsCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/pokemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ async def lookatpokemon(self, ctx, pkmn: typing.Union[int, str] = None, *, who:
await ctx.send(embed = e)


def setup(bot):
bot.add_cog(PokemonCog(bot))
async def setup(bot):
await bot.add_cog(PokemonCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ async def profile(self, ctx, member: discord.Member = None):
await ctx.send(embed = profileembed)


def setup(bot):
bot.add_cog(ProfileCog(bot))
async def setup(bot):
await bot.add_cog(ProfileCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/rainbow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ async def before_rainbower(self):
await self.bot.wait_until_ready()


def setup(bot):
bot.add_cog(RainbowCog(bot))
async def setup(bot):
await bot.add_cog(RainbowCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,5 +426,5 @@ def check(reaction, reacter):
await ctx.send(f"Successfully copied profile from *{self.bot.get_guild(int(chosenguildid)).name}* to here!")


def setup(bot):
bot.add_cog(RegisterCog(bot))
async def setup(bot):
await bot.add_cog(RegisterCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/roll.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ async def r(self, ctx, *, dString):
await ctx.send(f"{ctx.author.display_name} rolled `{dString}` = **{result.total}**")


def setup(bot):
bot.add_cog(RollCog(bot))
async def setup(bot):
await bot.add_cog(RollCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ async def runTask(self):
logger.error(e)


def setup(bot):
bot.add_cog(RunCog(bot))
async def setup(bot):
await bot.add_cog(RunCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/say.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,5 +320,5 @@ async def sayto(self, ctx, memberOrHeight: typing.Union[discord.Member, SV], *,
await ctx.send(f"{nick} {verb} to {othernick}: \n> {m}")


def setup(bot):
bot.add_cog(SayCog(bot))
async def setup(bot):
await bot.add_cog(SayCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/scaletalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ async def on_message(self, message):
userdb.save(userdata)


def setup(bot):
bot.add_cog(ScaleTypeCog(bot))
async def setup(bot):
await bot.add_cog(ScaleTypeCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/scalewalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,5 @@ async def step(self, ctx, steps = None):
userdb.save(userdata)


def setup(bot):
bot.add_cog(ScaleWalkCog(bot))
async def setup(bot):
await bot.add_cog(ScaleWalkCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,5 +756,5 @@ async def clearview(self, ctx, *, user: discord.Member):
await ctx.send(f"Cleared {userdata.nickname}'s view.")


def setup(bot):
bot.add_cog(SetCog(bot))
async def setup(bot):
await bot.add_cog(SetCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/setbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,5 @@ async def setbaseswim(self, ctx, *, newswim: ParseableRate):
await showNextStep(ctx, userdata)


def setup(bot):
bot.add_cog(SetBaseCog(bot))
async def setup(bot):
await bot.add_cog(SetBaseCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,5 @@ async def gravitycompare(self, ctx, memberOrHeight: typing.Union[discord.Member,
await ctx.send(f"Standing on {larger_person.nickname}, {smaller_person.nickname} would experience **{gs:.3}**g of gravitational force.")


def setup(bot):
bot.add_cog(StatsCog(bot))
async def setup(bot):
await bot.add_cog(StatsCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ async def test(self, ctx):
await reactionmenu.message.edit(content = reactionmenu.message.content + f"\nYou pressed {answer}. Good job!")


def setup(bot):
bot.add_cog(TestCog(bot))
async def setup(bot):
await bot.add_cog(TestCog(bot))
6 changes: 3 additions & 3 deletions sizebot/cogs/thistracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def on_message(self, m):
return
if isAgreementMessage(m.content):
channel = m.channel
messages = await channel.history(limit=100).flatten()
messages = [m async for m in channel.history(limit=100)]
if findLatestNonThis(messages).author.id == m.author.id:
return
tracker = ThisTracker.load()
Expand All @@ -128,5 +128,5 @@ async def on_reaction_add(self, r, u):
tracker.save()


def setup(bot):
bot.add_cog(ThisCog(bot))
async def setup(bot):
await bot.add_cog(ThisCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,5 @@ async def clearalltriggers(self, ctx):
await ctx.send("Removed all trigger words.")


def setup(bot):
bot.add_cog(TriggerCog(bot))
async def setup(bot):
await bot.add_cog(TriggerCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/weird.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,5 @@ async def math(self, ctx, *, equation):
await ctx.send("Math failed.")


def setup(bot):
bot.add_cog(WeirdCog(bot))
async def setup(bot):
await bot.add_cog(WeirdCog(bot))
4 changes: 2 additions & 2 deletions sizebot/cogs/winks.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@ async def winkcount(self, ctx):
logger.info(f"Wink count requested by {ctx.author.nickname}! Current count: {winkcount} times!")


def setup(bot):
bot.add_cog(WinksCog(bot))
async def setup(bot):
await bot.add_cog(WinksCog(bot))
2 changes: 1 addition & 1 deletion sizebot/extensions/banned.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ def denyGuildBan(ctx):
return not isGuildBanned


def setup(bot):
async def setup(bot):
bot.add_check(denyGuildBan)
2 changes: 1 addition & 1 deletion sizebot/extensions/errorhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logger = logging.getLogger("sizebot")


def setup(bot):
async def setup(bot):
@bot.event
async def on_command_error(ctx, error):
# Get actual error
Expand Down
2 changes: 1 addition & 1 deletion sizebot/extensions/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from sizebot.lib import telemetry


def setup(bot):
async def setup(bot):
@bot.listen
def on_command(ctx):
# Log command runs to telemetry
Expand Down
2 changes: 1 addition & 1 deletion sizebot/extensions/tupperbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ def ignoreTupperbox(ctx):
return not (ctx.message.content.startswith(ctx.prefix) and ctx.message.content.endswith(ctx.prefix))


def setup(bot):
async def setup(bot):
bot.add_check(ignoreTupperbox)
2 changes: 1 addition & 1 deletion sizebot/lib/userdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ def load(guildid, userid, *, member=None, allow_unreg=False) -> User:
if member:
if not user.gender:
user.soft_gender = member.gender
user.avatar_url = member.avatar_url
user.avatar_url = member.avatar

if (not allow_unreg) and (not user.registered):
raise errors.UserNotFoundException(guildid, userid, unreg=True)
Expand Down
13 changes: 8 additions & 5 deletions sizebot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,14 @@ def main():
objs.init()
pokemon.init()

for extension in initial_extensions:
bot.load_extension("sizebot.extensions." + extension)
for cog in initial_cogs:
bot.load_extension("sizebot.cogs." + cog)
bot.load_extension("sizeroyale.cogs.royale")
@bot.event
async def setup_hook():
logger.info("Setup hook called!")
for extension in initial_extensions:
await bot.load_extension("sizebot.extensions." + extension)
for cog in initial_cogs:
await bot.load_extension("sizebot.cogs." + cog)
# await bot.load_extension("sizeroyale.cogs.royale")

@bot.event
async def on_first_ready():
Expand Down

0 comments on commit 413bb38

Please sign in to comment.