from games import spy_game, base_commands
from games.game_enviroment import *
from utli.line_api import *


add_list = [
    (None, base_commands),
    (SpyGame, spy_game),
]


def events_excute(event):
    line = LineAPI(event)
    game_db = GameDB.init(db.read_json())

    commands = []
    for item in add_list:
        class_game = item[0]
        cmd = item[1]

        if class_game is None:
            commands.extend(cmd.commands())
        else:
            if event.source.type == "group":
                room = game_db.get_room(event.source.group_id)
                if hasattr(room, "game"):
                    if isinstance(room.game, class_game):
                        commands.extend(cmd.commands())

    invoker = Invoker()
    invoker.appends(commands)
    invoker.execute(execute_all=True, event=event, line=line, game_db=game_db)
    g = game_db.to_dict()
    db.write_json(game_db.to_dict())

e1e9b61506a2736a06c79ca90f9b0df856feb1da
<mask token>

<mask token>


def events_excute(event):
    line = LineAPI(event)
    game_db = GameDB.init(db.read_json())
    commands = []
    for item in add_list:
        class_game = item[0]
        cmd = item[1]
        if class_game is None:
            commands.extend(cmd.commands())
        elif event.source.type == 'group':
            room = game_db.get_room(event.source.group_id)
            if hasattr(room, 'game'):
                if isinstance(room.game, class_game):
                    commands.extend(cmd.commands())
    invoker = Invoker()
    invoker.appends(commands)
    invoker.execute(execute_all=True, event=event, line=line, game_db=game_db)
    g = game_db.to_dict()
    db.write_json(game_db.to_dict())

<mask token>
add_list = [(None, base_commands), (SpyGame, spy_game)]


def events_excute(event):
    line = LineAPI(event)
    game_db = GameDB.init(db.read_json())
    commands = []
    for item in add_list:
        class_game = item[0]
        cmd = item[1]
        if class_game is None:
            commands.extend(cmd.commands())
        elif event.source.type == 'group':
            room = game_db.get_room(event.source.group_id)
            if hasattr(room, 'game'):
                if isinstance(room.game, class_game):
                    commands.extend(cmd.commands())
    invoker = Invoker()
    invoker.appends(commands)
    invoker.execute(execute_all=True, event=event, line=line, game_db=game_db)
    g = game_db.to_dict()
    db.write_json(game_db.to_dict())

from games import spy_game, base_commands
from games.game_enviroment import *
from utli.line_api import *
add_list = [(None, base_commands), (SpyGame, spy_game)]


def events_excute(event):
    line = LineAPI(event)
    game_db = GameDB.init(db.read_json())
    commands = []
    for item in add_list:
        class_game = item[0]
        cmd = item[1]
        if class_game is None:
            commands.extend(cmd.commands())
        elif event.source.type == 'group':
            room = game_db.get_room(event.source.group_id)
            if hasattr(room, 'game'):
                if isinstance(room.game, class_game):
                    commands.extend(cmd.commands())
    invoker = Invoker()
    invoker.appends(commands)
    invoker.execute(execute_all=True, event=event, line=line, game_db=game_db)
    g = game_db.to_dict()
    db.write_json(game_db.to_dict())

from games import spy_game, base_commands
from games.game_enviroment import *
from utli.line_api import *


add_list = [
    (None, base_commands),
    (SpyGame, spy_game),
]


def events_excute(event):
    line = LineAPI(event)
    game_db = GameDB.init(db.read_json())

    commands = []
    for item in add_list:
        class_game = item[0]
        cmd = item[1]

        if class_game is None:
            commands.extend(cmd.commands())
        else:
            if event.source.type == "group":
                room = game_db.get_room(event.source.group_id)
                if hasattr(room, "game"):
                    if isinstance(room.game, class_game):
                        commands.extend(cmd.commands())

    invoker = Invoker()
    invoker.appends(commands)
    invoker.execute(execute_all=True, event=event, line=line, game_db=game_db)
    g = game_db.to_dict()
    db.write_json(game_db.to_dict())
