Coder Social home page Coder Social logo

clanrank's People

Contributors

corvo007 avatar var-mixer avatar wosiwq avatar xhl6666 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

clanrank's Issues

Local var referenced before assigned

在clanrank.py的112行处,函数process里:

msg += "没有查询结果,仅能查询前20000名公会,排名信息30分钟更新一次,相比于游戏内更新有10分钟左右延迟\n"

这一句话会触发错误,需要将+=改成=。

缓存结构调整

当前缓存数据函数,默认读写路径为./hoshino/modules/clanrank/clanrank.json,且所有配置和查询都放在此文件内,可能有如下问题:

  1. 所有群的绑定数据、缓存数据均在同一个文件内,发起查询时会先读取clanrank.json,查询修改后再存入。如果两个群同时发起查询或者绑定请求(本质上也是查询),且网络状况不佳时,先查询的群的数据会被后来者覆盖。
  2. 缓存信息和群公会绑定信息均保存在该插件目录下,迁移机器人时需要额外迁移。
  3. 使用json格式保存缓存信息不妥。

考虑中的改进方案:

  1. 考虑将绑定信息移动至~/.hoshino,即采用和HoshinoBot一样的配置保存路径。
  2. 每次查询的信息均会被缓存,在不同的文件中进行缓存,避免冲突。

BOSS进度计算出现错误

BOSS的进度和游戏里对不上,我查了一下是因为现在BOSS的得分倍率从
[1, 1, 1.1, 1.1, 1.2],
[1.2, 1.2, 1.5, 1.7, 2],
改成了
[1, 1, 1.3, 1.3, 1.5],
[1.3, 1.3, 1.8, 1.8, 2],

历史数据查询相关

因为不是所有时间的数据都会保存在后台,所以可以查询的时间戳是被限制的,常规情况下可以通过/default读取historyV2获取可以查询的时间的时间戳。为了方便,这里提供两个接口。

只获取时间
GET /var-mixer/historyList/version/1
[1589785200,1594278000,1596697200,1591945200,1598216405,1598302806,1598389206]

单独获取/default接口的historyV2
GET /var-mixer/historyList/version/2
{"1589785200":"2020年白羊座公会战","1594278000":"2020年双子座公会战","1596697200":"2020年巨蟹座公会战","1591945200":"2020年金牛座公会战","1598216405":"","1598302806":"","1598389206":""}

查询公会如果有多个结果的时候机器人发送不出来

10:41:46 [INFO] [BOT 361233717] Group(823820675) <- 第1条信息:\n公会名称:上弦月\n总人数:30\n会长名:月见莉莉娅\n会长UID:1343040248366\n公会排名:114\nBOSS进度:9周目4王 [11411019/12000000] 95.09%\n\n第2条信息:\n公会名称:上弦花月醉伊人\n总人数:30\n会长名:叶秋痕(阿矿奥利给\n会长UID:1363342891538\n公会排名:3820\nBOSS进度:8周目3王 [9761706/10000000] 97.62%\n\n第3条信息:\n公会名称:上弦月\n总人数:30\n会长名:如沐丶秋枫\n会长UID:1234357880395\n公会排名:13475\nBOSS进度:5周目3王 [1545423/10000000] 15.45%\n\n查询有120秒冷却

查询公会的时候如果查到多个结果,机器人后台显示已经发送,但是群里没有显示消息,
如果只有一个结果群里就能正常显示出来
查询排名和分数线也没有问题

我是用的是mirai

非公会战时间内推送排名

复现:
绑定公会ID,在会战结束后更换会长或解散公会,则会战结束后每日会推送:
没有查询到本日5时的公会战排名信息, 可能已掉出前2W名
可能原因:
目前非会战期间不推送排名靠返回的时间戳实现,如果返回的更新时间和上次查询时间相差超过45分钟则不推送排名。原因是此公会已解散或更换会长后,fav接口查询的返回结果为0,首先触发以下部分:

    elif result == 0:
    msg += "没有查询到本日5时的公会战排名信息, 可能已掉出前2W名"

则不会触发时间戳判断,因此仍然会错误推送。
解决:
1, 从某个源处获取B服活动日历来判断是否是会战期间。
2,调整clanrank.py第246~250行判断的先后顺序。(已推送)

重构中.,效率极低,尽量在下次会战前加入官方接口。

最新版本无法绑定公会,处理报错

发送 绑定公会+UID 无法绑定工会,会报错
报错日志如下
[2020-12-28 03:35:59,361 公会战排名推送] ERROR: <class 'TypeError'> occured when set_clan handling message 783578050.
[2020-12-28 03:35:59,362 公会战排名推送] ERROR: argument of type 'int' is not iterable
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\hoshinobot\hoshino\msghandler.py", line 28, in handle_message
await sf.func(bot, event)
File "C:\Users\Administrator\Desktop\hoshinobot\hoshino\modules\clanrank\clanrank.py", line 259, in set_clan
code = set_clanname(int(group_id),int(leader_id))
File "C:\Users\Administrator\Desktop\hoshinobot\hoshino\modules\clanrank\clanrank.py", line 191, in set_clanname
origin_info = get_rank(leader_id,"fav")
File "C:\Users\Administrator\Desktop\hoshinobot\hoshino\modules\clanrank\clanrank.py", line 93, in get_rank
if '[CQ:' in info and ']' in info and '=' in info:
TypeError: argument of type 'int' is not iterable

process 函数的小 bug

应在 process 函数开头加上 infoList = infoList.copy(),否则 infoList.remove('ts') 会导致 'ts'self_clan_query_list 中被删除,之后的所有查询都不会显示时间.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.