from pathlib import Path
import json


def remove(guild, key: str):
    """
    Removes a guild from a given key
        Parameters:
            guild (str/int): ID of the guild
            key (str): The key to modify
        Returns:
            Success (bool): Did it succeed
    """
    data = {}
    guild = str(guild)

    if not Path(f'./data/guild_{key}.json').is_file():
        return False

    with open(f'./data/guild_{key}.json', 'r') as filein:
        data = json.load(filein)

    data.pop(guild)

    with open(f'./data/guild_{key}.json', 'w') as fileout:
        json.dump(data, fileout, indent=4)

    return True