diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2024-03-06 20:15:09 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2024-03-06 20:56:41 +0000 |
commit | 54a8d59a146d56148c65e248350c3bd6ecde526c (patch) | |
tree | dddb0aa7f8b81c56275594742b01239ba6b9b082 | |
parent | b0ba0fa7a55ce9210df7786f83b5991defcf6880 (diff) | |
download | aps-cogs-54a8d59a146d56148c65e248350c3bd6ecde526c.tar aps-cogs-54a8d59a146d56148c65e248350c3bd6ecde526c.tar.gz aps-cogs-54a8d59a146d56148c65e248350c3bd6ecde526c.zip |
markov: switch from reply to send
This is useful for certain purposes
-rw-r--r-- | markov/markov.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/markov/markov.py b/markov/markov.py index e977aaa..a61a3ce 100644 --- a/markov/markov.py +++ b/markov/markov.py @@ -51,7 +51,9 @@ class Markov(commands.Cog): async def process_message(self, clean_content: str, guild_id: int, member_id: int): # Ignore messages with blacklisted strings - for blacklisted_string in await self.config.guild_from_id(guild_id).blacklisted_strings(): + for blacklisted_string in await self.config.guild_from_id( + guild_id + ).blacklisted_strings(): if blacklisted_string in clean_content: return @@ -215,7 +217,9 @@ class Markov(commands.Cog): if not blacklisted_string: await ctx.reply("Error: blacklisted_string must have length greater than 0") return - async with self.config.guild(ctx.guild).blacklisted_strings() as blacklisted_strings: + async with self.config.guild( + ctx.guild + ).blacklisted_strings() as blacklisted_strings: if len(blacklisted_strings) >= MAX_BLACKLISTED_STRINGS_PER_GUILD: await ctx.reply( "Error: you already have the maximum number of blacklisted strings in this guild" @@ -231,14 +235,18 @@ class Markov(commands.Cog): """ Remove blacklisted string with ID num. You can see the IDs in `markov blacklisted_string list`. """ - async with self.config.guild(ctx.guild).blacklisted_strings() as blacklisted_strings: + async with self.config.guild( + ctx.guild + ).blacklisted_strings() as blacklisted_strings: string = blacklisted_strings[num - 1] try: del blacklisted_strings[num - 1] except IndexError: await ctx.reply("Error: no blacklisted string with that ID exists.") else: - await ctx.reply(f"Removed {repr(string)} from your blacklisted strings.") + await ctx.reply( + f"Removed {repr(string)} from your blacklisted strings." + ) @blacklist_string.command() @commands.admin_or_permissions(manage_guild=True) @@ -329,7 +337,7 @@ class Markov(commands.Cog): if token == "": break - await ctx.reply(result, allowed_mentions=discord.AllowedMentions.none()) + await ctx.send(result, allowed_mentions=discord.AllowedMentions.none()) else: result = "" token = "" @@ -401,4 +409,4 @@ class Markov(commands.Cog): if token == "": break - await ctx.reply(result, allowed_mentions=discord.AllowedMentions.none()) + await ctx.send(result, allowed_mentions=discord.AllowedMentions.none()) |