Skip to content

Commit

Permalink
Merge pull request #10 from Valorant-Shop-CN/develop
Browse files Browse the repository at this point in the history
chown(1.1.3): release v1.1.3
  • Loading branch information
musnows authored Apr 4, 2023
2 parents 353050c + 741566b commit 8bb8e1a
Show file tree
Hide file tree
Showing 70 changed files with 2,539 additions and 1,514 deletions.
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# config file
config.json
valorant.json
caiyun.json

__pycache__/
# log file
*/log/
*.log
btest.py

# python file
__pycache__/

# idea
.idea/

67 changes: 41 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@
[English](./README_EN.md) | 简体中文


![python](https://img.shields.io/badge/Python-3.8%2B-green) ![commit](https://img.shields.io/github/last-commit/musnows/Kook-Valorant-Bot) ![release](https://img.shields.io/github/v/release/musnows/Kook-Valorant-Bot)
![python](https://img.shields.io/badge/Python-3.10%2B-green) ![commit](https://img.shields.io/github/last-commit/musnows/Kook-Valorant-Bot) ![release](https://img.shields.io/github/v/release/musnows/Kook-Valorant-Bot)
[![khl server](https://www.kaiheila.cn/api/v3/badge/guild?guild_id=3986996654014459&style=0)](https://kook.top/gpbTwZ) ![githubstars](https://img.shields.io/github/stars/musnows/Kook-Valorant-Bot?style=social)

<img src="./screenshot/log.png" height="55px" alt="Bot Log Image">
</div>

## 功能
当前机器人基本完善,目前支持回复Valorant游戏错误码、查询Valorant每日商店/夜市/vp/r点,和一些简单功能。邮箱验证用户登录也已添加。
当前机器人基本完善,目前支持回复Valorant游戏错误码、查询Valorant每日商店/夜市/vp/r点,和一些简单功能。

支持邮箱验证用户登录,支持多账户登录(每位用户最多可登录3个Riot账户)

下面是目前支持的功能列表:

| 帮助命令 | 功能 |
| ------------- | ------------------------------------------ |
| `/Ahri` | 回复使用帮助(因`/help`和其他机器人冲突,故用阿狸的英文名`Ahri`替代) |
| `/ahri` | 回复使用帮助(因`/help`和其他机器人冲突,故用阿狸的英文名`ahri`替代) |
| `/vhelp` | Valorant相关查询功能的帮助命令 |


Expand All @@ -37,11 +39,6 @@
| `/saveid` | 保存(修改)用户的游戏id |
| `/myid` | 显示用户的游戏id |
| `/bundle 皮肤名` | 搜索已有皮肤系列包含什么枪械 |
| `/login 账户 密码` | 私聊bot进行登录riot账户的操作(获取token) |
| `/logout` | 退出riot账户登录 |
| `/shop` | 获取每日商店的4个皮肤 |
| `/night` | 获取夜市的6个皮肤 |
| `/uinfo``/point` | 获取玩家卡面和称号,剩余vp和r点 |
| `/notify-a 皮肤名` | 搜索皮肤名,并提供选项将指定皮肤加入商店提醒 |
| `/notify-l` | 查看当前已经设置了提醒的皮肤 |
| `/notify-d 皮肤uuid` | 使用uuid删除不需要提醒的皮肤 |
Expand All @@ -51,6 +48,23 @@

`/rate` 参与的打分,其会显示在 `/shop` 商店查询结果的尾部,同时统计当日商店最高分和最低分,可以在第二天用 `/kkn` 来查看。

| 登陆和查询 | 功能 |
| ------------- | ------------------------------------------ |
| `/login 账户 密码` | 私聊bot进行登录riot账户的操作 (支持多账户登录) |
| `/login-l` | 查看已登录的账户 |
| `/tfa 验证码` | 开启了邮箱验证的账户提供邮箱验证码 |
| `/logout` | 退出riot账户登录 |
| `/shop` | 获取每日商店的4个皮肤 |
| `/night` | 获取夜市的6个皮肤 |
| `/uinfo``/point` | 获取玩家卡面和称号,剩余vp和r点 |
| `/mission` | 获取玩家的每日/每周任务(开发中) |
| `/match` | 获取玩家的历史5场战绩 |


每日商店刷枪提醒功能 `/notify-a` 需要用户**保持登录状态**,bot会在每天的`08:00AM`遍历列表,查看您的商店是否刷出了您想要的皮肤;如果是vip用户,则会直接发送当日商店的图片。

cookie 登录信息将在2-3天后失效,所以皮肤提醒功能会出现用户没有登录而无法获取的情况。目前取消了notify未登录提醒,添加了在**全局变量**中保存账户密码的功能。

| Vip相关 | 功能 |
| ------------- | ---------------- |
| `/vip-u 激活码` |兑换阿狸的vip |
Expand All @@ -60,20 +74,16 @@
| `/vip-shop-s 图片编号` | 切换商店查询的背景图 |
| `/vip-shop-d 图片编号` | 删除商店查询的背景图 |


每日商店刷枪提醒功能 `/notify-a` 需要用户**保持登录状态**,bot会在每天的`08:00AM`遍历列表,查看您的商店是否刷出了您想要的皮肤;如果是vip用户,则会直接发送当日商店的图片。

cookie 登录信息将在2-3天后失效,所以皮肤提醒功能会出现用户没有登录而无法获取的情况。目前取消了notify未登录提醒,添加了在**全局变量**中保存账户密码的功能。

机器人的所有vip命令斗需要vip用户才能执行。vip功能是阿狸的主要发电来源,感谢大家的支持。

| 其他命令 | 功能 |
| ----------------- | ------------------------------------------------------------ |
| `/hello` | 打个招呼 (一般用来测试bot在不在线) |
| `/roll 1 100` | 掷色子1-100,范围可自行调节 |
| `/countdown 秒数` | 倒计时,默认60秒 |
| `/TL 内容` | 翻译内容。其他语言翻译为中文,中文默认翻译成en |
| `/TLON` | 在本文字频道`打开`实时翻译功能 |
| `/TLOFF` | 在本文字频道`关闭`实时翻译功能 |
| `/tl 内容` | 翻译内容。其他语言翻译为中文,中文默认翻译成en |
| `/tlon` | 在本文字频道`打开`实时翻译功能 |
| `/tloff` | 在本文字频道`关闭`实时翻译功能 |
| `/we 城市` | 查询`城市`未来3天的天气情况 |
| `/hs` | 历史上的今天(因为kook审核原因被删除) |
| `` | 自动给新用户上对应角色(可自主修改) |
Expand Down Expand Up @@ -117,15 +127,17 @@ Api请求返回示例图:

## 如何使用?

保证你的Windows/Linux中`Python`版本高于`3.8`,执行下面的安装库命令
保证你的 Windows/Linux 中 `Python` 版本高于 `3.10`,执行下面的安装库命令

~~~
pip install -r requirements.txt
~~~

建议根据 [khl.py/example](https://github.com/TWT233/khl.py/tree/main/example) 的教程,学习KOOK机器人的基本搭建(很简单的,相信我)

如果你想直接使用本机器人,可以转到本仓库 [WIKI](https://github.com/musnows/Kook-Valorant-Bot/wiki) 查看更多引导内容
如果你想直接使用本机器人,可以转到本仓库 [WIKI](https://github.com/musnows/Kook-Valorant-Bot/wiki) 查看更多引导内容。

本仓库代码文件较多,提供了带注释的Tree,详见 [docs/file-tree](./docs/file-tree.md)

----

Expand All @@ -134,19 +146,22 @@ pip install -r requirements.txt
下面是一些未来的计划

- [x] 增加保存用户游戏id的功能
- [x] 添加自动给新用户上色功能(目前只有kook的valorant服务器能用
- [ ] 实现查询游戏战绩(需要roit授权)
- [x] 添加自动给新用户上色功能(只有 kook [valorant社区](https://kook.top/oqz7Xg) 可用
- [x] 实现查询游戏战绩
- [x] 实现玩家商店刷枪的查询
- [x] 实现当商店刷新某一把枪的时候提醒玩家
- [x] 查看玩家的夜市
- [x] 邮箱验证2fa登录
- [ ] 通行证、每日任务的查询
- [ ] 通行证、每日任务的查询(开发中)
- [ ] 以类似抽卡的方式,用按钮、图片等等方式显示用户的夜市
- [ ] Api增加使用Riot Token调用的接口,方便本地管理登录信息,调用api画图
- [x] Api增加画图接口,方便本地管理登录信息,只调用api画图


### 免责声明

咳咳,虽然初步的商店查询功能已经上线,但是其是否`封号`依旧有争论!目前功能已经上线半年有余,未出现异常现象;且询问过外网开发者,其表示没有听说过有人因为使用api查询而被封号。
虽然初步的商店查询功能已经上线,但是其是否`封号`依旧有争论!目前功能已经上线一年有余,未出现异常现象;且询问过外网开发者,其表示没有听说过有人因为使用api查询而被封号。

**如果您担心风险,请不要使用相关功能**!bot的`/vhelp`命令`/login`命令中有相关警告提示,使用即代表您同意了承担风险!
**如果您担心风险,请不要使用相关功能**!bot的 `/vhelp` 命令 `/login` 命令中有相关警告提示,使用即代表您同意了承担风险!

<img src="./screenshot/issue_banned.png" height="250px" alt="issue screenshots">

Expand All @@ -155,10 +170,10 @@ pip install -r requirements.txt
## 依赖

由于本人压根没有系统的学过Python,所以本仓库的很多代码都是根据他人教程修改后使用的
* 基本框架参考[khl.py](https://github.com/TWT233/khl.py)提供的 `kook sdk` 以及使用教程
* 基本框架参考 [khl.py](https://github.com/TWT233/khl.py) 提供的 `kook sdk` 以及使用教程
* Valorant游戏皮肤/捆绑包/玩家卡面等素材源自 [valorant-api.com](https://valorant-api.com/)
* Valorant游戏主要商店查询代码基于 [ValorantClientAPI](https://github.com/HeyM1ke/ValorantClientAPI) 项目提供的 `api文档`
* 通过账户密码获取 `riot_auth_token` 基于 [floxay/python-riot-auth](https://github.com/floxay/python-riot-auth) & [Prodzify/Riot-auth](https://github.com/Prodzify/Riot-auth)
* 通过账户密码获取 `riot_auth_token` 基于 [floxay/python-riot-auth](https://github.com/floxay/python-riot-auth) & [Prodzify/Riot-auth](https://github.com/Prodzify/Riot-auth)。目前已和 `floxay/python-riot-auth` 解耦


### 特别鸣谢🎁
Expand Down
34 changes: 20 additions & 14 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Kook-Valorant-Bot</h1>

English | [简体中文](./README.md)

![python](https://img.shields.io/badge/Python-3.8%2B-green) ![commit](https://img.shields.io/github/last-commit/musnows/Kook-Valorant-Bot) ![release](https://img.shields.io/github/v/release/musnows/Kook-Valorant-Bot)
![python](https://img.shields.io/badge/Python-3.10%2B-green) ![commit](https://img.shields.io/github/last-commit/musnows/Kook-Valorant-Bot) ![release](https://img.shields.io/github/v/release/musnows/Kook-Valorant-Bot)
[![khl server](https://www.kaiheila.cn/api/v3/badge/guild?guild_id=3986996654014459&style=0)](https://kook.top/gpbTwZ) ![githubstars](https://img.shields.io/github/stars/musnows/Kook-Valorant-Bot?style=social)

<img src="./screenshot/log.png" height="55px" alt="Bot Log Image">
</div>

KOOK(once called kaiheila) is a Chinese voice communication software.
KOOK (once called kaiheila) is a Chinese voice communication platform.

>Because this bot are only used in Chinese platform,so I didn't write a more detail Readme in English.Sorry for that
> This bot is only used in Chinese platform, so I didn't write a more detail README in English. Sorry for that

## Command
Expand All @@ -26,29 +26,38 @@ Here is the Command List for bot:

| Help | Function |
| --------------- | ------------------------------------------------------------ |
| `/Ahri` | help command(Because `/help`conflicts with other bots, `/Ahri`is used instead,who is an hero in League of Legends) |
| `/vhelp` | help command for Valorant serch fuction |
| `/ahri` | help command (Because `/help`conflicts with other bots, `/ahri` is used instead, which is an hero-name in League of Legends) |
| `/vhelp` | help command for Valorant search fuction |


Recommended to use after the Valorant_Function is stable.

| Valorant | Function |
| --------------- | ------------------------------------------------------------ |
| `/val err_code` | help with the err_code of valorant |
| `/saveid` | save or change user's game ID |
| `/myid` | show user's game ID |
| `/bundle name` | search for skin bundles |
| `/bundle name` | search for skin bundles (only support zh-TW ) |
| `/login account passwd` | login your `riot_account` to fetch `auth_token` |
| `/logout` | logout your riot_account |
| `/login-l` | show riot accout you have logined |
| `/tfa vcode` | login with verify code of MFA user |
| `/logout` | logout your `riot_account` |
| `/shop` | fetch skin at daily shop |
| `/night` | fetch night market at daily shop |
| `/uinfo` or `/point` | fetch player `card` & `title`,remaining `Vp` and `Rp` |
| `/night` | fetch night market |
| `/uinfo` or `/point` | fetch player `card` & `title`,remaining `Vp` & `Rp` |
| `/mission` | fetch player's mission (Under developmen) |
| `/match` | fetch player's match history |
| `/notify-a skin_name` |search for skin name,providing NO for add it into notification |
| `/notify-l` | show current notify skin |
|`/rate skin_name`|search skin by name for /rts|
|`/rts NO. point comment`|select skin_no. to rate a point(0~100) and leave a comment to it|
|`/kkn`|checkout yesterday's heighest/lowest rate_point of daily shop |


notify function require user to stay `login`, bot wil fetch your daily shop at `08:00AM GMT+8` .If the skin is in daily shop, bot will send a private message to user.

The bot is only using in Chinese platform, the skin `name` only support `zh-TW`


| Vip | Function |
| ------------- | ---------------- |
| `/vip-u uuid` | get vip from uuid |
Expand All @@ -59,11 +68,8 @@ Recommended to use after the Valorant_Function is stable.
| `/vip-shop-d NO.` | delete vip-shop background img using `NO.` |


notify function require user to stay `login`, bot wil fetch your daily shop at `08:00AM GMT+8` .If the skin is in daily shop, bot will send a private message to user.

If the user is a vip, the bot will also send the full picture of the daily-shop on that day through private message.

> The bot is only using in Chinese platform, the skin `name` only support `zh-TW`

| Other | Function |
| --------------- | ------------------------------------------------------------ |
Expand Down Expand Up @@ -103,7 +109,7 @@ You can find image examples for the functions in [screenshot](./screenshot) flod
## How to used?


make sure your Windows/Linux `Python` version `3.8+`
make sure your Windows/Linux `Python` version `3.10+`

~~~
pip install -r requirements.txt
Expand Down
13 changes: 7 additions & 6 deletions code/api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
import traceback
from aiohttp import web
from utils.Gtime import getTime
from utils.api import ApiHandler
from utils.log.Logging import _log
from pkg.utils.Gtime import getTime
from pkg.utils.api import ApiHandler
from pkg.utils.log.Logging import _log

# 初始化节点
routes = web.RouteTableDef()
Expand Down Expand Up @@ -199,7 +199,7 @@ async def post_shop_cmp(request):


# 爱发电的wh
from utils.file.Files import bot
from pkg.utils.file.Files import bot
@routes.post('/afd')
async def aifadian_webhook(request):
_log.info(f"request | /afd")
Expand All @@ -221,7 +221,8 @@ async def aifadian_webhook(request):
app.add_routes(routes)
if __name__ == '__main__':
try: # host需要设置成0.0.0.0,否则只有本地才能访问
_log.info(f"API Service Start")
web.run_app(app, host='0.0.0.0', port=14726)
HOST,PORT = '0.0.0.0',14726
_log.info(f"API Service Start at {HOST}:{PORT}")
web.run_app(app, host=HOST, port=PORT)
except:
_log.exception("Exception occur")
4 changes: 2 additions & 2 deletions code/config/config.exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"img_upload_token": "用来进行vip商店图片测试的机器人websocket token(发图片让kook的内容识别来判断有么有问题)"
},
"master_id": "机器人开发者userid",
"caiyun": "彩云小译的token",
"caiyun": "彩云小译的token,可为空,但不能删除本键值",
"channel":{
"debug_ch": "发送错误日志的频道",
"img_upload_ch": "用来测试vip商店图片的频道"
Expand All @@ -17,7 +17,7 @@
"leancloud":{
"appid":"leancloud数据库的appid(可联系作者,共用皮肤评价数据库)",
"appkey":"leancloud数据库的appkey",
"master_key":"leancloud数据库的masterkey",
"master_key":"leancloud数据库的masterkey(可为空,目前没有使用)",
"user_name":"数据库内置用户id",
"user_pwd":"数据库内置用户密码"
},
Expand Down
Loading

0 comments on commit 8bb8e1a

Please sign in to comment.