MinatoAquaCrews / nonebot_plugin_fortune

Fortune divination plugin for nonebot2
MIT License
106 stars 22 forks source link

资源格式问题 #76

Closed veadex closed 1 year ago

veadex commented 1 year ago

大佬,我尝试使用png的文件格式,但是它会报错,我想问一下要改哪个代码才能对png格式的图进行绘制啊,麻烦大佬了

veadex commented 1 year ago

不好意思,我的问题,png格式也能使用

veadex commented 1 year ago

随机选取标题是平均概率的吗?

def get_copywriting() -> Tuple[str, str]:
    '''
            Read the copywriting.json, choice a luck with a random content
    '''
    _p: Path = fortune_config.fortune_path / "fortune" / "copywriting.json"

    with open(_p, "r", encoding="utf-8") as f:
        content = json.load(f).get("copywriting")

    luck = random.choice(content)

    title: str = luck.get("good-luck")
    text: str = random.choice(luck.get("content"))

    return title, text`

我看这个里面好像没有传入概率的参数

KafCoppelia commented 1 year ago

random.choice() 就是平均概率