@@ -48,7 +48,7 @@ class Pixl(commands.Cog):
4848 """
4949
5050 __author__ = "[vertyco](https://github.com/vertyco/vrt-cogs)"
51- __version__ = "0.3.10 "
51+ __version__ = "0.4.0 "
5252
5353 def __init__ (self , bot : Red , * args , ** kwargs ):
5454 super ().__init__ (* args , ** kwargs )
@@ -65,6 +65,7 @@ def __init__(self, bot: Red, *args, **kwargs):
6565 "show_answer" : True , # Show the answer after game over
6666 "use_global" : True , # Use global images added by bot owner
6767 "use_default" : True , # Use default images
68+ "fuzzy_threshold" : 92 , # Fuzzy matching threshold (0-100)
6869 }
6970 default_global = {
7071 "images" : [], # Images added by bot owner
@@ -283,7 +284,9 @@ async def start_game(self, ctx: commands.Context):
283284 invalid = "\n " .join (cant_get )
284285 await ctx .send (f"Some images failed during prep\n { box (invalid )} " )
285286
286- game = PixlGrids (ctx , game_image , correct , conf ["blocks_to_reveal" ], conf ["time_limit" ])
287+ game = PixlGrids (
288+ ctx , game_image , correct , conf ["blocks_to_reveal" ], conf ["time_limit" ], conf ["fuzzy_threshold" ]
289+ )
287290 msg = None
288291 embed = discord .Embed (
289292 title = "Pixl Guess" ,
@@ -393,6 +396,7 @@ async def view_settings(self, ctx: commands.Context):
393396 f"`Participants: `{ conf ['min_participants' ]} minimum\n "
394397 f"`Currency Ratio: `{ conf ['currency_ratio' ]} x\n "
395398 f"`Show Answer: `{ conf ['show_answer' ]} \n "
399+ f"`Fuzzy Threshold:`{ conf ['fuzzy_threshold' ]} %\n "
396400 f"Delay between blocks is { await self .config .delay ()} seconds"
397401 )
398402 # If the timeout is faster than the amount of blocks could be revealed at that delay, calculate how many blocks would be left at game end
@@ -524,6 +528,29 @@ async def reset_scoreboard(self, ctx: commands.Context, user: Optional[discord.M
524528 await self .config .clear_all_members (ctx .guild )
525529 await ctx .send ("Scoreboard has been reset for all users in this server" )
526530
531+ @pixlset .command (name = "fuzzy" )
532+ async def set_fuzzy_threshold (self , ctx : commands .Context , threshold : float ):
533+ """
534+ Set the fuzzy matching threshold for answer checking (0.0 to 1.0)
535+
536+ A lower value means more lenient matching (more answers accepted)
537+ A higher value requires more accurate spelling
538+
539+ Examples:
540+ - 0.92 (default) accepts answers that are 92% similar
541+ - 0.7 would accept answers that are roughly 70% similar
542+ - 1.0 would require exact matching
543+ - 0 would disable fuzzy matching entirely
544+ """
545+ if threshold < 0 or threshold > 1 :
546+ return await ctx .send ("The threshold must be between 0 and 1" )
547+
548+ # Convert from 0-1 range to 0-100 range for fuzz.ratio
549+ threshold_int = int (threshold * 100 )
550+
551+ await self .config .guild (ctx .guild ).fuzzy_threshold .set (threshold_int )
552+ await ctx .send (f"The fuzzy matching threshold has been set to { threshold } ({ threshold_int } %)" )
553+
527554 @pixlset .group (name = "image" )
528555 async def image (self , ctx : commands .Context ):
529556 """Add/Remove images"""
0 commit comments