2021-11-28 14:55:10 +00:00
|
|
|
|
from pyrogram import Client, filters
|
2023-07-16 09:49:21 +00:00
|
|
|
|
from pyrogram.types import (
|
|
|
|
|
Message,
|
|
|
|
|
InlineQuery,
|
|
|
|
|
InlineQueryResultArticle,
|
|
|
|
|
InputTextMessageContent,
|
|
|
|
|
)
|
2021-11-28 14:55:10 +00:00
|
|
|
|
from defs.button import gen_button, Button
|
2023-06-23 15:37:55 +00:00
|
|
|
|
from init import bot
|
2021-11-28 14:55:10 +00:00
|
|
|
|
|
|
|
|
|
des = """本机器人特性:
|
|
|
|
|
|
2022-10-03 08:31:20 +00:00
|
|
|
|
★ 解析 bilibili 视频、动态
|
|
|
|
|
★ 解析 lofter 日志、用户
|
2023-01-12 14:56:04 +00:00
|
|
|
|
★ 解析 fanbox 发帖、用户
|
2022-10-03 08:31:20 +00:00
|
|
|
|
★ 汇率查询
|
2021-11-28 14:55:10 +00:00
|
|
|
|
★ 复读机(3条)
|
|
|
|
|
★ 答案之书
|
|
|
|
|
★ 鲁迅说过
|
|
|
|
|
★ 我有个朋友
|
|
|
|
|
★ 简易版问与答
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
2023-06-23 15:37:55 +00:00
|
|
|
|
@bot.on_message(filters.incoming & filters.private & filters.command(["start"]))
|
2022-07-25 09:35:54 +00:00
|
|
|
|
async def start_command(_: Client, message: Message):
|
2021-11-28 14:55:10 +00:00
|
|
|
|
"""
|
2023-01-12 13:19:54 +00:00
|
|
|
|
回应机器人信息
|
2021-11-28 14:55:10 +00:00
|
|
|
|
"""
|
2023-01-12 13:19:54 +00:00
|
|
|
|
await message.reply(
|
|
|
|
|
des,
|
|
|
|
|
quote=True,
|
|
|
|
|
reply_markup=gen_button(
|
|
|
|
|
[
|
|
|
|
|
Button(0, "Gitlab", "https://gitlab.com/Xtao-Labs/iShotaBot"),
|
|
|
|
|
Button(0, "Github", "https://github.com/Xtao-Labs/iShotaBot"),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
)
|
2023-06-23 15:37:55 +00:00
|
|
|
|
|
|
|
|
|
|
2023-06-23 16:05:37 +00:00
|
|
|
|
def empty():
|
|
|
|
|
async def fun(_, __, update):
|
|
|
|
|
return not bool(update.query)
|
|
|
|
|
|
|
|
|
|
return filters.create(fun)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.on_inline_query(filters=empty())
|
2023-06-23 15:37:55 +00:00
|
|
|
|
async def empty_inline(_, inline_query: InlineQuery):
|
|
|
|
|
results = [
|
|
|
|
|
InlineQueryResultArticle(
|
|
|
|
|
title="@username",
|
|
|
|
|
input_message_content=InputTextMessageContent("使用 @username 来查询遗产"),
|
|
|
|
|
description="使用 @username 来查询遗产",
|
|
|
|
|
),
|
|
|
|
|
InlineQueryResultArticle(
|
|
|
|
|
title="m",
|
|
|
|
|
input_message_content=InputTextMessageContent("使用 m 来查询米游社启动图"),
|
|
|
|
|
description="使用 m 来查询米游社启动图",
|
|
|
|
|
),
|
2024-07-17 12:16:19 +00:00
|
|
|
|
InlineQueryResultArticle(
|
|
|
|
|
title="dc",
|
|
|
|
|
input_message_content=InputTextMessageContent("使用 dc 来查询会话数据中心"),
|
|
|
|
|
description="使用 dc 来查询会话数据中心",
|
|
|
|
|
),
|
2023-06-23 15:37:55 +00:00
|
|
|
|
]
|
|
|
|
|
return await inline_query.answer(
|
|
|
|
|
results=results,
|
|
|
|
|
switch_pm_text="使用关键词开始查询",
|
|
|
|
|
switch_pm_parameter="start",
|
|
|
|
|
cache_time=0,
|
|
|
|
|
)
|