🚀 支持主程序设置命令别名

This commit is contained in:
xtaodada 2021-06-16 15:09:40 +08:00
parent 827a72a2f6
commit 9023c1d4b9
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
51 changed files with 610 additions and 458 deletions

View File

@ -1,12 +1,12 @@
import json import json
import random import random
import requests import requests
from time import sleep
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
from os import remove from os import remove
@listener(is_plugin=True, outgoing=True, command="acgm", @listener(is_plugin=True, outgoing=True, command=alias_command("acgm"),
description="多网站随机获取二刺螈bushi ACG图片") description="多网站随机获取二刺螈bushi ACG图片")
async def joke(context): async def joke(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -24,9 +24,11 @@ async def joke(context):
elif website == 3: elif website == 3:
img = requests.get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman") img = requests.get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman")
elif website == 4: elif website == 4:
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063','Referer':'https://osk.soloop.ooo/give_me_eropics-l/'} headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, '
'like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063',
'Referer': 'https://osk.soloop.ooo/give_me_eropics-l/'}
img = requests.get("https://osk.soloop.ooo/rdm.php?" + str(random.random()), headers=headers) img = requests.get("https://osk.soloop.ooo/rdm.php?" + str(random.random()), headers=headers)
elif website == 5: else:
img = requests.get('https://api.lolicon.app/setu/?r18=0') img = requests.get('https://api.lolicon.app/setu/?r18=0')
if img.status_code == 200: if img.status_code == 200:
if website == 5: if website == 5:

5
aff.py
View File

@ -1,10 +1,11 @@
from time import sleep from time import sleep
from os.path import exists from os.path import exists
from os import mkdir, remove from os import mkdir, remove
from pagermaid import redis, log, redis_status from pagermaid.utils import alias_command
from pagermaid.listener import listener from pagermaid.listener import listener
@listener(is_plugin=True, outgoing=True, command="aff",
@listener(is_plugin=True, outgoing=True, command=alias_command("aff"),
description="在别人要打算买机场的时候光速发出自己的aff信息(请尽量配合短链接)", description="在别人要打算买机场的时候光速发出自己的aff信息(请尽量配合短链接)",
parameters="<save|remove> (可选,用于保存|删除aff信息)") parameters="<save|remove> (可选,用于保存|删除aff信息)")
async def aff(context): async def aff(context):

View File

@ -1,12 +1,10 @@
from telethon.tl.types import ChannelParticipantsAdmins from telethon.tl.types import ChannelParticipantsAdmins
from pagermaid import bot from pagermaid.utils import alias_command
from pagermaid.listener import listener from pagermaid.listener import listener
from telethon.errors.rpcbaseerrors import BadRequestError
from os import remove
import re
import time import time
@listener(is_plugin=True, outgoing=True, command="atadmins",
@listener(is_plugin=True, outgoing=True, command=alias_command("atadmins"),
description="一键 AT 本群管理员(仅在群组中有效)", description="一键 AT 本群管理员(仅在群组中有效)",
parameters="回复消息(可选) <要说的话(可选)>") parameters="回复消息(可选) <要说的话(可选)>")
async def atadmins(context): async def atadmins(context):
@ -36,7 +34,8 @@ async def atadmins(context):
await context.reply(f'{say}:\n{send_list}') await context.reply(f'{say}:\n{send_list}')
await context.delete() await context.delete()
@listener(is_plugin=True, outgoing=True, command="atall",
@listener(is_plugin=True, outgoing=True, command=alias_command("atall"),
description="一键 AT 本群成员(仅在群组中有效)", description="一键 AT 本群成员(仅在群组中有效)",
parameters="回复消息(可选) <要说的话(可选)>") parameters="回复消息(可选) <要说的话(可选)>")
async def atall(context): async def atall(context):

View File

@ -7,6 +7,7 @@ from telethon.tl.functions.account import UpdateProfileRequest
from emoji import emojize from emoji import emojize
from pagermaid import bot, log from pagermaid import bot, log
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
dizzy = emojize(":dizzy:", use_aliases=True) dizzy = emojize(":dizzy:", use_aliases=True)
cake = emojize(":cake:", use_aliases=True) cake = emojize(":cake:", use_aliases=True)
@ -14,7 +15,7 @@ all_time_emoji_name = ["clock12", "clock1230", "clock1", "clock130", "clock2", "
time_emoji_symb = [emojize(":%s:" %s, use_aliases=True) for s in all_time_emoji_name] time_emoji_symb = [emojize(":%s:" %s, use_aliases=True) for s in all_time_emoji_name]
@listener(is_plugin=True, outgoing=True, command="autochangename", @listener(is_plugin=True, outgoing=True, command=alias_command("autochangename"),
description="每 30 秒更新一次 last_name") description="每 30 秒更新一次 last_name")
async def change_name_auto(context): async def change_name_auto(context):
await context.delete() await context.delete()

View File

@ -18,6 +18,8 @@ from telethon.tl.functions.messages import GetStickerSetRequest
from telethon.tl.types import InputStickerSetID from telethon.tl.types import InputStickerSetID
from pagermaid import log from pagermaid import log
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
async def ars_check(message: Message) -> None: async def ars_check(message: Message) -> None:
try: try:
@ -43,6 +45,7 @@ async def ars_check(message: Message) -> None:
await sleep(15) await sleep(15)
await _noti.delete() await _noti.delete()
async def ars_getall(message: Message) -> None: async def ars_getall(message: Message) -> None:
sticker_sets = await message.client(GetAllStickersRequest(0)) sticker_sets = await message.client(GetAllStickersRequest(0))
sticker_pack_list = [] sticker_pack_list = []
@ -62,6 +65,7 @@ async def ars_getall(message: Message) -> None:
await message.client.send_message(message.chat_id, sendtext) await message.client.send_message(message.chat_id, sendtext)
await message.delete() await message.delete()
async def ars_help(message: Message) -> None: async def ars_help(message: Message) -> None:
await message.reply( await message.reply(
'欢迎使用自动回复贴纸\n' '欢迎使用自动回复贴纸\n'
@ -74,6 +78,7 @@ async def ars_help(message: Message) -> None:
'如有使用问题,请前往 [这里](https://t.me/PagerMaid_Modify) 请求帮助') '如有使用问题,请前往 [这里](https://t.me/PagerMaid_Modify) 请求帮助')
await message.delete() await message.delete()
async def ars_whitelist(message: Message) -> None: async def ars_whitelist(message: Message) -> None:
chat_id = str(message.chat_id) chat_id = str(message.chat_id)
try: try:
@ -108,6 +113,7 @@ async def ars_whitelist(message: Message) -> None:
await sleep(5) await sleep(5)
await _noti.delete() await _noti.delete()
def set_state(name: str, state: list) -> None: def set_state(name: str, state: list) -> None:
file_name = "./plugins/autoreplysticker/config.yml" file_name = "./plugins/autoreplysticker/config.yml"
if exists(file_name): if exists(file_name):
@ -121,6 +127,7 @@ def set_state(name: str, state: list) -> None:
with open(file_name, 'w', encoding='utf-8') as f: with open(file_name, 'w', encoding='utf-8') as f:
yaml.dump(dc, f) yaml.dump(dc, f)
def get_name(sender: Message.sender) -> str: def get_name(sender: Message.sender) -> str:
""" """
get_name(Message.sender) get_name(Message.sender)
@ -138,6 +145,7 @@ def get_name(sender: Message.sender) -> str:
name = f'@{username}' name = f'@{username}'
return name return name
def process_link(chatid: int, msgid: int) -> str: def process_link(chatid: int, msgid: int) -> str:
""" """
process_link(chat_id, message_id) process_link(chat_id, message_id)
@ -152,7 +160,8 @@ def process_link(chatid: int, msgid: int) -> str:
link = f'https://t.me/c/{chatid}/{msgid}' link = f'https://t.me/c/{chatid}/{msgid}'
return link return link
@listener(is_plugin=True, outgoing=True, command="ars")
@listener(is_plugin=True, outgoing=True, command=alias_command("ars"))
async def ars(context): async def ars(context):
if not exists('./plugins/autoreplysticker'): if not exists('./plugins/autoreplysticker'):
mkdir('./plugins/autoreplysticker') mkdir('./plugins/autoreplysticker')
@ -193,13 +202,14 @@ async def ars(context):
elif context.parameter[0] == 'w': elif context.parameter[0] == 'w':
await ars_whitelist(context) await ars_whitelist(context)
@listener(incoming=True, ignore_edited=True) @listener(incoming=True, ignore_edited=True)
async def process_message(context): async def process_message(context):
reply_user_id = 0 reply_user_id = 0
link = process_link(context.chat_id, context.id) link = process_link(context.chat_id, context.id)
me = await context.client.get_me() me = await context.client.get_me()
try:
reply = await context.get_reply_message() reply = await context.get_reply_message()
try:
reply_user_id = reply.sender.id reply_user_id = reply.sender.id
if context.sticker: if context.sticker:
return return
@ -228,7 +238,7 @@ async def process_message(context):
except: except:
pass pass
if (reply and reply_user_id == me.id): if reply and reply_user_id == me.id:
stickers = await context.client( stickers = await context.client(
GetStickerSetRequest( GetStickerSetRequest(
stickerset=InputStickerSetID( stickerset=InputStickerSetID(
@ -241,6 +251,7 @@ async def process_message(context):
reply_to=context.id) reply_to=context.id)
await sleep(_time) await sleep(_time)
await sticker.delete() await sticker.delete()
await log(f'#被回复\n在 [{context.chat.title}]({process_link(context.chat_id, context.id)})\n获得了 {get_name(context.sender)} 的回复') await log(
f'#被回复\n在 [{context.chat.title}]({process_link(context.chat_id, context.id)})\n获得了 {get_name(context.sender)} 的回复')
except: except:
pass pass

View File

@ -3,11 +3,12 @@
from telethon.events import StopPropagation from telethon.events import StopPropagation
from pagermaid import persistent_vars, log from pagermaid import persistent_vars, log
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
persistent_vars.update({'autorespond': {'enabled': False, 'message': None, 'amount': 0}}) persistent_vars.update({'autorespond': {'enabled': False, 'message': None, 'amount': 0}})
@listener(is_plugin=True, outgoing=True, command="autorespond", @listener(is_plugin=True, outgoing=True, command=alias_command("autorespond"),
description="启用自动回复。", description="启用自动回复。",
parameters="<message>") parameters="<message>")
async def autorespond(context): async def autorespond(context):

View File

@ -5,14 +5,15 @@
try: try:
import dateparser import dateparser
imported = True imported = True
except ImportError: except ImportError:
imported = False imported = False
import asyncio, time, traceback import asyncio, time, traceback
from pagermaid import log
from pagermaid.listener import listener from pagermaid.listener import listener
from datetime import datetime from pagermaid.utils import alias_command
# https://stackoverflow.com/questions/1111056/get-time-zone-information-of-the-system-in-python # https://stackoverflow.com/questions/1111056/get-time-zone-information-of-the-system-in-python
def local_time_offset(t=None): def local_time_offset(t=None):
@ -26,6 +27,7 @@ def local_time_offset(t=None):
else: else:
return -time.timezone return -time.timezone
offset = local_time_offset() // 3600 offset = local_time_offset() // 3600
sign = "+" if offset >= 0 else "-" sign = "+" if offset >= 0 else "-"
offset = abs(offset) offset = abs(offset)
@ -56,6 +58,7 @@ i.e.
取消所有群和全局 -autorm cancelall 取消所有群和全局 -autorm cancelall
""" """
@listener(outgoing=True, ignore_edited=True) @listener(outgoing=True, ignore_edited=True)
async def remove_message(context): async def remove_message(context):
""" Event handler to infinitely remove messages. """ """ Event handler to infinitely remove messages. """
@ -82,12 +85,15 @@ async def remove_message(context):
except Exception as e: except Exception as e:
await sendmsg(context, await context.get_chat(), str(e)) await sendmsg(context, await context.get_chat(), str(e))
@listener(is_plugin=True, outgoing=True, command="autorm", diagnostics=True, ignore_edited=False,
@listener(is_plugin=True, outgoing=True, command=alias_command("autorm"),
diagnostics=True, ignore_edited=False,
description=helpmsg, description=helpmsg,
parameters="<time>") parameters="<time>")
async def autorm_wrap(context): async def autorm_wrap(context):
return await autorm(context) return await autorm(context)
async def autorm(context): async def autorm(context):
try: try:
global all_chat, all_chat_delta, chats, times global all_chat, all_chat_delta, chats, times
@ -182,6 +188,7 @@ async def autorm(context):
await edit(context, f"Error: {str(e)}") await edit(context, f"Error: {str(e)}")
return return
async def edit(context, text): async def edit(context, text):
chat = await context.get_chat() chat = await context.get_chat()
try: try:
@ -193,8 +200,8 @@ async def edit(context, text):
else: else:
return context return context
async def sendmsg(context, chat, origin_text): async def sendmsg(context, chat, origin_text):
text = origin_text.strip() text = origin_text.strip()
msg = await context.client.send_message(chat, text) msg = await context.client.send_message(chat, text)
return msg return msg

17
bc.py
View File

@ -8,15 +8,10 @@
# #
from asyncio import sleep from asyncio import sleep
from json.decoder import JSONDecodeError
from time import strftime
import json
import urllib.request import urllib.request
import time
from telethon.tl.custom.message import Message from telethon.tl.custom.message import Message
from pagermaid import log
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import execute from pagermaid.utils import execute, alias_command
imported = True imported = True
try: try:
@ -48,9 +43,7 @@ def init() -> None:
raise e raise e
@listener(is_plugin=True, @listener(is_plugin=True, outgoing=True, command=alias_command("bc"),
outgoing=True,
command="bc",
description="coins", description="coins",
parameters="<num> <coin1> <coin2>") parameters="<num> <coin1> <coin2>")
async def coin(context: Message) -> None: async def coin(context: Message) -> None:
@ -66,7 +59,8 @@ async def coin(context: Message) -> None:
await context.edit('支持库 `python-binance` `xmltodict` 安装成功...\n正在尝试自动重启...') await context.edit('支持库 `python-binance` `xmltodict` 安装成功...\n正在尝试自动重启...')
await context.client.disconnect() await context.client.disconnect()
else: else:
await context.edit("自动安装失败..请尝试手动安装 `python3 -m pip install python-binance`\n\n`python3 -m pip install xmltodict`\n随后,请重启 PagerMaid") await context.edit("自动安装失败..请尝试手动安装 `python3 -m pip install python-binance`\n\n`python3 -m pip install "
"xmltodict`\n随后,请重启 PagerMaid")
return return
init() init()
action = context.arguments.split() action = context.arguments.split()
@ -83,8 +77,9 @@ async def coin(context: Message) -> None:
text = '' text = ''
rear_text = '' rear_text = ''
price = 0.0 price = 0.0
_to_USD_rate = 0.0
if ((CURRENCIES.count(_from) != 0) and (CURRENCIES.count(_to) != 0)): if (CURRENCIES.count(_from) != 0) and (CURRENCIES.count(_to) != 0):
# both are real currency # both are real currency
text = f'{action[0]} {action[1].upper().strip()} = {float(action[0])*DATA[_to]/DATA[_from]:.2f} {action[2].upper().strip()}' text = f'{action[0]} {action[1].upper().strip()} = {float(action[0])*DATA[_to]/DATA[_from]:.2f} {action[2].upper().strip()}'

View File

@ -1,10 +1,11 @@
import json import json
import random import random
from time import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
from os import remove from os import remove
def get_url(num): def get_url(num):
json_url = f"https://www.bing.com/HPImageArchive.aspx?format=js&mkt=zh-CN&n=1&idx={str(num)}" json_url = f"https://www.bing.com/HPImageArchive.aspx?format=js&mkt=zh-CN&n=1&idx={str(num)}"
req = get(json_url) req = get(json_url)
@ -17,7 +18,7 @@ def get_url(num):
return url, copyright return url, copyright
@listener(is_plugin=True, outgoing=True, command="bingwall", @listener(is_plugin=True, outgoing=True, command=alias_command("bingwall"),
description="获取Bing每日壁纸") description="获取Bing每日壁纸")
async def bingwall(context): async def bingwall(context):
await context.edit("获取壁纸中 . . .") await context.edit("获取壁纸中 . . .")
@ -31,6 +32,8 @@ async def bingwall(context):
try: try:
if website == 0 and image_url != " ": if website == 0 and image_url != " ":
img = get(image_url) img = get(image_url)
else:
continue
if img.status_code == 200: if img.status_code == 200:
with open(filename, 'wb') as f: with open(filename, 'wb') as f:
f.write(img.content) f.write(img.content)

View File

@ -1,7 +1,8 @@
from pagermaid import log, bot
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import attach_log, execute from pagermaid.utils import attach_log, execute, alias_command
@listener(is_plugin=False, outgoing=True, command="cal",
@listener(is_plugin=False, outgoing=True, command=alias_command("cal"),
description="计算", description="计算",
parameters="<加减乘除>") parameters="<加减乘除>")
async def cal(context): async def cal(context):

View File

@ -1,13 +1,13 @@
from random import randint, random from random import randint, random
from time import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
from os import remove from os import remove
@listener(is_plugin=True, outgoing=True, command="cosm", @listener(is_plugin=True, outgoing=True, command=alias_command("cosm"),
description="多网站随机获取cosplay图片会自动重试哦") description="多网站随机获取cosplay图片会自动重试哦")
async def joke(context): async def cosm(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
status = False status = False
for _ in range(20): # 最多重试20次 for _ in range(20): # 最多重试20次
@ -26,7 +26,7 @@ async def joke(context):
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%8A%A8%E6%BC%AB") img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%8A%A8%E6%BC%AB")
elif website == 5: elif website == 5:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E4%BA%8C%E6%AC%A1%E5%85%83") img = get("https://uploadbeta.com/api/pictures/random/?key=%E4%BA%8C%E6%AC%A1%E5%85%83")
elif website == 6: else:
img = get("https://xn--wcs142h.herokuapp.com/") img = get("https://xn--wcs142h.herokuapp.com/")
if img.status_code == 200: if img.status_code == 200:
if website == 3: if website == 3:

7
da.py
View File

@ -1,11 +1,13 @@
from asyncio import sleep from asyncio import sleep
from pagermaid import log from pagermaid import log
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="da",
@listener(is_plugin=True, outgoing=True, command=alias_command("da"),
description="以此命令删除所有消息。(非群组管理员只删除自己的消息)", description="以此命令删除所有消息。(非群组管理员只删除自己的消息)",
parameters="<text>") parameters="<text>")
async def prune(context): async def da(context):
if len(context.parameter) > 2 or len(context.parameter) == 0: if len(context.parameter) > 2 or len(context.parameter) == 0:
await context.edit("\n呜呜呜,请执行 `-da true` 来删除所有消息。") await context.edit("\n呜呜呜,请执行 `-da true` 来删除所有消息。")
return return
@ -31,6 +33,7 @@ async def prune(context):
await sleep(.5) await sleep(.5)
await notification.delete() await notification.delete()
async def send_prune_notify(context, count): async def send_prune_notify(context, count):
return await context.client.send_message( return await context.client.send_message(
context.chat_id, context.chat_id,

View File

@ -10,8 +10,10 @@
from asyncio import sleep from asyncio import sleep
from telethon.tl.custom.message import Message from telethon.tl.custom.message import Message
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="dmfg")
@listener(is_plugin=True, outgoing=True, command=alias_command("dmfg"))
async def dmfg(context: Message) -> None: async def dmfg(context: Message) -> None:
if len(context.parameter) == 0: if len(context.parameter) == 0:
await context.edit('您没有输入参数.\n`-dmfg group` 删除所有群内发言\n`-dmfg private` 删除所有与人的对话消息') await context.edit('您没有输入参数.\n`-dmfg group` 删除所有群内发言\n`-dmfg private` 删除所有与人的对话消息')

View File

@ -4,8 +4,10 @@
from pagermaid import redis, log, redis_status from pagermaid import redis, log, redis_status
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="denyu",
@listener(is_plugin=True, outgoing=True, command=alias_command("denyu"),
description="在某群中强制禁言某用户,需要删除他人消息权限,需要 redis。强制禁言全群请使用 `-deny`。", description="在某群中强制禁言某用户,需要删除他人消息权限,需要 redis。强制禁言全群请使用 `-deny`。",
parameters="<userid> <true|false|status> 或直接回复用户并指定 <true|false|status>") parameters="<userid> <true|false|status> 或直接回复用户并指定 <true|false|status>")
async def denyu(context): async def denyu(context):
@ -53,6 +55,7 @@ async def denyu(context):
else: else:
await context.edit("出错了呜呜呜 ~ 无效的参数。只能为 `<true|false|status>`。") await context.edit("出错了呜呜呜 ~ 无效的参数。只能为 `<true|false|status>`。")
@listener(incoming=True, ignore_edited=True) @listener(incoming=True, ignore_edited=True)
async def message_removal_user(context): async def message_removal_user(context):
""" Event handler to infinitely delete denied messages. """ """ Event handler to infinitely delete denied messages. """

View File

@ -1,8 +1,10 @@
from time import sleep from time import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="diss",
@listener(is_plugin=True, outgoing=True, command=alias_command("diss"),
description="儒雅随和版祖安语录。") description="儒雅随和版祖安语录。")
async def diss(context): async def diss(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -21,7 +23,8 @@ async def diss(context):
sleep(2) sleep(2)
await context.delete() await context.delete()
@listener(is_plugin=True, outgoing=True, command="biss",
@listener(is_plugin=True, outgoing=True, command=alias_command("biss"),
description="加带力度版祖安语录。") description="加带力度版祖安语录。")
async def biss(context): async def biss(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")

3
diy.py
View File

@ -3,6 +3,7 @@ from random import randint, choice
from time import sleep from time import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
def get_api(num): def get_api(num):
@ -38,7 +39,7 @@ def process_web_data(num, req):
return res return res
@listener(is_plugin=True, outgoing=True, command="diy", @listener(is_plugin=True, outgoing=True, command=alias_command("diy"),
description="多个随机api。") description="多个随机api。")
async def diy(context): async def diy(context):
short_name = ['sao', 'qh', 'zn', 'tg', 'ba', 'gs'] short_name = ['sao', 'qh', 'zn', 'tg', 'ba', 'gs']

8
dme.py
View File

@ -5,12 +5,14 @@ from os.path import exists
from PIL import Image from PIL import Image
from pagermaid import redis, log, redis_status from pagermaid import redis, log, redis_status
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="dme", @listener(is_plugin=True, outgoing=True, command=alias_command("dme"),
description="编辑并删除当前对话您发送的特定数量的消息。限制:基于消息 ID 的 1000 条消息,大于 1000 条可能会触发删除消息过快限制。入群消息非管理员无法删除。(倒序)当数字足够大时即可实现删除所有消息。", description="编辑并删除当前对话您发送的特定数量的消息。限制:基于消息 ID 的 1000 条消息,大于 1000 "
"条可能会触发删除消息过快限制。入群消息非管理员无法删除。(倒序)当数字足够大时即可实现删除所有消息。",
parameters="<数量> [文本]") parameters="<数量> [文本]")
async def selfprune(context): async def dme(context):
""" Deletes specific amount of messages you sent. """ """ Deletes specific amount of messages you sent. """
reply = await context.get_reply_message() reply = await context.get_reply_message()
if reply and reply.photo: if reply and reply.photo:

4
eat.py
View File

@ -9,6 +9,8 @@ from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import MessageEntityMentionName from telethon.tl.types import MessageEntityMentionName
from struct import error as StructError from struct import error as StructError
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
positions = { positions = {
"1": [297, 288], "1": [297, 288],
@ -37,7 +39,7 @@ def eat_it(base, mask, photo, number):
return base return base
@listener(is_plugin=True, outgoing=True, command="eat", @listener(is_plugin=True, outgoing=True, command=alias_command("eat"),
description="生成一张 吃头像 图片,(可选:当第二个参数存在时,旋转用户头像 180°", description="生成一张 吃头像 图片,(可选:当第二个参数存在时,旋转用户头像 180°",
parameters="<username/uid> [随意内容]") parameters="<username/uid> [随意内容]")
async def eat(context): async def eat(context):

View File

@ -2,7 +2,7 @@
# By tg @fruitymelon # By tg @fruitymelon
from pagermaid import log from pagermaid.utils import alias_command
from pagermaid.listener import listener from pagermaid.listener import listener
helpmsg = """在不进群的情况下,强制向频道的附属群内发送消息。需要事先关注频道。 helpmsg = """在不进群的情况下,强制向频道的附属群内发送消息。需要事先关注频道。
@ -15,12 +15,15 @@ helpmsg = """在不进群的情况下,强制向频道的附属群内发送消
在普通群内使用 -forcesend 效果与直接发送消息基本没有区别因此不做特殊判断 在普通群内使用 -forcesend 效果与直接发送消息基本没有区别因此不做特殊判断
""" """
async def sendmsg(context, chat, origin_text): async def sendmsg(context, chat, origin_text):
text = origin_text.strip() text = origin_text.strip()
msg = await context.client.send_message(chat, text) msg = await context.client.send_message(chat, text)
return msg return msg
@listener(is_plugin=True, outgoing=True, command="forcesend", diagnostics=True, ignore_edited=True,
@listener(is_plugin=True, outgoing=True, command=alias_command("forcesend"),
diagnostics=True, ignore_edited=True,
description=helpmsg, description=helpmsg,
parameters="<text>") parameters="<text>")
async def forcesend(context): async def forcesend(context):

26
fuck.py
View File

@ -10,19 +10,21 @@
from datetime import timedelta from datetime import timedelta
from telethon.tl.types import ChannelParticipantsAdmins from telethon.tl.types import ChannelParticipantsAdmins
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, incoming=True, outgoing=True, command="fuck",
@listener(is_plugin=True, incoming=True, outgoing=True, command=alias_command("fuck"),
description="回复你要踢出的人或-fuck <TelegramID>") description="回复你要踢出的人或-fuck <TelegramID>")
async def fuck(context): async def fuck(context):
""" kick and ban this member """ """ kick and ban this member """
reply = await context.get_reply_message() reply = await context.get_reply_message()
if context.is_group: if context.is_group:
if reply: if reply:
if reply.sender.last_name == None: if reply.sender.last_name is None:
reply_last_name = '' reply_last_name = ''
else: else:
reply_last_name = reply.sender.last_name reply_last_name = reply.sender.last_name
if context.sender.last_name == None: if context.sender.last_name is None:
context_last_name = '' context_last_name = ''
else: else:
context_last_name = context.sender.last_name context_last_name = context.sender.last_name
@ -40,10 +42,15 @@ async def fuck(context):
pass pass
else: else:
try: try:
await context.client.edit_permissions(context.chat_id, context.sender.id, timedelta(seconds=60), send_messages=False, send_media=False, send_stickers=False, send_gifs=False, send_games=False, send_inline=False, send_polls=False, invite_users=False, change_info=False, pin_messages=False) await context.client.edit_permissions(context.chat_id, context.sender.id, timedelta(seconds=60),
send_messages=False, send_media=False, send_stickers=False,
send_gifs=False, send_games=False, send_inline=False,
send_polls=False, invite_users=False, change_info=False,
pin_messages=False)
await context.client.send_message( await context.client.send_message(
context.chat_id, context.chat_id,
f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒', f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) '
f'由于乱玩管理员命令 已被禁言60秒',
reply_to=context.id reply_to=context.id
) )
await context.delete() await context.delete()
@ -68,10 +75,15 @@ async def fuck(context):
pass pass
else: else:
try: try:
await context.client.edit_permissions(context.chat_id, context.sender.id, timedelta(seconds=60), send_messages=False, send_media=False, send_stickers=False, send_gifs=False, send_games=False, send_inline=False, send_polls=False, invite_users=False, change_info=False, pin_messages=False) await context.client.edit_permissions(context.chat_id, context.sender.id, timedelta(seconds=60),
send_messages=False, send_media=False,
send_stickers=False, send_gifs=False, send_games=False,
send_inline=False, send_polls=False, invite_users=False,
change_info=False, pin_messages=False)
await context.client.send_message( await context.client.send_message(
context.chat_id, context.chat_id,
f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒', f'[{context.sender.first_name}{context.sender.last_name}](tg://user?id={context.sender.id}) '
f'由于乱玩管理员命令 已被禁言60秒',
reply_to=context.id reply_to=context.id
) )
await context.delete() await context.delete()

5
ghs.py
View File

@ -1,11 +1,11 @@
import random import random
from time import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from os import remove from os import remove
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="ghs", @listener(is_plugin=True, outgoing=True, command=alias_command("ghs"),
description="随机获取涩情写真") description="随机获取涩情写真")
async def ghs(context): async def ghs(context):
await context.edit("搞颜色中 . . .") await context.edit("搞颜色中 . . .")
@ -14,7 +14,6 @@ async def ghs(context):
website = random.randint(0, 0) website = random.randint(0, 0)
filename = "ghs" + str(random.random())[2:] + ".png" filename = "ghs" + str(random.random())[2:] + ".png"
try: try:
if website == 0:
img = get("https://se.jiba.xyz/api.php") img = get("https://se.jiba.xyz/api.php")
if img.status_code == 200: if img.status_code == 200:
with open(filename, 'wb') as f: with open(filename, 'wb') as f:

View File

@ -1,12 +1,16 @@
""" Pagermaid hyperlink plugin. by @OahiewUoil """ """ Pagermaid hyperlink plugin. by @OahiewUoil """
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="hl",
@listener(is_plugin=True, outgoing=True, command=alias_command("hl"),
description="生成隐藏链接。非链接的纯文字将直接隐藏。", description="生成隐藏链接。非链接的纯文字将直接隐藏。",
parameters="<link>") parameters="<link>")
async def hyperlink(context): async def hyperlink(context):
await context.edit(f"正在生成 . . .") await context.edit(f"正在生成 . . .")
if context.arguments: if context.arguments:
link = context.arguments link = context.arguments
else:
link = ''
await context.edit(f"[]({link})", link_preview=False) await context.edit(f"[]({link})", link_preview=False)

View File

@ -1,12 +1,12 @@
import re, time, asyncio, requests, os, json, random import re, time, asyncio, requests, os, json, random
from io import BytesIO from io import BytesIO
from os import path, mkdir, remove, makedirs, chdir from os import path, remove, makedirs, chdir
from shutil import copyfile, move, rmtree from shutil import copyfile, move, rmtree
from uuid import uuid4 from uuid import uuid4
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
from importlib import import_module
from pagermaid import bot, redis, log, redis_status, working_dir from pagermaid import bot, redis, log, redis_status, working_dir
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
msg_freq = 1 msg_freq = 1
group_last_time = {} group_last_time = {}
@ -417,7 +417,7 @@ async def send_reply(chat_id, trigger, mode, reply_msg, context):
pass pass
@listener(is_plugin=True, outgoing=True, command="keyword", @listener(is_plugin=True, outgoing=True, command=alias_command("keyword"),
description="关键词自动回复 [教程](https://telegra.ph/Keyword-插件使用教程-02-07)", description="关键词自动回复 [教程](https://telegra.ph/Keyword-插件使用教程-02-07)",
parameters="``new <plain|regex> '<规则>' '<回复信息>'` 或者 `del <plain|regex> '<规则>'` 或者 `list` 或者 " parameters="``new <plain|regex> '<规则>' '<回复信息>'` 或者 `del <plain|regex> '<规则>'` 或者 `list` 或者 "
"`clear <plain|regex>") "`clear <plain|regex>")
@ -529,7 +529,7 @@ async def reply(context):
return return
@listener(outgoing=True, command="replyset", @listener(outgoing=True, command=alias_command("replyset"),
description="自动回复设置", description="自动回复设置",
parameters="help") parameters="help")
async def reply_set(context): async def reply_set(context):
@ -830,7 +830,7 @@ async def reply_set(context):
return return
@listener(outgoing=True, command="funcset", @listener(outgoing=True, command=alias_command("funcset"),
description="设置自定义函数", description="设置自定义函数",
parameters="help") parameters="help")
async def funcset(context): async def funcset(context):
@ -941,7 +941,7 @@ async def funcset(context):
pass pass
@listener(outgoing=True, command="keydata", @listener(outgoing=True, command=alias_command("keydata"),
description="设置规则数据", description="设置规则数据",
parameters="dump / load") parameters="dump / load")
async def setdata(context): async def setdata(context):

View File

@ -3,8 +3,10 @@ from asyncio import sleep
from telethon.tl.types import ChannelParticipantsAdmins from telethon.tl.types import ChannelParticipantsAdmins
from telethon.errors.rpcerrorlist import FloodWaitError from telethon.errors.rpcerrorlist import FloodWaitError
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="killallmembers",
@listener(is_plugin=True, outgoing=True, command=alias_command("killallmembers"),
description="⚠⚠慎用! 一件扬了群内所有成员⚠⚠") description="⚠⚠慎用! 一件扬了群内所有成员⚠⚠")
async def killallmembers(context): async def killallmembers(context):
""" PagerMaid Plugin killallmembers """ """ PagerMaid Plugin killallmembers """

100
list.json
View File

@ -2,7 +2,7 @@
"list": [ "list": [
{ {
"name": "autorespond", "name": "autorespond",
"version": "0.2", "version": "0.21",
"section": "chat", "section": "chat",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "1.9 kb", "size": "1.9 kb",
@ -12,7 +12,7 @@
}, },
{ {
"name": "dme", "name": "dme",
"version": "1.1", "version": "1.11",
"section": "chat", "section": "chat",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "4.3 kb", "size": "4.3 kb",
@ -22,7 +22,7 @@
}, },
{ {
"name": "autochangename", "name": "autochangename",
"version": "1.01", "version": "1.011",
"section": "profile", "section": "profile",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "2.1 kb", "size": "2.1 kb",
@ -32,7 +32,7 @@
}, },
{ {
"name": "autorm", "name": "autorm",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "fruitymelon", "maintainer": "fruitymelon",
"size": "6.7 kb", "size": "6.7 kb",
@ -42,7 +42,7 @@
}, },
{ {
"name": "sendat", "name": "sendat",
"version": "1.3", "version": "1.31",
"section": "chat", "section": "chat",
"maintainer": "fruitymelon", "maintainer": "fruitymelon",
"size": "15.0 kb", "size": "15.0 kb",
@ -52,7 +52,7 @@
}, },
{ {
"name": "weather", "name": "weather",
"version": "1.1", "version": "1.11",
"section": "daily", "section": "daily",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "2.9 kb", "size": "2.9 kb",
@ -62,7 +62,7 @@
}, },
{ {
"name": "xtao-some", "name": "xtao-some",
"version": "1.16", "version": "1.161",
"section": "daily", "section": "daily",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "18.8 kb", "size": "18.8 kb",
@ -72,7 +72,7 @@
}, },
{ {
"name": "yb-dl", "name": "yb-dl",
"version": "1.0", "version": "1.01",
"section": "daily", "section": "daily",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "18.8 kb", "size": "18.8 kb",
@ -82,7 +82,7 @@
}, },
{ {
"name": "throwit", "name": "throwit",
"version": "1.61", "version": "1.611",
"section": "profile", "section": "profile",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "6.9 kb", "size": "6.9 kb",
@ -92,7 +92,7 @@
}, },
{ {
"name": "rate", "name": "rate",
"version": "1.4", "version": "1.41",
"section": "daily", "section": "daily",
"maintainer": "fruitymelon", "maintainer": "fruitymelon",
"size": "3.4 kb", "size": "3.4 kb",
@ -102,7 +102,7 @@
}, },
{ {
"name": "netease", "name": "netease",
"version": "1.3", "version": "1.31",
"section": "daily", "section": "daily",
"maintainer": "xtaodada、KorenKrita", "maintainer": "xtaodada、KorenKrita",
"size": "0.7 kb", "size": "0.7 kb",
@ -122,7 +122,7 @@
}, },
{ {
"name": "denyu", "name": "denyu",
"version": "1.1", "version": "1.11",
"section": "chat", "section": "chat",
"maintainer": "fruitymelon", "maintainer": "fruitymelon",
"size": "2.7 kb", "size": "2.7 kb",
@ -132,7 +132,7 @@
}, },
{ {
"name": "hyperlink", "name": "hyperlink",
"version": "1.0", "version": "1.01",
"section": "daily", "section": "daily",
"maintainer": "OahiewUoil", "maintainer": "OahiewUoil",
"size": "0.5 kb", "size": "0.5 kb",
@ -142,7 +142,7 @@
}, },
{ {
"name": "nthmsg", "name": "nthmsg",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "seiuneko", "maintainer": "seiuneko",
"size": "0.9 kb", "size": "0.9 kb",
@ -152,7 +152,7 @@
}, },
{ {
"name": "portball", "name": "portball",
"version": "1.42", "version": "1.43",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "2.8 kb", "size": "2.8 kb",
@ -162,7 +162,7 @@
}, },
{ {
"name": "resou", "name": "resou",
"version": "1.2", "version": "1.21",
"section": "daily", "section": "daily",
"maintainer": "KorenKrita、xtaodada", "maintainer": "KorenKrita、xtaodada",
"size": "6.1 kb", "size": "6.1 kb",
@ -172,7 +172,7 @@
}, },
{ {
"name": "mjx", "name": "mjx",
"version": "1.0", "version": "1.01",
"section": "profile", "section": "profile",
"maintainer": "KorenKrita", "maintainer": "KorenKrita",
"size": "1 kb", "size": "1 kb",
@ -182,7 +182,7 @@
}, },
{ {
"name": "tel", "name": "tel",
"version": "1.1", "version": "1.11",
"section": "daily", "section": "daily",
"maintainer": "KorenKrita、xtaodada", "maintainer": "KorenKrita、xtaodada",
"size": "1 kb", "size": "1 kb",
@ -192,7 +192,7 @@
}, },
{ {
"name": "whois", "name": "whois",
"version": "1.12", "version": "1.13",
"section": "daily", "section": "daily",
"maintainer": "KorenKrita", "maintainer": "KorenKrita",
"size": "1.1 kb", "size": "1.1 kb",
@ -202,7 +202,7 @@
}, },
{ {
"name": "eat", "name": "eat",
"version": "1.01", "version": "1.02",
"section": "profile", "section": "profile",
"maintainer": "SF_PICK", "maintainer": "SF_PICK",
"size": "6.4 kb", "size": "6.4 kb",
@ -212,7 +212,7 @@
}, },
{ {
"name": "cosplay-multi", "name": "cosplay-multi",
"version": "1.3", "version": "1.31",
"section": "daily", "section": "daily",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "2.4 kb", "size": "2.4 kb",
@ -222,7 +222,7 @@
}, },
{ {
"name": "meizi", "name": "meizi",
"version": "1.8", "version": "1.81",
"section": "daily", "section": "daily",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "4.0 kb", "size": "4.0 kb",
@ -232,7 +232,7 @@
}, },
{ {
"name": "acg-multi", "name": "acg-multi",
"version": "1.4", "version": "1.41",
"section": "daily", "section": "daily",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "2.4 kb", "size": "2.4 kb",
@ -242,7 +242,7 @@
}, },
{ {
"name": "da", "name": "da",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "yxkumad", "maintainer": "yxkumad",
"size": "1.6 kb", "size": "1.6 kb",
@ -252,7 +252,7 @@
}, },
{ {
"name": "diss", "name": "diss",
"version": "1.1", "version": "1.11",
"section": "chat", "section": "chat",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "1.5 kb", "size": "1.5 kb",
@ -262,7 +262,7 @@
}, },
{ {
"name": "shangliu", "name": "shangliu",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "2.5 kb", "size": "2.5 kb",
@ -272,7 +272,7 @@
}, },
{ {
"name": "neteaseshuffle", "name": "neteaseshuffle",
"version": "1.1", "version": "1.11",
"section": "daily", "section": "daily",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "3.0 kb", "size": "3.0 kb",
@ -282,7 +282,7 @@
}, },
{ {
"name": "neteasemusic", "name": "neteasemusic",
"version": "4.3", "version": "4.31",
"section": "daily", "section": "daily",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "28.8 kb", "size": "28.8 kb",
@ -292,7 +292,7 @@
}, },
{ {
"name": "killallmembers", "name": "killallmembers",
"version": "1.10", "version": "1.11",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "idk", "size": "idk",
@ -302,7 +302,7 @@
}, },
{ {
"name": "videodl", "name": "videodl",
"version": "0.11", "version": "0.12",
"section": "daily", "section": "daily",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "5.3 kb", "size": "5.3 kb",
@ -312,7 +312,7 @@
}, },
{ {
"name": "aff", "name": "aff",
"version": "1.2", "version": "1.21",
"section": "chat", "section": "chat",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "2.0 kb", "size": "2.0 kb",
@ -322,7 +322,7 @@
}, },
{ {
"name": "stickertopic", "name": "stickertopic",
"version": "1.1", "version": "1.11",
"section": "chat", "section": "chat",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "3.5 kb", "size": "3.5 kb",
@ -332,7 +332,7 @@
}, },
{ {
"name": "vip", "name": "vip",
"version": "0.22", "version": "0.23",
"section": "chat", "section": "chat",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "4.0 kb", "size": "4.0 kb",
@ -342,7 +342,7 @@
}, },
{ {
"name": "calculator", "name": "calculator",
"version": "1.01", "version": "1.02",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "1.0 kb", "size": "1.0 kb",
@ -352,7 +352,7 @@
}, },
{ {
"name": "paolu", "name": "paolu",
"version": "1.01", "version": "1.02",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "1.0 kb", "size": "1.0 kb",
@ -362,7 +362,7 @@
}, },
{ {
"name": "autoreplysticker", "name": "autoreplysticker",
"version": "1.21", "version": "1.22",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "12 kb", "size": "12 kb",
@ -372,7 +372,7 @@
}, },
{ {
"name": "deletemsgsfromgrps", "name": "deletemsgsfromgrps",
"version": "1.01", "version": "1.02",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "4 kb", "size": "4 kb",
@ -382,7 +382,7 @@
}, },
{ {
"name": "keyword", "name": "keyword",
"version": "2.632", "version": "2.633",
"section": "chat", "section": "chat",
"maintainer": "c3b2a,xtaodada", "maintainer": "c3b2a,xtaodada",
"size": "44.1 kb", "size": "44.1 kb",
@ -392,7 +392,7 @@
}, },
{ {
"name": "msgst", "name": "msgst",
"version": "1.1", "version": "1.11",
"section": "chat", "section": "chat",
"maintainer": "c3b2a", "maintainer": "c3b2a",
"size": "3.1 kb", "size": "3.1 kb",
@ -402,7 +402,7 @@
}, },
{ {
"name": "transfer", "name": "transfer",
"version": "1.0", "version": "1.01",
"section": "daily", "section": "daily",
"maintainer": "c3b2a", "maintainer": "c3b2a",
"size": "2.7 kb", "size": "2.7 kb",
@ -412,7 +412,7 @@
}, },
{ {
"name": "xjj", "name": "xjj",
"version": "1.0", "version": "1.01",
"section": "daily", "section": "daily",
"maintainer": "Moriarty-989", "maintainer": "Moriarty-989",
"size": "1.4 kb", "size": "1.4 kb",
@ -422,7 +422,7 @@
}, },
{ {
"name": "zpr", "name": "zpr",
"version": "1.0", "version": "1.01",
"section": "daily", "section": "daily",
"maintainer": "Moriarty-989", "maintainer": "Moriarty-989",
"size": "1.4 kb", "size": "1.4 kb",
@ -432,7 +432,7 @@
}, },
{ {
"name": "forcesend", "name": "forcesend",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "fruitymelon", "maintainer": "fruitymelon",
"size": "1.3 kb", "size": "1.3 kb",
@ -442,7 +442,7 @@
}, },
{ {
"name": "ghs", "name": "ghs",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "akun", "maintainer": "akun",
"size": "1.3 kb", "size": "1.3 kb",
@ -452,7 +452,7 @@
}, },
{ {
"name": "bc", "name": "bc",
"version": "1.2", "version": "1.21",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "8.0 kb", "size": "8.0 kb",
@ -462,7 +462,7 @@
}, },
{ {
"name": "diy", "name": "diy",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "ahhhiiii,xtaodada", "maintainer": "ahhhiiii,xtaodada",
"size": "2.9 kb", "size": "2.9 kb",
@ -472,7 +472,7 @@
}, },
{ {
"name": "bingwall", "name": "bingwall",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "ahhhiiii", "maintainer": "ahhhiiii",
"size": "1.9 kb", "size": "1.9 kb",
@ -482,7 +482,7 @@
}, },
{ {
"name": "pl", "name": "pl",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "lowking", "maintainer": "lowking",
"size": "4.0 kb", "size": "4.0 kb",
@ -492,7 +492,7 @@
}, },
{ {
"name": "rape", "name": "rape",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "4.0 kb", "size": "4.0 kb",
@ -502,7 +502,7 @@
}, },
{ {
"name": "fuck", "name": "fuck",
"version": "1.0", "version": "1.01",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "4.0 kb", "size": "4.0 kb",

View File

@ -1,11 +1,11 @@
import random import random
from time import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
from os import remove from os import remove
@listener(is_plugin=True, outgoing=True, command="mz", @listener(is_plugin=True, outgoing=True, command=alias_command("mz"),
description="多网站随机获取性感(可能)的写真") description="多网站随机获取性感(可能)的写真")
async def mz(context): async def mz(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -40,7 +40,7 @@ async def mz(context):
img = get("https://api.uomg.com/api/rand.img3") img = get("https://api.uomg.com/api/rand.img3")
elif website == 12: elif website == 12:
img = get("https://api.nmb.show/xiaojiejie1.php") img = get("https://api.nmb.show/xiaojiejie1.php")
elif website == 13: else:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%80%A7%E6%84%9F") img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%80%A7%E6%84%9F")
if img.status_code == 200: if img.status_code == 200:
with open(filename, 'wb') as f: with open(filename, 'wb') as f:
@ -66,7 +66,8 @@ async def mz(context):
if not status: if not status:
await context.client.send_message(context.chat_id, "出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有妹子看啦!) 。") await context.client.send_message(context.chat_id, "出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有妹子看啦!) 。")
@listener(is_plugin=True, outgoing=True, command="sp",
@listener(is_plugin=True, outgoing=True, command=alias_command("sp"),
description="随机获取妹子的视频") description="随机获取妹子的视频")
async def sp(context): async def sp(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")

5
mjx.py
View File

@ -1,9 +1,10 @@
import json import json
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="mjx", @listener(is_plugin=True, outgoing=True, command=alias_command("mjx"),
description="随机一个淘宝带图评价。") description="随机一个淘宝带图评价。")
async def mjx(context): async def mjx(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -16,7 +17,7 @@ async def mjx(context):
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
@listener(is_plugin=True, outgoing=True, command="sqmjx", @listener(is_plugin=True, outgoing=True, command=alias_command("sqmjx"),
description="一个淘宝涩气买家秀。") description="一个淘宝涩气买家秀。")
async def sqmjx(context): async def sqmjx(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")

View File

@ -1,6 +1,8 @@
import time, asyncio import time, asyncio
from pagermaid import bot, redis, redis_status from pagermaid import bot, redis, redis_status
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
def is_num(x: str): def is_num(x: str):
try: try:
@ -9,6 +11,7 @@ def is_num(x: str):
except ValueError: except ValueError:
return False return False
def get_bot(): def get_bot():
data = [1527463252, "msg_schedule_bot"] data = [1527463252, "msg_schedule_bot"]
if redis_status(): if redis_status():
@ -18,14 +21,16 @@ def get_bot():
if n_un: data[1] = str(n_un, "ascii") if n_un: data[1] = str(n_un, "ascii")
return data return data
async def del_msg(context, t_lim): async def del_msg(context, t_lim):
await asyncio.sleep(t_lim) await asyncio.sleep(t_lim)
await context.delete() await context.delete()
@listener(is_plugin=True, outgoing=True, command="msgst",
@listener(is_plugin=True, outgoing=True, command=alias_command("msgst"),
description="消息每天定时发送", description="消息每天定时发送",
parameters="new 时:分:秒 消息` 或 `del <msg_id>` 或 `list") parameters="new 时:分:秒 消息` 或 `del <msg_id>` 或 `list")
async def process(context): async def msgst(context):
params = [] params = []
for p in context.parameter: for p in context.parameter:
if len(p.split()) != 0: if len(p.split()) != 0:
@ -43,10 +48,11 @@ async def process(context):
await context.edit(response.text) await context.edit(response.text)
if len(params) > 0 and params[0] != "list": await del_msg(context, 10) if len(params) > 0 and params[0] != "list": await del_msg(context, 10)
@listener(is_plugin=True, outgoing=True, command="msgset",
@listener(is_plugin=True, outgoing=True, command=alias_command("msgset"),
description="定时发送 bot 服务端设置", description="定时发送 bot 服务端设置",
parameters="bot <bot_id> <bot_username>` 或 `bot clear") parameters="bot <bot_id> <bot_username>` 或 `bot clear")
async def settings(context): async def msgset(context):
if not redis_status(): if not redis_status():
await context.edit("出错了呜呜呜 ~ Redis 离线,无法运行") await context.edit("出错了呜呜呜 ~ Redis 离线,无法运行")
await del_msg(context, 10) await del_msg(context, 10)
@ -70,6 +76,7 @@ async def settings(context):
await context.edit("参数错误") await context.edit("参数错误")
await del_msg(context, 10) await del_msg(context, 10)
@listener(incoming=True, ignore_edited=True) @listener(incoming=True, ignore_edited=True)
async def sendmsg(context): async def sendmsg(context):
bot_data = get_bot() bot_data = get_bot()

View File

@ -1,10 +1,10 @@
import json import json
from requests import get from requests import get
from pagermaid import bot, log
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="netease", @listener(is_plugin=True, outgoing=True, command=alias_command("netease"),
description="随机一条网易云音乐评论。") description="随机一条网易云音乐评论。")
async def netease(context): async def netease(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -15,9 +15,13 @@ async def netease(context):
return return
if req.status_code == 200: if req.status_code == 200:
data = json.loads(req.text) data = json.loads(req.text)
try:
res = data['comments'] + '\n\n来自 @' + data[ res = data['comments'] + '\n\n来自 @' + data[
'nickname'] + ' 在鸽曲 <a href="' + str(data['music_url']) + '">' + \ 'nickname'] + ' 在鸽曲 <a href="' + str(data['music_url']) + '">' + \
data['name'] + ' --by' + data['artists_name'] + '</a>' + ' 下方的评论。' data['name'] + ' --by' + data['artists_name'] + '</a>' + ' 下方的评论。'
except:
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
return
await context.edit(res, parse_mode='html', link_preview=True) await context.edit(res, parse_mode='html', link_preview=True)
else: else:
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")

View File

@ -9,7 +9,7 @@ import math
from time import sleep from time import sleep
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid import bot from pagermaid import bot
from pagermaid.utils import obtain_message from pagermaid.utils import alias_command
from os import remove, path, mkdir, getcwd from os import remove, path, mkdir, getcwd
from os.path import exists from os.path import exists
from collections import defaultdict from collections import defaultdict
@ -20,16 +20,21 @@ class RetryError(Exception): # 重试错误,用于再次重试
pass pass
@listener(is_plugin=True, outgoing=True, command="nem", @listener(is_plugin=True, outgoing=True, command=alias_command("nem"),
description="网易云搜/点歌。\n指令s为搜索p为点歌id为歌曲ID点歌r为随机热歌(无关键词)\n搜索在s后添加数字如`-nem` `s8` `<关键词>`调整结果数量\n搜索灰色歌曲请尽量**指定歌手**\n可回复搜索结果消息`-nem` `p` `<歌曲数字序号>`点歌", description="网易云搜/点歌。\n指令s为搜索p为点歌id为歌曲ID点歌r为随机热歌(无关键词)\n搜索在s后添加数字如`-nem` `s8` "
"`<关键词>`调整结果数量\n搜索灰色歌曲请尽量**指定歌手**\n可回复搜索结果消息`-nem` `p` `<歌曲数字序号>`点歌",
parameters="<指令> <关键词>") parameters="<指令> <关键词>")
async def nem(context): async def nem(context):
proxies = {} proxies = {}
proxynum = 0 proxynum = 0
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063', headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "X-Real-IP": "223.252.199.66"} 'Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063',
proxy = [{'http': 'http://music.lolico.me:39000', 'https': 'http://music.lolico.me:39000'}, {'http': 'http://netease.unlock.feiwuis.me:6958', 'https': 'https://netease.unlock.feiwuis.me:6958'}] "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,"
helptext = "**使用方法:** `-nem` `<指令>` `<关键词>`\n\n指令s为搜索p为点歌id为歌曲ID点歌r为随机热歌(无关键词)\n搜索在s后添加数字如`-nem` `s8` `<关键词>`调整结果数量\n搜索灰色歌曲请尽量**指定歌手**\n可回复搜索结果消息`-nem` `p` `<歌曲数字序号>`点歌" "application/signed-exchange;v=b3;q=0.9", "X-Real-IP": "223.252.199.66"}
proxy = [{'http': 'http://music.lolico.me:39000', 'https': 'http://music.lolico.me:39000'},
{'http': 'http://netease.unlock.feiwuis.me:6958', 'https': 'https://netease.unlock.feiwuis.me:6958'}]
helptext = "**使用方法:** `-nem` `<指令>` `<关键词>`\n\n指令s为搜索p为点歌id为歌曲ID点歌r为随机热歌(无关键词)\n搜索在s后添加数字如`-nem` `s8` " \
"`<关键词>`调整结果数量\n搜索灰色歌曲请尽量**指定歌手**\n可回复搜索结果消息`-nem` `p` `<歌曲数字序号>`点歌 "
apifailtext = "出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。" apifailtext = "出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。"
if len(context.parameter) < 2: if len(context.parameter) < 2:
@ -182,7 +187,8 @@ async def nem(context):
imported = True imported = True
except ImportError: except ImportError:
imported = False imported = False
await bot.send_message(context.chat_id, '(`eyeD3`支持库未安装,歌曲文件信息将无法导入\n请使用 `-sh` `pip3` `install` `eyed3` 安装或自行ssh安装)') await bot.send_message(context.chat_id, '(`eyeD3`支持库未安装,歌曲文件信息将无法导入\n请使用 `-sh` `pip3` `install` `eyed3` '
'安装或自行ssh安装)')
url = "http://music.163.com/api/search/pc?&s=" + \ url = "http://music.163.com/api/search/pc?&s=" + \
keyword + "&offset=0&limit=1&type=1" keyword + "&offset=0&limit=1&type=1"
for _ in range(20): # 最多尝试20次 for _ in range(20): # 最多尝试20次
@ -208,13 +214,10 @@ async def nem(context):
else: else:
result = False result = False
if result: if result:
info = {'id': '', 'title': '', 'alias': '', info = {'id': req['result']['songs'][0]['id'], 'title': req['result']['songs'][0]['name'],
'album': '', 'albumpic': '', 'artist': '', 'br': ''} 'alias': req['result']['songs'][0]['alias'],
info['id'] = req['result']['songs'][0]['id'] 'album': req['result']['songs'][0]['album']['name'],
info['title'] = req['result']['songs'][0]['name'] 'albumpic': req['result']['songs'][0]['album']['picUrl'], 'artist': '', 'br': ''}
info['alias'] = req['result']['songs'][0]['alias']
info['album'] = req['result']['songs'][0]['album']['name']
info['albumpic'] = req['result']['songs'][0]['album']['picUrl']
if req['result']['songs'][0]['hMusic']: if req['result']['songs'][0]['hMusic']:
info['br'] = req['result']['songs'][0]['hMusic']['bitrate'] info['br'] = req['result']['songs'][0]['hMusic']['bitrate']
elif req['result']['songs'][0]['mMusic']: elif req['result']['songs'][0]['mMusic']:
@ -236,7 +239,8 @@ async def nem(context):
ccimported = True ccimported = True
except ImportError: except ImportError:
ccimported = False ccimported = False
await bot.send_message(context.chat_id, '(`PyCryptodome`支持库未安装,音乐曲库/音质受限\n请使用 `-sh` `pip3` `install` `pycryptodome` 安装或自行ssh安装)') await bot.send_message(context.chat_id, '(`PyCryptodome`支持库未安装,音乐曲库/音质受限\n请使用 `-sh` `pip3` '
'`install` `pycryptodome` 安装或自行ssh安装)')
name = info['title'].replace('/', " ") + ".mp3" name = info['title'].replace('/', " ") + ".mp3"
name = name.encode('utf-8').decode('utf-8') name = name.encode('utf-8').decode('utf-8')
if ccimported: # 尝试使用高清音质下载 if ccimported: # 尝试使用高清音质下载
@ -246,14 +250,19 @@ async def nem(context):
def __init__(self): def __init__(self):
self.key = '0CoJUm6Qyw8W8jud' self.key = '0CoJUm6Qyw8W8jud'
self.public_key = "010001" self.public_key = "010001"
self.modulus = '00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7' self.modulus = '00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b72515' \
'2b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92' \
'557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d' \
'3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7 '
# 偏移量 # 偏移量
self.iv = "0102030405060708" self.iv = "0102030405060708"
# 请求头 # 请求头
self.headers = { self.headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ('
'KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36',
# 传入登录cookie, # 传入登录cookie,
'Cookie': 'MUSIC_U=f52f220df171da480dbf33ce89947961585a7fdf08c89a2a4bdd6efebd86544233a649814e309366;', 'Cookie': 'MUSIC_U=f52f220df171da480dbf33ce899479615'
'85a7fdf08c89a2a4bdd6efebd86544233a649814e309366;',
"X-Real-IP": "223.252.199.66", "X-Real-IP": "223.252.199.66",
} }
# 请求url # 请求url
@ -325,7 +334,8 @@ async def nem(context):
random_num=random_num) random_num=random_num)
# 调用两次AES加密生成params # 调用两次AES加密生成params
# 初始化歌曲song_info # 初始化歌曲song_info
song_info = '{"ids":"[%s]","level":"exhigh","encodeType":"mp3","csrf_token":"477c1bd99fddedb3adc074f47fee2d35"}' % song_id song_info = '{"ids":"[%s]","level":"exhigh","encodeType":"mp3",' \
'"csrf_token":"477c1bd99fddedb3adc074f47fee2d35"}' % song_id
# 第一次加密,传入encText, key和iv # 第一次加密,传入encText, key和iv
first_encryption = self.AES_encrypt( first_encryption = self.AES_encrypt(
msg=song_info, key=self.key, iv=self.iv) msg=song_info, key=self.key, iv=self.iv)
@ -432,7 +442,8 @@ async def nem(context):
res = '或者你可以点击<a href="https://music.163.com/#/song?id=' + \ res = '或者你可以点击<a href="https://music.163.com/#/song?id=' + \
str(info['id']) + '">' + \ str(info['id']) + '">' + \
' <strong>这里</strong> ' + '</a>' + '前往网页版收听' ' <strong>这里</strong> ' + '</a>' + '前往网页版收听'
await bot.send_message(context.chat_id, f"<strong>【{info['title']}】</strong>\n" + "歌曲获取失败,资源获取可能受限,你可以再次尝试。\n" + res, parse_mode='html', link_preview=True) await bot.send_message(context.chat_id, f"<strong>【{info['title']}】</strong>\n" +
"歌曲获取失败,资源获取可能受限,你可以再次尝试。\n" + res, parse_mode='html', link_preview=True)
return return
duration = 0 duration = 0
imagedata = requests.get( imagedata = requests.get(
@ -465,7 +476,9 @@ async def nem(context):
mkdir("plugins/NeteaseMusicExtra") mkdir("plugins/NeteaseMusicExtra")
for ____ in range(6): # 最多尝试6次 for ____ in range(6): # 最多尝试6次
faster = requests.request( faster = requests.request(
"GET", "https://gist.githubusercontent.com/TNTcraftHIM/ca2e6066ed5892f67947eb2289dd6439/raw/86244b02c7824a3ca32ce01b2649f5d9badd2e49/FastTelethon.py") "GET", "https://gist.githubusercontent.com/TNTcraftHIM"
"/ca2e6066ed5892f67947eb2289dd6439/raw"
"/86244b02c7824a3ca32ce01b2649f5d9badd2e49/FastTelethon.py")
if faster.status_code == 200: if faster.status_code == 200:
with open("plugins/NeteaseMusicExtra/FastTelethon.py", "wb") as f: with open("plugins/NeteaseMusicExtra/FastTelethon.py", "wb") as f:
f.write(faster.content) f.write(faster.content)
@ -480,8 +493,14 @@ async def nem(context):
file = name file = name
if not exists("plugins/NeteaseMusicExtra/NoFastTelethon.txt"): if not exists("plugins/NeteaseMusicExtra/NoFastTelethon.txt"):
with open("plugins/NeteaseMusicExtra/NoFastTelethon.txt", "w") as f: with open("plugins/NeteaseMusicExtra/NoFastTelethon.txt", "w") as f:
f.write("此文件出现表示FastTelethon支持文件在首次运行NeteaseMusic插件时导入失败\n这可能是因为Github服务器暂时性的访问出错导致的\nFastTelethon可以提升低网络性能机型在上传文件时的效率但是正常情况提升并不明显\n如想要手动导入,可以手动下载:\nhttps://gist.githubusercontent.com/TNTcraftHIM/ca2e6066ed5892f67947eb2289dd6439/raw/86244b02c7824a3ca32ce01b2649f5d9badd2e49/FastTelethon.py\n并放入当前文件夹") f.write("此文件出现表示FastTelethon支持文件在首次运行NeteaseMusic插件时导入失败\n这可能是因为Github"
await bot.send_message(context.chat_id, '`FastTelethon`支持文件导入失败,上传速度可能受到影响\n此提示仅出现**一次**,手动导入可参考:\n`' + getcwd() + '/plugins/NeteaseMusicExtra/NoFastTelethon.txt`') "服务器暂时性的访问出错导致的\nFastTelethon可以提升低网络性能机型在上传文件时的效率但是正常情况提升并不明显\n"
"如想要手动导入,可以手动下载:\nhttps://gist.githubusercontent.com/TNTcraftHIM"
"/ca2e6066ed5892f67947eb2289dd6439/raw"
"/86244b02c7824a3ca32ce01b2649f5d9badd2e49/FastTelethon.py\n并放入当前文件夹")
await bot.send_message(context.chat_id, '`FastTelethon`支持文件导入失败,上传速度可能受到影响\n'
'此提示仅出现**一次**,手动导入可参考:\n`' + getcwd() +
'/plugins/NeteaseMusicExtra/NoFastTelethon.txt`')
await context.client.send_file( await context.client.send_file(
context.chat_id, context.chat_id,

View File

@ -3,9 +3,10 @@ import requests
from time import sleep from time import sleep
from pagermaid.listener import listener from pagermaid.listener import listener
from os import remove, path from os import remove, path
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="ns", @listener(is_plugin=True, outgoing=True, command=alias_command("ns"),
description="随机网抑云热歌。") description="随机网抑云热歌。")
async def ns(context): async def ns(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -23,8 +24,10 @@ async def ns(context):
req = json.loads(req.content) req = json.loads(req.content)
songid = req["data"]["url"][45:] songid = req["data"]["url"][45:]
music = req['data']['url'] music = req['data']['url']
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063', headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, '
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"} 'like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063',
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,"
"*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"}
music = requests.request("GET", music, headers=headers) music = requests.request("GET", music, headers=headers)
name = str(req['data']['name']) + ".mp3" name = str(req['data']['name']) + ".mp3"
with open(name, 'wb') as f: with open(name, 'wb') as f:
@ -65,7 +68,7 @@ async def ns(context):
break break
else: else:
continue continue
if status == False: if not status:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。") await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
sleep(2) sleep(2)
await context.delete() await context.delete()

View File

@ -1,10 +1,9 @@
from pagermaid.listener import listener from pagermaid.listener import listener
# from pagermaid import log
from telethon import functions, types from telethon import functions, types
from pagermaid.utils import alias_command
@listener(outgoing=True, @listener(outgoing=True, command=alias_command("nthmsg"),
command="nthmsg",
description="获取你发送的第 n 条消息,默认为第一条", description="获取你发送的第 n 条消息,默认为第一条",
parameters="<n>") parameters="<n>")
async def nthmsg(context): async def nthmsg(context):
@ -16,13 +15,8 @@ async def nthmsg(context):
n = 1 n = 1
m = object() m = object()
async for m in context.client.iter_messages(context.chat_id, async for m in context.client.iter_messages(context.chat_id, from_user="me", reverse=True, limit=n):
from_user="me",
reverse=True,
limit=n):
pass pass
r = await context.client( r = await context.client(
functions.channels.ExportMessageLinkRequest(channel=m.to_id, functions.channels.ExportMessageLinkRequest(channel=m.to_id, id=m.id, grouped=True))
id=m.id,
grouped=True))
await context.edit(r.link) await context.edit(r.link)

View File

@ -9,8 +9,10 @@
from asyncio import sleep from asyncio import sleep
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="paolu",
@listener(is_plugin=True, outgoing=True, command=alias_command("paolu"),
description="⚠一键跑路 删除群内消息并禁言⚠") description="⚠一键跑路 删除群内消息并禁言⚠")
async def paolu(context): async def paolu(context):
"""一键跑路 删除群内消息并禁言""" """一键跑路 删除群内消息并禁言"""

4
pl.py
View File

@ -13,9 +13,11 @@ except ImportError:
from asyncio import sleep from asyncio import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
from urllib import parse from urllib import parse
@listener(is_plugin=True, outgoing=True, command="pl",
@listener(is_plugin=True, outgoing=True, command=alias_command("pl"),
description="输入【-pl 食物名】查询食物嘌呤含量", description="输入【-pl 食物名】查询食物嘌呤含量",
parameters="<食物名>") parameters="<食物名>")
async def pl(context): async def pl(context):

View File

@ -3,12 +3,12 @@ from pagermaid.listener import listener
from telethon.errors import rpcerrorlist from telethon.errors import rpcerrorlist
from asyncio import sleep from asyncio import sleep
from datetime import timedelta from datetime import timedelta
from telethon.tl.types import ChannelParticipantsAdmins from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="portball",
@listener(is_plugin=True, outgoing=True, command=alias_command("portball"),
description="回复你要临时禁言的人的消息来实现XX秒的禁言", description="回复你要临时禁言的人的消息来实现XX秒的禁言",
parameters="<理由>(空格)<时间/秒>") parameters="<理由>(空格)<时间/秒>")
async def portball(context): async def portball(context):
if context.is_group: if context.is_group:
reply = await context.get_reply_message() reply = await context.get_reply_message()
@ -38,7 +38,11 @@ async def portball(context):
pass pass
return False return False
try: try:
await bot.edit_permissions(context.chat_id, reply.sender.id, timedelta(seconds=int(action[1].replace(' ',''))), send_messages=False, send_media=False, send_stickers=False, send_gifs=False, send_games=False, send_inline=False, send_polls=False, invite_users=False, change_info=False, pin_messages=False) await bot.edit_permissions(context.chat_id, reply.sender.id,
timedelta(seconds=int(action[1].replace(' ', ''))), send_messages=False,
send_media=False, send_stickers=False, send_gifs=False, send_games=False,
send_inline=False, send_polls=False, invite_users=False, change_info=False,
pin_messages=False)
portball_message = await bot.send_message( portball_message = await bot.send_message(
context.chat_id, context.chat_id,
f'[{reply.sender.first_name}{last_name}](tg://user?id={reply.sender.id}) 由于 {action[0]} 被塞了{action[1]}秒口球.\n' f'[{reply.sender.first_name}{last_name}](tg://user?id={reply.sender.id}) 由于 {action[0]} 被塞了{action[1]}秒口球.\n'
@ -68,4 +72,3 @@ async def portball(context):
await context.delete() await context.delete()
except: except:
pass pass

16
rape.py
View File

@ -10,8 +10,10 @@
from datetime import timedelta from datetime import timedelta
from telethon.tl.types import ChannelParticipantsAdmins from telethon.tl.types import ChannelParticipantsAdmins
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, incoming=True, outgoing=True, command="rape",
@listener(is_plugin=True, incoming=True, outgoing=True, command=alias_command("rape"),
description="回复你要踢出的人或-rape <TelegramID>") description="回复你要踢出的人或-rape <TelegramID>")
async def rape(context): async def rape(context):
reply = await context.get_reply_message() reply = await context.get_reply_message()
@ -39,7 +41,11 @@ async def rape(context):
pass pass
else: else:
try: try:
await context.client.edit_permissions(context.chat_id, context.sender.id, timedelta(seconds=60), send_messages=False, send_media=False, send_stickers=False, send_gifs=False, send_games=False, send_inline=False, send_polls=False, invite_users=False, change_info=False, pin_messages=False) await context.client.edit_permissions(context.chat_id, context.sender.id, timedelta(seconds=60),
send_messages=False, send_media=False, send_stickers=False,
send_gifs=False, send_games=False, send_inline=False,
send_polls=False, invite_users=False, change_info=False,
pin_messages=False)
await context.client.send_message( await context.client.send_message(
context.chat_id, context.chat_id,
f'[{context.sender.first_name} {context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒', f'[{context.sender.first_name} {context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒',
@ -67,7 +73,11 @@ async def rape(context):
pass pass
else: else:
try: try:
await context.client.edit_permissions(context.chat_id, context.sender.id, timedelta(seconds=60), send_messages=False, send_media=False, send_stickers=False, send_gifs=False, send_games=False, send_inline=False, send_polls=False, invite_users=False, change_info=False, pin_messages=False) await context.client.edit_permissions(context.chat_id, context.sender.id, timedelta(seconds=60),
send_messages=False, send_media=False,
send_stickers=False, send_gifs=False, send_games=False,
send_inline=False, send_polls=False, invite_users=False,
change_info=False, pin_messages=False)
await context.client.send_message( await context.client.send_message(
context.chat_id, context.chat_id,
f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒', f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒',

20
rate.py
View File

@ -1,18 +1,25 @@
""" Pagermaid currency exchange rates plugin. Plugin by @fruitymelon and @xtaodada""" """ Pagermaid currency exchange rates plugin. Plugin by @fruitymelon and @xtaodada"""
import asyncio, json, time import json, time
from json.decoder import JSONDecodeError from json.decoder import JSONDecodeError
import urllib.request import urllib.request
from pagermaid.listener import listener, config from pagermaid.listener import listener, config
from pagermaid import log from pagermaid import log
from pagermaid.utils import alias_command
# i18n # i18n
## 默认语言 ## 默认语言
lang_rate = {"des": "货币汇率插件", "arg": "<FROM> <TO> <NUM>", "help": "这是货币汇率插件\n\n使用方法: `-rate <FROM> <TO> <NUM>,其中 <NUM> 是可省略的`\n\n支持货币: \n", "nc": "不是支持的货币. \n\n支持货币: \n", "notice": "数据每日更新,建议使用 bc 插件查看加密货币汇率", "warning": "数据每日更新"} lang_rate = {"des": "货币汇率插件", "arg": "<FROM> <TO> <NUM>",
"help": "这是货币汇率插件\n\n使用方法: `-rate <FROM> <TO> <NUM>,其中 <NUM> 是可省略的`\n\n支持货币: \n",
"nc": "不是支持的货币. \n\n支持货币: \n", "notice": "数据每日更新,建议使用 bc 插件查看加密货币汇率", "warning": "数据每日更新"}
## 其他语言 ## 其他语言
if config["application_language"] == "en": if config["application_language"] == "en":
lang_rate = {"des": "Currency exchange rate plugin", "arg": "<FROM> <TO> <NUM>", "help": "Currency exchange rate plugin\n\nUsage: `-rate <FROM> <TO> <NUM> where <NUM> is optional`\n\nAvailable currencies: \n", "nc": "is not available.\n\nAvailable currencies: \n", "notice": "Data are updated daily, for encrypted currencies we recommend to use the `bc` plugin.", "warning": "Data are updated daily"} lang_rate = {"des": "Currency exchange rate plugin", "arg": "<FROM> <TO> <NUM>",
"help": "Currency exchange rate plugin\n\nUsage: `-rate <FROM> <TO> <NUM> where <NUM> is "
"optional`\n\nAvailable currencies: \n",
"nc": "is not available.\n\nAvailable currencies: \n",
"notice": "Data are updated daily, for encrypted currencies we recommend to use the `bc` plugin.",
"warning": "Data are updated daily"}
API = "https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json" API = "https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json"
currencies = [] currencies = []
@ -39,6 +46,7 @@ def init():
init() init()
last_init = time.time() last_init = time.time()
@listener(incoming=True, ignore_edited=True) @listener(incoming=True, ignore_edited=True)
async def refresher(context): async def refresher(context):
global last_init global last_init
@ -51,6 +59,7 @@ async def refresher(context):
except Exception as e: except Exception as e:
await log(f"Warning: plugin rate failed to refresh rates data. {e}") await log(f"Warning: plugin rate failed to refresh rates data. {e}")
@listener(is_plugin=True, outgoing=True, command="rate", @listener(is_plugin=True, outgoing=True, command="rate",
description=lang_rate["des"], description=lang_rate["des"],
parameters=lang_rate["arg"]) parameters=lang_rate["arg"])
@ -84,6 +93,7 @@ async def rate(context):
result = response.read() result = response.read()
try: try:
rate_data = json.loads(result) rate_data = json.loads(result)
await context.edit(f'`{FROM} : {TO} = {NB} : {round(NB * rate_data[TO.lower()], 4)}`\n\n{lang_rate["warning"]}') await context.edit(
f'`{FROM} : {TO} = {NB} : {round(NB * rate_data[TO.lower()], 4)}`\n\n{lang_rate["warning"]}')
except Exception as e: except Exception as e:
await context.edit(str(e)) await context.edit(str(e))

View File

@ -1,9 +1,10 @@
import json import json
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="zhrs", @listener(is_plugin=True, outgoing=True, command=alias_command("zhrs"),
description="知乎热搜。") description="知乎热搜。")
async def netease(context): async def netease(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -26,7 +27,7 @@ async def netease(context):
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
@listener(is_plugin=True, outgoing=True, command="wbrs", @listener(is_plugin=True, outgoing=True, command=alias_command("wbrs"),
description="微博热搜。") description="微博热搜。")
async def netease(context): async def netease(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -53,7 +54,7 @@ async def netease(context):
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
@listener(is_plugin=True, outgoing=True, command="dyrs", @listener(is_plugin=True, outgoing=True, command=alias_command("dyrs"),
description="抖音热搜。") description="抖音热搜。")
async def netease(context): async def netease(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -74,7 +75,8 @@ async def netease(context):
else: else:
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
@listener(is_plugin=True, outgoing=True, command="brank",
@listener(is_plugin=True, outgoing=True, command=alias_command("brank"),
description="B站排行榜。") description="B站排行榜。")
async def brank(context): async def brank(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")

View File

@ -15,14 +15,18 @@ except ImportError:
import asyncio import asyncio
from pagermaid import log from pagermaid import log
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
DAY_SECS = 24 * 60 * 60 DAY_SECS = 24 * 60 * 60
def logsync(message): def logsync(message):
sys.stdout.writelines(f"{message}\n") sys.stdout.writelines(f"{message}\n")
logsync("sendat: loading... If failed, please install dateparser first.") logsync("sendat: loading... If failed, please install dateparser first.")
# https://stackoverflow.com/questions/1111056/get-time-zone-information-of-the-system-in-python # https://stackoverflow.com/questions/1111056/get-time-zone-information-of-the-system-in-python
def local_time_offset(t=None): def local_time_offset(t=None):
"""Return offset of local zone from GMT, either at present or at time t.""" """Return offset of local zone from GMT, either at present or at time t."""
@ -35,6 +39,7 @@ def local_time_offset(t=None):
else: else:
return -time.timezone return -time.timezone
offset = local_time_offset() // 3600 offset = local_time_offset() // 3600
sign = "+" if offset >= 0 else "-" sign = "+" if offset >= 0 else "-"
offset = abs(offset) offset = abs(offset)
@ -65,12 +70,14 @@ i.e.
-sendat 10 minutes | -autorespond 我暂时有事离开一下 -sendat 10 minutes | -autorespond 我暂时有事离开一下
""" """
@listener(is_plugin=True, outgoing=True, command="sendat", diagnostics=True, ignore_edited=True,
@listener(is_plugin=True, outgoing=True, command=alias_command("sendat"), diagnostics=True, ignore_edited=True,
description=helpmsg, description=helpmsg,
parameters="<atmsg>") parameters="<atmsg>")
async def sendatwrap(context): async def sendatwrap(context):
await sendat(context) await sendat(context)
async def sendat(context): async def sendat(context):
if not context.parameter: if not context.parameter:
await context.edit(helpmsg) await context.edit(helpmsg)
@ -227,7 +234,7 @@ async def sendat(context):
return return
@listener(outgoing=True, command="sendatdump", diagnostics=True, ignore_edited=True, @listener(outgoing=True, command=alias_command("sendatdump"), diagnostics=True, ignore_edited=True,
description="导出并转储内存中的 sendat 配置") description="导出并转储内存中的 sendat 配置")
async def sendatdump(context): async def sendatdump(context):
clean_mem = mem[:] clean_mem = mem[:]
@ -237,7 +244,8 @@ async def sendatdump(context):
clean_mem.remove("") clean_mem.remove("")
await context.edit(".\n-sendat " + "\n-sendat ".join(clean_mem)) await context.edit(".\n-sendat " + "\n-sendat ".join(clean_mem))
@listener(outgoing=True, command="sendatparse", diagnostics=True, ignore_edited=True,
@listener(outgoing=True, command=alias_command("sendatparse"), diagnostics=True, ignore_edited=True,
description="导入已导出的 sendat 配置。用法:-sendatparse 在此处粘贴 -sendatdump 命令的输出结果") description="导入已导出的 sendat 配置。用法:-sendatparse 在此处粘贴 -sendatdump 命令的输出结果")
async def sendatparse(context): async def sendatparse(context):
chat = await context.get_chat() chat = await context.get_chat()
@ -255,11 +263,13 @@ async def sendatparse(context):
pms.append(sendat(sent)) pms.append(sendat(sent))
await asyncio.wait(pms) await asyncio.wait(pms)
""" Modified pagermaid autorespond plugin. """ """ Modified pagermaid autorespond plugin. """
from telethon.events import StopPropagation from telethon.events import StopPropagation
from pagermaid import persistent_vars from pagermaid import persistent_vars
async def autorespond(context): async def autorespond(context):
""" Enables the auto responder. """ """ Enables the auto responder. """
message = "我还在睡觉... ZzZzZzZzZZz" message = "我还在睡觉... ZzZzZzZzZZz"
@ -269,8 +279,10 @@ async def autorespond(context):
await log(f"启用自动响应器,将自动回复 `{message}`.") await log(f"启用自动响应器,将自动回复 `{message}`.")
persistent_vars.update({'autorespond': {'enabled': True, 'message': message, 'amount': 0}}) persistent_vars.update({'autorespond': {'enabled': True, 'message': message, 'amount': 0}})
from pagermaid import redis, redis_status from pagermaid import redis, redis_status
async def ghost(context): async def ghost(context):
""" Toggles ghosting of a user. """ """ Toggles ghosting of a user. """
if not redis_status(): if not redis_status():

View File

@ -1,8 +1,10 @@
from time import sleep from time import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(is_plugin=True, outgoing=True, command="chp",
@listener(is_plugin=True, outgoing=True, command=alias_command("chp"),
description="彩虹屁生成器。") description="彩虹屁生成器。")
async def chp(context): async def chp(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -21,7 +23,8 @@ async def chp(context):
sleep(2) sleep(2)
await context.delete() await context.delete()
@listener(is_plugin=True, outgoing=True, command="djt",
@listener(is_plugin=True, outgoing=True, command=alias_command("djt"),
description="毒鸡汤生成器。") description="毒鸡汤生成器。")
async def djt(context): async def djt(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -40,7 +43,8 @@ async def djt(context):
sleep(2) sleep(2)
await context.delete() await context.delete()
@listener(is_plugin=True, outgoing=True, command="yxh",
@listener(is_plugin=True, outgoing=True, command=alias_command("yxh"),
description="营销号文案生成器建议配合tts食用", parameters="<主体> <事件> <原因>") description="营销号文案生成器建议配合tts食用", parameters="<主体> <事件> <原因>")
async def yxh(context): async def yxh(context):
try: try:

View File

@ -1,16 +1,15 @@
from time import sleep from time import sleep
from os import remove from os import remove
from urllib import request
from io import BytesIO from io import BytesIO
from telethon.tl.types import DocumentAttributeFilename, MessageMediaPhoto from telethon.tl.types import DocumentAttributeFilename, MessageMediaPhoto
from PIL import Image from PIL import Image
from math import floor
from pagermaid import bot from pagermaid import bot
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
from random import random from random import random
@listener(outgoing=True, command="pic", @listener(outgoing=True, command=alias_command("pic"),
description="将你回复的静态贴纸转换为图片", parameters="<y/n>是否发送原图默认为n") description="将你回复的静态贴纸转换为图片", parameters="<y/n>是否发送原图默认为n")
async def stickertopic(context): async def stickertopic(context):
try: try:

8
tel.py
View File

@ -1,11 +1,13 @@
import json import json
import os,sys,codecs import sys, codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import obtain_message from pagermaid.utils import obtain_message, alias_command
@listener(outgoing=True, command="tel",
@listener(outgoing=True, command=alias_command("tel"),
description="手机号码归属地等信息查询。") description="手机号码归属地等信息查询。")
async def tel(context): async def tel(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")

View File

@ -9,10 +9,13 @@ from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import MessageEntityMentionName from telethon.tl.types import MessageEntityMentionName
from struct import error as StructError from struct import error as StructError
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
def crop_max_square(pil_img): def crop_max_square(pil_img):
return crop_center(pil_img, min(pil_img.size), min(pil_img.size)) return crop_center(pil_img, min(pil_img.size), min(pil_img.size))
def crop_center(pil_img, crop_width, crop_height): def crop_center(pil_img, crop_width, crop_height):
img_width, img_height = pil_img.size img_width, img_height = pil_img.size
return pil_img.crop(((img_width - crop_width) // 2, return pil_img.crop(((img_width - crop_width) // 2,
@ -20,6 +23,7 @@ def crop_center(pil_img, crop_width, crop_height):
(img_width + crop_width) // 2, (img_width + crop_width) // 2,
(img_height + crop_height) // 2)) (img_height + crop_height) // 2))
def mask_circle_transparent(pil_img, blur_radius, offset=0): def mask_circle_transparent(pil_img, blur_radius, offset=0):
offset = blur_radius * 2 + offset offset = blur_radius * 2 + offset
mask = Image.new("L", pil_img.size, 0) mask = Image.new("L", pil_img.size, 0)
@ -31,7 +35,8 @@ def mask_circle_transparent(pil_img, blur_radius, offset=0):
result.putalpha(mask) result.putalpha(mask)
return result return result
@listener(is_plugin=True, outgoing=True, command="diu",
@listener(is_plugin=True, outgoing=True, command=alias_command("diu"),
description="生成一张 扔头像 图片,(可选:当第二个参数存在时,旋转用户头像 180°", description="生成一张 扔头像 图片,(可选:当第二个参数存在时,旋转用户头像 180°",
parameters="<username/uid> [随意内容]") parameters="<username/uid> [随意内容]")
async def throwit(context): async def throwit(context):

View File

@ -1,9 +1,10 @@
import asyncio, zipfile, os import asyncio, zipfile, os
from io import BytesIO from io import BytesIO
from uuid import uuid4
from os.path import exists, isfile from os.path import exists, isfile
from pagermaid import bot from pagermaid import bot
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
async def make_zip(source_dir, output_filename): async def make_zip(source_dir, output_filename):
zipf = zipfile.ZipFile(output_filename, "w") zipf = zipfile.ZipFile(output_filename, "w")
@ -15,6 +16,7 @@ async def make_zip(source_dir, output_filename):
zipf.write(pathfile, arcname) zipf.write(pathfile, arcname)
zipf.close() zipf.close()
async def del_msg(context, t_lim): async def del_msg(context, t_lim):
await asyncio.sleep(t_lim) await asyncio.sleep(t_lim)
try: try:
@ -22,7 +24,8 @@ async def del_msg(context, t_lim):
except: except:
pass pass
@listener(is_plugin=True, outgoing=True, command="transfer",
@listener(is_plugin=True, outgoing=True, command=alias_command("transfer"),
description="上传 / 下载文件", description="上传 / 下载文件",
parameters="upload <filepath>` 或 `download <filepath>") parameters="upload <filepath>` 或 `download <filepath>")
async def transfer(context): async def transfer(context):

View File

@ -6,11 +6,12 @@ from os.path import exists
from re import compile as regex_compile from re import compile as regex_compile
from pagermaid import bot, log from pagermaid import bot, log
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
from telethon.tl.types import DocumentAttributeVideo from telethon.tl.types import DocumentAttributeVideo
from time import sleep from time import sleep
@listener(outgoing=True, command="vdl", @listener(outgoing=True, command=alias_command("vdl"),
description="下载 YouTube/bilibili 视频并上传", description="下载 YouTube/bilibili 视频并上传",
parameters="<url>") parameters="<url>")
async def vdl(context): async def vdl(context):
@ -33,7 +34,8 @@ async def vdl(context):
from pytube import YouTube from pytube import YouTube
except ImportError: except ImportError:
await context.edit('`pytube`支持库未安装YouTube视频无法下载\n请使用 `-sh pip3 install --user ' await context.edit('`pytube`支持库未安装YouTube视频无法下载\n请使用 `-sh pip3 install --user '
'git+https://github.com/nficano/pytube 或 -sh pip3 install pytube --upgrade ` 安装或自行ssh安装\n\n已安装过 `pytube3` 的用户请使用 `-sh pip3 ' 'git+https://github.com/nficano/pytube 或 -sh pip3 install pytube --upgrade ` '
'安装或自行ssh安装\n\n已安装过 `pytube3` 的用户请使用 `-sh pip3 '
'uninstall pytube3 -y` 进行卸载') 'uninstall pytube3 -y` 进行卸载')
return return
url = url.replace('www.youtube.com/watch?v=', 'youtu.be/') url = url.replace('www.youtube.com/watch?v=', 'youtu.be/')

View File

@ -2,7 +2,7 @@ import json
import datetime import datetime
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import obtain_message from pagermaid.utils import obtain_message, alias_command
icons = { icons = {
"01d": "🌞", "01d": "🌞",
@ -25,15 +25,19 @@ icons = {
"50n": "🌫", "50n": "🌫",
} }
def timestamp_to_time(timestamp, timeZoneShift): def timestamp_to_time(timestamp, timeZoneShift):
timeArray = datetime.datetime.utcfromtimestamp(timestamp) + datetime.timedelta(seconds=timeZoneShift) timeArray = datetime.datetime.utcfromtimestamp(timestamp) + datetime.timedelta(seconds=timeZoneShift)
return timeArray.strftime("%H:%M") return timeArray.strftime("%H:%M")
def calcWindDirection(windDirection): def calcWindDirection(windDirection):
dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW'] dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']
ix = round(windDirection / (360. / len(dirs))) ix = round(windDirection / (360. / len(dirs)))
return dirs[ix % len(dirs)] return dirs[ix % len(dirs)]
@listener(is_plugin=True, outgoing=True, command="weather",
@listener(is_plugin=True, outgoing=True, command=alias_command("weather"),
description="查询天气", description="查询天气",
parameters="<城市>") parameters="<城市>")
async def weather(context): async def weather(context):
@ -44,7 +48,9 @@ async def weather(context):
await context.edit("出错了呜呜呜 ~ 无效的参数。") await context.edit("出错了呜呜呜 ~ 无效的参数。")
return return
try: try:
req = get("http://api.openweathermap.org/data/2.5/weather?appid=973e8a21e358ee9d30b47528b43a8746&units=metric&lang=zh_cn&q=" + message) req = get(
"http://api.openweathermap.org/data/2.5/weather?appid=973e8a21e358ee9d30b47528b43a8746&units=metric&lang"
"=zh_cn&q=" + message)
if req.status_code == 200: if req.status_code == 200:
data = json.loads(req.text) data = json.loads(req.text)
cityName = "{}, {}".format(data["name"], data["sys"]["country"]) cityName = "{}, {}".format(data["name"], data["sys"]["country"])
@ -65,7 +71,8 @@ async def weather(context):
icon = data["weather"][0]["icon"] icon = data["weather"][0]["icon"]
desc = data["weather"][0]["description"] desc = data["weather"][0]["description"]
res = "{} {}{} 💨{} {}m/s\n大气🌡 {}℃ ({}℉) 💦 {}% \n体感🌡 {}\n气压 {}hpa\n🌅{} 🌇{} ".format( res = "{} {}{} 💨{} {}m/s\n大气🌡 {}℃ ({}℉) 💦 {}% \n体感🌡 {}\n气压 {}hpa\n🌅{} 🌇{} ".format(
cityName, icons[icon], desc, windDirection, windSpeed, tempInC, tempInF, humidity, fellsTemp, pressure, sunriseTime, sunsetTime cityName, icons[icon], desc, windDirection, windSpeed, tempInC, tempInF, humidity, fellsTemp, pressure,
sunriseTime, sunsetTime
) )
await context.edit(res) await context.edit(res)
if req.status_code == 404: if req.status_code == 404:

View File

@ -1,11 +1,11 @@
import json import json
import os,sys,codecs
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import obtain_message from pagermaid.utils import obtain_message, alias_command
@listener(outgoing=True, command="whois",
@listener(outgoing=True, command=alias_command("whois"),
description="查看域名是否已被注册、注册日期、过期日期、域名状态、DNS解析服务器等。") description="查看域名是否已被注册、注册日期、过期日期、域名状态、DNS解析服务器等。")
async def whois(context): async def whois(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
@ -17,7 +17,10 @@ async def whois(context):
req = get("https://tenapi.cn/whois/?url=" + message) req = get("https://tenapi.cn/whois/?url=" + message)
if req.status_code == 200: if req.status_code == 200:
data = json.loads(req.text)['data'] data = json.loads(req.text)['data']
res = '域名: `' + data['url'] + '`\n注册商: `' + str(data['registrar']) + '`\n联系人: `' + str(data['registrant']) + '`\n联系邮箱: `' + str(data['mail']) + '`\n注册时间: `' + str(data['registration']) + '`\n过期时间: `' + str(data['expiration']) + '`\nDNS ' + str(data['dns']).replace('<br/>', '\n') res = '域名: `' + data['url'] + '`\n注册商: `' + str(data['registrar']) + '`\n联系人: `' + str(
data['registrant']) + '`\n联系邮箱: `' + str(data['mail']) + '`\n注册时间: `' + str(
data['registration']) + '`\n过期时间: `' + str(data['expiration']) + '`\nDNS ' + str(data['dns']).replace(
'<br/>', '\n')
await context.edit(res) await context.edit(res)
else: else:
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")

4
xjj.py
View File

@ -1,11 +1,11 @@
import random import random
from time import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
from os import remove from os import remove
@listener(is_plugin=True, outgoing=True, command="xjj", @listener(is_plugin=True, outgoing=True, command=alias_command("xjj"),
description="随机小姐姐写真") description="随机小姐姐写真")
async def ghs(context): async def ghs(context):
await context.edit("拍小姐姐写真中 . . .") await context.edit("拍小姐姐写真中 . . .")

View File

@ -3,12 +3,11 @@ import json, requests, re
from urllib.parse import urlparse from urllib.parse import urlparse
from pagermaid import bot, log from pagermaid import bot, log
from pagermaid.listener import listener, config from pagermaid.listener import listener, config
from pagermaid.utils import clear_emojis, obtain_message, attach_log from pagermaid.utils import clear_emojis, obtain_message, attach_log, alias_command
from telethon.errors import ChatAdminRequiredError from telethon.errors import ChatAdminRequiredError
from os import remove
@listener(is_plugin=True, outgoing=True, command="guess", @listener(is_plugin=True, outgoing=True, command=alias_command("guess"),
description="能不能好好说话? - 拼音首字母缩写释义工具(需要回复一句话)") description="能不能好好说话? - 拼音首字母缩写释义工具(需要回复一句话)")
async def guess(context): async def guess(context):
reply = await context.get_reply_message() reply = await context.get_reply_message()
@ -37,7 +36,7 @@ async def guess(context):
await context.edit("没有匹配到拼音首字母缩写") await context.edit("没有匹配到拼音首字母缩写")
@listener(is_plugin=True, outgoing=True, command="wiki", @listener(is_plugin=True, outgoing=True, command=alias_command("wiki"),
description="查询维基百科词条", description="查询维基百科词条",
parameters="<词组>") parameters="<词组>")
async def wiki(context): async def wiki(context):
@ -77,7 +76,7 @@ async def wiki(context):
await context.edit("没有匹配到相关词条") await context.edit("没有匹配到相关词条")
@listener(is_plugin=True, outgoing=True, command="ip", @listener(is_plugin=True, outgoing=True, command=alias_command("ip"),
description="IPINFO (或者回复一句话)", description="IPINFO (或者回复一句话)",
parameters="<ip/域名>") parameters="<ip/域名>")
async def ipinfo(context): async def ipinfo(context):
@ -170,7 +169,7 @@ async def ipinfo(context):
await context.edit('没有找到要查询的 ip/域名 ...') await context.edit('没有找到要查询的 ip/域名 ...')
@listener(is_plugin=True, outgoing=True, command="ipping", @listener(is_plugin=True, outgoing=True, command=alias_command("ipping"),
description="Ping (或者回复一句话)", description="Ping (或者回复一句话)",
parameters="<ip/域名>") parameters="<ip/域名>")
async def ipping(context): async def ipping(context):
@ -272,7 +271,7 @@ async def tx_t(context):
await context.edit(result) await context.edit(result)
@listener(is_plugin=True, outgoing=True, command="getdel", @listener(is_plugin=True, outgoing=True, command=alias_command("getdel"),
description="获取当前群组/频道的死号数。") description="获取当前群组/频道的死号数。")
async def getdel(context): async def getdel(context):
""" PagerMaid getdel. """ """ PagerMaid getdel. """

View File

@ -6,9 +6,10 @@ from youtube_dl import YoutubeDL
from re import compile as regex_compile from re import compile as regex_compile
from pagermaid import bot, log from pagermaid import bot, log
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
@listener(outgoing=True, command="ybdl", @listener(outgoing=True, command=alias_command("ybdl"),
description="上传 Youtube、Bilibili 视频到 telegram", description="上传 Youtube、Bilibili 视频到 telegram",
parameters="<url>.") parameters="<url>.")
async def ybdl(context): async def ybdl(context):

4
zpr.py
View File

@ -1,11 +1,11 @@
import random import random
from time import sleep
from requests import get from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import alias_command
from os import remove from os import remove
@listener(is_plugin=True, outgoing=True, command="zpr", @listener(is_plugin=True, outgoing=True, command=alias_command("zpr"),
description="随机小姐姐或纸片人写真") description="随机小姐姐或纸片人写真")
async def ghs(context): async def ghs(context):
await context.edit("拍小姐姐或纸片人写真中 . . .") await context.edit("拍小姐姐或纸片人写真中 . . .")