forked from sanshanya/hoshino_xcw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sanshanya
committed
Nov 1, 2020
1 parent
261f573
commit 2928c47
Showing
231 changed files
with
5,925 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# Genshin_Impact_bot | ||
|
||
### This is a Genshin Impact plugin for [HoshinoBot](https://github.com/Ice-Cirno/HoshinoBot) | ||
### 这是一个[HoshinoBot](https://github.com/Ice-Cirno/HoshinoBot)的原神相关插件 | ||
### 这个项目目前正在扩展,加入更多原神相关娱乐和信息查询功能,敬请期待 | ||
|
||
### 如果你是在项目名称为Genshin_Impact_gacha时安装的,请删除Genshin_Impact_gacha重新Git clone | ||
|
||
# 安装方法 | ||
|
||
在 HoshinoBot\hoshino\modules 目录下使用以下命令拉取本项目 | ||
``` | ||
git clone https://github.com/H-K-Y/Genshin_Impact_bot.git | ||
``` | ||
然后在 HoshinoBot\\hoshino\\config\\\__bot__.py 文件的 MODULES_ON 加入 Genshin_Impact_bot | ||
|
||
config.py文件有插件的常用配置,你可以根据自己的情况修改 | ||
|
||
重启 HoshinoBot | ||
|
||
### (可选)放置找神瞳的gif动态图 | ||
原神观测枢wiki上还有如何拿到神瞳的gif动态图,如果你想让机器人发送动态图可以在Releases下载 | ||
|
||
gif图包解压后放在icon路径下,安装完的路径应该是 | ||
``` | ||
HoshinoBot\hoshino\modules\Genshin_Impact_bot\seek_god_eye\icon\风神瞳\56.gif | ||
``` | ||
|
||
|
||
|
||
# 效果演示 | ||
### 原神抽卡 | ||
 | ||
### 丘丘语翻译 | ||
 | ||
### 找神瞳 | ||
 | ||
### 资源位置查询 | ||
 | ||
|
||
|
||
# 指令 | ||
|
||
原神帮助 : 查看插件的帮助 | ||
|
||
### 原神抽卡 | ||
|
||
@bot相遇之缘:10连抽卡 | ||
|
||
@bot纠缠之缘:90连抽卡 | ||
|
||
@bot原之井:180连抽卡 | ||
|
||
原神卡池:查看当前UP池,这个指令也可以用来重载卡池配置文件,config.json保存的是当前卡池信息 | ||
|
||
原神卡池切换:切换其他原神卡池 | ||
|
||
### 丘丘语翻译 | ||
丘丘一下 丘丘语句 :翻译丘丘语,注意这个翻译只能把丘丘语翻译成中文,不能反向 | ||
|
||
丘丘词典 丘丘语句 :查询丘丘语句的单词含义 | ||
|
||
### 找神瞳 | ||
找风神瞳 <神瞳编号>:让机器人发送风神瞳的位置,神瞳编号为可选参数,不写编号机器人会随机一个编号,风可以换成岩来找岩神瞳 | ||
|
||
找到神瞳了 <神瞳编号>:让机器人记录这个神瞳编号,以后机器人不会给你发送这个编号 | ||
|
||
@bot删除找到神瞳 <神瞳编号>:在你已经找到的神瞳记录里删除这个编号 | ||
|
||
@bot重置风神瞳找到记录 : 删除所有风神瞳的找到记录,这个指令会有二次确认,风可以换成岩来重置岩神瞳的记录 | ||
|
||
@bot找到多少神瞳了 : 查看当前你找到多少神瞳了 | ||
|
||
### 资源位置查询 | ||
|
||
XXX哪里有:查询XXX的位置图,XXX是资源的名字 | ||
|
||
原神资源列表:查询所有的资源名称 | ||
|
||
# 更新记录 | ||
|
||
### 2020-10-31 | ||
* 加入了查询资源位置的功能 | ||
|
||
### 2020-10-29 | ||
* 加入了找神瞳的功能 | ||
|
||
### 2020-10-26 | ||
* 加入了丘丘语翻译功能 | ||
|
||
### 2020-10-22 | ||
* 修复了4星概率写错了导致4星只能保底抽出的问题............. | ||
* 加入了更多抽卡的统计结果,比如抽出最多的武器是啥,第一个4星和5星事多少抽出的 | ||
|
||
### 2020-10-21 | ||
* 在config.py加入了抽卡限制功能,限制每个人一天最多抽多少次,感谢[corvo007](https://github.com/corvo007)提出的粪pr (粪pr是他自己说的 | ||
* 修复了第一次切换卡池后不能再切换卡池的问题 | ||
* 修复了查看UP信息时报错的问题 | ||
|
||
### 2020-10-20 | ||
* 重构了项目代码,~~第二天就重写?~~,~~过几天怕是忘了写的啥了........~~ | ||
* 加入的武器UP池和常驻池 | ||
* 加入了切换卡池的功能 | ||
|
||
### 2020-10-19 | ||
* 加入10连抽,90连抽和180连抽 | ||
* 加入抽卡发送图片功能 | ||
* 修复了Windows系统发送图片时可能出现的路径问题,图片全部改为base64发送 | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from hoshino import Service | ||
|
||
|
||
sv = Service("原神帮助") | ||
|
||
|
||
help_txt = '''这是一个HoshinoBot的原神相关插件,包含原神抽卡,丘丘语翻译,找神瞳,找资源点等功能 | ||
插件仓库在 https://github.com/H-K-Y/Genshin_Impact_bot.git | ||
指令: | ||
@bot相遇之缘:10连抽卡 | ||
@bot纠缠之缘:90连抽卡 | ||
@bot原之井:180连抽卡 | ||
原神卡池:查看当前UP池,这个指令也可以用来重载卡池配置文件,config.json保存的是当前卡池信息 | ||
原神卡池切换:切换其他原神卡池 | ||
丘丘一下 丘丘语句 :翻译丘丘语,注意这个翻译只能把丘丘语翻译成中文,不能反向 | ||
丘丘词典 丘丘语句 :查询丘丘语句的单词含义 | ||
找风神瞳 <神瞳编号>:让机器人发送风神瞳的位置,神瞳编号为可选参数,不写编号机器人会随机一个编号,风可以换成岩来找岩神瞳 | ||
找到神瞳了 <神瞳编号>:让机器人记录这个神瞳编号,以后机器人不会给你发送这个编号 | ||
@bot删除找到神瞳 <神瞳编号>:在你已经找到的神瞳记录里删除这个编号 | ||
@bot重置风神瞳找到记录 : 删除所有风神瞳的找到记录,这个指令会有二次确认,风可以换成岩来重置岩神瞳的记录 | ||
@bot找到多少神瞳了 : 查看当前你找到多少神瞳了 | ||
XXX哪里有:查询XXX的位置图,XXX是资源的名字 | ||
原神资源列表:查询所有的资源名称 | ||
''' | ||
|
||
|
||
@sv.on_fullmatch("原神帮助") | ||
async def help(bot, ev): | ||
await bot.send(ev, help_txt) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
# 插件的配置文件 | ||
|
||
|
||
# 原神抽卡 | ||
|
||
Gacha10Limit = 100 # 10连每天可以抽的次数 | ||
Gacha90Limit = 100 # 90连每天可以抽的次数 | ||
Gacha180Limit = 100 # 180连每天可以抽的次数 | ||
|
||
|
||
|
||
|
||
# 神瞳信息查询 | ||
|
||
# 这个参数设置是否允许私聊获取神瞳信息,默认为False,表示不允许私聊,你可以改为True,来设置允许私聊 | ||
# 注意,机器人短时间内大量私聊有可能会被腾讯风控 | ||
# 这个效果还没实现,先不要管 | ||
# ALLOW_PRIVATE_CHAT = False | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
from hoshino import Service | ||
from .gacha import gacha_info , FILE_PATH , Gacha , POOL | ||
import os | ||
import json | ||
from hoshino.util import DailyNumberLimiter | ||
from ..config import Gacha10Limit,Gacha90Limit,Gacha180Limit | ||
|
||
|
||
daily_limiter_10 = DailyNumberLimiter(Gacha10Limit) | ||
daily_limiter_90 = DailyNumberLimiter(Gacha90Limit) | ||
daily_limiter_180 = DailyNumberLimiter(Gacha180Limit) | ||
|
||
sv = Service('原神抽卡') | ||
|
||
group_pool = { | ||
# 这个字典保存每个群对应的卡池是哪个,群号字符串为key,卡池名为value,群号不包含在字典key里卡池按默认DEFAULT_POOL | ||
} | ||
|
||
def save_group_pool(): | ||
with open(os.path.join(FILE_PATH,'gid_pool.json'),'w',encoding='UTF-8') as f: | ||
json.dump(group_pool,f,ensure_ascii=False) | ||
|
||
|
||
|
||
# 检查gid_pool.json是否存在,没有创建空的 | ||
if not os.path.exists(os.path.join(FILE_PATH,'gid_pool.json')): | ||
save_group_pool() | ||
|
||
|
||
|
||
# 读取gid_pool.json的信息 | ||
with open(os.path.join(FILE_PATH,'gid_pool.json'),'r',encoding='UTF-8') as f: | ||
group_pool = json.load(f) | ||
|
||
|
||
|
||
|
||
@sv.on_prefix(["相遇之缘"], only_to_me=True) | ||
async def gacha_(bot, ev): | ||
gid = str(ev.group_id) | ||
userid = ev['user_id'] | ||
if not daily_limiter_10.check(userid): | ||
await bot.send(ev, '今天已经抽了很多次啦,明天再来吧~') | ||
return | ||
if gid in group_pool: | ||
G = Gacha(group_pool[gid]) | ||
else: | ||
G = Gacha() | ||
daily_limiter_10.increase(userid) | ||
await bot.send(ev, G.gacha_10() , at_sender=True) | ||
|
||
@sv.on_prefix(["纠缠之缘"], only_to_me=True) | ||
async def gacha_(bot, ev): | ||
gid = str(ev.group_id) | ||
userid = ev['user_id'] | ||
if not daily_limiter_90.check(userid): | ||
await bot.send(ev, '今天已经抽了很多次啦,明天再来吧~') | ||
return | ||
if gid in group_pool: | ||
G = Gacha(group_pool[gid]) | ||
else: | ||
G = Gacha() | ||
daily_limiter_90.increase(userid) | ||
await bot.send(ev, G.gacha_90(90) , at_sender=True) | ||
|
||
|
||
|
||
@sv.on_prefix(["原之井"], only_to_me=True) | ||
async def gacha_(bot, ev): | ||
gid = str(ev.group_id) | ||
userid = ev['user_id'] | ||
if not daily_limiter_180.check(userid): | ||
await bot.send(ev, '今天已经抽了很多次啦,明天再来吧~') | ||
return | ||
daily_limiter_180.increase(userid) | ||
if gid in group_pool: | ||
G = Gacha(group_pool[gid]) | ||
else: | ||
G = Gacha() | ||
await bot.send(ev, G.gacha_90(180) , at_sender=True) | ||
|
||
|
||
|
||
@sv.on_prefix(["原神卡池","原神up","原神UP"]) | ||
async def gacha_(bot, ev): | ||
gid = str(ev.group_id) | ||
|
||
if gid in group_pool: | ||
info = gacha_info(group_pool[gid]) | ||
else: | ||
info = gacha_info() | ||
|
||
await bot.send(ev, info , at_sender=True) | ||
|
||
@sv.on_prefix(('原神卡池切换','原神切换卡池')) | ||
async def set_pool(bot, ev): | ||
|
||
pool_name = ev.message.extract_plain_text().strip() | ||
gid = str(ev.group_id) | ||
|
||
if pool_name in POOL.keys(): | ||
if gid in group_pool: | ||
group_pool[gid] = pool_name | ||
else: | ||
group_pool.setdefault(gid,pool_name) | ||
save_group_pool() | ||
await bot.send(ev, f"卡池已切换为 {pool_name} ") | ||
return | ||
|
||
txt = "请使用以下命令来切换卡池\n" | ||
for i in POOL.keys(): | ||
txt += f"原神卡池切换 {i} \n" | ||
|
||
await bot.send(ev, txt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"注释": "4星和5星常驻角色武器是不包括UP的,需要4星或5星所有物品角色随机时程序会自己拼接列表去除重复", | ||
"5星up角色": ["可莉"], | ||
"4星up角色": ["行秋","诺艾尔", "砂糖"], | ||
"5星up武器": ["四风原典","狼的末路"], | ||
"4星up武器": ["祭礼弓","祭礼残章","匣里灭辰","祭礼大剑","祭礼剑"], | ||
"5星常驻角色": ["刻晴","莫娜","七七","迪卢克","琴"], | ||
"4星常驻角色": ["菲谢尔","香菱", "芭芭拉","重云","班尼特","凝光","北斗","雷泽"], | ||
"4星白给角色": ["安柏","凯亚","丽莎"], | ||
"5星非up武器": ["阿莫斯之弓","天空之翼","天空之卷","和璞鸢","天空之脊","天空之傲","天空之刃","风鹰剑"], | ||
"4星非up武器": ["弓藏","绝弦","西风猎弓","昭心","流浪乐章","西风秘典","西风长枪", "雨裁","钟剑","西风大剑","匣里龙吟","笛剑","西风剑"], | ||
"3星武器": ["弹弓","神射手之誓","鸦羽弓","翡玉法球","讨龙英杰谭","魔导绪论","黑缨枪","以理服人", "沐浴龙血的剑","铁影阔剑","飞天御剑","黎明神剑","冷刃"] | ||
} |
Oops, something went wrong.