Merge pull request #1 from BinaryBrain/feature/wordle-chat-detection
Add chat detection to avoid using dash
This commit is contained in:
@@ -60,6 +60,24 @@ class Game:
|
|||||||
content = message.content.strip()
|
content = message.content.strip()
|
||||||
if (len(content) >= 1 and content[0] == "-") or self.winner or not self.target: # special char, or somebody won, or never initialized
|
if (len(content) >= 1 and content[0] == "-") or self.winner or not self.target: # special char, or somebody won, or never initialized
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# if the user is just chatting
|
||||||
|
if " " in content:
|
||||||
|
return
|
||||||
|
# if the guess is obviously not the same length (just chatting)
|
||||||
|
ratio = 2/3
|
||||||
|
if len(content) <= len(self.target) * ratio or len(self.target) <= len(content) * ratio:
|
||||||
|
return
|
||||||
|
# if the user post an emoji
|
||||||
|
if content[0] == ":":
|
||||||
|
return
|
||||||
|
# if the user post a link
|
||||||
|
if "://" in content:
|
||||||
|
return
|
||||||
|
# if the user post a gif (not sure about this one)
|
||||||
|
if len(content) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
guess = unidecode(content).upper()
|
guess = unidecode(content).upper()
|
||||||
if WORDLE_FORCE_ALTERNATION and message.author == self.last_player:
|
if WORDLE_FORCE_ALTERNATION and message.author == self.last_player:
|
||||||
await self.channel.send(f"{message.author.mention} Laisse un peu jouer les autres !")
|
await self.channel.send(f"{message.author.mention} Laisse un peu jouer les autres !")
|
||||||
|
|||||||
Reference in New Issue
Block a user