Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow all commands that start with !eval to overcome spam rules #967

Merged
merged 3 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ def command(self, line: ChatLine, cmd: str) -> None:
:param cmd: The command to react to.
"""
from_self = line.username == self.game.username
is_eval = cmd.startswith("eval")
if cmd == "commands" or cmd == "help":
self.send_reply(line, "Supported commands: !wait (wait a minute for my first move), !name, !howto, !eval, !queue")
self.send_reply(line, (
"Supported commands: !wait (wait a minute for my first move), !name, !howto, "
"!eval (or any text starting with !eval), !queue"))
elif cmd == "wait" and self.game.is_abortable():
self.game.ping(seconds(60), seconds(120), seconds(120))
self.send_reply(line, "Waiting 60 seconds...")
Expand All @@ -77,10 +80,10 @@ def command(self, line: ChatLine, cmd: str) -> None:
self.send_reply(line, f"{name} running {self.engine.name()} (lichess-bot v{self.version})")
elif cmd == "howto":
self.send_reply(line, "How to run: Check out 'Lichess Bot API'")
elif cmd == "eval" and (from_self or line.room == "spectator"):
elif is_eval and (from_self or line.room == "spectator"):
stats = self.engine.get_stats(for_chat=True)
self.send_reply(line, ", ".join(stats))
elif cmd == "eval":
elif is_eval:
self.send_reply(line, "I don't tell that to my opponent, sorry.")
elif cmd == "queue":
if self.challengers:
Expand Down
Loading