update tos
This commit is contained in:
parent
bcaefb9120
commit
dec0729861
8 changed files with 37 additions and 33 deletions
|
@ -53,6 +53,7 @@ slower_schedule = false
|
|||
enable_dirty_check = true
|
||||
enable_urlmanager = true
|
||||
enable_tos = false
|
||||
tos_waring_counts = 5
|
||||
enable_analytics = true
|
||||
enable_eval = true
|
||||
enable_rickroll = true
|
||||
|
|
11
core/tos.py
11
core/tos.py
|
@ -2,20 +2,22 @@ from config import Config
|
|||
from core.builtins import Bot
|
||||
from database import BotDBUtil
|
||||
|
||||
WARNING_COUNTS = int(Config('tos_waring_counts', 5))
|
||||
|
||||
async def warn_target(msg: Bot.MessageSession, reason=None):
|
||||
if WARNING_COUNTS >= 1:
|
||||
current_warns = int(msg.target.sender_info.query.warns) + 1
|
||||
msg.target.sender_info.edit('warns', current_warns)
|
||||
warn_template = [msg.locale.t("tos.warning")]
|
||||
if reason is not None:
|
||||
warn_template.append(msg.locale.t("tos.reason") + reason)
|
||||
if current_warns < 5:
|
||||
if current_warns < WARNING_COUNTS:
|
||||
warn_template.append(msg.locale.t('tos.warning.count', current_warns=current_warns))
|
||||
if current_warns <= 2:
|
||||
warn_template.append(msg.locale.t('tos.warning.appeal', issue_url=Config('issue_url')))
|
||||
if current_warns == 5:
|
||||
if current_warns == WARNING_COUNTS:
|
||||
warn_template.append(msg.locale.t('tos.warning.last'))
|
||||
if current_warns > 5:
|
||||
if current_warns > WARNING_COUNTS:
|
||||
msg.target.sender_info.edit('isInBlockList', True)
|
||||
return
|
||||
await msg.send_message('\n'.join(warn_template))
|
||||
|
@ -26,8 +28,9 @@ async def pardon_user(user: str):
|
|||
|
||||
|
||||
async def warn_user(user: str, count=1):
|
||||
if WARNING_COUNTS >= 1:
|
||||
current_warns = int(BotDBUtil.SenderInfo(user).query.warns) + count
|
||||
BotDBUtil.SenderInfo(user).edit('warns', current_warns)
|
||||
if current_warns > 5:
|
||||
if current_warns > WARNING_COUNTS:
|
||||
BotDBUtil.SenderInfo(user).edit('isInBlockList', True)
|
||||
return current_warns
|
||||
|
|
|
@ -49,7 +49,9 @@
|
|||
"petal.message.gained.success": "获得了 ${amount} 片花瓣。",
|
||||
"petal.message.gained.limit": "但是,本日获得花瓣已达到每日上限,请明日再试。",
|
||||
"petal.message.lost.success": "失去了 ${amount} 片花瓣。",
|
||||
"petal.message.lost.limit": "(本日失去花瓣已达到每日上限)",
|
||||
"petal.message.lost.limit": "(本日失去花瓣已达到每日上限。)",
|
||||
"game.message.stop": "已停止。",
|
||||
"game.message.none": "当前游戏未在进行。",
|
||||
"success": "成功。",
|
||||
"tos.reason": "具体原因:",
|
||||
"tos.reason.abuse": "一段时间内使用命令的次数过多。",
|
||||
|
|
|
@ -99,8 +99,6 @@ async def skip_stone(msg: Bot.MessageSession):
|
|||
if count == 10:
|
||||
if g := gained_petal(msg, 2):
|
||||
send += '\n' + g
|
||||
if count in [3, 5, 9]:
|
||||
send += '\n' + msg.locale.t('eastereggs.message.1')
|
||||
await msg.finish(send)
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,5 @@
|
|||
"coin.message.tail": "…\n…是反面!",
|
||||
"stone.help.desc": "打水漂。",
|
||||
"stone.message.skip": "你扔了一块石头,漂了 ${count} 下。",
|
||||
"stone.message.skip.nothing": "你扔了一块石头,什么也没发生。",
|
||||
"eastereggs.message.1": "※ 这使你充满了决心。"
|
||||
"stone.message.skip.nothing": "你扔了一块石头,什么也没发生。"
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ async def _(msg: Bot.MessageSession):
|
|||
await asyncio.create_task(timer(datetime.now().timestamp(), wait_time, hooked_time))
|
||||
|
||||
|
||||
@fish.handle('retract')
|
||||
@fish.handle('retract {{fish.retract.help}}')
|
||||
@fish.regex(r'^(?:收杆|收)$')
|
||||
async def _(msg: Bot.MessageSession):
|
||||
if msg.target.target_id in play_state and play_state[msg.target.target_id]['active']:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"fish.help.desc": "钓鱼",
|
||||
"fish.help": "抛竿/收竿",
|
||||
"fish.help.desc": "钓鱼。",
|
||||
"fish.help": "抛竿。",
|
||||
"fish.retract.help": "收竿。",
|
||||
"fish.message.size.tiny": "特小",
|
||||
"fish.message.size.small": "稍小",
|
||||
"fish.message.size.medium": "中",
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"tic_tac_toe.help.desc": "下井字棋。",
|
||||
"tic_tac_toe.help": "和(菜鸡)机器人下井字棋。不会获得花瓣。",
|
||||
"tic_tac_toe.help": "和机器人下井字棋。",
|
||||
"tic_tac_toe.expert.help": "和专家级机器人下井字棋。",
|
||||
"tic_tac_toe.master.help": "和大师级机器人下井字棋。可能获得花瓣,但是你不会赢。",
|
||||
"tic_tac_toe.noob.help": "和一心只想让你赢的机器人下井字棋。不会获得花瓣。",
|
||||
"tic_tac_toe.duo.help": "双人(也可以是多人)对战井字棋。不会获得花瓣。",
|
||||
"tic_tac_toe.message.turn": "请 ${player} 落子。",
|
||||
"tic_tac_toe.master.help": "和大师级机器人下井字棋。",
|
||||
"tic_tac_toe.noob.help": "和菜鸟级机器人下井字棋。",
|
||||
"tic_tac_toe.duo.help": "双人对战井字棋。",
|
||||
"tic_tac_toe.message.turn": "请 ${player} 落子。\n(发送数字以确定要落子的位置)",
|
||||
"tic_tac_toe.stop.message": "已停止。",
|
||||
"tic_tac_toe.stop.message.none": "当前没有游戏正在进行。",
|
||||
"tic_tac_toe.message.draw": "游戏已结束,平局。",
|
||||
|
|
Reference in a new issue