Skip to content

Commit

Permalink
Merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
王见思 committed May 9, 2020
2 parents 5e20d89 + 4c9a3b9 commit 2bccf20
Show file tree
Hide file tree
Showing 17 changed files with 219 additions and 683 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ HoshinoBot 的功能开发以服务 [公主连结☆Re:Dive](http://priconne-red
- **官方推特转发**
- **官方四格推送**
- **角色别称转换**
- **切噜语编解码**:切噜~♪
- **竞技场余矿查询**

> 由于bot的功能会快速迭代开发,使用方式这里不进行具体的说明,请向bot发送"help"或移步[此文件](hoshino/modules/botmanage/help.py)查看详细。会战管理功能的详细说明,请[点击这里](hoshino/modules/pcrclanbattle/clanbattle/README.md)
除上述与之外,HoshinoBot 还具有以下通用功能:
HoshinoBot 还具有以下通用功能:

- **[蜜柑计划](http://mikanani.me)番剧更新订阅**
- **入群欢迎**&**退群提醒**
Expand All @@ -35,7 +37,7 @@ HoshinoBot 的功能开发以服务 [公主连结☆Re:Dive](http://priconne-red
- **机器翻译**
- **反馈发送**:反馈内容将由bot私聊发送给维护组

另外,HoshinoBot 为 [艦隊これくしょん](http://www.dmm.com/netgame/feature/kancolle.html) 玩家开发了以下功能:
此外,HoshinoBot 为 [艦隊これくしょん](http://www.dmm.com/netgame/feature/kancolle.html) 玩家开发了以下功能:

- **官推转发**:「艦これ」開発/運営 & C2機関
- **时报**
Expand Down Expand Up @@ -305,13 +307,13 @@ HoshinoBot 的功能繁多,各群可根据自己的需要进行开关控制,
https://mikanani.me/RSS/MyBangumi?token=abcdfegABCFEFG%2b123%3d%3d
```

保留其中的`token`参数,创建文件`hoshino\modules\subscribe\mikan\config.json`编写以下内容:
保留其中的`token`参数,创建文件`hoshino\modules\mikan\config.json`编写以下内容:

```json
{"MIKAN_TOKEN" : "abcdfegABCFEFG+123=="}
```

注意:`token`中可能含有url转义,您需要将`%2b`替换为`+`,将`%3d`替换为`=`
注意:`token`中可能含有url转义,您需要将`%2b`替换为`+`,将`%2f`替换为`/`,将`%3d`替换为`=`



Expand Down
3 changes: 3 additions & 0 deletions hoshino/aiorequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ async def text(self) -> str:

async def json(self, **kwargs) -> Any:
return await run_sync_func(self.raw_response.json, **kwargs)

def raise_for_status(self):
self.raw_response.raise_for_status()


async def request(method, url, **kwargs) -> AsyncResponse:
Expand Down
3 changes: 3 additions & 0 deletions hoshino/modules/botmanage/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
[禁用 pcr-twitter] 禁用日服官推转发
[启用 pcr-arena-reminder-jp] 背刺时间提醒(UTC+9)
[启用 pcr-arena-reminder-tw] 背刺时间提醒(UTC+8)
[挖矿 15001] 查询矿场中还剩多少钻
[切噜一下] 后以空格隔开接想要转换为切噜语的话
[切噜~♪切啰巴切拉切蹦切蹦] 切噜语翻译
[!帮助] 查看会战管理功能的说明
===========
- 通用功能 -
Expand Down
2 changes: 1 addition & 1 deletion hoshino/modules/groupmaster/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def chat_queshi(bot, ctx):
@sv.on_keyword(('会战', '刀'))
async def chat_clanba(bot, ctx):
if random.random() < 0.03:
await bot.send(ctx, R.img('我的天啊你看看都几点了.jpg').cqcode)
await bot.send(ctx, R.img('我的天啊你看看都几度了.jpg').cqcode)

@sv.on_keyword(('内鬼'))
async def chat_neigui(bot, ctx):
Expand Down
43 changes: 21 additions & 22 deletions hoshino/modules/pcrclanbattle/clanbattle/battlemaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ class BattleMaster(object):
SERVER_TW_NAME = ('tw', 'TW', 'Tw', '台', '台服', str(SERVER_TW))
SERVER_CN_NAME = ('cn', 'CN', 'Cn', '国', '国服', 'B', 'B服', str(SERVER_CN))

config = get_config()

def __init__(self, group):
super().__init__()
self.group = group
self.clandao = ClanDao()
self.memberdao = MemberDao()
BattleMaster.config = get_config()
self.config = get_config()


@staticmethod
Expand Down Expand Up @@ -60,40 +58,41 @@ def get_yyyymmdd(time, zone_num:int=8):


@staticmethod
def next_boss(round_, boss):
boss = boss + 1
if boss > 5:
boss = 1
round_ = round_ + 1
return (round_, boss)
def next_boss(round_:int, boss:int):
return (round_, boss + 1) if boss < 5 else (round_ + 1, 1)


@staticmethod
def get_stage(round_):
def get_stage(round_, server):
if server == BattleMaster.SERVER_CN:
y, m, _ = BattleMaster.get_yyyymmdd(datetime.now(), 8)
if y == 2020:
if m < 9:
return 5 if round_ == 1 else 6
elif m < 12:
return 7 if round_ <= 3 else 8
# All other situation
return 4 if round_ >= 35 else 3 if round_ >= 11 else 2 if round_ >= 4 else 1


@staticmethod
def get_boss_info(round_, boss, server):
def get_boss_info(self, round_, boss, server):
"""@return: boss_max_hp, score_rate"""
stage = BattleMaster.get_stage(round_)
config = BattleMaster.config
stage = BattleMaster.get_stage(round_, server)
config = self.config
boss_hp = config[ config["BOSS_HP"][server] ][ stage-1 ][ boss-1 ]
score_rate = config[ config["SCORE_RATE"][server] ][ stage-1 ][ boss-1 ]
return boss_hp, score_rate


@staticmethod
def get_boss_hp(round_, boss, server):
stage = BattleMaster.get_stage(round_)
config = BattleMaster.config
def get_boss_hp(self, round_, boss, server):
stage = BattleMaster.get_stage(round_, server)
config = self.config
return config[ config["BOSS_HP"][server] ][ stage-1 ][ boss-1 ]


@staticmethod
def get_score_rate(round_, boss, server):
stage = BattleMaster.get_stage(round_)
config = BattleMaster.config
def get_score_rate(self, round_, boss, server):
stage = BattleMaster.get_stage(round_, server)
config = self.config
return config[ config["SCORE_RATE"][server] ][ stage-1 ][ boss-1 ]


Expand Down
Loading

0 comments on commit 2bccf20

Please sign in to comment.