diff --git a/ampremover/ampremover.py b/ampremover/ampremover.py index 90d0584..4217a28 100644 --- a/ampremover/ampremover.py +++ b/ampremover/ampremover.py @@ -36,20 +36,15 @@ async def opt_out(self, ctx): @amputator.command(name='convert') async def convert_amp(self, ctx, *, message: str): """Converts AMP URLs to canonical URLs using AmputatorBot API""" - if ctx.guild is None: # DM context - if ctx.author.id not in self.opted_in_users: - await ctx.send(f"{ctx.author.mention}, you need to opt-in to use this service in DMs. Use the `[p]amputator optin` command.") - return - else: # Server context - if ctx.guild.id not in self.opted_in_servers: - await ctx.send(f"Server {ctx.guild.name} needs to opt-in to use this service. Use the `[p]amputator optin` command.") - return - urls = re.findall(r'(https?://\S+)', message) if not urls: await ctx.send("No URLs found in the message.") return + if ctx.guild is not None and ctx.guild.id not in self.opted_in_servers: + # If the server hasn't opted in, do not respond + return + canonical_links = [] for url in urls: api_url = f"https://www.amputatorbot.com/api/v1/convert?gac=true&md=3&q={url}"