whisper.txt 461 Bytes
def whisper(id, tokens, players, mud):
    # go through every player in the game
    for pid, pl in players.items():
        # if they're in the same room as the player
        if players[pid]["name"] == tokens[0]:
            # send them a message telling them what the player said
            mud.send_message(pid, "{} whispers: {}".format(
                                        players[id]["name"], ' '.join(tokens[1:])))

whisper(id, tokens, players, mud)