mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
133b927d9d | ||
|
|
46e6b26d75 | ||
|
|
8d0b0e5505 | ||
|
|
754a0c111c | ||
|
|
81ef3f04e4 | ||
|
|
e7c00484b3 | ||
|
|
065432448f | ||
|
|
5d45a9c28a | ||
|
|
7db5b3b5c0 | ||
|
|
5eb64060dc | ||
|
|
2c4877b9f8 | ||
|
|
218dad3b86 | ||
|
|
974c6b106a | ||
|
|
954b281b69 | ||
|
|
b1b15b63a1 |
@@ -2,7 +2,7 @@
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
# 绪山真寻Bot
|
||||
****
|
||||
@@ -11,7 +11,9 @@
|
||||
用爱发电,某些功能学习借鉴了大佬们的代码,因为绪山真寻实在太可爱了因此开发了
|
||||
绪山真寻bot,实现了一些对群友的娱乐功能和实用功能(大概)。
|
||||
|
||||
如果该项目的图片等等侵犯猫豆腐老师权益请联系我删除!
|
||||
如果该项目的图片等等侵犯猫豆腐老师权益请联系我删除!
|
||||
|
||||
如果希望有个地方讨论绪山真寻Bot,或者有问题或建议,可以发送issues或加入[ <strong>[是真寻酱哒](https://jq.qq.com/?_wv=1027&k=u8PgBkMZ) </strong>]
|
||||
|
||||
## 声明
|
||||
此项目仅用于学习交流,请勿用于非法用途
|
||||
@@ -463,6 +465,22 @@ python bot.py
|
||||
|
||||
## 更新
|
||||
|
||||
### 2021/9/9
|
||||
|
||||
* 替换coser API
|
||||
* 修复签到uid可能不默认为0
|
||||
* 修复签到可能重复的问题
|
||||
* 修复无订阅时递归出错
|
||||
* 启用了plugins2info_dict, plugins2cd_dict, plugins2exists_dict配置文件,通过USE_CONFIG_FILE=True开启
|
||||
|
||||
### 2021/9/7
|
||||
|
||||
* 修改 update_info.json
|
||||
* 修改 更新信息 图片大小
|
||||
* 修复 查看订阅 命令 UP和番剧无法正常显示
|
||||
* 修复订阅推送无法正确推送
|
||||
* 修复搜图返回列表为空时无法正确回复 @[pull/40](https://github.com/HibiKier/zhenxun_bot/pull/40)
|
||||
|
||||
### 2021/9/5
|
||||
* 添加配置PIX_IMAGE_SIZE,调整PIX下载图片大小,当设置的图片404时,改为原图
|
||||
* 新增配置DEFAULT_GROUP_LEVEL,默认群等级
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
__version__: v0.0.4.3
|
||||
__version__: v0.0.4.5
|
||||
|
||||
+43
-7
@@ -10,6 +10,10 @@ except ModuleNotFoundError:
|
||||
|
||||
|
||||
# 是否使用配置文件
|
||||
# 使用配置文件在每次启动时 plugins2info_dict, plugins2cd_dict, plugins2exists_dict 将从本地读取
|
||||
# 除了 plugins2info_dict 新增内容键值会写入 plugins2info_file
|
||||
# 其他修改或新增在 configs.config.py中对 plugins2info_dict, plugins2cd_dict, plugins2exists_dict 的配置无效
|
||||
# 目录:data/configs/
|
||||
USE_CONFIG_FILE: bool = False
|
||||
|
||||
# 回复消息名称
|
||||
@@ -55,12 +59,12 @@ MAXINFO_PRIVATE_ANIME: int = 20 # 私聊搜索动漫返回的最大数量
|
||||
MAXINFO_GROUP_ANIME: int = 5 # 群搜索动漫返回的最大数量
|
||||
MAX_FIND_IMG_COUNT: int = 3 # 识图最大返回数
|
||||
# 参1:延迟撤回色图时间(秒),0 为关闭 | 参2:监控聊天类型,0(私聊) 1(群聊) 2(群聊+私聊)
|
||||
WITHDRAW_SETU_TIME: Tuple[int, int] = (0, 1)
|
||||
WITHDRAW_SETU_TIME: Tuple[int, int] = (90, 1)
|
||||
# 参1:延迟撤回PIX图片时间(秒),0 为关闭 | 参2:监控聊天类型,0(私聊) 1(群聊) 2(群聊+私聊)
|
||||
WITHDRAW_PIX_TIME: Tuple[int, int] = (0, 1)
|
||||
|
||||
# PIX图库 与 额外图库OmegaPixivIllusts 混合搜索的比例 参1:PIX图库 参2:OmegaPixivIllusts扩展图库(没有此图库请设置为0)
|
||||
PIX_OMEGA_PIXIV_RATIO: Tuple[int, int] = (10, 0)
|
||||
PIX_OMEGA_PIXIV_RATIO: Tuple[int, int] = (2, 8)
|
||||
|
||||
# 各种卡池的开关
|
||||
PRTS_FLAG = True # 明日方舟
|
||||
@@ -92,7 +96,7 @@ CHECK_NOTICE_INFO_CD = 300 # 群检测,个人权限检测等各种检测提
|
||||
|
||||
# 注:即在 MALICIOUS_CHECK_TIME 时间内触发相同命令 MALICIOUS_BAN_COUNT 将被ban MALICIOUS_BAN_TIME 分钟
|
||||
MALICIOUS_BAN_TIME: int = 30 # 恶意命令触发检测触发后ban的时长(分钟)
|
||||
MALICIOUS_BAN_COUNT: int = 8 # 恶意命令触发检测最大触发次数
|
||||
MALICIOUS_BAN_COUNT: int = 3 # 恶意命令触发检测最大触发次数
|
||||
MALICIOUS_CHECK_TIME: int = 5 # 恶意命令触发检测规定时间内(秒)
|
||||
|
||||
# LEVEL
|
||||
@@ -102,6 +106,7 @@ UPLOAD_LEVEL: int = 6 # 上传图片权限
|
||||
BAN_LEVEL: int = 5 # BAN权限
|
||||
OC_LEVEL: int = 2 # 开关群功能权限
|
||||
MUTE_LEVEL: int = 5 # 更改禁言设置权限
|
||||
MEMBER_ACTIVITY_LEVEL = 5 # 群员活跃检测设置权限
|
||||
GROUP_BILIBILI_SUB_LEVEL = 5 # 群内bilibili订阅需要的权限
|
||||
|
||||
DEFAULT_GROUP_LEVEL = 5 # 默认群等级
|
||||
@@ -140,6 +145,7 @@ admin_plugins_auth = {
|
||||
"upload_img": UPLOAD_LEVEL,
|
||||
"admin_help": 1,
|
||||
"mute": MUTE_LEVEL,
|
||||
"member_activity_handle": MEMBER_ACTIVITY_LEVEL,
|
||||
}
|
||||
|
||||
# 需要cd的功能(方便管理)[秒]
|
||||
@@ -307,10 +313,40 @@ HIBIAPI = HIBIAPI[:-1] if HIBIAPI[-1] == "/" else HIBIAPI
|
||||
RSSHUBAPP = RSSHUBAPP[:-1] if RSSHUBAPP[-1] == "/" else RSSHUBAPP
|
||||
|
||||
|
||||
# plugins2info_file = Path(DATA_PATH) / 'configs' / 'plugins2info.json'
|
||||
# plugins2info_file.parent.mkdir(exist_ok=True, parents=True)
|
||||
#
|
||||
# with open(f'{DATA_PATH}/configs/')
|
||||
if USE_CONFIG_FILE:
|
||||
# 读取配置文件
|
||||
plugins2info_file = Path(DATA_PATH) / 'configs' / 'plugins2info.json'
|
||||
plugins2info_file.parent.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
if plugins2info_file.exists():
|
||||
with open(plugins2info_file, 'r') as f:
|
||||
_data = json.load(f)
|
||||
for p in plugins2info_dict:
|
||||
if not _data.get(p):
|
||||
_data[p] = plugins2info_dict[p]
|
||||
with open(plugins2info_file, 'w') as wf:
|
||||
json.dump(_data, wf, ensure_ascii=False, indent=4)
|
||||
plugins2info_dict = _data
|
||||
else:
|
||||
with open(plugins2info_file, 'w', encoding='utf8') as wf:
|
||||
json.dump(plugins2info_dict, wf, ensure_ascii=False, indent=4)
|
||||
|
||||
plugins2cd_file = Path(DATA_PATH) / 'configs' / 'plugins2cd.json'
|
||||
if plugins2cd_file.exists():
|
||||
with open(plugins2cd_file, 'r', encoding='utf8') as f:
|
||||
plugins2cd_dict = json.load(f)
|
||||
else:
|
||||
with open(plugins2cd_file, 'w', encoding='utf8') as wf:
|
||||
json.dump(plugins2cd_dict, wf, ensure_ascii=False, indent=4)
|
||||
|
||||
plugins2exists_file = Path(DATA_PATH) / 'configs' / 'plugins2exists.json'
|
||||
if plugins2exists_file.exists():
|
||||
with open(plugins2exists_file, 'r', encoding='utf8') as f:
|
||||
plugins2exists_dict = json.load(f)
|
||||
else:
|
||||
with open(plugins2exists_file, 'w', encoding='utf8') as wf:
|
||||
json.dump(plugins2exists_dict, wf, ensure_ascii=False, indent=4)
|
||||
|
||||
|
||||
# 配置文件应用
|
||||
# if USE_CONFIG_FILE:
|
||||
|
||||
@@ -24,6 +24,7 @@ class GroupInfoUser(db.Model):
|
||||
belonging_group: int,
|
||||
user_name: str,
|
||||
user_join_time: datetime,
|
||||
uid: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
说明:
|
||||
@@ -33,6 +34,7 @@ class GroupInfoUser(db.Model):
|
||||
:param belonging_group: 群号
|
||||
:param user_name: 用户名称
|
||||
:param user_join_time: 入群时间
|
||||
:param uid: 用户唯一 id(自动生成)
|
||||
"""
|
||||
query = cls.query.where(
|
||||
(cls.user_qq == user_qq) & (cls.belonging_group == belonging_group)
|
||||
@@ -44,6 +46,7 @@ class GroupInfoUser(db.Model):
|
||||
user_name=user_name,
|
||||
belonging_group=belonging_group,
|
||||
user_join_time=user_join_time,
|
||||
uid=uid
|
||||
)
|
||||
return True
|
||||
except Exception:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from nonebot import on_command, export
|
||||
from nonebot import on_command, on_notice
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.adapters.cqhttp import Bot, GroupMessageEvent, GROUP
|
||||
from nonebot.adapters.cqhttp import Bot, GroupMessageEvent, GROUP, GroupIncreaseNoticeEvent
|
||||
from .data_source import update_member_info
|
||||
|
||||
__plugin_name__ = "更新群组成员列表"
|
||||
@@ -12,8 +12,6 @@ __plugin_usage__ = """
|
||||
更新群组成员列表
|
||||
"""
|
||||
|
||||
export = export()
|
||||
export.update_member_info = update_member_info
|
||||
|
||||
refresh_member_group = on_command(
|
||||
"更新群组成员列表", aliases={"更新群组成员信息"}, permission=GROUP, priority=5, block=True
|
||||
@@ -26,3 +24,12 @@ async def _(bot: Bot, event: GroupMessageEvent, state: T_State):
|
||||
await refresh_member_group.finish("更新群员信息成功!", at_sender=True)
|
||||
else:
|
||||
await refresh_member_group.finish("更新群员信息失败!", at_sender=True)
|
||||
|
||||
|
||||
group_increase_handle = on_notice(priority=1, block=False)
|
||||
|
||||
|
||||
@group_increase_handle.handle()
|
||||
async def _(bot: Bot, event: GroupIncreaseNoticeEvent, state: dict):
|
||||
if event.user_id == int(bot.self_id):
|
||||
await update_member_info(event.group_id)
|
||||
|
||||
@@ -19,6 +19,10 @@ __plugin_usage__ = f'''[权限等级]管理帮助:
|
||||
\t\t/设置检测次数/设置禁言时长
|
||||
[5]7.群订阅相关 -> 指令:添加订阅 [主播/up/番剧] [id/番名/链接]
|
||||
\t\t/删除订阅 [id]/ 查看订阅
|
||||
[5]8.群员活跃度相关 --> 指令:群员活跃检测设置
|
||||
设置群员活跃检测时长(天)
|
||||
添加群员活跃检测白名单[at]...
|
||||
查看群员活跃检测白名单
|
||||
[6]8.上传图片/连续上传图片(6)
|
||||
[7]9.移动图片(7)
|
||||
[7]10.删除图片(7)
|
||||
|
||||
@@ -132,7 +132,7 @@ def hello() -> str:
|
||||
(
|
||||
"哦豁?!",
|
||||
"你好!Ov<",
|
||||
f"库库库,呼唤{list(get_bot().config.nickname)[0]}做什么呢",
|
||||
f"库库库,呼唤{NICKNAME}做什么呢",
|
||||
"我在呢!",
|
||||
"呼呼,叫俺干嘛",
|
||||
)
|
||||
@@ -170,8 +170,8 @@ async def check_text(text: str, sess: ClientSession) -> str:
|
||||
async with sess.get(check_url, timeout=2, params=params) as response:
|
||||
data = await response.json()
|
||||
if data["code"] == 200:
|
||||
if data["conclusion_type"] == 2:
|
||||
if data['data']["conclusion_type"] == 2:
|
||||
return ''
|
||||
except Exception as e:
|
||||
logger.error(f"检测违规文本错误...e:{e}")
|
||||
logger.error(f"检测违规文本错误...{type(e)}:{e}")
|
||||
return text
|
||||
|
||||
@@ -80,7 +80,6 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
if sub_type in ["season", "动漫", "番剧"]:
|
||||
rst = "*以为您找到以下番剧,请输入Id选择:*\n"
|
||||
state["season_data"] = await get_media_id(id_)
|
||||
print(state["season_data"])
|
||||
if len(state["season_data"]) == 0:
|
||||
await add_sub.finish(f"未找到番剧:{msg}")
|
||||
for i, x in enumerate(state["season_data"]):
|
||||
@@ -105,7 +104,6 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
await add_sub.send(await add_season_sub(id_, sub_user))
|
||||
else:
|
||||
await add_sub.finish("参数错误,第一参数必须为:主播/up/番剧!")
|
||||
sub_manager.reload_flag = True
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, GROUP "
|
||||
f"{event.group_id if isinstance(event, GroupMessageEvent) else 'private'})"
|
||||
@@ -151,8 +149,8 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
f'\t当前集数:{x.season_current_episode}\n' \
|
||||
f'------------------\n'
|
||||
live_rst = '当前订阅的直播:\n' + live_rst if live_rst else live_rst
|
||||
up_rst = '当前订阅的UP:\n' if up_rst else up_rst
|
||||
season_rst = '当前订阅的番剧:\n' if season_rst else season_rst
|
||||
up_rst = '当前订阅的UP:\n' + up_rst if up_rst else up_rst
|
||||
season_rst = '当前订阅的番剧:\n' + season_rst if season_rst else season_rst
|
||||
if not live_rst and not up_rst and not season_rst:
|
||||
live_rst = '您目前没有任何订阅...'
|
||||
await show_sub_info.send(live_rst + up_rst + season_rst)
|
||||
|
||||
@@ -279,9 +279,13 @@ async def _get_season_status(id_) -> Optional[str]:
|
||||
_idx = (await BilibiliSub.get_sub(id_)).season_current_episode
|
||||
new_ep = season_info["media"]["new_ep"]["index"]
|
||||
if new_ep != _idx:
|
||||
await BilibiliSub.update_sub_info(id_, season_current_episode=new_ep, season_update_time=datetime.now())
|
||||
await BilibiliSub.update_sub_info(
|
||||
id_, season_current_episode=new_ep, season_update_time=datetime.now()
|
||||
)
|
||||
return (
|
||||
f'{image(season_info["media"]["cover"])}\n' f"[{title}]更新啦\n" f"最新集数:{new_ep}"
|
||||
f'{image(season_info["media"]["cover"])}\n'
|
||||
f"[{title}]更新啦\n"
|
||||
f"最新集数:{new_ep}"
|
||||
)
|
||||
return None
|
||||
|
||||
@@ -335,45 +339,52 @@ async def get_user_dynamic(
|
||||
|
||||
class SubManager:
|
||||
def __init__(self):
|
||||
self.reload_flag = True
|
||||
self.live_data = []
|
||||
self.up_data = []
|
||||
self.season_data = []
|
||||
self.sub_list = []
|
||||
self.current_index = -1
|
||||
|
||||
async def reload_sub_data(self):
|
||||
"""
|
||||
重载数据
|
||||
"""
|
||||
if self.reload_flag or not self.sub_list:
|
||||
if not self.live_data or not self.up_data or not self.season_data:
|
||||
(
|
||||
self.live_data,
|
||||
self.up_data,
|
||||
self.season_data,
|
||||
_live_data,
|
||||
_up_data,
|
||||
_season_data,
|
||||
) = await BilibiliSub.get_all_sub_data()
|
||||
for x, i, j in zip(self.live_data, self.up_data, self.season_data):
|
||||
self.sub_list.append(x)
|
||||
self.sub_list.append(i)
|
||||
self.sub_list.append(j)
|
||||
self.reload_flag = False
|
||||
|
||||
def append(self, data: BilibiliSub):
|
||||
"""
|
||||
增加新数据
|
||||
:param data: 数据
|
||||
"""
|
||||
self.sub_list.append(data)
|
||||
if not self.live_data:
|
||||
self.live_data = _live_data
|
||||
if not self.up_data:
|
||||
self.up_data = _up_data
|
||||
if not self.season_data:
|
||||
self.season_data = _season_data
|
||||
|
||||
async def random_sub_data(self) -> Optional[BilibiliSub]:
|
||||
"""
|
||||
随机获取一条数据
|
||||
:return:
|
||||
"""
|
||||
if not self.sub_list:
|
||||
await self.reload_sub_data()
|
||||
if self.sub_list:
|
||||
sub = random.choice(self.sub_list)
|
||||
self.sub_list.remove(sub)
|
||||
sub = None
|
||||
if not self.live_data and not self.up_data and not self.season_data:
|
||||
return sub
|
||||
return None
|
||||
|
||||
self.current_index += 1
|
||||
if self.current_index == 0:
|
||||
if self.live_data:
|
||||
sub = random.choice(self.live_data)
|
||||
self.live_data.remove(sub)
|
||||
elif self.current_index == 1:
|
||||
if self.up_data:
|
||||
sub = random.choice(self.up_data)
|
||||
self.up_data.remove(sub)
|
||||
elif self.current_index == 2:
|
||||
if self.season_data:
|
||||
sub = random.choice(self.season_data)
|
||||
self.season_data.remove(sub)
|
||||
else:
|
||||
self.current_index = -1
|
||||
if sub:
|
||||
return sub
|
||||
await self.reload_sub_data()
|
||||
return await self.random_sub_data()
|
||||
|
||||
@@ -89,10 +89,12 @@ async def check_update(bot: Bot) -> 'int, str':
|
||||
update_info = data["body"]
|
||||
width = 0
|
||||
height = len(update_info.split('\n')) * 24
|
||||
for m in update_info.split('\n'):
|
||||
if len(m) * 20 > width:
|
||||
width = len(m) * 18
|
||||
A = CreateImg(width, height, font_size=20)
|
||||
for m in update_info.split('\n'):
|
||||
w, h = A.getsize(m)
|
||||
if w > width:
|
||||
width = w
|
||||
A = CreateImg(width + 50, height, font_size=20)
|
||||
A.text((10, 10), update_info)
|
||||
A.save(f'{IMAGE_PATH}/update_info.png')
|
||||
await bot.send_private_msg(
|
||||
|
||||
+13
-11
@@ -19,7 +19,7 @@ coser = on_command(
|
||||
)
|
||||
|
||||
|
||||
url = "http://81.70.100.130/api/cosplay.php"
|
||||
url = "http://api520.ltd/api/cosplay.php"
|
||||
|
||||
|
||||
@coser.handle()
|
||||
@@ -29,20 +29,22 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
for _ in range(3):
|
||||
try:
|
||||
async with session.get(url, timeout=2) as response:
|
||||
r = re.search(r'±img=(.*)±', await response.text())
|
||||
if r:
|
||||
async with session.get(r.group(1), timeout=5, verify_ssl=False) as res:
|
||||
_url = await response.text()
|
||||
async with session.get(_url, timeout=5, verify_ssl=False) as res:
|
||||
if res.status == 200:
|
||||
async with aiofiles.open(f'{IMAGE_PATH}/temp/{event.user_id}_coser.jpg', 'wb') as f:
|
||||
await f.write(await res.read())
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, "
|
||||
f"GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'})"
|
||||
f" 发送COSER"
|
||||
)
|
||||
await coser.send(image(f'{event.user_id}_coser.jpg', 'temp'))
|
||||
break
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, "
|
||||
f"GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'})"
|
||||
f" 发送COSER"
|
||||
)
|
||||
await coser.send(image(f'{event.user_id}_coser.jpg', 'temp'))
|
||||
break
|
||||
except TimeoutError:
|
||||
pass
|
||||
else:
|
||||
await coser.send('你cos给我看!')
|
||||
except Exception as e:
|
||||
await coser.send('发生了预料之外的错误..请稍后再试或联系管理员修复...')
|
||||
logger.error(f'coser 发送了未知错误 {type(e)}:{e}')
|
||||
|
||||
+1
-9
@@ -116,15 +116,10 @@ async def _(matcher: Matcher, bot: Bot, event: GroupMessageEvent, state: T_State
|
||||
return
|
||||
if matcher.type == "message" and matcher.priority not in [1, 9]:
|
||||
if state["_prefix"]["raw_command"]:
|
||||
# print(state["_prefix"]["raw_command"])
|
||||
if _blmt.check(f'{event.user_id}{state["_prefix"]["raw_command"]}'):
|
||||
if await BanUser.ban(event.user_id, 9, MALICIOUS_BAN_TIME * 60):
|
||||
logger.info(f"USER {event.user_id} 触发了恶意触发检测")
|
||||
# await update_img.finish('检测到恶意触发命令,您将被封禁 30 分钟', at_sender=True)
|
||||
if event.message_type == "group":
|
||||
if not static_flmt.check(event.user_id):
|
||||
return
|
||||
static_flmt.start_cd(event.user_id)
|
||||
if isinstance(event, GroupMessageEvent):
|
||||
try:
|
||||
await bot.send_group_msg(
|
||||
group_id=event.group_id,
|
||||
@@ -133,9 +128,6 @@ async def _(matcher: Matcher, bot: Bot, event: GroupMessageEvent, state: T_State
|
||||
except ActionFailed:
|
||||
pass
|
||||
else:
|
||||
if not static_flmt.check(event.user_id):
|
||||
return
|
||||
static_flmt.start_cd(event.user_id)
|
||||
try:
|
||||
await bot.send_private_msg(
|
||||
user_id=event.user_id,
|
||||
|
||||
@@ -131,6 +131,8 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
info_list, code = await search_pixiv_urls(keyword, num, page, r18)
|
||||
if code != 200:
|
||||
await pixiv_keyword.finish(info_list[0])
|
||||
if not info_list:
|
||||
await pixiv_keyword.finish("没有找到啊,等等再试试吧~V", at_sender=True)
|
||||
await send_image(info_list, pixiv_keyword, bot, event)
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'})"
|
||||
|
||||
@@ -27,13 +27,13 @@ async def group_user_check_in(
|
||||
# 取得相应用户
|
||||
user = await SignGroupUser.ensure(user_qq, group, for_update=True)
|
||||
# 如果同一天签到过,特殊处理
|
||||
# if (
|
||||
# user.checkin_time_last + timedelta(hours=8)
|
||||
# ).date() >= present.date() or f"{user}_{group}_sign_{datetime.now().date()}" in os.listdir(
|
||||
# SIGN_TODAY_CARD_PATH
|
||||
# ):
|
||||
# gold = await BagUser.get_gold(user_qq, group)
|
||||
# return await get_card(user, nickname, -1, gold, "")
|
||||
if (
|
||||
user.checkin_time_last + timedelta(hours=8)
|
||||
).date() >= present.date() or f"{user}_{group}_sign_{datetime.now().date()}" in os.listdir(
|
||||
SIGN_TODAY_CARD_PATH
|
||||
):
|
||||
gold = await BagUser.get_gold(user_qq, group)
|
||||
return await get_card(user, nickname, -1, gold, "")
|
||||
return await _handle_check_in(nickname, user_qq, group, present) # ok
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,10 @@ driver: Driver = nonebot.get_driver()
|
||||
@driver.on_startup
|
||||
async def init_image():
|
||||
SIGN_RESOURCE_PATH.mkdir(parents=True, exist_ok=True)
|
||||
await GroupInfoUser.add_member_info(114514, 114514, "", datetime.min)
|
||||
await GroupInfoUser.add_member_info(114514, 114514, "", datetime.min, 0)
|
||||
_u = await GroupInfoUser.get_member_info(114514, 114514)
|
||||
if _u.uid is None:
|
||||
await _u.update(uid=0).apply()
|
||||
generate_progress_bar_pic()
|
||||
clear_sign_data_pic()
|
||||
|
||||
|
||||
+14
-13
@@ -15,16 +15,17 @@ yiqing = on_command("疫情", aliases={"查询疫情", "疫情查询"}, priority
|
||||
@yiqing.handle()
|
||||
async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
msg = get_message_text(event.json())
|
||||
result = await get_yiqing_data(msg)
|
||||
if result:
|
||||
await yiqing.send(result)
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, GROUP "
|
||||
f"{event.group_id if isinstance(event, GroupMessageEvent) else 'private'}) 查询疫情: {msg}"
|
||||
)
|
||||
else:
|
||||
await yiqing.send("查询失败!!!!", at_sender=True)
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, GROUP "
|
||||
f"{event.group_id if isinstance(event, GroupMessageEvent) else 'private'}) 查询疫情失败"
|
||||
)
|
||||
if msg:
|
||||
result = await get_yiqing_data(msg)
|
||||
if result:
|
||||
await yiqing.send(result)
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, GROUP "
|
||||
f"{event.group_id if isinstance(event, GroupMessageEvent) else 'private'}) 查询疫情: {msg}"
|
||||
)
|
||||
else:
|
||||
await yiqing.send("查询失败!!!!", at_sender=True)
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, GROUP "
|
||||
f"{event.group_id if isinstance(event, GroupMessageEvent) else 'private'}) 查询疫情失败"
|
||||
)
|
||||
|
||||
+6
-7
@@ -7,8 +7,7 @@
|
||||
"models/pixiv.py",
|
||||
"models/russian_user.py",
|
||||
"models/setu.py",
|
||||
"plugins/admin_bot_manage/data_source.py",
|
||||
"plugins/admin_bot_manage/switch_rule.py",
|
||||
"plugins/admin_bot_manage",
|
||||
"plugins/admin_help/__init__.py",
|
||||
"plugins/ai/__init__.py",
|
||||
"plugins/ai/data_source.py",
|
||||
@@ -55,6 +54,8 @@
|
||||
"plugins/super_help/__init__.py",
|
||||
"plugins/update_gocqhttp/__init__.py",
|
||||
"plugins/what_anime/__init__.py",
|
||||
"plugins/bilibili_sub",
|
||||
"models/bilibili_sub.py",
|
||||
"services/log.py",
|
||||
"update_info.json",
|
||||
"utils/browser.py",
|
||||
@@ -63,14 +64,11 @@
|
||||
"utils/static_data/__init__.py",
|
||||
"utils/static_data/data_class.py",
|
||||
"utils/static_data/group_manager.py",
|
||||
"utils/utils.py"
|
||||
],
|
||||
"add_file": [
|
||||
"__version__",
|
||||
"models/bilibili_sub.py",
|
||||
"utils/utils.py",
|
||||
"models/omega_pixiv_illusts.py",
|
||||
"models/sign_group_user.py",
|
||||
"plugins/bilibili_sub",
|
||||
"models/bilibili_sub.py",
|
||||
"plugins/database_scripts.py",
|
||||
"plugins/sign_in/config.py",
|
||||
"plugins/sign_in/random_event.py",
|
||||
@@ -78,5 +76,6 @@
|
||||
"plugins/withdraw.py",
|
||||
"resources/img/sign"
|
||||
],
|
||||
"add_file": [],
|
||||
"delete_file": ["plugins/nonebot_plugin_withdraw", "models/sigin_group_user.py"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user