🎨 签到优化与配置修改

This commit is contained in:
HibiKier
2024-08-24 17:06:23 +08:00
parent 28b7415581
commit f69253616e
34 changed files with 202 additions and 128 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ from nonebot.rule import to_me
from nonebot_plugin_alconna import UniMsg
from nonebot_plugin_session import EventSession
from zhenxun.configs.config import NICKNAME, Config
from zhenxun.configs.config import BotConfig, Config
from zhenxun.configs.utils import PluginExtraData, RegisterConfig
from zhenxun.models.friend_user import FriendUser
from zhenxun.models.group_member_info import GroupInfoUser
@@ -20,7 +20,7 @@ __plugin_meta__ = PluginMetadata(
name="AI",
description="屑Ai",
usage=f"""
与{NICKNAME}普普通通的对话吧!
与{BotConfig.nickname}普普通通的对话吧!
""".strip(),
extra=PluginExtraData(
author="HibiKier",
+5 -5
View File
@@ -5,7 +5,7 @@ import re
import ujson as json
from nonebot_plugin_alconna import UniMessage, UniMsg
from zhenxun.configs.config import NICKNAME, Config
from zhenxun.configs.config import BotConfig, Config
from zhenxun.configs.path_config import DATA_PATH, IMAGE_PATH
from zhenxun.services.log import logger
from zhenxun.utils.http_utils import AsyncHttpx
@@ -154,9 +154,9 @@ async def xie_ai(text: str) -> str:
if data["result"] == 0:
content = data["content"]
if "菲菲" in content:
content = content.replace("菲菲", NICKNAME)
content = content.replace("菲菲", BotConfig.nickname)
if "艳儿" in content:
content = content.replace("艳儿", NICKNAME)
content = content.replace("艳儿", BotConfig.nickname)
if "公众号" in content:
content = ""
if "{br}" in content:
@@ -188,7 +188,7 @@ def hello() -> UniMessage:
(
"哦豁?!",
"你好!Ov<",
f"库库库,呼唤{NICKNAME}做什么呢",
f"库库库,呼唤{BotConfig.nickname}做什么呢",
"我在呢!",
"呼呼,叫俺干嘛",
)
@@ -206,7 +206,7 @@ def no_result() -> UniMessage:
random.choice(
[
"你在说啥子?",
f"纯洁的{NICKNAME}没听懂",
f"纯洁的{BotConfig.nickname}没听懂",
"下次再告诉你(下次一定)",
"你觉得我听懂了吗?嗯?",
"我!不!知!道!",
+5 -5
View File
@@ -1,7 +1,7 @@
import random
import time
from zhenxun.configs.config import NICKNAME
from zhenxun.configs.config import BotConfig
from zhenxun.models.ban_console import BanConsole
@@ -15,14 +15,14 @@ class AiMessageManager:
"你是只会说这一句话吗?",
"[*],你发我也发!",
"[uname],[*]",
f"救命!有笨蛋一直给{NICKNAME}发一样的话!",
f"救命!有笨蛋一直给{BotConfig.nickname}发一样的话!",
"这句话你已经给我发了{}次了,再发就生气!",
]
self._repeat_message = [
f"请不要学{NICKNAME}说话",
f"为什么要一直学{NICKNAME}说话?",
f"请不要学{BotConfig.nickname}说话",
f"为什么要一直学{BotConfig.nickname}说话?",
"你再学!你再学我就生气了!",
f"呜呜,你是想欺负{NICKNAME}嘛..",
f"呜呜,你是想欺负{BotConfig.nickname}嘛..",
"[uname]不要再学我说话了!",
"再学我说话,我就把你拉进黑名单(生气",
"你再学![uname]是个笨蛋!",
+3 -3
View File
@@ -7,7 +7,7 @@ from nonebot.plugin import PluginMetadata
from nonebot_plugin_alconna import Alconna, Args, Arparma, Match, Option, on_alconna
from nonebot_plugin_session import EventSession
from zhenxun.configs.config import NICKNAME
from zhenxun.configs.config import BotConfig
from zhenxun.configs.utils import PluginExtraData, RegisterConfig
from zhenxun.services.log import logger
from zhenxun.utils.enum import PluginType
@@ -79,7 +79,7 @@ __plugin_meta__ = PluginMetadata(
),
RegisterConfig(
key="WARNING_RESULT",
value=f"请注意对{NICKNAME}的发言内容",
value=f"请注意对{BotConfig.nickname}的发言内容",
help="口头警告内容",
default_value=None,
),
@@ -202,7 +202,7 @@ async def _():
关于敏感词:
记住不要骂{NICKNAME}就对了!
记住不要骂{BotConfig.nickname}就对了!
""".strip()
max_width = 0
for m in text.split("\n"):
-2
View File
@@ -5,9 +5,7 @@ from nonebot.adapters.onebot.v11 import Bot as v11Bot
from nonebot.adapters.onebot.v12 import Bot as v12Bot
from nonebot_plugin_alconna import Image, UniMessage
from zhenxun.configs.config import NICKNAME
from zhenxun.services.log import logger
from zhenxun.utils._build_image import BuildImage
from zhenxun.utils.http_utils import AsyncHttpx
from zhenxun.utils.message import MessageUtils
+2 -2
View File
@@ -7,7 +7,7 @@ from nonebot_plugin_alconna import Image as alcImg
from nonebot_plugin_alconna import UniMsg
from nonebot_plugin_session import EventSession
from zhenxun.configs.config import NICKNAME, Config
from zhenxun.configs.config import BotConfig, Config
from zhenxun.configs.path_config import TEMP_PATH
from zhenxun.configs.utils import PluginExtraData, RegisterConfig, Task
from zhenxun.models.task_info import TaskInfo
@@ -112,7 +112,7 @@ async def _(message: UniMsg, event: Event, session: EventSession):
image_list.append(m.url)
if not plain_text and not image_list:
return
if plain_text and plain_text.startswith(f"@可爱的{NICKNAME}"):
if plain_text and plain_text.startswith(f"@可爱的{BotConfig.nickname}"):
await MessageUtils.build_message("复制粘贴的虚空艾特?").send(reply_to=True)
if image_list:
img_hash = await get_download_image_hash(image_list[0], group_id)
+5 -5
View File
@@ -12,7 +12,7 @@ from nonebot_plugin_alconna import Alconna, Args, Arparma, At, Match, Option, on
from nonebot_plugin_apscheduler import scheduler
from nonebot_plugin_session import EventSession
from zhenxun.configs.config import NICKNAME
from zhenxun.configs.config import BotConfig
from zhenxun.configs.utils import PluginCdBlock, PluginExtraData, RegisterConfig
from zhenxun.services.log import logger
from zhenxun.utils.depends import GetConfig, UserName
@@ -298,7 +298,7 @@ async def _(
try:
await MessageUtils.build_message(
[
f"{NICKNAME}的节日红包过时了,一共开启了 "
f"{BotConfig.nickname}的节日红包过时了,一共开启了 "
f"{len(festive_red_bag.open_user)}"
f" 个红包,共 {sum(festive_red_bag.open_user.values())} 金币\n",
rank_image,
@@ -314,10 +314,10 @@ async def _(
except JobLookupError:
pass
await group_red_bag.add_red_bag(
f"{NICKNAME}的红包",
f"{BotConfig.nickname}的红包",
amount,
num,
NICKNAME,
BotConfig.nickname,
FESTIVE_KEY,
_uuid,
platform=session.platform,
@@ -335,7 +335,7 @@ async def _(
)
await MessageUtils.build_message(
[
f"{NICKNAME}发起了节日金币红包\n金额: {amount}\n数量: {num}\n",
f"{BotConfig.nickname}发起了节日金币红包\n金额: {amount}\n数量: {num}\n",
image_result,
]
).send(target=target, bot=bot)
+3 -3
View File
@@ -8,7 +8,7 @@ from nonebot.adapters import Bot
from nonebot.exception import ActionFailed
from nonebot_plugin_alconna import UniMessage
from zhenxun.configs.config import NICKNAME, Config
from zhenxun.configs.config import BotConfig, Config
from zhenxun.configs.path_config import IMAGE_PATH
from zhenxun.models.user_console import UserConsole
from zhenxun.utils.image_utils import BuildImage
@@ -58,7 +58,7 @@ class RedBagManager:
try:
await MessageUtils.build_message(
[
f"{NICKNAME}的节日红包过时了,一共开启了 "
f"{BotConfig.nickname}的节日红包过时了,一共开启了 "
f"{len(red_bag.open_user)}"
f" 个红包,共 {sum(red_bag.open_user.values())} 金币\n",
rank_image,
@@ -92,7 +92,7 @@ class RedBagManager:
rank_image = await festive_red_bag.build_amount_rank(rank_num, platform)
return MessageUtils.build_message(
[
f"{NICKNAME}的节日红包过时了,一共开启了 "
f"{BotConfig.nickname}的节日红包过时了,一共开启了 "
f"{len(festive_red_bag.open_user)}"
f" 个红包,共 {sum(festive_red_bag.open_user.values())} 金币\n",
rank_image,
+2 -2
View File
@@ -5,7 +5,7 @@ from nonebot_plugin_alconna import Image as alcImage
from nonebot_plugin_alconna import UniMsg
from nonebot_plugin_session import EventSession
from zhenxun.configs.config import NICKNAME
from zhenxun.configs.config import BotConfig
from zhenxun.configs.utils import PluginExtraData
from zhenxun.models.ban_console import BanConsole
from zhenxun.services.log import logger
@@ -48,7 +48,7 @@ async def _(bot: Bot, session: EventSession, message: UniMsg):
try:
await PlatformUtils.ban_user(bot, session.id1, group_id, duration)
await MessageUtils.build_message(
f"检测到恶意刷屏,{NICKNAME}要把你关进小黑屋!"
f"检测到恶意刷屏,{BotConfig.nickname}要把你关进小黑屋!"
).send(at_sender=True)
mute_manage.reset(session.id1, group_id)
logger.info(f"检测刷屏 被禁言 {duration} 分钟", "禁言检查", session=session)
+2 -2
View File
@@ -2,7 +2,7 @@ from nonebot.plugin import PluginMetadata
from nonebot_plugin_alconna import Alconna, Args, Arparma, Match, Option, on_alconna
from nonebot_plugin_session import EventSession
from zhenxun.configs.config import NICKNAME
from zhenxun.configs.config import BotConfig
from zhenxun.configs.utils import PluginExtraData, RegisterConfig
from zhenxun.services.log import logger
from zhenxun.utils.enum import PluginType
@@ -15,7 +15,7 @@ __plugin_meta__ = PluginMetadata(
name="刷屏禁言",
description="刷屏禁言相关操作",
usage="""
刷屏禁言相关操作,需要 {NICKNAME} 有群管理员权限
刷屏禁言相关操作,需要 {BotConfig.nickname} 有群管理员权限
指令:
设置刷屏: 查看当前设置
-c [count]: 检测最大次数
+2 -2
View File
@@ -6,7 +6,7 @@ from nonebot.plugin import PluginMetadata
from nonebot_plugin_alconna import UniMsg
from nonebot_plugin_session import EventSession
from zhenxun.configs.config import NICKNAME
from zhenxun.configs.config import BotConfig
from zhenxun.configs.utils import PluginExtraData
from zhenxun.services.log import logger
from zhenxun.utils.depends import UserName
@@ -56,7 +56,7 @@ async def _(
await MessageUtils.build_message(
random.choice(
[
f"让{NICKNAME}看看是什么结果!答案是:‘{random_text}’",
f"让{BotConfig.nickname}看看是什么结果!答案是:‘{random_text}’",
f"根据命运的指引,接下来{user_name} ‘{random_text}’ 会比较好",
f"祈愿被回应了!是 ‘{random_text}’!",
f"结束了,{user_name},命运之轮停在了 ‘{random_text}’!",
+3 -3
View File
@@ -8,7 +8,7 @@ from nonebot_plugin_alconna import At, UniMessage
from nonebot_plugin_apscheduler import scheduler
from pydantic import BaseModel
from zhenxun.configs.config import NICKNAME, Config
from zhenxun.configs.config import BotConfig, Config
from zhenxun.models.group_member_info import GroupInfoUser
from zhenxun.models.user_console import UserConsole
from zhenxun.utils.enum import GoldHandle
@@ -278,7 +278,7 @@ class RussianManage:
random.choice(
[
f"不要打扰 {russian.player1[1]} 和 {russian.player2[1]} 的决斗啊!",
f"给我好好做好一个观众!不然{NICKNAME}就要生气了",
f"给我好好做好一个观众!不然{BotConfig.nickname}就要生气了",
f"不要捣乱啊baka{uname}!",
]
)
@@ -429,7 +429,7 @@ class RussianManage:
f"\t累计败场:{loser.fail_count}\n"
f"\t累计输掉金币:{loser.lose_money}\n"
f"-------------------\n"
f"哼哼,{NICKNAME}从中收取了 {float(rand)}%({fee}金币) 作为手续费!\n"
f"哼哼,{BotConfig.nickname}从中收取了 {float(rand)}%({fee}金币) 作为手续费!\n"
f"子弹排列:{russian.bullet_arr}",
padding=10,
color="#f9f6f2",
@@ -4,7 +4,7 @@ from nonebot.rule import to_me
from nonebot_plugin_alconna import Alconna, Args, Arparma, Match, on_alconna
from nonebot_plugin_session import EventSession
from zhenxun.configs.config import NICKNAME
from zhenxun.configs.config import BotConfig
from zhenxun.configs.utils import BaseBlock, PluginExtraData, RegisterConfig
from zhenxun.services.log import logger
from zhenxun.utils.message import MessageUtils
@@ -83,7 +83,7 @@ async def arg_handle(
result, status_code = await get_price(name)
except FileNotFoundError:
await MessageUtils.build_message(
f'请先对{NICKNAME}说"设置cookie"来设置cookie!'
f'请先对{BotConfig.nickname}说"设置cookie"来设置cookie!'
).send(at_sender=True)
if status_code in [996, 997, 998]:
await MessageUtils.build_message(result).finish()
@@ -16,7 +16,7 @@ from nonebot_plugin_alconna import (
)
from nonebot_plugin_session import EventSession
from zhenxun.configs.config import NICKNAME
from zhenxun.configs.config import BotConfig
from zhenxun.configs.utils import PluginCdBlock, PluginExtraData, RegisterConfig
from zhenxun.models.sign_user import SignUser
from zhenxun.models.user_console import UserConsole
@@ -173,7 +173,7 @@ async def _(
local_id: Match[int],
):
_tags = tags.result.split("#") if tags.available else None
if _tags and NICKNAME in _tags:
if _tags and BotConfig.nickname in _tags:
await MessageUtils.build_message(
"咳咳咳,虽然我很可爱,但是我木有自己的色图~~~有的话记得发我一份呀"
).finish()
@@ -5,7 +5,7 @@ from pathlib import Path
from asyncpg import UniqueViolationError
from nonebot_plugin_alconna import UniMessage
from zhenxun.configs.config import NICKNAME, Config
from zhenxun.configs.config import BotConfig, Config
from zhenxun.configs.path_config import IMAGE_PATH, TEMP_PATH
from zhenxun.services.log import logger
from zhenxun.utils.http_utils import AsyncHttpx
@@ -186,7 +186,7 @@ class SetuManage:
IMAGE_PATH
/ "luoxiang"
/ random.choice(os.listdir(IMAGE_PATH / "luoxiang")),
f"\n(快向{NICKNAME}签到提升好感度吧!)",
f"\n(快向{BotConfig.nickname}签到提升好感度吧!)",
]
)
return None