aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks123 <[email protected]>2020-03-17 19:32:48 +0200
committerGravatar ks123 <[email protected]>2020-03-17 19:32:48 +0200
commit95dae9bc7a7519c723539382848c02b9748d067f (patch)
tree16133483c007a8d78c97e31df1446f8d982e7c71
parent(!zen Command): Added exact word check before `difflib`'s matching, due match... (diff)
(!zen Command): Under exact word match, change matching way from substring to sentence split iterate and equality check.
-rw-r--r--bot/cogs/utils.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py
index 2ca2c028e..0619296ad 100644
--- a/bot/cogs/utils.py
+++ b/bot/cogs/utils.py
@@ -233,11 +233,12 @@ class Utils(Cog):
# Try to handle first exact word due difflib.SequenceMatched may use some other similar word instead
# exact word.
for i, line in enumerate(zen_lines):
- if search_value.lower() in line.lower():
- embed.title += f" (line {i}):"
- embed.description = line
- await ctx.send(embed=embed)
- return
+ for word in line.split():
+ if word.lower() == search_value.lower():
+ embed.title += f" (line {i}):"
+ embed.description = line
+ await ctx.send(embed=embed)
+ return
# handle if it's a search string and not exact word
matcher = difflib.SequenceMatcher(None, search_value.lower())