# Path: bot/commands/abstract/command.py
# class Command(ABC):
#     """Represents a command, a way of reacting to chat messages."""
# 
#     perm = Permission.Admin
# 
#     def __init__(self, bot):
#         """Initialize the command."""
#         pass
# 
#     def match(self, bot, user, msg, tag_info):
#         """Return whether this command should be run."""
#         return False
# 
#     def run(self, bot, user, msg, tag_info):
#         """Run this command."""
#         pass
# 
#     def close(self, bot):
#         """Clean up."""
#         pass
# 
# Path: bot/utilities/startgame.py
# def start_game(bot, user, msg, cmd):
#     """Return whether a user can start a game.
# 
#     Takes off points if a non moderator wants to start a game.
#     Also makes sure only one game is running at a time.
#     """
#     responses = bot.config.responses["startGame"]
# 
#     if bot.game_running:
#         return False
#     elif (
#         user != bot.config.nickname and
#         bot.get_permission(user) in [Permission.User, Permission.Subscriber]
#         and msg == cmd
#     ):
#         """Check if pleb_gametimer is not on cooldown."""
#         if (time.time() - bot.last_plebgame) > bot.config.pleb_gametimer:
#             # The calling user is not a mod, so we subtract 5 points.
#             if bot.ranking.get_points(user) > bot.config.config["points"]["game_start"]:
#                 bot.last_plebgame = time.time()  # Set pleb_gametimer
#                 bot.ranking.increment_points(
#                     user, -int(bot.config.config["points"]["game_start"]), bot
#                 )
#                 bot.game_running = True
#                 return True
#             else:
#                 var = {"<AMOUNT>": int(bot.config.config["points"]["game_start"])}
#                 bot.write(replace_vars(responses["points_needed"]["msg"], var))
#                 return False
#         else:
#             t = bot.config.pleb_gametimer - time.time() + bot.last_plebgame
#             next_plebgame = "%8.0f" % t
#             var = {"<COOLDOWN>": next_plebgame}
#             bot.write(replace_vars(responses["plebgames_on_cooldown"]["msg"], var))
#     else:  # The calling user is a mod, so we only check if the command is correct
#         if msg == cmd:
#             bot.game_running = True
#         return msg == cmd
# 
# Path: bot/utilities/tools.py
# def emote_list_to_string(emote_list):
#     """Convert an EmoteList to a string."""
#     # Use string.join to glue string of emotes in emoteList
#     separator = " "
#     return separator.join(emote_list)
# 
# Path: bot/utilities/tools.py
# def replace_vars(msg, args):
#     """Replace the variables in the message."""
#     oldmsg = msg
#     newmsg = msg
# 
#     for key in args:
#         newmsg = newmsg.replace(key, str(args[key]))
#         """Check if something was replaced, otherwise something went wrong."""
#         if newmsg is oldmsg:
#             print("ERROR: Could not replace variable in string!")
# 
#         oldmsg = newmsg
#     return newmsg


import random
from bot.commands.abstract.command import Command
from bot.utilities.permission import Permission
from bot.utilities.startgame import start_game
from bot.utilities.tools import emote_list_to_string
from bot.utilities.tools import replace_vars
        self.responses = bot.config.responses["GuessEmoteGame"]
        cmd = msg.strip()

        if not self.active:
            self.active = True
            self.init_game(bot, msg)
            print("Right emote: " + self.emote)
            var = {"<MULTIEMOTES>": emote_list_to_string(self.emotes)}
            bot.write(replace_vars(self.responses["start_msg"]["msg"], var))
        else:
            if cmd == "!estop" and bot.get_permission(user) not in [
                Permission.User,
                Permission.Subscriber,
            ]:
                bot.write(self.responses["stop_msg"]["msg"])
                self.close(bot)
                return

            if cmd == self.emote:
                var = {
                    "<USER>": bot.twitch.display_name(user),
                    "<EMOTE>": self.emote,
                    "<PRONOUN0>": bot.config.pronoun(user)[0].capitalize(),
                    "<AMOUNT>": self.emote_game_points,
                }
                bot.write(replace_vars(self.responses["winner_msg"]["msg"], var))
                bot.ranking.increment_points(user, self.emote_game_points, bot)
                bot.game_running = False
                self.active = False
            elif cmd == "!emotes":

# Path: bot/commands/abstract/command.py
# class Command(ABC):
#     """Represents a command, a way of reacting to chat messages."""
# 
#     perm = Permission.Admin
# 
#     def __init__(self, bot):
#         """Initialize the command."""
#         pass
# 
#     def match(self, bot, user, msg, tag_info):
#         """Return whether this command should be run."""
#         return False
# 
#     def run(self, bot, user, msg, tag_info):
#         """Run this command."""
#         pass
# 
#     def close(self, bot):
#         """Clean up."""
#         pass
# 
# Path: bot/utilities/startgame.py
# def start_game(bot, user, msg, cmd):
#     """Return whether a user can start a game.
# 
#     Takes off points if a non moderator wants to start a game.
#     Also makes sure only one game is running at a time.
#     """
#     responses = bot.config.responses["startGame"]
# 
#     if bot.game_running:
#         return False
#     elif (
#         user != bot.config.nickname and
#         bot.get_permission(user) in [Permission.User, Permission.Subscriber]
#         and msg == cmd
#     ):
#         """Check if pleb_gametimer is not on cooldown."""
#         if (time.time() - bot.last_plebgame) > bot.config.pleb_gametimer:
#             # The calling user is not a mod, so we subtract 5 points.
#             if bot.ranking.get_points(user) > bot.config.config["points"]["game_start"]:
#                 bot.last_plebgame = time.time()  # Set pleb_gametimer
#                 bot.ranking.increment_points(
#                     user, -int(bot.config.config["points"]["game_start"]), bot
#                 )
#                 bot.game_running = True
#                 return True
#             else:
#                 var = {"<AMOUNT>": int(bot.config.config["points"]["game_start"])}
#                 bot.write(replace_vars(responses["points_needed"]["msg"], var))
#                 return False
#         else:
#             t = bot.config.pleb_gametimer - time.time() + bot.last_plebgame
#             next_plebgame = "%8.0f" % t
#             var = {"<COOLDOWN>": next_plebgame}
#             bot.write(replace_vars(responses["plebgames_on_cooldown"]["msg"], var))
#     else:  # The calling user is a mod, so we only check if the command is correct
#         if msg == cmd:
#             bot.game_running = True
#         return msg == cmd
# 
# Path: bot/utilities/tools.py
# def emote_list_to_string(emote_list):
#     """Convert an EmoteList to a string."""
#     # Use string.join to glue string of emotes in emoteList
#     separator = " "
#     return separator.join(emote_list)
# 
# Path: bot/utilities/tools.py
# def replace_vars(msg, args):
#     """Replace the variables in the message."""
#     oldmsg = msg
#     newmsg = msg
# 
#     for key in args:
#         newmsg = newmsg.replace(key, str(args[key]))
#         """Check if something was replaced, otherwise something went wrong."""
#         if newmsg is oldmsg:
#             print("ERROR: Could not replace variable in string!")
# 
#         oldmsg = newmsg
#     return newmsg


# Path: bot/commands/guessemotegame.py
import random
from bot.commands.abstract.command import Command
from bot.utilities.permission import Permission
from bot.utilities.startgame import start_game
from bot.utilities.tools import emote_list_to_string
from bot.utilities.tools import replace_vars

        self.responses = bot.config.responses["GuessEmoteGame"]
        cmd = msg.strip()

        if not self.active:
            self.active = True
            self.init_game(bot, msg)
            print("Right emote: " + self.emote)
            var = {"<MULTIEMOTES>": emote_list_to_string(self.emotes)}
            bot.write(replace_vars(self.responses["start_msg"]["msg"], var))
        else:
            if cmd == "!estop" and bot.get_permission(user) not in [
                Permission.User,
                Permission.Subscriber,
            ]:
                bot.write(self.responses["stop_msg"]["msg"])
                self.close(bot)
                return

            if cmd == self.emote:
                var = {
                    "<USER>": bot.twitch.display_name(user),
                    "<EMOTE>": self.emote,
                    "<PRONOUN0>": bot.config.pronoun(user)[0].capitalize(),
                    "<AMOUNT>": self.emote_game_points,
                }
                bot.write(replace_vars(self.responses["winner_msg"]["msg"], var))
                bot.ranking.increment_points(user, self.emote_game_points, bot)
                bot.game_running = False
                self.active = False
            elif cmd == "!emotes":

                var = {"<MULTIEMOTES>": emote_list_to_string(self.emotes)}