# 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/tools.py
# def format_list(_list):
#     """Format a list to an enumeration.
# 
#     e.g.: [a,b,c,d] -> a, b, c and d
#     """
#     if len(_list) == 0:
#         return "no one"
#     elif len(_list) == 1:
#         return _list[0]
#     else:
#         s = ""
#         for e in _list[: len(_list) - 2]:
#             s = s + str(e) + ", "
#         s = s + str(_list[len(_list) - 2]) + " and " + str(_list[len(_list) - 1])
#         return s
# 
# 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 logging
import random
from collections import Counter
from enum import Enum
from bot.commands.abstract.command import Command
from bot.utilities.permission import Permission
from bot.utilities.tools import format_list
from bot.utilities.tools import replace_vars
                var = {
                    "<USER>": bot.twitch.display_name(user),
                    "<PRONOUN0>": bot.config.pronoun(user)[0],
                }
                bot.write(replace_vars(self.responses["mod_plebpyramid"]["msg"], var))
        else:
            s = format_list(
                list(map(lambda x: bot.twitch.display_name(x), unique_users))
            )
            var = {"<MULTIUSERS>": s}
            bot.write(replace_vars(self.responses["multi_plebpyramid"]["msg"], var))
            for u in unique_users:
                if bot.get_permission(u) in [Permission.User, Permission.Subscriber]:
                    bot.timeout(u, 60)

        self.reset()

    def send_success_message(self, bot):
        """Send a message for a successful pyramid."""
        points = self.calculate_points(bot)
        if len(points) == 1:
            user = self.pyramid_builders[0]
            var = {
                "<USER>": bot.twitch.display_name(user),
                "<PRONOUN0>": bot.config.pronoun(user)[0],
                "<AMOUNT>": points[user],
            }
            bot.write(replace_vars(self.responses["pyramid"]["msg"], var))
            bot.ranking.increment_points(user, points[user], bot)
        else:

# 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/tools.py
# def format_list(_list):
#     """Format a list to an enumeration.
# 
#     e.g.: [a,b,c,d] -> a, b, c and d
#     """
#     if len(_list) == 0:
#         return "no one"
#     elif len(_list) == 1:
#         return _list[0]
#     else:
#         s = ""
#         for e in _list[: len(_list) - 2]:
#             s = s + str(e) + ", "
#         s = s + str(_list[len(_list) - 2]) + " and " + str(_list[len(_list) - 1])
#         return s
# 
# 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/pyramid.py
import logging
import random
from collections import Counter
from enum import Enum
from bot.commands.abstract.command import Command
from bot.utilities.permission import Permission
from bot.utilities.tools import format_list
from bot.utilities.tools import replace_vars

                var = {
                    "<USER>": bot.twitch.display_name(user),
                    "<PRONOUN0>": bot.config.pronoun(user)[0],
                }
                bot.write(replace_vars(self.responses["mod_plebpyramid"]["msg"], var))
        else:
            s = format_list(
                list(map(lambda x: bot.twitch.display_name(x), unique_users))
            )
            var = {"<MULTIUSERS>": s}
            bot.write(replace_vars(self.responses["multi_plebpyramid"]["msg"], var))
            for u in unique_users:
                if bot.get_permission(u) in [Permission.User, Permission.Subscriber]:
                    bot.timeout(u, 60)

        self.reset()

    def send_success_message(self, bot):
        """Send a message for a successful pyramid."""
        points = self.calculate_points(bot)
        if len(points) == 1:
            user = self.pyramid_builders[0]
            var = {
                "<USER>": bot.twitch.display_name(user),
                "<PRONOUN0>": bot.config.pronoun(user)[0],
                "<AMOUNT>": points[user],
            }
            bot.write(replace_vars(self.responses["pyramid"]["msg"], var))
            bot.ranking.increment_points(user, points[user], bot)
        else:

            s = format_list(