mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-21 21:58:04 +00:00
✨ Use create_deep_linked_url
to create url
This commit is contained in:
parent
c090dd97ba
commit
a2656d2df7
@ -12,6 +12,7 @@ from pytz import timezone
|
|||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Message, Update
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Message, Update
|
||||||
from telegram.constants import ChatAction, ParseMode
|
from telegram.constants import ChatAction, ParseMode
|
||||||
from telegram.ext import CallbackContext, filters
|
from telegram.ext import CallbackContext, filters
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.base.assets import AssetsService
|
from core.base.assets import AssetsService
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
@ -135,7 +136,7 @@ class Abyss(Plugin, BasePlugin):
|
|||||||
except CookiesNotFoundError:
|
except CookiesNotFoundError:
|
||||||
client, uid = await get_public_genshin_client(user.id)
|
client, uid = await get_public_genshin_client(user.id)
|
||||||
except UserNotFoundError: # 若未找到账号
|
except UserNotFoundError: # 若未找到账号
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_uid")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_uid"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton
|
from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton
|
||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters
|
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.base.assets import AssetsService
|
from core.base.assets import AssetsService
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
@ -40,7 +41,7 @@ class AbyssTeam(Plugin, BasePlugin):
|
|||||||
try:
|
try:
|
||||||
client = await get_genshin_client(user.id)
|
client = await get_genshin_client(user.id)
|
||||||
except (CookiesNotFoundError, UserNotFoundError):
|
except (CookiesNotFoundError, UserNotFoundError):
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_cookie")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_cookie"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
|
@ -9,6 +9,7 @@ from genshin.models import CalculatorCharacterDetails, CalculatorTalent, Charact
|
|||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Message, Update, User
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Message, Update, User
|
||||||
from telegram.constants import ChatAction, ParseMode
|
from telegram.constants import ChatAction, ParseMode
|
||||||
from telegram.ext import CallbackContext, filters
|
from telegram.ext import CallbackContext, filters
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.base.assets import AssetsService
|
from core.base.assets import AssetsService
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
@ -41,7 +42,7 @@ class AvatarListPlugin(Plugin, BasePlugin):
|
|||||||
try:
|
try:
|
||||||
return await get_genshin_client(user.id)
|
return await get_genshin_client(user.id)
|
||||||
except UserNotFoundError: # 若未找到账号
|
except UserNotFoundError: # 若未找到账号
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_cookie")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_cookie"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
@ -52,7 +53,7 @@ class AvatarListPlugin(Plugin, BasePlugin):
|
|||||||
else:
|
else:
|
||||||
await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号", reply_markup=InlineKeyboardMarkup(buttons))
|
await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号", reply_markup=InlineKeyboardMarkup(buttons))
|
||||||
except CookiesNotFoundError:
|
except CookiesNotFoundError:
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_cookie")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_cookie"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_msg = await message.reply_text(
|
reply_msg = await message.reply_text(
|
||||||
"此功能需要绑定<code>cookie</code>后使用,请先私聊派蒙绑定账号",
|
"此功能需要绑定<code>cookie</code>后使用,请先私聊派蒙绑定账号",
|
||||||
|
@ -6,6 +6,7 @@ from genshin import DataNotPublic
|
|||||||
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
|
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, filters, CallbackContext
|
from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, filters, CallbackContext
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
from core.cookies.error import CookiesNotFoundError
|
from core.cookies.error import CookiesNotFoundError
|
||||||
@ -102,7 +103,7 @@ class DailyNote(Plugin, BasePlugin):
|
|||||||
client = await get_genshin_client(user.id)
|
client = await get_genshin_client(user.id)
|
||||||
render_result = await self._get_daily_note(client)
|
render_result = await self._get_daily_note(client)
|
||||||
except (UserNotFoundError, CookiesNotFoundError):
|
except (UserNotFoundError, CookiesNotFoundError):
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_cookie")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_cookie"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
|
@ -7,6 +7,7 @@ from genshin.models import BannerType
|
|||||||
from telegram import Update, User, Message, Document, InlineKeyboardButton, InlineKeyboardMarkup
|
from telegram import Update, User, Message, Document, InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters, ConversationHandler
|
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters, ConversationHandler
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.base.assets import AssetsService
|
from core.base.assets import AssetsService
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
@ -232,7 +233,7 @@ class GachaLogPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
|||||||
context.chat_data["uid"] = client.uid
|
context.chat_data["uid"] = client.uid
|
||||||
except UserNotFoundError:
|
except UserNotFoundError:
|
||||||
logger.info(f"未查询到用户({user.full_name} {user.id}) 所绑定的账号信息")
|
logger.info(f"未查询到用户({user.full_name} {user.id}) 所绑定的账号信息")
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_uid")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_uid"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
@ -306,7 +307,7 @@ class GachaLogPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
|||||||
await message.reply_document(document=open(path, "rb+"), caption="抽卡记录导出文件 - UIGF V2.2")
|
await message.reply_document(document=open(path, "rb+"), caption="抽卡记录导出文件 - UIGF V2.2")
|
||||||
except GachaLogNotFound:
|
except GachaLogNotFound:
|
||||||
buttons = [
|
buttons = [
|
||||||
[InlineKeyboardButton("点我导入", url=f"https://t.me/{context.bot.username}?start=gacha_log_import")]
|
[InlineKeyboardButton("点我导入", url=create_deep_linked_url(context.bot.username, "gacha_log_import"))]
|
||||||
]
|
]
|
||||||
await message.reply_text("派蒙没有找到你的抽卡记录,快来私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons))
|
await message.reply_text("派蒙没有找到你的抽卡记录,快来私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons))
|
||||||
except GachaLogAccountNotFound:
|
except GachaLogAccountNotFound:
|
||||||
@ -315,7 +316,7 @@ class GachaLogPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
|||||||
await message.reply_text("导入失败,数据格式错误")
|
await message.reply_text("导入失败,数据格式错误")
|
||||||
except UserNotFoundError:
|
except UserNotFoundError:
|
||||||
logger.info(f"未查询到用户({user.full_name} {user.id}) 所绑定的账号信息")
|
logger.info(f"未查询到用户({user.full_name} {user.id}) 所绑定的账号信息")
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_uid")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_uid"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
@ -357,12 +358,12 @@ class GachaLogPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
|||||||
await png_data.reply_photo(message)
|
await png_data.reply_photo(message)
|
||||||
except GachaLogNotFound:
|
except GachaLogNotFound:
|
||||||
buttons = [
|
buttons = [
|
||||||
[InlineKeyboardButton("点我导入", url=f"https://t.me/{context.bot.username}?start=gacha_log_import")]
|
[InlineKeyboardButton("点我导入", url=create_deep_linked_url(context.bot.username, "gacha_log_import"))]
|
||||||
]
|
]
|
||||||
await message.reply_text("派蒙没有找到你的抽卡记录,快来点击按钮私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons))
|
await message.reply_text("派蒙没有找到你的抽卡记录,快来点击按钮私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons))
|
||||||
except UserNotFoundError:
|
except UserNotFoundError:
|
||||||
logger.info(f"未查询到用户({user.full_name} {user.id}) 所绑定的账号信息")
|
logger.info(f"未查询到用户({user.full_name} {user.id}) 所绑定的账号信息")
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_uid")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_uid"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
@ -422,12 +423,12 @@ class GachaLogPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
|||||||
await png_data.reply_photo(message)
|
await png_data.reply_photo(message)
|
||||||
except GachaLogNotFound:
|
except GachaLogNotFound:
|
||||||
buttons = [
|
buttons = [
|
||||||
[InlineKeyboardButton("点我导入", url=f"https://t.me/{context.bot.username}?start=gacha_log_import")]
|
[InlineKeyboardButton("点我导入", url=create_deep_linked_url(context.bot.username, "gacha_log_import"))]
|
||||||
]
|
]
|
||||||
await message.reply_text("派蒙没有找到你的抽卡记录,快来私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons))
|
await message.reply_text("派蒙没有找到你的抽卡记录,快来私聊派蒙导入吧~", reply_markup=InlineKeyboardMarkup(buttons))
|
||||||
except (UserNotFoundError):
|
except (UserNotFoundError):
|
||||||
logger.info(f"未查询到用户({user.full_name} {user.id}) 所绑定的账号信息")
|
logger.info(f"未查询到用户({user.full_name} {user.id}) 所绑定的账号信息")
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_uid")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_uid"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
|
@ -6,6 +6,7 @@ from genshin import GenshinException, DataNotPublic
|
|||||||
from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton
|
from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton
|
||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters
|
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
from core.cookies.error import CookiesNotFoundError
|
from core.cookies.error import CookiesNotFoundError
|
||||||
@ -124,7 +125,7 @@ class Ledger(Plugin, BasePlugin):
|
|||||||
client = await get_genshin_client(user.id)
|
client = await get_genshin_client(user.id)
|
||||||
render_result = await self._start_get_ledger(client, month)
|
render_result = await self._start_get_ledger(client, month)
|
||||||
except (UserNotFoundError, CookiesNotFoundError):
|
except (UserNotFoundError, CookiesNotFoundError):
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_cookie")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_cookie"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
|
@ -4,6 +4,7 @@ from PIL import Image
|
|||||||
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
|
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CommandHandler, MessageHandler, filters, CallbackContext
|
from telegram.ext import CommandHandler, MessageHandler, filters, CallbackContext
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
from core.plugin import handler, Plugin
|
from core.plugin import handler, Plugin
|
||||||
@ -45,7 +46,7 @@ class Map(Plugin, BasePlugin):
|
|||||||
return
|
return
|
||||||
if resource_name in ("list", "列表"):
|
if resource_name in ("list", "列表"):
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
buttons = [[InlineKeyboardButton("点我私聊", url=f"https://t.me/{context.bot.username}")]]
|
buttons = [[InlineKeyboardButton("点我私聊", url=create_deep_linked_url(context.bot.username))]]
|
||||||
reply_message = await message.reply_text("请私聊派蒙使用该命令", reply_markup=InlineKeyboardMarkup(buttons))
|
reply_message = await message.reply_text("请私聊派蒙使用该命令", reply_markup=InlineKeyboardMarkup(buttons))
|
||||||
self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id, 300)
|
self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id, 300)
|
||||||
self._add_delete_message_job(context, message.chat_id, message.message_id, 300)
|
self._add_delete_message_job(context, message.chat_id, message.message_id, 300)
|
||||||
|
@ -20,6 +20,7 @@ from pydantic import BaseModel
|
|||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CallbackContext, CallbackQueryHandler, CommandHandler, MessageHandler, filters
|
from telegram.ext import CallbackContext, CallbackQueryHandler, CommandHandler, MessageHandler, filters
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.base.assets import DEFAULT_EnkaAssets
|
from core.base.assets import DEFAULT_EnkaAssets
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
@ -76,7 +77,7 @@ class PlayerCards(Plugin, BasePlugin):
|
|||||||
else:
|
else:
|
||||||
uid = user_info.genshin_uid
|
uid = user_info.genshin_uid
|
||||||
except UserNotFoundError:
|
except UserNotFoundError:
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_uid")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_uid"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
|
@ -12,6 +12,7 @@ from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
|
|||||||
from telegram.constants import ChatAction
|
from telegram.constants import ChatAction
|
||||||
from telegram.ext import CommandHandler, CallbackContext, CallbackQueryHandler
|
from telegram.ext import CommandHandler, CallbackContext, CallbackQueryHandler
|
||||||
from telegram.ext import MessageHandler, filters
|
from telegram.ext import MessageHandler, filters
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.admin.services import BotAdminService
|
from core.admin.services import BotAdminService
|
||||||
from core.base.redisdb import RedisDB
|
from core.base.redisdb import RedisDB
|
||||||
@ -387,7 +388,7 @@ class Sign(Plugin, BasePlugin):
|
|||||||
if filters.ChatType.GROUPS.filter(reply_message):
|
if filters.ChatType.GROUPS.filter(reply_message):
|
||||||
self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id)
|
self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id)
|
||||||
except (UserNotFoundError, CookiesNotFoundError):
|
except (UserNotFoundError, CookiesNotFoundError):
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_cookie")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_cookie"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
@ -429,5 +430,4 @@ class Sign(Plugin, BasePlugin):
|
|||||||
if not challenge:
|
if not challenge:
|
||||||
await callback_query.answer(text="验证请求已经过期,请重新发起签到!", show_alert=True)
|
await callback_query.answer(text="验证请求已经过期,请重新发起签到!", show_alert=True)
|
||||||
return
|
return
|
||||||
url = f"t.me/{bot.app.bot.username}?start=sign"
|
await callback_query.answer(url=create_deep_linked_url(bot.app.bot.username, "sign"))
|
||||||
await callback_query.answer(url=url)
|
|
||||||
|
@ -11,6 +11,7 @@ from telegram.ext import (
|
|||||||
MessageHandler,
|
MessageHandler,
|
||||||
filters,
|
filters,
|
||||||
)
|
)
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
from core.cookies.error import CookiesNotFoundError, TooManyRequestPublicCookies
|
from core.cookies.error import CookiesNotFoundError, TooManyRequestPublicCookies
|
||||||
@ -54,7 +55,7 @@ class UserStatsPlugins(Plugin, BasePlugin):
|
|||||||
client, uid = await get_public_genshin_client(user.id)
|
client, uid = await get_public_genshin_client(user.id)
|
||||||
render_result = await self.render(client, uid)
|
render_result = await self.render(client, uid)
|
||||||
except UserNotFoundError:
|
except UserNotFoundError:
|
||||||
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_uid")]]
|
buttons = [[InlineKeyboardButton("点我绑定账号", url=create_deep_linked_url(context.bot.username, "set_uid"))]]
|
||||||
if filters.ChatType.GROUPS.filter(message):
|
if filters.ChatType.GROUPS.filter(message):
|
||||||
reply_message = await message.reply_text(
|
reply_message = await message.reply_text(
|
||||||
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
"未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons)
|
||||||
|
@ -8,6 +8,7 @@ from httpx import ConnectTimeout
|
|||||||
from telegram import Update, ReplyKeyboardRemove, InlineKeyboardButton, InlineKeyboardMarkup, Message
|
from telegram import Update, ReplyKeyboardRemove, InlineKeyboardButton, InlineKeyboardMarkup, Message
|
||||||
from telegram.error import BadRequest, TimedOut, Forbidden
|
from telegram.error import BadRequest, TimedOut, Forbidden
|
||||||
from telegram.ext import CallbackContext, ConversationHandler, filters
|
from telegram.ext import CallbackContext, ConversationHandler, filters
|
||||||
|
from telegram.helpers import create_deep_linked_url
|
||||||
|
|
||||||
from core.baseplugin import add_delete_message_job
|
from core.baseplugin import add_delete_message_job
|
||||||
from modules.apihelper.error import APIHelperException, ReturnCodeError, APIHelperTimedOut, ResponseException
|
from modules.apihelper.error import APIHelperException, ReturnCodeError, APIHelperTimedOut, ResponseException
|
||||||
@ -23,11 +24,11 @@ async def send_user_notification(update: Update, context: CallbackContext, text:
|
|||||||
return None
|
return None
|
||||||
if "重新绑定" in text:
|
if "重新绑定" in text:
|
||||||
buttons = InlineKeyboardMarkup(
|
buttons = InlineKeyboardMarkup(
|
||||||
[[InlineKeyboardButton("点我重新绑定", url=f"https://t.me/{context.bot.username}?start=set_cookie")]]
|
[[InlineKeyboardButton("点我重新绑定", url=create_deep_linked_url(context.bot.username, "set_cookie"))]]
|
||||||
)
|
)
|
||||||
elif "通过验证" in text:
|
elif "通过验证" in text:
|
||||||
buttons = InlineKeyboardMarkup(
|
buttons = InlineKeyboardMarkup(
|
||||||
[[InlineKeyboardButton("点我通过验证", url=f"https://t.me/{context.bot.username}?start=verify_verification")]]
|
[[InlineKeyboardButton("点我通过验证", url=create_deep_linked_url(context.bot.username, "verify_verification"))]]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
buttons = ReplyKeyboardRemove()
|
buttons = ReplyKeyboardRemove()
|
||||||
|
Loading…
Reference in New Issue
Block a user