GithubHelp home page GithubHelp logo

lipraty / koishi-plugin-paimon Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 1.72 MB

A koishi plugin for a certain anime game.

License: MIT License

TypeScript 99.91% Vue 0.09%
genshin-impact koishi koishi-plugin chatbot genshin genshin-api yuanshen

koishi-plugin-paimon's Introduction

koishi-plugin-paimon

npm

这是一个已经停止更新的插件,所有功能将转移至 Koishi 官方插件: koishi-plugin-genshin。敬请期待适用于 Koishi v4 的 Genshin 插件吧!

安装

#npm:
npm install koishi-plugin-paimon

#or use yarn:
yarn add koishi-plugin-paimon

所需koishi外部插件与依赖

  • database:用于存储用户数据
  • koishi-plugin-puppeteer:用于图片生成
  • @koishijs/plugin-rate-limit:用于指令速率限制

如果未安装上述依赖,可以使用以下方法进行安装:

koishi database能对接多种平台,请选择符合自身的数据库平台;名称为@koishijs/plugin-database-[platform],下列示例以sqlite为例。

#npm:
npm install koishi-plugin-puppeteer @koishijs/plugin-database-sqlite @koishijs/plugin-rate-limit

#or use yarn:
yarn add koishi-plugin-puppeteer @koishijs/plugin-database-sqlite @koishijs/plugin-rate-limit

Paimon 服务

通过ctx.paimon访问

paimon.login(uid, cookie?, dsalt?): Paimon

在使用其他api前应当先进行login,传入必要的参数以保证符合预期执行

Params Description
uid 游戏uid
cookie? 米游社Cookie
dsalt? 虚拟设备信息所用的Salt

paimon.render(def, elementType?)(...args): Promise<string | Buffer | h>

请求后续所列出的某个API,并渲染为图片返回

这是一个柯里化的函数,第二个(...args)则是下列函数可能需要的参数。并根据elementType返回一个流动的Promise<T>
例如:paimon.render('bbsSign', 'base64')(true)

Params Description
def 需要请求的API,即下列所列出的函数名
elementType? 返回类型,默认为buffer(base64 -> stringbuffer -> Buffer, element -> h

paimon.bbsSign(onlyInfo?): Promise<SignInfo>

执行米游社签到

Params Description
onlyInfo? 不执行签到行为,只返回签到数据

paimon.memo(): Promise<MemoInfo>

查询米游社 每日便笺 内容

paimon.abyss(period?, level?): Promise<AbyssInfo>

查询米游社 深境螺旋 内容

Params Description
period? 选择回顾上期或本期的战报
level? 单独限制该层信息

paimon.gachaImport(gachaDataJson): Promise<void | boolan>

导入原神抽卡记录进行分析

Params Description
gachaDataJson gachaData-[uid]-[time].json文件名的原神祈愿记录(genshin-gacha-export)

paimon.note(month?): Promise<NoteData>

查询米游社旅行者札记

Paimon 命令

插件命令以paimon开头,部分命令拥有参数[uid],随后可接额外的选项与参数。

使用命令需要在插件设置中将 useCommand 设置为true

paimon[.subcommand] [uid] --option [option arg]

具体用法可以发送paimon -h查看

其中[uid]被视为一个可选参数,如果有该参数则会让paimon的行为限制在该uid内。

  • 指定的[uid]只能是已绑定的uid,如果未绑定该uid,则返回非绑定uid警告。
  • 当用户权限大于等于master选项所设置数值时,将无视限制。

当然,为了方便使用,插件支持以快捷方式触发命令,发送paimon#帮助即可获得一个支持的命令列表图片。就像Yunzai-bot一样。

All game data & pictures from ©mihoyo

koishi-plugin-paimon's People

Contributors

lipraty avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

kunzaijs

koishi-plugin-paimon's Issues

v0.2 plan - add api request debounce

Some function will request the API multiple times in a short period of time, which will make miHoyo think that you is attacking it -- marked as a risk control account
And, multiple instantaneous command execution will also create the above effect

  • add all API requests to a request queue and timely send status of requests based on the queue

v0.2 plan

Due to personal reasons, the following plans may take longer than expected.

new (sub)command/command option

  • paimon --memo, #每日便笺, #便笺, #体力: Get the "Daily Note" content of miHoyo bbs(maby china only? I am not aware of the contents of hoyolab)
  • paimon [-s, --sign]: a shortcut option for paimon.sign
  • paimon.abyss, paimon.abs, #深渊, #深境螺旋: check your Spiral Abyss battle data
  • paimon.today, #今日打本, #天赋本, #材料本: table of Talent Materials and Weapon Ascension Materials required to obtain the character of the day
  • paimon.search, #查[val]: search (character/weapons/artifacts/etc.) data such as panels, phrases, description texts, breakout materials(maybe access to the api of some wiki)
  • paimon.sign [-i, --info], #签到详情: provide user with sign infomation for the day
  • remove command paimon.bind
  • new command paimon.uid [uid] [--bind, --cookie [cookie], --remove, --default, --device]

feature

remove .shortcut() and change to a new way compatible with i18n and types of processing params and options

- [x] handle compatible with i18n and types of params and options to before middleware

In Koishi 4.10.4, added a new api ctx.match see issue#4

make .shortcut() be used again!

database

  • add custom database table to koishi-core.observer

Internal APIs

  • test Enka api
  • test & add other miHoyo bbs apis

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.