Code Monkey home page Code Monkey logo

bf_info_plugin's Introduction

Ivan社徽

----About YujioNako & Pro-Ivan----
Main Site · Image Collection · Manga · Feedback · Img_Bed · Download · JS Game
Have you saw this site, very simple right? That's cause we know little about html5 lol

Introduction

Members of Pro-Ivan, Yujio and Nako, mainly appear in Bilibili. Character set came from Ldcivan。Actually, it's another name of Nako.
Yujio is a vtuber, while Nako act as the manager of Yujio.
Yujio rarely broadcast live now.

Background setting

Yujio almost died when she was 3 years old because she accidentally fell into a deep pit. As a result, she was picked up by nake who lived in the deep pit and turned her into an immortal monster. She is a fox who can accept the status quo. As a result, he not only accepted the identity of being a monster, but also quickly integrated into human society. Now she is sent to the fence of Yanfeng animation Club of Yanfeng Niang. Pro-Ivan was actually established by Yujio in the name of Nako in this case. At the same time, Yujio succeeded in what many people failed to do: persuading Nako out of the deep pit.
Nako didn't disclose her age not because of confidentiality. Nako just forgot her birthday. Many years ago, she picked up Yujio while wandering in her pit. Maybe it was because she was too bored to live in the pit for too long, so she saved and left Yujio in her pit. Expect being keen on learning various painting techniques, she’s invariant in other aspects. At the same time, she is often forgetful. According to herself, the reason is that she deliberately forgets some things in order not to have too many things in her mind - but she may not forget how Yujio persuaded her out of that pit forever.


More...

  Yujio Nako
Color of hair silver black-deep red
Color of eyes Left-blue Right-orange red
Height 180 166
Birthday 3.21 3.21
Constellation Aries Aries
Active area CN-Mainland CN-Mainland
Platform Bilibili -
Belonging Ivan社徽
BUPT Yanfeng Animate Club
Ivan社徽

Yujio&Nako's Illustration

Oringinal Illustrations

钰中 那珂

Developed Illustrations of Yujio

钰中 钰中 钰中

Message Board

Click Me!

bf_info_plugin's People

Contributors

ldcivan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

bf_info_plugin's Issues

无法生成图片

[MiaoYz][01:03:05.155][ERRO] [bf_info][bf_base]
[MiaoYz][01:03:05.156][ERRO] TypeError: forwardMsg.data.replace is not a function
at example.makeForwardMsg (file:///F:/yunzai/Yunzai-Bot/plugins/example/bf_info.js:422:8)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async example.bf_base (file:///F:/yunzai/Yunzai-Bot/plugins/example/bf_info.js:144:26)
at async PluginsLoader.deal (file:///F:/yunzai/Yunzai-Bot/lib/plugins/loader.js:291:54)

一些小问题

开发者您好,以下是本人在使用中发现的一些小问题以及改进方案:

1. bf1/bfv 版本的确认

问题描述

在确认版本号时,开发者使用了如下代码:

    if(e.msg.search(/(B|b)(F|f)1/g)!=-1) version = "bf1"  
    if(e.msg.search(/(B|b)(F|f)v/g)!=-1) version = "bfv"  

在此情况下,确认版本号时未指认搜索范围。此时若用户名中含有“bfv”或类似组合, 即使是想要查询战地1相关数据,如以下状况:

    #bf1 bfv-happygame

由于“bfv”的搜索在“bf1”之后,仍会返回战地5的查询结果。

改进方案

正常输入时 bf1、bfv 等指示游戏版本的字符应置于开头,故在匹配时只考虑开头的 bf1、bfv,伪代码实现如下:

    if(e.msg.search(/^#?(B|b)(F|f)1/g)!=-1) version = "bf1"  
    if(e.msg.search(/^#?(B|b)(F|f)v/g)!=-1) version = "bfv"  

其中“^”匹配开头,“#?”匹配不确定是否存在的提示符“#”。

2. 关于 me 相关的用户名确认

问题描述

在讨论 me 的用户名匹配时,开发者使用了如下代码:

    if (/(M|m)(E|e)/g.test(playerid))  

在此情况下,若用户名中含有“me”等字符,将会造成误判。该问题在使用此插件查询他人战绩时尤为明显。仍以上一问题中的用户名举例:

    #bf1 bfv-happygame

其中 bfv-happygame 用户名中含有“me”字符组,在查询时会返回 QQ 账号对应的用户名查询结果。

改进方案

考虑到 me 作为用户名的代称,总是单独出现,故只匹配单独出现的“me”,伪代码实现如下:

    if (/\b(M|m)(E|e)\b/g.test(playerid))

其中“\b”匹配单词边界,两侧使用即匹配单独出现的“me”。

3. bfv 与 bf5 的用户习惯问题

问题描述

对于游戏 Battlefield V™,玩家通常称呼为“战地5”(显然作者也是这么做的),即使官方并未明确表示其中的“V”代表罗马数字 5 。考虑到部分实体键盘用户或使用带有数字行的触屏用户的使用习惯,可以考虑添加“bf5”等字符组的匹配。

改进方案

匹配游戏版本部分的代码改为:

    if(e.msg.search(/^#?(B|b)(F|f)(v|V|5)/g)!=-1) version = "bfv"

在此之外涉及游戏版本时使用如下正则表达式:

    ^#?(B|b)(F|f)(1|v|V|5)

以上表达式还考虑了“v”的大小写问题(虽然应该没什么人会用大写)。

4. 插件内部部分代码的复用问题

问题描述

在处理以上问题时,发现插件内部存在一定的的代码重复问题,在修改时有一定重复工作量

改进方案

可以考虑在获取用户名、游戏版本以及命令结束的部分使用自行编写的函数,这在修改此部分代码时可以一定程度上减少工作量。由于本人并不了解 Javascript,此问题暂无代码实现。

5. 代码内部的排版问题

问题描述

数据查询输出部分代码中,单行字符量巨大,在编辑器中查看极不方便。例如以下代码:

        await message.push(`\n玩家名:${JSON.stringify(jsonobj.userName)}\n玩家等级:${JSON.stringify(jsonobj.rank)}\n技巧值:${JSON.stringify(jsonobj.skill)}\n每分钟得分:${JSON.stringify(jsonobj.scorePerMinute)}\n每分钟击杀:${JSON.stringify(jsonobj.killsPerMinute)}\n胜率:${JSON.stringify(jsonobj.winPercent)}\n最佳兵种:${JSON.stringify(jsonobj.bestClass)}\n准度:${JSON.stringify(jsonobj.accuracy)}\n爆头率:${JSON.stringify(jsonobj.headshots)}\n爆头数:${JSON.stringify(jsonobj.headShots)}\n最远爆头:${JSON.stringify(jsonobj.longestHeadShot)}\n已游玩时间:${JSON.stringify(jsonobj.timePlayed)}\nKD比:${JSON.stringify(jsonobj.killDeath)}\n击杀数:${JSON.stringify(jsonobj.kills)}\n死亡数:${JSON.stringify(jsonobj.deaths)}\n最高连续击杀:${JSON.stringify(jsonobj.highestKillStreak)}\n助攻数:${JSON.stringify(jsonobj.killAssists)}\n救起数:${JSON.stringify(jsonobj.revives)}\n治疗量:${JSON.stringify(jsonobj.heals)}\n维修量:${JSON.stringify(jsonobj.repairs)}\n`)

改进方案

利用 Javascript 的折行(本人参考了此教程)进行书写,样例如下:

    await message.push(`\n\
玩家名:${JSON.stringify(jsonobj.userName)}\n\
玩家等级:${JSON.stringify(jsonobj.rank)}\n\
技巧值:${JSON.stringify(jsonobj.skill)}\n\
每分钟得分:${JSON.stringify(jsonobj.scorePerMinute)}\n\
每分钟击杀:${JSON.stringify(jsonobj.killsPerMinute)}\n\
胜率:${JSON.stringify(jsonobj.winPercent)}\n\
最佳兵种:${JSON.stringify(jsonobj.bestClass)}\n\
准度:${JSON.stringify(jsonobj.accuracy)}\n\
爆头率:${JSON.stringify(jsonobj.headshots)}\n\
爆头数:${JSON.stringify(jsonobj.headShots)}\n\
最远爆头:${JSON.stringify(jsonobj.longestHeadShot)}\n\
已游玩时间:${JSON.stringify(jsonobj.timePlayed)}\n\
KD比:${JSON.stringify(jsonobj.killDeath)}\n\
击杀数:${JSON.stringify(jsonobj.kills)}\n\
死亡数:${JSON.stringify(jsonobj.deaths)}\n\
最高连续击杀:${JSON.stringify(jsonobj.highestKillStreak)}\n\
助攻数:${JSON.stringify(jsonobj.killAssists)}\n\
救起数:${JSON.stringify(jsonobj.revives)}\n\
治疗量:${JSON.stringify(jsonobj.heals)}\n\
维修量:${JSON.stringify(jsonobj.repairs)}\n\
`)

注意此处的折行部分需要顶格写,否则缩进部分会体现在 BOT 的转发消息中

6. gametools api 的入口选择问题

问题描述

注意到开发者在全部查询方式中均使用了 all 入口,这会使 BOT 获取较多的冗余信息,可能拖慢插件运行

改进方案

使用对应的 stats、weapons、vehicles、classes 等入口

7. 另一些用户习惯问题与衍生问题(很不重要)

问题描述

在使用插件时,部分用户习惯使用如下格式(比如本人):

    command username
    command argument username

而非开发者建议的格式:

    command1 username
    command2 username

若在此部分做出改动,工作繁琐,且不是很有意义。

改进方案

首先是命令的触发机制,以武器为例:

    reg: '^#?(B|b)(F|f)(1|v|V|5)( )*(weapons?)(\d?\d?条)?.+$'

在中间插入了若干空格以适配不同用户习惯。

其次是用户名的匹配机制,此处为通用解决方案:

let playerid = e.msg.replace(/^#?(B|b)(F|f)(1|v|V|5)( )*((vehicles?\b|carriers?\b|weapons?\b|class(es)?\b)( )*(\d?\d?条)?( )*[^$^\w-S])?/g, "")

匹配了非结尾处的 weapon(s) 等词和条数限制,应该能考虑到用户名为“vehicles”之类的刁钻的但是合法的输入。
(我 get 不到笑点,但是我对着这个笑了好久XD)


以上是本人发现的一些小问题以及改进方案。本人并未深入了解 Javascript 和正则表达式等相关计算机知识,以上意见仅供参考。

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.