parent
c01d0ffd83
commit
91f6b8108f
@ -37,6 +37,11 @@ application_tts: "zh-CN"
|
||||
log: "False"
|
||||
log_chatid: "503691334"
|
||||
|
||||
# Disabled Built-in Commands
|
||||
disabled_cmd:
|
||||
- example1
|
||||
- example2
|
||||
|
||||
# Google search preferences
|
||||
result_length: "5"
|
||||
|
||||
@ -51,4 +56,4 @@ proxy_addr: ""
|
||||
proxy_port: ""
|
||||
mtp_addr: ""
|
||||
mtp_port: ""
|
||||
mtp_secret: ""
|
||||
mtp_secret: ""
|
||||
|
@ -1,11 +1,12 @@
|
||||
""" PagerMaid event listener. """
|
||||
|
||||
import sys
|
||||
|
||||
from telethon import events
|
||||
from telethon.errors import MessageTooLongError
|
||||
from distutils2.util import strtobool
|
||||
from traceback import format_exc
|
||||
from time import gmtime, strftime, time
|
||||
from sys import exc_info
|
||||
from telethon.events import StopPropagation
|
||||
from pagermaid import bot, config, help_messages
|
||||
from pagermaid.utils import attach_log
|
||||
@ -19,6 +20,7 @@ def listener(**args):
|
||||
pattern = args.get('pattern', None)
|
||||
diagnostics = args.get('diagnostics', True)
|
||||
ignore_edited = args.get('ignore_edited', False)
|
||||
is_plugin = args.get('is_plugin', True)
|
||||
if command is not None:
|
||||
if command in help_messages:
|
||||
raise ValueError(f"出错了呜呜呜 ~ 命令 \"{command}\" 已经被注册。")
|
||||
@ -37,6 +39,8 @@ def listener(**args):
|
||||
del args['description']
|
||||
if 'parameters' in args:
|
||||
del args['parameters']
|
||||
if 'is_plugin' in args:
|
||||
del args['is_plugin']
|
||||
|
||||
def decorator(function):
|
||||
|
||||
@ -71,10 +75,14 @@ def listener(**args):
|
||||
f"{context.text}\n-----END TARGET MESSAGE-----\n" \
|
||||
f"# Traceback: \n-----BEGIN TRACEBACK-----\n" \
|
||||
f"{str(format_exc())}\n-----END TRACEBACK-----\n" \
|
||||
f"# Error: \"{str(exc_info()[1])}\". \n"
|
||||
f"# Error: \"{str(sys.last_value)}\". \n"
|
||||
await attach_log(report, -1001441461877, f"exception.{time()}.pagermaid", None,
|
||||
"Error report generated.")
|
||||
|
||||
if not is_plugin:
|
||||
if 'disabled_cmd' in config and config['disabled_cmd'].count(command) != 0:
|
||||
return
|
||||
|
||||
if not ignore_edited:
|
||||
bot.add_event_handler(handler, events.MessageEdited(**args))
|
||||
bot.add_event_handler(handler, events.NewMessage(**args))
|
||||
|
@ -13,7 +13,7 @@ from pagermaid import bot, log
|
||||
from pagermaid.listener import listener
|
||||
|
||||
|
||||
@listener(outgoing=True, command="username",
|
||||
@listener(is_plugin=False, outgoing=True, command="username",
|
||||
description="通过命令快捷设置道纹(不支持回复)",
|
||||
parameters="<username>")
|
||||
async def username(context):
|
||||
@ -39,7 +39,7 @@ async def username(context):
|
||||
await log(f"道纹已被设置为 `{result}`.")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="name",
|
||||
@listener(is_plugin=False, outgoing=True, command="name",
|
||||
description="换个名称。(不支持回复)",
|
||||
parameters="<first name> <last name>")
|
||||
async def name(context):
|
||||
@ -67,7 +67,7 @@ async def name(context):
|
||||
await log(f"显示名称已被更改为 `{first_name}`.")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="pfp",
|
||||
@listener(is_plugin=False, outgoing=True, command="pfp",
|
||||
description="回复某条带附件的消息然后把它变成咱的头像")
|
||||
async def pfp(context):
|
||||
""" Sets your profile picture. """
|
||||
@ -97,7 +97,7 @@ async def pfp(context):
|
||||
await context.edit("出错了呜呜呜 ~ 无法将此附件解析为图片。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="bio",
|
||||
@listener(is_plugin=False, outgoing=True, command="bio",
|
||||
description="设置咱的公开情报",
|
||||
parameters="<string>")
|
||||
async def bio(context):
|
||||
@ -114,7 +114,7 @@ async def bio(context):
|
||||
await log(f"公开的情报已被设置为 `{context.arguments}`.")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="rmpfp",
|
||||
@listener(is_plugin=False, outgoing=True, command="rmpfp",
|
||||
description="删除指定数量的咱的头像",
|
||||
parameters="<整数>")
|
||||
async def rmpfp(context):
|
||||
@ -145,7 +145,7 @@ async def rmpfp(context):
|
||||
await context.edit(f"`删除了 {len(input_photos)} 张头像。`")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="profile",
|
||||
@listener(is_plugin=False, outgoing=True, command="profile",
|
||||
description="生成一位用户简介 ~ 消息有点长",
|
||||
parameters="<username>")
|
||||
async def profile(context):
|
||||
|
@ -4,7 +4,7 @@ from pagermaid import redis, log, redis_status
|
||||
from pagermaid.listener import listener
|
||||
|
||||
|
||||
@listener(outgoing=True, command="ghost",
|
||||
@listener(is_plugin=False, outgoing=True, command="ghost",
|
||||
description="开启对话的自动已读,需要 Redis",
|
||||
parameters="<true|false|status>")
|
||||
async def ghost(context):
|
||||
@ -44,7 +44,7 @@ async def ghost(context):
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="deny",
|
||||
@listener(is_plugin=False, outgoing=True, command="deny",
|
||||
description="拒绝聊天功能,需要 redis",
|
||||
parameters="<true|false|status>")
|
||||
async def deny(context):
|
||||
@ -80,7 +80,7 @@ async def deny(context):
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
|
||||
|
||||
@listener(incoming=True, ignore_edited=True)
|
||||
@listener(is_plugin=False, incoming=True, ignore_edited=True)
|
||||
async def set_read_acknowledgement(context):
|
||||
""" Event handler to infinitely read ghosted messages. """
|
||||
if not redis_status():
|
||||
@ -89,7 +89,7 @@ async def set_read_acknowledgement(context):
|
||||
await context.client.send_read_acknowledge(context.chat_id)
|
||||
|
||||
|
||||
@listener(incoming=True, ignore_edited=True)
|
||||
@listener(is_plugin=False, incoming=True, ignore_edited=True)
|
||||
async def message_removal(context):
|
||||
""" Event handler to infinitely delete denied messages. """
|
||||
if not redis_status():
|
||||
|
@ -10,7 +10,7 @@ from pagermaid.listener import listener
|
||||
from pagermaid.utils import execute, upload_attachment
|
||||
|
||||
|
||||
@listener(outgoing=True, command="convert",
|
||||
@listener(is_plugin=False, outgoing=True, command="convert",
|
||||
description="回复某条附件消息然后转换为图片输出")
|
||||
async def convert(context):
|
||||
""" Converts image to png. """
|
||||
@ -39,7 +39,7 @@ async def convert(context):
|
||||
remove("result.png")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="caption",
|
||||
@listener(is_plugin=False, outgoing=True, command="caption",
|
||||
description="将两行字幕添加到回复的图片中,字幕将分别添加到顶部和底部,字幕需要以逗号分隔。",
|
||||
parameters="<string>,<string> <image>")
|
||||
async def caption(context):
|
||||
@ -90,7 +90,7 @@ async def caption(context):
|
||||
await log(f"成功将字幕 `{message}` 添加到了一张图片.")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="ocr",
|
||||
@listener(is_plugin=False, outgoing=True, command="ocr",
|
||||
description="从回复的图片中提取文本")
|
||||
async def ocr(context):
|
||||
""" Extracts texts from images. """
|
||||
@ -127,7 +127,7 @@ async def ocr(context):
|
||||
remove(target_file_path)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="highlight",
|
||||
@listener(is_plugin=False, outgoing=True, command="highlight",
|
||||
description="生成有语法高亮显示的图片。",
|
||||
parameters="<string>")
|
||||
async def highlight(context):
|
||||
|
@ -6,7 +6,7 @@ from pagermaid import config
|
||||
from pagermaid.listener import listener
|
||||
|
||||
|
||||
@listener(outgoing=True, command="time",
|
||||
@listener(is_plugin=False, outgoing=True, command="time",
|
||||
description="显示特定区域的时间,如果参数为空,则默认显示配置值。",
|
||||
parameters="<地区>")
|
||||
async def time(context):
|
||||
|
@ -13,7 +13,7 @@ from pagermaid.listener import listener, config
|
||||
from pagermaid.utils import clear_emojis, attach_log, fetch_youtube_audio
|
||||
|
||||
|
||||
@listener(outgoing=True, command="translate",
|
||||
@listener(is_plugin=False, outgoing=True, command="translate",
|
||||
description="通过 Google 翻译将目标消息翻译成指定的语言。(支持回复)",
|
||||
parameters="<文本>")
|
||||
async def translate(context):
|
||||
@ -52,7 +52,7 @@ async def translate(context):
|
||||
await log(f"把一条消息从 {source_lang} 翻译到了 {trans_lang}.")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="tts",
|
||||
@listener(is_plugin=False, outgoing=True, command="tts",
|
||||
description="通过 Google文本到语音 基于字符串生成语音消息。",
|
||||
parameters="<string>")
|
||||
async def tts(context):
|
||||
@ -98,7 +98,7 @@ async def tts(context):
|
||||
await context.delete()
|
||||
|
||||
|
||||
@listener(outgoing=True, command="google",
|
||||
@listener(is_plugin=False, outgoing=True, command="google",
|
||||
description="使用 Google 查询",
|
||||
parameters="<query>")
|
||||
async def googletest(context):
|
||||
@ -148,7 +148,7 @@ async def googletest(context):
|
||||
await log(f"在Google搜索引擎上查询了 `{query}`")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="fetchaudio",
|
||||
@listener(is_plugin=False, outgoing=True, command="fetchaudio",
|
||||
description="从多个平台获取音频文件。",
|
||||
parameters="<url>,<string>")
|
||||
async def fetchaudio(context):
|
||||
|
@ -9,7 +9,7 @@ from pagermaid.listener import listener
|
||||
from pagermaid.utils import owoify, execute, random_gen, obtain_message
|
||||
|
||||
|
||||
@listener(outgoing=True, command="animate",
|
||||
@listener(is_plugin=False, outgoing=True, command="animate",
|
||||
description="使用消息制作文本动画。",
|
||||
parameters="<message>")
|
||||
async def animate(context):
|
||||
@ -30,7 +30,7 @@ async def animate(context):
|
||||
count += 1
|
||||
|
||||
|
||||
@listener(outgoing=True, command="teletype",
|
||||
@listener(is_plugin=False, outgoing=True, command="teletype",
|
||||
description="通过编辑消息来制作打字动画。会产生大量操作记录!",
|
||||
parameters="<message>")
|
||||
async def teletype(context):
|
||||
@ -54,7 +54,7 @@ async def teletype(context):
|
||||
await sleep(interval)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="mock",
|
||||
@listener(is_plugin=False, outgoing=True, command="mock",
|
||||
description="通过怪异的大写字母来嘲笑人们。",
|
||||
parameters="<message>")
|
||||
async def mock(context):
|
||||
@ -77,7 +77,7 @@ async def mock(context):
|
||||
await context.delete()
|
||||
|
||||
|
||||
@listener(outgoing=True, command="widen",
|
||||
@listener(is_plugin=False, outgoing=True, command="widen",
|
||||
description="加宽字符串中的每个字符。",
|
||||
parameters="<message>")
|
||||
async def widen(context):
|
||||
@ -102,7 +102,7 @@ async def widen(context):
|
||||
await context.delete()
|
||||
|
||||
|
||||
@listener(outgoing=True, command="fox",
|
||||
@listener(is_plugin=False, outgoing=True, command="fox",
|
||||
description="使用狐狸来让您的消息看起来不那么完整",
|
||||
parameters="<message>")
|
||||
async def fox(context):
|
||||
@ -116,7 +116,7 @@ async def fox(context):
|
||||
await edit_reply(result, context)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="owo",
|
||||
@listener(is_plugin=False, outgoing=True, command="owo",
|
||||
description="将消息转换为OwO。",
|
||||
parameters="<message>")
|
||||
async def owo(context):
|
||||
@ -130,7 +130,7 @@ async def owo(context):
|
||||
await edit_reply(result, context)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="flip",
|
||||
@listener(is_plugin=False, outgoing=True, command="flip",
|
||||
description="翻转消息。",
|
||||
parameters="<message>")
|
||||
async def flip(context):
|
||||
@ -144,7 +144,7 @@ async def flip(context):
|
||||
await edit_reply(result, context)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="ship",
|
||||
@listener(is_plugin=False, outgoing=True, command="ship",
|
||||
description="生成随机基友,也支持指定目标。",
|
||||
parameters="<username> <username>")
|
||||
async def ship(context):
|
||||
@ -187,7 +187,7 @@ async def ship(context):
|
||||
f"[{target_2.first_name}](tg://user?id={target_2.id}) = ❤️")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="rng",
|
||||
@listener(is_plugin=False, outgoing=True, command="rng",
|
||||
description="生成具有特定长度的随机字符串。",
|
||||
parameters="<length>")
|
||||
async def rng(context):
|
||||
@ -204,7 +204,7 @@ async def rng(context):
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="aaa",
|
||||
@listener(is_plugin=False, outgoing=True, command="aaa",
|
||||
description="发送一条包含 a 和 A 的消息",
|
||||
parameters="<integer>")
|
||||
async def aaa(context):
|
||||
@ -221,7 +221,7 @@ async def aaa(context):
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="asciiart",
|
||||
@listener(is_plugin=False, outgoing=True, command="asciiart",
|
||||
description="为指定的字符串生成ASCII文字。",
|
||||
parameters="<string>")
|
||||
async def asciiart(context):
|
||||
@ -235,7 +235,7 @@ async def asciiart(context):
|
||||
await context.edit(f"```\n{result}\n```")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="tuxsay",
|
||||
@listener(is_plugin=False, outgoing=True, command="tuxsay",
|
||||
description="生成一条看起来像企鹅说话的 ASCII 艺术消息",
|
||||
parameters="<message>")
|
||||
async def tuxsay(context):
|
||||
@ -249,7 +249,7 @@ async def tuxsay(context):
|
||||
await context.edit(f"```\n{result}\n```")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="coin",
|
||||
@listener(is_plugin=False, outgoing=True, command="coin",
|
||||
description="扔硬币。")
|
||||
async def coin(context):
|
||||
""" Throws a coin. """
|
||||
|
@ -4,7 +4,7 @@ from pagermaid import help_messages
|
||||
from pagermaid.listener import listener
|
||||
|
||||
|
||||
@listener(outgoing=True, command="help",
|
||||
@listener(is_plugin=False, outgoing=True, command="help",
|
||||
description="显示命令列表或单个命令的帮助。",
|
||||
parameters="<命令>")
|
||||
async def help(context):
|
||||
|
@ -11,7 +11,7 @@ from pagermaid import bot, log, config
|
||||
from pagermaid.listener import listener
|
||||
|
||||
|
||||
@listener(outgoing=True, command="id",
|
||||
@listener(is_plugin=False, outgoing=True, command="id",
|
||||
description="获取一条消息的各种信息。")
|
||||
async def userid(context):
|
||||
""" Query the UserID of the sender of the message you replied to. """
|
||||
@ -78,7 +78,7 @@ async def userid(context):
|
||||
await context.edit(text)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="uslog",
|
||||
@listener(is_plugin=False, outgoing=True, command="uslog",
|
||||
description="转发一条消息到日志。",
|
||||
parameters="<string>")
|
||||
async def uslog(context):
|
||||
@ -97,7 +97,7 @@ async def uslog(context):
|
||||
await context.edit("出错了呜呜呜 ~ 日志记录已禁用。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="log",
|
||||
@listener(is_plugin=False, outgoing=True, command="log",
|
||||
description="静默转发一条消息到日志。",
|
||||
parameters="<string>")
|
||||
async def log(context):
|
||||
@ -116,7 +116,7 @@ async def log(context):
|
||||
await context.edit("出错了呜呜呜 ~ 日志记录已禁用。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="re",
|
||||
@listener(is_plugin=False, outgoing=True, command="re",
|
||||
description="在当前会话复读回复的消息。(需要回复一条消息)",
|
||||
parameters="<次数>")
|
||||
async def re(context):
|
||||
@ -141,7 +141,7 @@ async def re(context):
|
||||
await context.edit("出错了呜呜呜 ~ 您好像没有回复一条消息。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="leave",
|
||||
@listener(is_plugin=False, outgoing=True, command="leave",
|
||||
description="说 “再见” 然后离开会话。")
|
||||
async def leave(context):
|
||||
""" It leaves you from the group. """
|
||||
@ -157,7 +157,7 @@ async def leave(context):
|
||||
await context.edit("出错了呜呜呜 ~ 当前聊天似乎不是群聊。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="meter2feet",
|
||||
@listener(is_plugin=False, outgoing=True, command="meter2feet",
|
||||
description="将米转换为英尺。",
|
||||
parameters="<meters>")
|
||||
async def meter2feet(context):
|
||||
@ -170,7 +170,7 @@ async def meter2feet(context):
|
||||
await context.edit(f"将 {str(meter)} 米装换为了 {str(feet)} 英尺。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="feet2meter",
|
||||
@listener(is_plugin=False, outgoing=True, command="feet2meter",
|
||||
description="将英尺转换为米。",
|
||||
parameters="<feet>")
|
||||
async def feet2meter(context):
|
||||
@ -183,7 +183,7 @@ async def feet2meter(context):
|
||||
await context.edit(f"将 {str(feet)} 英尺转换为了 {str(meter)} 米。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="hitokoto",
|
||||
@listener(is_plugin=False, outgoing=True, command="hitokoto",
|
||||
description="每日一言")
|
||||
async def hitokoto(context):
|
||||
""" Get hitokoto.cn """
|
||||
@ -225,14 +225,14 @@ async def hitokoto(context):
|
||||
await context.edit(f"{hitokoto_json['hitokoto']} - {hitokoto_json['from']}({str(hitokoto_type)})")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="source",
|
||||
@listener(is_plugin=False, outgoing=True, command="source",
|
||||
description="显示原始 PagerMaid git 存储库的URL。")
|
||||
async def source(context):
|
||||
""" Outputs the git repository URL. """
|
||||
await context.edit("https://git.stykers.moe/scm/~stykers/pagermaid.git")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="site",
|
||||
@listener(is_plugin=False, outgoing=True, command="site",
|
||||
description="显示原始 PagerMaid 项目主页的URL。")
|
||||
async def site(context):
|
||||
""" Outputs the site URL. """
|
||||
|
@ -6,7 +6,7 @@ from pagermaid import bot, working_dir
|
||||
from pagermaid.listener import listener
|
||||
|
||||
|
||||
@listener(incoming=True, ignore_edited=True)
|
||||
@listener(is_plugin=False, incoming=True, ignore_edited=True)
|
||||
async def status(context):
|
||||
if exists(f"{working_dir}/data/time"):
|
||||
with open(f"{working_dir}/data/time", "r") as f: # 打开文件
|
||||
|
@ -10,7 +10,7 @@ from pagermaid.utils import upload_attachment
|
||||
from pagermaid.modules import plugin_list as active_plugins, __list_plugins
|
||||
|
||||
|
||||
@listener(outgoing=True, command="plugin", diagnostics=False,
|
||||
@listener(is_plugin=False, outgoing=True, command="plugin", diagnostics=False,
|
||||
description="用于管理安装到 PagerMaid-Modify 的插件。",
|
||||
parameters="{status|install|remove|enable|disable|upload} <插件名称/文件>")
|
||||
async def plugin(context):
|
||||
|
@ -6,7 +6,7 @@ from pagermaid import log
|
||||
from pagermaid.listener import listener
|
||||
|
||||
|
||||
@listener(outgoing=True, command="prune",
|
||||
@listener(is_plugin=False, outgoing=True, command="prune",
|
||||
description="以此命令回复某条消息,将删除最新一条消息至该条消息之间的所有消息。限制:基于消息 ID 的 1000 条消息,大于 1000 条可能会触发删除消息过快限制。(非群组管理员只删除自己的消息)")
|
||||
async def prune(context):
|
||||
""" Purge every single message after the message you replied to. """
|
||||
@ -32,7 +32,7 @@ async def prune(context):
|
||||
await notification.delete()
|
||||
|
||||
|
||||
@listener(outgoing=True, command="selfprune",
|
||||
@listener(is_plugin=False, outgoing=True, command="selfprune",
|
||||
description="删除当前对话您发送的特定数量的消息。限制:基于消息 ID 的 1000 条消息,大于 1000 条可能会触发删除消息过快限制。入群消息非管理员无法删除。(倒序)当数字足够大时即可实现删除所有消息。",
|
||||
parameters="<数量>")
|
||||
async def selfprune(context):
|
||||
@ -58,7 +58,7 @@ async def selfprune(context):
|
||||
await notification.delete()
|
||||
|
||||
|
||||
@listener(outgoing=True, command="yourprune",
|
||||
@listener(is_plugin=False, outgoing=True, command="yourprune",
|
||||
description="删除当前对话您回复用户所发送的特定数量的消息。限制:基于消息 ID 的 1000 条消息,大于 1000 条可能会触发删除消息过快限制。(倒序、需要删除消息权限)当数字足够大时即可实现删除所有消息。",
|
||||
parameters="<数量>")
|
||||
async def yourprune(context):
|
||||
@ -90,7 +90,7 @@ async def yourprune(context):
|
||||
await notification.delete()
|
||||
|
||||
|
||||
@listener(outgoing=True, command="del",
|
||||
@listener(is_plugin=False, outgoing=True, command="del",
|
||||
description="删除当前对话您回复的那条消息。(需要回复一条消息)")
|
||||
async def delete(context):
|
||||
""" Deletes the message you replied to. """
|
||||
|
@ -9,7 +9,7 @@ from pagermaid.listener import listener
|
||||
from pagermaid.utils import obtain_message, upload_attachment
|
||||
|
||||
|
||||
@listener(outgoing=True, command="genqr",
|
||||
@listener(is_plugin=False, outgoing=True, command="genqr",
|
||||
description="生成 QR Code 。",
|
||||
parameters="<string>")
|
||||
async def genqr(context):
|
||||
@ -32,7 +32,7 @@ async def genqr(context):
|
||||
await log(f"为 `{message}` 生成了一张 QR 码。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="parseqr",
|
||||
@listener(is_plugin=False, outgoing=True, command="parseqr",
|
||||
description="回复一张 QR 码进行解析并发送 QR 码内容。")
|
||||
async def parseqr(context):
|
||||
""" Parse attachment of replied message as a QR Code and output results. """
|
||||
|
@ -15,7 +15,7 @@ from pagermaid.utils import execute, upload_attachment
|
||||
from pagermaid.listener import listener
|
||||
|
||||
|
||||
@listener(outgoing=True, command="sysinfo",
|
||||
@listener(is_plugin=False, outgoing=True, command="sysinfo",
|
||||
description="通过 neofetch 检索系统信息。")
|
||||
async def sysinfo(context):
|
||||
""" Retrieve system information via neofetch. """
|
||||
@ -24,7 +24,7 @@ async def sysinfo(context):
|
||||
await context.edit(f"`{result}`")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="fortune",
|
||||
@listener(is_plugin=False, outgoing=True, command="fortune",
|
||||
description="读取 fortune cookies 信息。")
|
||||
async def fortune(context):
|
||||
""" Reads a fortune cookie. """
|
||||
@ -35,7 +35,7 @@ async def fortune(context):
|
||||
await context.edit(result)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="fbcon",
|
||||
@listener(is_plugin=False, outgoing=True, command="fbcon",
|
||||
description="拍摄当前绑定的帧缓冲控制台的屏幕截图。")
|
||||
async def tty(context):
|
||||
""" Screenshots a TTY and prints it. """
|
||||
@ -66,7 +66,7 @@ async def tty(context):
|
||||
await log("Screenshot of binded framebuffer console taken.")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="status",
|
||||
@listener(is_plugin=False, outgoing=True, command="status",
|
||||
description="输出 PagerMaid-Modify 的运行状态。")
|
||||
async def status(context):
|
||||
database = "Connected" if redis_status() else "Disconnected"
|
||||
@ -81,7 +81,7 @@ async def status(context):
|
||||
)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="speedtest",
|
||||
@listener(is_plugin=False, outgoing=True, command="speedtest",
|
||||
description="执行 speedtest 脚本并发送结果。")
|
||||
async def speedtest(context):
|
||||
""" Tests internet speed using speedtest. """
|
||||
@ -101,7 +101,7 @@ async def speedtest(context):
|
||||
)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="connection",
|
||||
@listener(is_plugin=False, outgoing=True, command="connection",
|
||||
description="显示运行 PagerMaid-Modify 的服务器和 Telegram 服务器之间的连接信息。")
|
||||
async def connection(context):
|
||||
""" Displays connection information between PagerMaid and Telegram. """
|
||||
@ -114,7 +114,7 @@ async def connection(context):
|
||||
)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="ping",
|
||||
@listener(is_plugin=False, outgoing=True, command="ping",
|
||||
description="计算运行 PagerMaid-Modify 的服务器和 Telegram 服务器之间的延迟。")
|
||||
async def ping(context):
|
||||
""" Calculates latency between PagerMaid and Telegram. """
|
||||
@ -125,7 +125,7 @@ async def ping(context):
|
||||
await context.edit(f"Pong!|{duration}")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="topcloud",
|
||||
@listener(is_plugin=False, outgoing=True, command="topcloud",
|
||||
description="生成一张资源占用的词云图片。")
|
||||
async def topcloud(context):
|
||||
""" Generates a word cloud of resource-hungry processes. """
|
||||
|
@ -12,7 +12,7 @@ from pagermaid import bot
|
||||
from pagermaid.listener import listener
|
||||
|
||||
|
||||
@listener(outgoing=True, command="sticker",
|
||||
@listener(is_plugin=False, outgoing=True, command="sticker",
|
||||
description="收集回复的图像/贴纸作为贴纸,通过参数指定 emoji 以设置非默认的 emoji。",
|
||||
parameters="<emoji>")
|
||||
async def sticker(context):
|
||||
|
@ -13,7 +13,7 @@ from telethon.errors.rpcerrorlist import UserAlreadyParticipantError
|
||||
from telethon.tl.functions.messages import ImportChatInviteRequest
|
||||
|
||||
|
||||
@listener(outgoing=True, command="sh",
|
||||
@listener(is_plugin=False, outgoing=True, command="sh",
|
||||
description="在 Telegram 上远程执行 Shell 命令。",
|
||||
parameters="<命令>")
|
||||
async def sh(context):
|
||||
@ -64,7 +64,7 @@ async def sh(context):
|
||||
await log(f"远程执行 Shell 命令: `{command}`")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="restart", diagnostics=False,
|
||||
@listener(is_plugin=False, outgoing=True, command="restart", diagnostics=False,
|
||||
description="使 PagerMaid-Modify 重新启动")
|
||||
async def restart(context):
|
||||
""" To re-execute PagerMaid. """
|
||||
@ -74,7 +74,7 @@ async def restart(context):
|
||||
await context.client.disconnect()
|
||||
|
||||
|
||||
@listener(outgoing=True, command="trace",
|
||||
@listener(is_plugin=False, outgoing=True, command="trace",
|
||||
description="跟踪 URL 的重定向。",
|
||||
parameters="<url>")
|
||||
async def trace(context):
|
||||
@ -117,7 +117,7 @@ async def trace(context):
|
||||
await context.edit("无效的参数。")
|
||||
|
||||
|
||||
@listener(outgoing=True, command="contact",
|
||||
@listener(is_plugin=False, outgoing=True, command="contact",
|
||||
description="向 Kat 发送消息。",
|
||||
parameters="<message>")
|
||||
async def contact(context):
|
||||
@ -133,7 +133,7 @@ async def contact(context):
|
||||
)
|
||||
|
||||
|
||||
@listener(outgoing=True, command="chat",
|
||||
@listener(is_plugin=False, outgoing=True, command="chat",
|
||||
description="加入 Pagermaid-Modify 用户群。")
|
||||
async def contact_chat(context):
|
||||
""" join a chatroom. """
|
||||
|
@ -8,7 +8,7 @@ from pagermaid.listener import listener
|
||||
from pagermaid.utils import execute
|
||||
|
||||
|
||||
@listener(outgoing=True, command="update",
|
||||
@listener(is_plugin=False, outgoing=True, command="update",
|
||||
description="从远程来源检查更新,并将其安装到 PagerMaid-Modify。",
|
||||
parameters="<boolean>")
|
||||
async def update(context):
|
||||
|
Loading…
Reference in New Issue
Block a user