From c8df4a0b9093767d5a7b92948fee5403e1e4c7b6 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 29 May 2022 20:08:02 -0600 Subject: [PATCH] Prepare for embed=embed removal --- jarvis/client.py | 22 +++++++++++----------- jarvis/cogs/admin/ban.py | 4 ++-- jarvis/cogs/admin/kick.py | 4 ++-- jarvis/cogs/admin/modcase.py | 10 +++++----- jarvis/cogs/admin/mute.py | 6 +++--- jarvis/cogs/admin/warning.py | 2 +- jarvis/cogs/botutil.py | 8 ++++---- jarvis/cogs/dbrand.py | 8 ++++---- jarvis/cogs/dev.py | 6 +++--- jarvis/cogs/gl.py | 8 ++++---- jarvis/cogs/image.py | 2 +- jarvis/cogs/remindme.py | 10 +++++----- jarvis/cogs/rolegiver.py | 10 +++++----- jarvis/cogs/settings.py | 2 +- jarvis/cogs/starboard.py | 2 +- jarvis/cogs/temprole.py | 2 +- jarvis/cogs/util.py | 12 ++++++------ 17 files changed, 59 insertions(+), 59 deletions(-) diff --git a/jarvis/client.py b/jarvis/client.py index 338c96a..377e15b 100644 --- a/jarvis/client.py +++ b/jarvis/client.py @@ -258,7 +258,7 @@ class Jarvis(Client): text=f"{ctx.author.user.username}#{ctx.author.discriminator} | {ctx.author.id}" ) if channel: - await channel.send(embed=embed) + await channel.send(embeds=embed) else: self.logger.warning( f"Activitylog channel no longer exists in {ctx.guild.name}, removing" @@ -295,7 +295,7 @@ class Jarvis(Client): ) embed.set_author(name=user.username, icon_url=user.avatar.url) embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}") - await channel.send(embed=embed) + await channel.send(embeds=embed) async def process_verify(self, before: Member, after: Member) -> Embed: """Process user verification.""" @@ -413,7 +413,7 @@ class Jarvis(Client): embed = embed or await self.process_rolechange(before, after) embed = embed or await self.process_rename(before, after) if embed: - await channel.send(embed=embed) + await channel.send(embeds=embed) # Message async def autopurge(self, message: Message) -> None: @@ -486,7 +486,7 @@ class Jarvis(Client): user=message.author.id, ).commit() embed = warning_embed(message.author, "Sent an invite link") - await message.channel.send(embed=embed) + await message.channel.send(embeds=embed) async def massmention(self, message: Message) -> None: """Handle massmention events.""" @@ -518,7 +518,7 @@ class Jarvis(Client): user=message.author.id, ).commit() embed = warning_embed(message.author, "Mass Mention") - await message.channel.send(embed=embed) + await message.channel.send(embeds=embed) async def roleping(self, message: Message) -> None: """Handle roleping events.""" @@ -579,7 +579,7 @@ class Jarvis(Client): user=message.author.id, ).commit() embed = warning_embed(message.author, "Pinged a blocked role/user with a blocked role") - await message.channel.send(embed=embed) + await message.channel.send(embeds=embed) async def phishing(self, message: Message) -> None: """Check if the message contains any known phishing domains.""" @@ -599,7 +599,7 @@ class Jarvis(Client): user=message.author.id, ).commit() embed = warning_embed(message.author, "Phishing URL") - await message.channel.send(embed=embed) + await message.channel.send(embeds=embed) await message.delete() return True return False @@ -631,7 +631,7 @@ class Jarvis(Client): ).commit() reasons = ", ".join(item["not_safe_reasons"]) embed = warning_embed(message.author, reasons) - await message.channel.send(embed=embed) + await message.channel.send(embeds=embed) await message.delete() return True return False @@ -689,7 +689,7 @@ class Jarvis(Client): embed.set_footer( text=f"{after.author.username}#{after.author.discriminator} | {after.author.id}" ) - await channel.send(embed=embed) + await channel.send(embeds=embed) except Exception as e: self.logger.warning( f"Failed to process edit {before.guild.id}/{before.channel.id}/{before.id}: {e}" @@ -765,7 +765,7 @@ class Jarvis(Client): f"{message.author.id}" ) ) - await channel.send(embed=embed) + await channel.send(embeds=embed) except Exception as e: self.logger.warning( f"Failed to process edit {message.guild.id}/{message.channel.id}/{message.id}: {e}" @@ -831,7 +831,7 @@ class Jarvis(Client): icon_url=user.display_avatar.url, ) - await context.message.edit(embed=embed) + await context.message.edit(embeds=embed) elif not user: self.logger.debug("User no longer in guild") await context.send("User no longer in guild", ephemeral=True) diff --git a/jarvis/cogs/admin/ban.py b/jarvis/cogs/admin/ban.py index 2cbe0c6..e0e9ed7 100644 --- a/jarvis/cogs/admin/ban.py +++ b/jarvis/cogs/admin/ban.py @@ -63,7 +63,7 @@ class BanCog(ModcaseCog): embed.set_thumbnail(url=user.avatar.url) embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}") - await ctx.send(embed=embed) + await ctx.send(embeds=embed) async def discord_apply_unban(self, ctx: InteractionContext, user: User, reason: str) -> None: """Apply a Discord unban.""" @@ -89,7 +89,7 @@ class BanCog(ModcaseCog): ) embed.set_thumbnail(url=user.avatar.url) embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}") - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @slash_command(name="ban", description="Ban a user") @slash_option(name="user", description="User to ban", opt_type=OptionTypes.USER, required=True) diff --git a/jarvis/cogs/admin/kick.py b/jarvis/cogs/admin/kick.py index 1f60354..0653a5d 100644 --- a/jarvis/cogs/admin/kick.py +++ b/jarvis/cogs/admin/kick.py @@ -53,7 +53,7 @@ class KickCog(ModcaseCog): send_failed = False try: - await user.send(embed=embed) + await user.send(embeds=embed) except Exception: send_failed = True try: @@ -80,4 +80,4 @@ class KickCog(ModcaseCog): guild=ctx.guild.id, ) await k.commit() - await ctx.send(embed=embed) + await ctx.send(embeds=embed) diff --git a/jarvis/cogs/admin/modcase.py b/jarvis/cogs/admin/modcase.py index 22a0bc6..039c531 100644 --- a/jarvis/cogs/admin/modcase.py +++ b/jarvis/cogs/admin/modcase.py @@ -227,7 +227,7 @@ class CaseCog(Extension): return embed = await self.get_summary_embed(case, ctx.guild) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @show.subcommand(sub_cmd_name="actions", sub_cmd_description="Get case actions") @slash_option(name="cid", description="Case ID", opt_type=OptionTypes.STRING, required=True) @@ -255,7 +255,7 @@ class CaseCog(Extension): await case.commit() embed = await self.get_summary_embed(case, ctx.guild) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @case.subcommand(sub_cmd_name="repoen", sub_cmd_description="Reopen a specific case") @slash_option(name="cid", description="Case ID", opt_type=OptionTypes.STRING, required=True) @@ -270,7 +270,7 @@ class CaseCog(Extension): await case.commit() embed = await self.get_summary_embed(case, ctx.guild) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @case.subcommand(sub_cmd_name="note", sub_cmd_description="Add a note to a specific case") @slash_option(name="cid", description="Case ID", opt_type=OptionTypes.STRING, required=True) @@ -298,7 +298,7 @@ class CaseCog(Extension): await case.commit() embed = await self.get_summary_embed(case, ctx.guild) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @case.subcommand(sub_cmd_name="new", sub_cmd_description="Open a new case") @slash_option(name="user", description="Target user", opt_type=OptionTypes.USER, required=True) @@ -329,4 +329,4 @@ class CaseCog(Extension): await case.reload() embed = await self.get_summary_embed(case, ctx.guild) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) diff --git a/jarvis/cogs/admin/mute.py b/jarvis/cogs/admin/mute.py index 51edda8..74745a4 100644 --- a/jarvis/cogs/admin/mute.py +++ b/jarvis/cogs/admin/mute.py @@ -123,7 +123,7 @@ class MuteCog(ModcaseCog): return try: embed = await self._apply_timeout(ctx, ctx.target, reason, until) - await response.send(embed=embed) + await response.send(embeds=embed) except Forbidden: await response.send("Unable to mute this user", ephemeral=True) @@ -183,7 +183,7 @@ class MuteCog(ModcaseCog): until = datetime.now(tz=timezone.utc) + timedelta(minutes=duration) try: embed = await self._apply_timeout(ctx, user, reason, until) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) except Forbidden: await ctx.send("Unable to mute this user", ephemeral=True) @@ -215,4 +215,4 @@ class MuteCog(ModcaseCog): embed.set_author(name=user.display_name, icon_url=user.display_avatar.url) embed.set_thumbnail(url=user.display_avatar.url) embed.set_footer(text=f"{user.username}#{user.discriminator} | {user.id}") - await ctx.send(embed=embed) + await ctx.send(embeds=embed) diff --git a/jarvis/cogs/admin/warning.py b/jarvis/cogs/admin/warning.py index c118ee0..4b67104 100644 --- a/jarvis/cogs/admin/warning.py +++ b/jarvis/cogs/admin/warning.py @@ -66,7 +66,7 @@ class WarningCog(ModcaseCog): active=True, ).commit() embed = warning_embed(user, reason) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @slash_command(name="warnings", description="Get count of user warnings") @slash_option(name="user", description="User to view", opt_type=OptionTypes.USER, required=True) diff --git a/jarvis/cogs/botutil.py b/jarvis/cogs/botutil.py index 96617ea..61a49f5 100644 --- a/jarvis/cogs/botutil.py +++ b/jarvis/cogs/botutil.py @@ -71,7 +71,7 @@ class BotutilCog(Extension): ) embed = build_embed(title="System Info", description="", fields=fields) embed.set_image(url=self.bot.user.avatar.url) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @prefixed_command(name="update") async def _update(self, ctx: PrefixedContext) -> None: @@ -105,14 +105,14 @@ class BotutilCog(Extension): self.logger.info("Updates applied") content = f"```ansi\n{capture.get()}\n```" if len(content) < 3000: - await ctx.reply(content, embed=embed) + await ctx.reply(content, embeds=embed) else: - await ctx.reply(f"Total Changes: {status.lines['total_lines']}", embed=embed) + await ctx.reply(f"Total Changes: {status.lines['total_lines']}", embeds=embed) else: embed = build_embed(title="Update Status", description="No changes applied", fields=[]) embed.set_thumbnail(url="https://dev.zevaryx.com/git.png") - await ctx.reply(embed=embed) + await ctx.reply(embeds=embed) def setup(bot: Client) -> None: diff --git a/jarvis/cogs/dbrand.py b/jarvis/cogs/dbrand.py index 9e0fbd0..c9e34d5 100644 --- a/jarvis/cogs/dbrand.py +++ b/jarvis/cogs/dbrand.py @@ -65,7 +65,7 @@ class DbrandCog(Extension): embed.set_author( name="dbrand", url=self.base_url, icon_url="https://dev.zevaryx.com/db_logo.png" ) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @db.subcommand( sub_cmd_name="contact", @@ -159,7 +159,7 @@ class DbrandCog(Extension): text="dbrand.com", icon_url="https://dev.zevaryx.com/db_logo.png", ) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) elif not data["is_valid"]: embed = build_embed( title="Check Shipping Times", @@ -176,7 +176,7 @@ class DbrandCog(Extension): text="dbrand.com", icon_url="https://dev.zevaryx.com/db_logo.png", ) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) elif not data["shipping_available"]: embed = build_embed( title="Shipping to {}".format(data["country"]), @@ -194,7 +194,7 @@ class DbrandCog(Extension): text="dbrand.com", icon_url="https://dev.zevaryx.com/db_logo.png", ) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) def setup(bot: Client) -> None: diff --git a/jarvis/cogs/dev.py b/jarvis/cogs/dev.py index e5b173a..7675d7a 100644 --- a/jarvis/cogs/dev.py +++ b/jarvis/cogs/dev.py @@ -113,7 +113,7 @@ class DevCog(Extension): ] embed = build_embed(title=title, description=description, fields=fields) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @slash_command(name="uuid", description="Generate a UUID") @slash_option( @@ -229,7 +229,7 @@ class DevCog(Extension): EmbedField(name=mstr, value=f"`{encoded}`", inline=False), ] embed = build_embed(title="Decoded Data", description="", fields=fields) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @slash_command(name="decode", description="Decode some data") @slash_option( @@ -264,7 +264,7 @@ class DevCog(Extension): EmbedField(name=mstr, value=f"`{decoded}`", inline=False), ] embed = build_embed(title="Decoded Data", description="", fields=fields) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @slash_command(name="cloc", description="Get JARVIS lines of code") @cooldown(bucket=Buckets.CHANNEL, rate=1, interval=30) diff --git a/jarvis/cogs/gl.py b/jarvis/cogs/gl.py index 5539383..1b97585 100644 --- a/jarvis/cogs/gl.py +++ b/jarvis/cogs/gl.py @@ -104,7 +104,7 @@ class GitlabCog(Extension): embed.set_thumbnail( url="https://about.gitlab.com/images/press/logo/png/gitlab-icon-rgb.png" ) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @gl.subcommand( sub_cmd_name="milestone", @@ -158,7 +158,7 @@ class GitlabCog(Extension): embed.set_thumbnail( url="https://about.gitlab.com/images/press/logo/png/gitlab-icon-rgb.png" ) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @gl.subcommand( sub_cmd_name="mr", @@ -235,7 +235,7 @@ class GitlabCog(Extension): embed.set_thumbnail( url="https://about.gitlab.com/images/press/logo/png/gitlab-icon-rgb.png" ) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) def build_embed_page(self, api_list: list, t_state: str, name: str) -> Embed: """Build an embed page for the paginator.""" @@ -462,7 +462,7 @@ class GitlabCog(Extension): fields=[], color="#00FFEE", ) - await resp.send(embed=embed) + await resp.send(embeds=embed) def setup(bot: Client) -> None: diff --git a/jarvis/cogs/image.py b/jarvis/cogs/image.py index 9a9ef4b..10d9b01 100644 --- a/jarvis/cogs/image.py +++ b/jarvis/cogs/image.py @@ -148,7 +148,7 @@ class ImageCog(Extension): embed = build_embed(title=filename, description="", fields=fields) embed.set_image(url="attachment://resized.png") await ctx.send( - embed=embed, + embeds=embed, file=File(file=bufio, file_name="resized.png"), ) diff --git a/jarvis/cogs/remindme.py b/jarvis/cogs/remindme.py index 7ade813..9030a90 100644 --- a/jarvis/cogs/remindme.py +++ b/jarvis/cogs/remindme.py @@ -166,7 +166,7 @@ class RemindmeCog(Extension): ) embed.set_thumbnail(url=ctx.author.display_avatar.url) - await response.send(embed=embed, ephemeral=private) + await response.send(embeds=embed, ephemeral=private) async def get_reminders_embed( self, ctx: InteractionContext, reminders: List[Reminder] @@ -216,7 +216,7 @@ class RemindmeCog(Extension): embed = await self.get_reminders_embed(ctx, reminders) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @reminders.subcommand(sub_cmd_name="delete", sub_cmd_description="Delete a reminder") async def _delete(self, ctx: InteractionContext) -> None: @@ -246,7 +246,7 @@ class RemindmeCog(Extension): embed = await self.get_reminders_embed(ctx, reminders) message = await ctx.send( content=f"You have {len(reminders)} reminder(s) set:", - embed=embed, + embeds=embed, components=components, ) @@ -300,7 +300,7 @@ class RemindmeCog(Extension): await context.context.edit_origin( content=f"Deleted {len(context.context.values)} reminder(s)", components=components, - embed=embed, + embeds=embed, ) except asyncio.TimeoutError: for row in components: @@ -328,7 +328,7 @@ class RemindmeCog(Extension): ) embed.set_thumbnail(url=ctx.author.display_avatar) - await ctx.send(embed=embed, ephemeral=reminder.private) + await ctx.send(embeds=embed, ephemeral=reminder.private) if reminder.remind_at <= datetime.now(tz=timezone.utc) and not reminder.active: try: await reminder.delete() diff --git a/jarvis/cogs/rolegiver.py b/jarvis/cogs/rolegiver.py index ce61baf..cf818ed 100644 --- a/jarvis/cogs/rolegiver.py +++ b/jarvis/cogs/rolegiver.py @@ -93,7 +93,7 @@ class RolegiverCog(Extension): embed.set_footer(text=f"{ctx.author.username}#{ctx.author.discriminator} | {ctx.author.id}") - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @rolegiver.subcommand(sub_cmd_name="remove", sub_cmd_description="Remove a role from rolegiver") @check(admin_or_permissions(Permissions.MANAGE_GUILD)) @@ -169,7 +169,7 @@ class RolegiverCog(Extension): await context.context.edit_origin( content=f"Removed {len(context.context.values)} role(s)", - embed=embed, + embeds=embed, components=components, ) except asyncio.TimeoutError: @@ -211,7 +211,7 @@ class RolegiverCog(Extension): embed.set_footer(text=f"{ctx.author.username}#{ctx.author.discriminator} | {ctx.author.id}") - await ctx.send(embed=embed) + await ctx.send(embeds=embed) role = SlashCommand(name="role", description="Get/Remove Rolegiver roles") @@ -284,7 +284,7 @@ class RolegiverCog(Extension): for component in row.components: component.disabled = True - await context.context.edit_origin(embed=embed, content="\u200b", components=components) + await context.context.edit_origin(embeds=embed, content="\u200b", components=components) except asyncio.TimeoutError: for row in components: for component in row.components: @@ -362,7 +362,7 @@ class RolegiverCog(Extension): for component in row.components: component.disabled = True - await context.context.edit_origin(embed=embed, components=components, content="\u200b") + await context.context.edit_origin(embeds=embed, components=components, content="\u200b") except asyncio.TimeoutError: for row in components: diff --git a/jarvis/cogs/settings.py b/jarvis/cogs/settings.py index 93eeb79..7595cfc 100644 --- a/jarvis/cogs/settings.py +++ b/jarvis/cogs/settings.py @@ -246,7 +246,7 @@ class SettingsCog(Extension): embed = build_embed(title="Current Settings", description="", fields=fields) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @settings.subcommand(sub_cmd_name="clear", sub_cmd_description="Clear all settings") @check(admin_or_permissions(Permissions.MANAGE_GUILD)) diff --git a/jarvis/cogs/starboard.py b/jarvis/cogs/starboard.py index b326a51..dc2aaad 100644 --- a/jarvis/cogs/starboard.py +++ b/jarvis/cogs/starboard.py @@ -218,7 +218,7 @@ class StarboardCog(Extension): if image_url: embed.set_image(url=image_url) - star = await starboard.send(embed=embed) + star = await starboard.send(embeds=embed) await Star( index=count, diff --git a/jarvis/cogs/temprole.py b/jarvis/cogs/temprole.py index 48bf8f1..d2a89a3 100644 --- a/jarvis/cogs/temprole.py +++ b/jarvis/cogs/temprole.py @@ -118,7 +118,7 @@ class TemproleCog(Extension): name=f"{user.username}#{user.discriminator}", icon_url=user.display_avatar.url ) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) def setup(bot: Client) -> None: diff --git a/jarvis/cogs/util.py b/jarvis/cogs/util.py index aeae54d..d38ac79 100644 --- a/jarvis/cogs/util.py +++ b/jarvis/cogs/util.py @@ -67,7 +67,7 @@ class UtilCog(Extension): ) ) embed = build_embed(title=title, description=desc, fields=fields, color=color) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @slash_command( name="logo", @@ -132,7 +132,7 @@ class UtilCog(Extension): embed = build_embed(title="Avatar", description="", fields=[], color="#00FFEE") embed.set_image(url=avatar) embed.set_author(name=f"{user.username}#{user.discriminator}", icon_url=avatar) - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @slash_command( name="roleinfo", @@ -180,7 +180,7 @@ class UtilCog(Extension): image_bytes.seek(0) color_show = File(image_bytes, file_name="color_show.png") - await ctx.send(embed=embed, file=color_show) + await ctx.send(embeds=embed, file=color_show) async def _userinfo(self, ctx: InteractionContext, user: User = None) -> None: await ctx.defer() @@ -222,7 +222,7 @@ class UtilCog(Extension): embed.set_thumbnail(url=user.display_avatar.url) embed.set_footer(text=f"ID: {user.id}") - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @slash_command( name="userinfo", @@ -277,7 +277,7 @@ class UtilCog(Extension): embed.set_thumbnail(url=guild.icon.url) embed.set_footer(text=f"ID: {guild.id} | Server Created") - await ctx.send(embed=embed) + await ctx.send(embeds=embed) @slash_command( name="pw", @@ -372,7 +372,7 @@ class UtilCog(Extension): EmbedField(name="ISO8601", value=timestamp.isoformat()), ] embed = build_embed(title="Converted Time", description=f"`{string}`", fields=fields) - await ctx.send(embed=embed, ephemeral=private) + await ctx.send(embeds=embed, ephemeral=private) @slash_command(name="support", description="Got issues?") async def _support(self, ctx: InteractionContext) -> None: