💬 Refactor some prompt text

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: xtaodada <xtao@xtaolink.cn>
This commit is contained in:
Nahida 2024-06-07 23:22:30 +08:00 committed by GitHub
parent b5438fa735
commit 4034c5d30c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 84 additions and 63 deletions

View File

@ -95,7 +95,11 @@ LOGGER_FILTERED_NAMES=["uvicorn","ErrorPush","ApiHelper"]
# ERROR_SENTRY_DSN=
# Notice
NOTICE_BOT_NAME="派蒙"
NOTICE_USER_NOT_FOUND="${NOTICE_BOT_NAME}没有找到您所绑定的账号信息,请先私聊${NOTICE_BOT_NAME}绑定账号"
NOTICE_USER_MISMATCH="再乱点我叫西风骑士团、千岩军、天领奉行、三十人团和逐影庭了!"
# 拒绝加入群聊
NOTICE_QUIT_STATUS="${NOTICE_BOT_NAME}不想进去!不是旅行者的邀请!"
# Plugin
# PLUGIN_DOWNLOAD_FILE_MAX_SIZE=5

1
.gitignore vendored
View File

@ -111,6 +111,7 @@ venv/
ENV/
env.bak/
venv.bak/
pyvenv.cfg
# Spyder project settings
.spyderproject

@ -1 +1 @@
Subproject commit b1399182760c135ed8fe2479e329abb3084c7abb
Subproject commit 213ae6eda5b29da7f736b1a393771195158c26dc

View File

@ -5,6 +5,7 @@ from typing import Tuple, TYPE_CHECKING
from simnet import Region, GenshinClient
from telegram import InlineKeyboardMarkup, InlineKeyboardButton
from telegram.ext import filters
from core.config import config
from core.plugin import Plugin, handler
from core.services.cookies import CookiesService
from core.services.players import PlayersService
@ -56,9 +57,9 @@ class PlayersManagesPlugin(Plugin):
players = await self.players_service.get_all_by_user_id(user.id)
if len(players) == 0:
if callback_query:
await callback_query.edit_message_text("未查询到您所绑定的账号信息,请先绑定账号")
await callback_query.edit_message_text(config.notice.user_not_found)
else:
await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号")
await message.reply_text(config.notice.user_not_found)
return
buttons = []
for player in players:

View File

@ -46,7 +46,7 @@ class SetCommandPlugin(Plugin):
group_command = [
# 通用
BotCommand("help", "帮助"),
BotCommand("quiz", "派蒙的十万个为什么"),
BotCommand("quiz", f"{config.notice.bot_name}的十万个为什么"),
BotCommand("wish", " 非洲人模拟器(抽卡模拟器)"),
BotCommand("set_wish", "抽卡模拟器定轨"),
BotCommand("calendar", "活动日历"),

View File

@ -2,6 +2,7 @@ from telegram import Update, ReplyKeyboardRemove
from telegram.ext import CallbackContext, CommandHandler
from telegram.helpers import escape_markdown
from core.config import config
from core.plugin import handler, Plugin
from utils.log import logger
@ -16,7 +17,9 @@ class StartPlugin(Plugin):
logger.info("用户 %s[%s] 发出start命令 args[%s]", user.full_name, user.id, args_text)
if args is not None and len(args) >= 1:
return
await message.reply_markdown_v2(f"你好 {user.mention_markdown_v2()} {escape_markdown('!我是派蒙 ')}")
await message.reply_markdown_v2(
f"你好 {user.mention_markdown_v2()} {escape_markdown(f'!我是{config.notice.bot_name}')}"
)
@staticmethod
async def unknown_command(update: Update, _: CallbackContext) -> None:

View File

@ -5,6 +5,7 @@ from telegram.constants import ChatAction, ChatMemberStatus, ParseMode
from telegram.error import BadRequest, Forbidden
from telegram.ext import filters
from core.config import config
from core.plugin import Plugin, handler
from gram_core.services.channels.models import ChannelAliasDataBase as ChannelAlias
from gram_core.services.channels.services import ChannelAliasService
@ -19,13 +20,15 @@ if TYPE_CHECKING:
__all__ = ("ChannelAliasPlugin",)
CHANNEL_ALIAS_OPEN = """成功开启频道透视模式,派蒙将会把你当做普通用户,现在你可以使用频道身份执行命令
CHANNEL_ALIAS_OPEN = f"""成功开启频道透视模式,{config.notice.bot_name}将会把你当做普通用户,现在你可以使用频道身份执行命令
- 此功能可能使其他人能看到你的个人账号身份
- 此功能开启后对所有群组均有效
- 在转让频道前请务必关闭此功能
"""
CHANNEL_ALIAS_CLOSE = """成功关闭频道透视模式,派蒙将不会把你当做普通用户,现在你无法使用频道身份执行命令"""
CHANNEL_ALIAS_CLOSE = (
f"""成功关闭频道透视模式,{config.notice.bot_name}将不会把你当做普通用户,现在你无法使用频道身份执行命令"""
)
CHANNEL_ADMIN_HELP = (
"参数错误,可用命令:\n\n- disable <id> 关闭频道透视模式\n- change <cid> <uid> 强制设置频道透视对应的用户 id"
)

View File

@ -134,7 +134,7 @@ class AbyssPlugin(Plugin):
reply_text: Optional[Message] = None
if total:
reply_text = await message.reply_text("派蒙需要时间整理深渊数据,还请耐心等待哦~")
reply_text = await message.reply_text(f"{config.notice.bot_name}需要时间整理深渊数据,还请耐心等待哦~")
try:
async with self.helper.genshin_or_public(user_id) as client:
if not client.public:

View File

@ -10,6 +10,7 @@ from simnet.models.genshin.chronicle.characters import Character
from telegram.constants import ChatAction
from telegram.ext import filters
from core.config import config
from core.dependence.assets import AssetsService
from core.plugin import Plugin, handler
from core.services.cookies import CookiesService
@ -181,7 +182,7 @@ class AvatarListPlugin(Plugin):
notice = None
try:
async with self.helper.genshin(user_id) as client:
notice = await message.reply_text("派蒙需要收集整理数据,还请耐心等待哦~")
notice = await message.reply_text(f"{config.notice.bot_name}需要收集整理数据,还请耐心等待哦~")
self.add_delete_message_job(notice, delay=60)
await message.reply_chat_action(ChatAction.TYPING)
characters = await client.get_genshin_characters(client.player_id)

View File

@ -23,6 +23,7 @@ from simnet.models.genshin.chronicle.characters import Character
from telegram.constants import ChatAction, ParseMode
from telegram.error import RetryAfter, TimedOut
from core.config import config
from core.dependence.assets import AssetsCouldNotFound, AssetsService, AssetsServiceType
from core.plugin import Plugin, handler
from core.services.template.models import FileType, RenderGroupResult
@ -351,7 +352,7 @@ class DailyMaterial(Plugin):
material = self.assets_service.material(material_id)
except AssetsCouldNotFound as exc:
logger.warning("AssetsCouldNotFound message[%s] target[%s]", exc.message, exc.target)
await loading_prompt.edit_text("出错了呜呜呜 ~ 派蒙找不到一些素材")
await loading_prompt.edit_text(f"出错了呜呜呜 ~ {config.notice.bot_name}找不到一些素材")
raise
[_, material_name, material_rarity] = HONEY_DATA["material"][material_id]
material_icon = await material.icon(False)
@ -392,15 +393,15 @@ class DailyMaterial(Plugin):
return
if self.locks[0].locked(): # 若检测到了第一个锁:正在下载每日素材表的数据
loading_prompt = await message.reply_text("派蒙正在摘抄每日素材表,以后再来探索吧~")
loading_prompt = await message.reply_text(f"{config.notice.bot_name}正在摘抄每日素材表,以后再来探索吧~")
self.add_delete_message_job(loading_prompt, delay=5)
return
if self.locks[1].locked(): # 若检测到了第二个锁:正在下载角色、武器、材料的图标
await message.reply_text("派蒙正在搬运每日素材的图标,以后再来探索吧~")
await message.reply_text(f"{config.notice.bot_name}正在搬运每日素材的图标,以后再来探索吧~")
return
loading_prompt = await message.reply_text("派蒙可能需要找找图标素材,还请耐心等待哦~")
loading_prompt = await message.reply_text(f"{config.notice.bot_name}可能需要找找图标素材,还请耐心等待哦~")
await message.reply_chat_action(ChatAction.TYPING)
# 获取已经缓存的秘境素材信息
@ -470,15 +471,17 @@ class DailyMaterial(Plugin):
logger.info("用户 {%s}[%s] 刷新[bold]每日素材[/]缓存命令", user.full_name, user.id, extra={"markup": True})
if self.locks[0].locked():
notice = await message.reply_text("派蒙还在抄每日素材表呢,我有在好好工作哦~")
notice = await message.reply_text(f"{config.notice.bot_name}还在抄每日素材表呢,我有在好好工作哦~")
self.add_delete_message_job(notice, delay=10)
return
if self.locks[1].locked():
notice = await message.reply_text("派蒙正在搬运每日素材图标,在努力工作呢!")
notice = await message.reply_text(f"{config.notice.bot_name}正在搬运每日素材图标,在努力工作呢!")
self.add_delete_message_job(notice, delay=10)
return
async with self.locks[1]: # 锁住第二把锁
notice = await message.reply_text("派蒙正在重新摘抄每日素材表,请稍等~", parse_mode=ParseMode.HTML)
notice = await message.reply_text(
f"{config.notice.bot_name}正在重新摘抄每日素材表,请稍等~", parse_mode=ParseMode.HTML
)
async with self.locks[0]: # 锁住第一把锁
await self._refresh_everyday_materials()
notice = await notice.edit_text(

View File

@ -86,7 +86,7 @@ class DailyNoteTasksPlugin(Plugin.Conversation):
except SimnetBadRequest as e:
return f"获取便签失败,可能遇到验证码风控,请尝试重新绑定账号。{e}"
except (CookiesNotFoundError, PlayerNotFoundError):
return "未查询到您所绑定的账号信息,请先私聊派蒙绑定账号"
return config.notice.user_not_found
@conversation.state(state=SET_BY_WEB)
@handler.message(filters=filters.TEXT & ~filters.COMMAND, block=False)

View File

@ -163,10 +163,10 @@ class GCSimPlugin(Plugin):
message = update.effective_message
args = self.get_args(context)
if not self.gcsim_runner.initialized:
await message.reply_text("GCSim 未初始化,请稍候再试或重启派蒙")
await message.reply_text(f"GCSim 未初始化,请稍候再试或重启{config.notice.bot_name}")
return
if context.user_data.get("overlapping", False):
reply = await message.reply_text("旅行者已经有脚本正在运行,请让派蒙稍微休息一下")
reply = await message.reply_text(f"旅行者已经有脚本正在运行,请让{config.notice.bot_name}稍微休息一下")
if filters.ChatType.GROUPS.filter(message):
self.add_delete_message_job(reply)
self.add_delete_message_job(message)
@ -230,7 +230,9 @@ class GCSimPlugin(Plugin):
fits = await self.gcsim_runner.get_fits(uid)
if not fits:
await callback_query.answer(text="其他数据好像被派蒙吃掉了,要不重新试试吧", show_alert=True)
await callback_query.answer(
text=f"其他数据好像被{config.notice.bot_name}吃掉了,要不重新试试吧", show_alert=True
)
await message.delete()
return
buttons = self._gen_buttons(user_id, uid, fits, page)
@ -277,7 +279,7 @@ class GCSimPlugin(Plugin):
try:
await self.gcsim_runner.run(user_id, uid, script_key, character_infos, results, callback_task, priority)
except GCSimQueueFull:
await callback_query.edit_message_text("派蒙任务过多忙碌中,请稍后再试")
await callback_query.edit_message_text(f"{config.notice.bot_name}任务过多忙碌中,请稍后再试")
return
async def _callback(
@ -301,15 +303,17 @@ class GCSimPlugin(Plugin):
result_path = self.player_gcsim_scripts.get_result_path(uid, script_key)
if not result_path.exists():
await callback_query.answer(text="运行结果似乎在提瓦特之外,派蒙找不到了", show_alert=True)
await callback_query.answer(
text=f"运行结果似乎在提瓦特之外,{config.notice.bot_name}找不到了", show_alert=True
)
return
if result.script is None:
await callback_query.answer(text="脚本似乎在提瓦特之外,派蒙找不到了", show_alert=True)
await callback_query.answer(text=f"脚本似乎在提瓦特之外,{config.notice.bot_name}找不到了", show_alert=True)
return
result_ = await self.gcsim_renderer.prepare_result(result_path, result.script, character_infos)
if not result_:
await callback_query.answer(text="在准备运行结果时派蒙出问题了", show_alert=True)
await callback_query.answer(text=f"在准备运行结果时{config.notice.bot_name}出问题了", show_alert=True)
return
render_result = await self.gcsim_renderer.render(script_key, result_)

View File

@ -6,6 +6,7 @@ from bs4 import BeautifulSoup
from telegram import Update
from telegram.ext import CallbackContext
from core.config import config
from core.plugin import Plugin, handler
from utils.log import logger
@ -44,6 +45,6 @@ class HelpRawPlugin(Plugin):
if self.help_raw is None:
await self.initialize()
if self.help_raw is None:
await message.reply_text("出错了呜呜呜~派蒙没有找到任何帮助信息")
await message.reply_text(f"出错了呜呜呜~ {config.notice.bot_name}没有找到任何帮助信息")
return
await message.reply_text(self.help_raw, allow_sending_without_reply=True)

View File

@ -112,7 +112,7 @@ class Map(Plugin):
def gen_caption(self, map_id: Union[int, str], name: str) -> str:
count = self.map_helper.get_label_count(map_id, name)
return f"派蒙一共找到了 {name}{count} 个位置点\n* 数据来源于米游社wiki"
return f"{config.notice.bot_name}一共找到了 {name}{count} 个位置点\n* 数据来源于米游社wiki"
@handler(CommandHandler, command="map", block=False)
@handler(

View File

@ -7,6 +7,7 @@ from telegram.ext import CommandHandler, MessageHandler, filters, ConversationHa
from telegram.helpers import create_deep_linked_url
from core.basemodel import RegionEnum
from core.config import config
from core.plugin import Plugin, handler, conversation
from core.services.cookies import CookiesService
from core.services.players.services import PlayersService
@ -26,6 +27,8 @@ if TYPE_CHECKING:
INPUT_URL, CONFIRM_DELETE = range(10100, 10102)
WAITING = f"{config.notice.bot_name}正在从服务器获取数据,请稍后"
PAYLOG_NOT_FOUND = f"{config.notice.bot_name}没有找到你的充值记录,快来私聊{config.notice.bot_name}导入吧~"
class PayLogPlugin(Plugin.Conversation):
@ -63,7 +66,7 @@ class PayLogPlugin(Plugin.Conversation):
new_num = await self.pay_log.get_log_data(user.id, player_id, authkey)
return "更新完成,本次没有新增数据" if new_num == 0 else f"更新完成,本次共新增{new_num}条充值记录"
except PayLogNotFound:
return "派蒙没有找到你的充值记录,快去充值吧~"
return f"{config.notice.bot_name}没有找到你的充值记录,快去充值吧~"
except PayLogAccountNotFound:
return "导入失败,可能文件包含的祈愿记录所属 uid 与你当前绑定的 uid 不同"
except PayLogInvalidAuthkey:
@ -72,7 +75,7 @@ class PayLogPlugin(Plugin.Conversation):
return "更新数据失败authkey 已经过期"
except PlayerNotFoundError:
logger.info("未查询到用户 %s[%s] 所绑定的账号信息", user.full_name, user.id)
return "派蒙没有找到您所绑定的账号信息,请先私聊派蒙绑定账号"
return config.notice.user_not_found
@conversation.entry_point
@handler.command(command="pay_log_import", filters=filters.ChatType.PRIVATE, block=False)
@ -102,8 +105,7 @@ class PayLogPlugin(Plugin.Conversation):
raise CookiesNotFoundError(user.id)
else:
raise CookiesNotFoundError(user.id)
text = "小派蒙正在从服务器获取数据,请稍后"
reply = await message.reply_text(text)
reply = await message.reply_text(WAITING)
await message.reply_chat_action(ChatAction.TYPING)
data = await self._refresh_user_data(user, authkey=authkey)
await reply.edit_text(data)
@ -121,7 +123,7 @@ class PayLogPlugin(Plugin.Conversation):
await message.reply_text("呜呜呜~输入错误,请尝试重新获取连接")
return INPUT_URL
authkey = from_url_get_authkey(message.text)
reply = await message.reply_text("小派蒙正在从服务器获取数据,请稍后")
reply = await message.reply_text(WAITING)
await message.reply_chat_action(ChatAction.TYPING)
text = await self._refresh_user_data(user, authkey=authkey)
await reply.edit_text(text)
@ -137,7 +139,7 @@ class PayLogPlugin(Plugin.Conversation):
player_info = await self.players_service.get_player(user.id)
if player_info is None:
logger.info("未查询到用户 %s[%s] 所绑定的账号信息", user.full_name, user.id)
await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号")
await message.reply_text(config.notice.user_not_found)
return ConversationHandler.END
_, status = await self.pay_log.load_history_info(str(user.id), str(player_info.player_id), only_status=True)
if not status:
@ -205,14 +207,12 @@ class PayLogPlugin(Plugin.Conversation):
buttons = [
[InlineKeyboardButton("点我导入", url=create_deep_linked_url(context.bot.username, "pay_log_import"))]
]
await message.reply_text(
"派蒙没有找到你的充值记录,快来私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons)
)
await message.reply_text(PAYLOG_NOT_FOUND, reply_markup=InlineKeyboardMarkup(buttons))
except PayLogAccountNotFound:
await message.reply_text("导出失败,可能文件包含的祈愿记录所属 uid 与你当前绑定的 uid 不同")
except PlayerNotFoundError:
logger.info("未查询到用户 %s[%s] 所绑定的账号信息", user.full_name, user.id)
await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号")
await message.reply_text(config.notice.user_not_found)
@handler(CommandHandler, command="pay_log", block=False)
@handler(MessageHandler, filters=filters.Regex("^充值记录$"), block=False)
@ -235,9 +235,7 @@ class PayLogPlugin(Plugin.Conversation):
buttons = [
[InlineKeyboardButton("点我导入", url=create_deep_linked_url(context.bot.username, "pay_log_import"))]
]
await message.reply_text(
"派蒙没有找到你的充值记录,快来点击按钮私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons)
)
await message.reply_text(PAYLOG_NOT_FOUND, reply_markup=InlineKeyboardMarkup(buttons))
@staticmethod
async def get_migrate_data(

View File

@ -43,10 +43,10 @@ class Sign(Plugin):
async def _process_auto_sign(self, user_id: int, chat_id: int, method: str) -> str:
player = await self.players_service.get_player(user_id)
if player is None:
return "未查询到账号信息,请先私聊派蒙绑定账号"
return config.notice.user_not_found
cookie_model = await self.cookies_service.get(player.user_id, player.account_id, player.region)
if cookie_model is None:
return "未查询到账号信息,请先私聊派蒙绑定账号"
return config.notice.user_not_found
user: SignUser = await self.sign_service.get_by_user_id(user_id)
if user:
if method == "关闭":

View File

@ -3,6 +3,7 @@ from typing import Optional, TYPE_CHECKING
from telegram.constants import ChatAction
from telegram.ext import filters
from core.config import config
from core.plugin import Plugin, handler
from core.services.cookies.error import TooManyRequestPublicCookies
from core.services.template.models import RenderResult
@ -48,7 +49,7 @@ class PlayerStatsPlugins(Plugin):
except AttributeError as exc:
logger.error("角色数据有误")
logger.exception(exc)
await message.reply_text("角色数据有误 估计是派蒙晕了")
await message.reply_text(f"角色数据有误 估计是{config.notice.bot_name}晕了")
return
except ValueError as exc:
logger.warning("获取 uid 发生错误! 错误信息为 %s", str(exc))

View File

@ -52,6 +52,8 @@ if TYPE_CHECKING:
from gram_core.services.template.models import RenderResult
INPUT_URL, INPUT_FILE, CONFIRM_DELETE = range(10100, 10103)
WAITING = f"{config.notice.bot_name}正在从服务器获取数据,请稍后"
WISHLOG_NOT_FOUND = f"{config.notice.bot_name}没有找到你的抽卡记录,快来私聊{config.notice.bot_name}导入吧~"
class WishLogPlugin(Plugin.Conversation):
@ -60,7 +62,7 @@ class WishLogPlugin(Plugin.Conversation):
IMPORT_HINT = (
"<b>开始导入祈愿历史记录:请通过 https://paimon.moe/wish/import 获取抽卡记录链接后发送给我"
"(非 paimon.moe 导出的文件数据)</b>\n\n"
f"> 你还可以向派蒙发送从其他工具导出的 UIGF {UIGF_VERSION} 标准的记录文件\n"
f"> 你还可以向{config.notice.bot_name}发送从其他工具导出的 UIGF {UIGF_VERSION} 标准的记录文件\n"
"> 或者从 paimon.moe 、非小酋 导出的 xlsx 记录文件\n"
"> 在绑定 Cookie 时添加 stoken 可能有特殊效果哦(仅限国服)\n"
"<b>注意:导入的数据将会与旧数据进行合并。</b>"
@ -115,7 +117,7 @@ class WishLogPlugin(Plugin.Conversation):
new_num = await self.gacha_log.import_gacha_log_data(user.id, player_id, data, verify_uid)
return "更新完成,本次没有新增数据" if new_num == 0 else f"更新完成,本次共新增{new_num}条抽卡记录"
except GachaLogNotFound:
return "派蒙没有找到你的抽卡记录,快来私聊派蒙导入吧~"
return WAITING
except GachaLogAccountNotFound:
return "导入失败,可能文件包含的祈愿记录所属 uid 与你当前绑定的 uid 不同"
except GachaLogFileError:
@ -128,7 +130,7 @@ class WishLogPlugin(Plugin.Conversation):
return "导入失败,你已经通过其他方式导入过抽卡记录了,本次无法导入"
except PlayerNotFoundError:
logger.info("未查询到用户 %s[%s] 所绑定的账号信息", user.full_name, user.id)
return "派蒙没有找到您所绑定的账号信息,请先私聊派蒙绑定账号"
return config.notice.user_not_found
async def import_from_file(self, user: "User", message: "Message", document: "Optional[Document]" = None) -> None:
if not document:
@ -245,7 +247,7 @@ class WishLogPlugin(Plugin.Conversation):
return ConversationHandler.END
else:
authkey = from_url_get_authkey(message.text)
reply = await message.reply_text("小派蒙正在从服务器获取数据,请稍后", reply_markup=ReplyKeyboardRemove())
reply = await message.reply_text(WAITING, reply_markup=ReplyKeyboardRemove())
await message.reply_chat_action(ChatAction.TYPING)
text = await self._refresh_user_data(user, authkey=authkey)
try:
@ -268,7 +270,7 @@ class WishLogPlugin(Plugin.Conversation):
context.chat_data["uid"] = player_id
except PlayerNotFoundError:
logger.info("未查询到用户 %s[%s] 所绑定的账号信息", user.full_name, user.id)
await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号")
await message.reply_text(config.notice.user_not_found)
return ConversationHandler.END
_, status = await self.gacha_log.load_history_info(str(user.id), str(player_id), only_status=True)
if not status:
@ -337,16 +339,14 @@ class WishLogPlugin(Plugin.Conversation):
buttons = [
[InlineKeyboardButton("点我导入", url=create_deep_linked_url(context.bot.username, "gacha_log_import"))]
]
await message.reply_text(
"派蒙没有找到你的抽卡记录,快来私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons)
)
await message.reply_text(WISHLOG_NOT_FOUND, reply_markup=InlineKeyboardMarkup(buttons))
except GachaLogAccountNotFound:
await message.reply_text("导入失败,可能文件包含的祈愿记录所属 uid 与你当前绑定的 uid 不同")
except GachaLogFileError:
await message.reply_text("导入失败,数据格式错误")
except PlayerNotFoundError:
logger.info("未查询到用户 %s[%s] 所绑定的账号信息", user.full_name, user.id)
await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号")
await message.reply_text(config.notice.user_not_found)
@handler.command(command="wish_log_url", filters=filters.ChatType.PRIVATE, block=False)
@handler.command(command="gacha_log_url", filters=filters.ChatType.PRIVATE, block=False)
@ -474,9 +474,7 @@ class WishLogPlugin(Plugin.Conversation):
buttons = [
[InlineKeyboardButton("点我导入", url=create_deep_linked_url(context.bot.username, "gacha_log_import"))]
]
await message.reply_text(
"派蒙没有找到你的抽卡记录,快来点击按钮私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons)
)
await message.reply_text(WISHLOG_NOT_FOUND, reply_markup=InlineKeyboardMarkup(buttons))
@handler.callback_query(pattern=r"^get_wish_log\|", block=False)
async def get_wish_log(self, update: "Update", _: "ContextTypes.DEFAULT_TYPE") -> None:

View File

@ -215,7 +215,7 @@ class GroupCaptcha(Plugin):
)
else:
logger.warning("auth 模块 admin 函数 发现未知命令 result[%s]", result)
await context.bot.send_message(chat.id, "派蒙这边收到了错误的消息!请检查详细日记!")
await context.bot.send_message(chat.id, f"{config.notice.bot_name}这边收到了错误的消息!请检查详细日记!")
if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user_id}|auth_kick"):
schedule.remove()
@ -334,7 +334,7 @@ class GroupCaptcha(Plugin):
return
chat_administrators = await ChatAdministrators.get_chat_administrators(self.cache, context, chat_id=chat.id)
if ChatAdministrators.is_admin(chat_administrators, from_user.id):
await chat.send_message("派蒙检测到管理员邀请,自动放行了!")
await chat.send_message(f"{config.notice.bot_name}检测到管理员邀请,自动放行了!")
return
question_id_list = await self.quiz_service.get_question_id_list()
if len(question_id_list) == 0:
@ -346,7 +346,7 @@ class GroupCaptcha(Plugin):
if "Not enough rights" in exc.message:
logger.warning("%s[%s] 权限不够", chat.title, chat.id)
await chat.send_message(
f"派蒙无法修改 {user.mention_html()} 的权限!请检查是否给派蒙授权管理了",
f"{config.notice.bot_name}无法修改 {user.mention_html()} 的权限!请检查是否给{config.notice.bot_name}授权管理了",
parse_mode=ParseMode.HTML,
)
return
@ -396,7 +396,9 @@ class GroupCaptcha(Plugin):
parse_mode=ParseMode.MARKDOWN_V2,
)
except BadRequest as exc:
await chat.send_message("派蒙分心了一下,不小心忘记你了,你只能先退出群再重新进来吧。")
await chat.send_message(
f"{config.notice.bot_name}分心了一下,不小心忘记你了,你只能先退出群再重新进来吧。"
)
raise exc
context.job_queue.run_once(
callback=self.kick_member_job,

View File

@ -80,7 +80,7 @@ class ChatMember(Plugin):
quit_status = True
if quit_status:
try:
await context.bot.send_message(chat.id, "派蒙不想进去!不是旅行者的邀请!")
await context.bot.send_message(chat.id, config.notice.quit_status)
except Forbidden as exc:
logger.info("发送消息失败 %s", exc.message)
except NetworkError as exc:
@ -90,7 +90,9 @@ class ChatMember(Plugin):
await context.bot.leave_chat(chat.id)
else:
try:
await context.bot.send_message(chat.id, "感谢邀请小派蒙到本群!请使用 /help 查看咱已经学会的功能。")
await context.bot.send_message(
chat.id, f"感谢邀请小{config.notice.bot_name}到本群!请使用 /help 查看咱已经学会的功能。"
)
except Forbidden as exc:
logger.info("发送消息失败 %s", exc.message)
except NetworkError as exc:

View File

@ -268,8 +268,7 @@ class ErrorHandler(Plugin):
context.error, (CookiesNotFoundError, PlayerNotFoundError, GenshinPlayerNotFoundError)
) or not isinstance(update, Update):
return
notice = "未查询到您所绑定的账号信息,请先私聊派蒙绑定账号"
self.create_notice_task(update, context, notice)
self.create_notice_task(update, context, config.notice.user_not_found)
raise ApplicationHandlerStop
@error_handler(block=False)
@ -291,7 +290,7 @@ class ErrorHandler(Plugin):
chat.id,
update.update_id,
)
text = "出错了呜呜呜 ~ 派蒙这边发生了点问题无法处理!"
text = f"出错了呜呜呜 ~ {config.notice.bot_name}这边发生了点问题无法处理!"
await context.bot.send_message(
effective_message.chat_id, text, reply_markup=ReplyKeyboardRemove(), parse_mode=ParseMode.HTML
)