mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-21 23:18:04 +00:00
🚀 支持主程序设置命令别名
This commit is contained in:
parent
827a72a2f6
commit
9023c1d4b9
22
acg-multi.py
22
acg-multi.py
@ -1,17 +1,17 @@
|
||||
import json
|
||||
import random
|
||||
import requests
|
||||
from time import sleep
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
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图片")
|
||||
async def joke(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
for _ in range(20): # 最多重试20次
|
||||
website = random.randint(0, 6)
|
||||
filename = "acgm" + str(random.random())[2:] + ".png"
|
||||
try:
|
||||
@ -24,9 +24,11 @@ async def joke(context):
|
||||
elif website == 3:
|
||||
img = requests.get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman")
|
||||
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/'}
|
||||
img = requests.get("https://osk.soloop.ooo/rdm.php?"+ str(random.random()), headers=headers)
|
||||
elif website == 5:
|
||||
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)
|
||||
else:
|
||||
img = requests.get('https://api.lolicon.app/setu/?r18=0')
|
||||
if img.status_code == 200:
|
||||
if website == 5:
|
||||
@ -34,13 +36,13 @@ async def joke(context):
|
||||
img = tmp['data'][0]['url']
|
||||
img = requests.get(img)
|
||||
if img.status_code != 200:
|
||||
continue #如果返回不正常就赶紧下一回
|
||||
continue # 如果返回不正常就赶紧下一回
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(img.content)
|
||||
await context.edit("上传中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename)
|
||||
await context.client.send_file(context.chat_id, filename)
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
break # 成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
@ -64,4 +66,4 @@ async def joke(context):
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器 。")
|
||||
await context.client.send_message(context.chat_id, "出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器 。")
|
||||
|
13
aff.py
13
aff.py
@ -1,14 +1,15 @@
|
||||
from time import sleep
|
||||
from os.path import exists
|
||||
from os import mkdir, remove
|
||||
from pagermaid import redis, log, redis_status
|
||||
from pagermaid.utils import alias_command
|
||||
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信息(请尽量配合短链接)",
|
||||
parameters="<save|remove> (可选,用于保存|删除aff信息)")
|
||||
async def aff(context):
|
||||
if not context.parameter: #发送aff信息
|
||||
if not context.parameter: # 发送aff信息
|
||||
try:
|
||||
with open("plugins/AffExtra/aff.txt", "r", encoding="UTF-8") as f:
|
||||
msg = f.read()
|
||||
@ -23,7 +24,7 @@ async def aff(context):
|
||||
await context.edit("出错了呜呜呜 ~ 信息无变化。")
|
||||
sleep(3)
|
||||
await context.delete()
|
||||
elif context.parameter[0] == "save": #保存aff信息
|
||||
elif context.parameter[0] == "save": # 保存aff信息
|
||||
reply = await context.get_reply_message()
|
||||
if not reply:
|
||||
await context.edit("出错了呜呜呜 ~ 请回复一条消息以保存新的Aff信息。")
|
||||
@ -36,7 +37,7 @@ async def aff(context):
|
||||
await context.edit("好耶 ! Aff信息保存成功。")
|
||||
sleep(3)
|
||||
await context.delete()
|
||||
elif context.parameter[0] == "remove": #删除aff信息
|
||||
elif context.parameter[0] == "remove": # 删除aff信息
|
||||
try:
|
||||
remove("plugins/AffExtra/aff.txt")
|
||||
await context.edit("好耶 ! Aff信息删除成功。")
|
||||
@ -47,4 +48,4 @@ async def aff(context):
|
||||
else:
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
sleep(3)
|
||||
await context.delete()
|
||||
await context.delete()
|
||||
|
@ -1,12 +1,10 @@
|
||||
from telethon.tl.types import ChannelParticipantsAdmins
|
||||
from pagermaid import bot
|
||||
from pagermaid.utils import alias_command
|
||||
from pagermaid.listener import listener
|
||||
from telethon.errors.rpcbaseerrors import BadRequestError
|
||||
from os import remove
|
||||
import re
|
||||
import time
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="atadmins",
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("atadmins"),
|
||||
description="一键 AT 本群管理员(仅在群组中有效)",
|
||||
parameters="回复消息(可选) <要说的话(可选)>")
|
||||
async def atadmins(context):
|
||||
@ -25,7 +23,7 @@ async def atadmins(context):
|
||||
for admin in admins:
|
||||
if not admin.bot:
|
||||
if admin.username is not None:
|
||||
admin_list.extend(['@'+ admin.username])
|
||||
admin_list.extend(['@' + admin.username])
|
||||
elif admin.first_name is not None:
|
||||
admin_list.extend(['[' + admin.first_name + '](tg://user?id=' + str(admin.id) + ')'])
|
||||
send_list = ' , '.join(admin_list)
|
||||
@ -36,7 +34,8 @@ async def atadmins(context):
|
||||
await context.reply(f'{say}:\n{send_list}')
|
||||
await context.delete()
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="atall",
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("atall"),
|
||||
description="一键 AT 本群成员(仅在群组中有效)",
|
||||
parameters="回复消息(可选) <要说的话(可选)>")
|
||||
async def atall(context):
|
||||
@ -56,7 +55,7 @@ async def atall(context):
|
||||
if not user.bot:
|
||||
if len(user_list) < 128:
|
||||
if user.username is not None:
|
||||
user_list.extend(['@'+ user.username])
|
||||
user_list.extend(['@' + user.username])
|
||||
elif user.first_name is not None:
|
||||
user_list.extend(['[' + user.first_name + '](tg://user?id=' + str(user.id) + ')'])
|
||||
else:
|
||||
|
@ -7,6 +7,7 @@ from telethon.tl.functions.account import UpdateProfileRequest
|
||||
from emoji import emojize
|
||||
from pagermaid import bot, log
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
dizzy = emojize(":dizzy:", 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]
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="autochangename",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("autochangename"),
|
||||
description="每 30 秒更新一次 last_name")
|
||||
async def change_name_auto(context):
|
||||
await context.delete()
|
||||
|
@ -18,6 +18,8 @@ from telethon.tl.functions.messages import GetStickerSetRequest
|
||||
from telethon.tl.types import InputStickerSetID
|
||||
from pagermaid import log
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
|
||||
async def ars_check(message: Message) -> None:
|
||||
try:
|
||||
@ -43,14 +45,15 @@ async def ars_check(message: Message) -> None:
|
||||
await sleep(15)
|
||||
await _noti.delete()
|
||||
|
||||
|
||||
async def ars_getall(message: Message) -> None:
|
||||
sticker_sets = await message.client(GetAllStickersRequest(0))
|
||||
sticker_pack_list = []
|
||||
for sticker_set in sticker_sets.sets:
|
||||
if len(sticker_pack_list) < 10:
|
||||
text = "我发现了一个Sticker Pack,名为\n" + sticker_set.title + "\n" + "ID为: `" + \
|
||||
str(sticker_set.id) + "` \n" + "Hash为: `" + str(sticker_set.access_hash) + \
|
||||
"` \n" + "共有" + str(sticker_set.count) + "张"
|
||||
str(sticker_set.id) + "` \n" + "Hash为: `" + str(sticker_set.access_hash) + \
|
||||
"` \n" + "共有" + str(sticker_set.count) + "张"
|
||||
sticker_pack_list.extend([text])
|
||||
else:
|
||||
sticker_pack_list_old = 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.delete()
|
||||
|
||||
|
||||
async def ars_help(message: Message) -> None:
|
||||
await message.reply(
|
||||
'欢迎使用自动回复贴纸\n'
|
||||
@ -74,6 +78,7 @@ async def ars_help(message: Message) -> None:
|
||||
'如有使用问题,请前往 [这里](https://t.me/PagerMaid_Modify) 请求帮助')
|
||||
await message.delete()
|
||||
|
||||
|
||||
async def ars_whitelist(message: Message) -> None:
|
||||
chat_id = str(message.chat_id)
|
||||
try:
|
||||
@ -108,6 +113,7 @@ async def ars_whitelist(message: Message) -> None:
|
||||
await sleep(5)
|
||||
await _noti.delete()
|
||||
|
||||
|
||||
def set_state(name: str, state: list) -> None:
|
||||
file_name = "./plugins/autoreplysticker/config.yml"
|
||||
if exists(file_name):
|
||||
@ -121,11 +127,12 @@ def set_state(name: str, state: list) -> None:
|
||||
with open(file_name, 'w', encoding='utf-8') as f:
|
||||
yaml.dump(dc, f)
|
||||
|
||||
|
||||
def get_name(sender: Message.sender) -> str:
|
||||
"""
|
||||
get_name(Message.sender)
|
||||
"""
|
||||
username = sender.username
|
||||
username = sender.username
|
||||
first_name = sender.first_name
|
||||
last_name = sender.last_name
|
||||
_id = sender.id
|
||||
@ -138,6 +145,7 @@ def get_name(sender: Message.sender) -> str:
|
||||
name = f'@{username}'
|
||||
return name
|
||||
|
||||
|
||||
def process_link(chatid: int, msgid: int) -> str:
|
||||
"""
|
||||
process_link(chat_id, message_id)
|
||||
@ -152,11 +160,12 @@ def process_link(chatid: int, msgid: int) -> str:
|
||||
link = f'https://t.me/c/{chatid}/{msgid}'
|
||||
return link
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="ars")
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("ars"))
|
||||
async def ars(context):
|
||||
if not exists('./plugins/autoreplysticker'):
|
||||
mkdir('./plugins/autoreplysticker')
|
||||
|
||||
|
||||
if len(context.parameter) == 0:
|
||||
await ars_help(context)
|
||||
return
|
||||
@ -183,7 +192,7 @@ async def ars(context):
|
||||
await sleep(10)
|
||||
await _noti.delete()
|
||||
await ars_check(context)
|
||||
|
||||
|
||||
elif context.parameter[0] == 'check':
|
||||
await ars_check(context)
|
||||
elif context.parameter[0] == 'getall':
|
||||
@ -193,13 +202,14 @@ async def ars(context):
|
||||
elif context.parameter[0] == 'w':
|
||||
await ars_whitelist(context)
|
||||
|
||||
|
||||
@listener(incoming=True, ignore_edited=True)
|
||||
async def process_message(context):
|
||||
reply_user_id = 0
|
||||
link = process_link(context.chat_id, context.id)
|
||||
me = await context.client.get_me()
|
||||
reply = await context.get_reply_message()
|
||||
try:
|
||||
reply = await context.get_reply_message()
|
||||
reply_user_id = reply.sender.id
|
||||
if context.sticker:
|
||||
return
|
||||
@ -207,7 +217,7 @@ async def process_message(context):
|
||||
return
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
try:
|
||||
config = yaml.load(open(r"./plugins/autoreplysticker/config.yml"), Loader=yaml.FullLoader)
|
||||
_sticker_id = int(config['sticker_id'])
|
||||
@ -228,19 +238,20 @@ async def process_message(context):
|
||||
except:
|
||||
pass
|
||||
|
||||
if (reply and reply_user_id == me.id):
|
||||
if reply and reply_user_id == me.id:
|
||||
stickers = await context.client(
|
||||
GetStickerSetRequest(
|
||||
stickerset=InputStickerSetID(
|
||||
id=_sticker_id, access_hash=_sticker_hash)))
|
||||
try:
|
||||
i = randint(0, len(_num)-1)
|
||||
i = randint(0, len(_num) - 1)
|
||||
sticker = await context.client.send_file(
|
||||
context.chat_id,
|
||||
stickers.documents[int(_num[i])],
|
||||
reply_to=context.id)
|
||||
await sleep(_time)
|
||||
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:
|
||||
pass
|
||||
|
@ -3,11 +3,12 @@
|
||||
from telethon.events import StopPropagation
|
||||
from pagermaid import persistent_vars, log
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
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="启用自动回复。",
|
||||
parameters="<message>")
|
||||
async def autorespond(context):
|
||||
|
23
autorm.py
23
autorm.py
@ -5,14 +5,15 @@
|
||||
|
||||
try:
|
||||
import dateparser
|
||||
|
||||
imported = True
|
||||
except ImportError:
|
||||
imported = False
|
||||
|
||||
import asyncio, time, traceback
|
||||
from pagermaid import log
|
||||
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
|
||||
def local_time_offset(t=None):
|
||||
@ -26,6 +27,7 @@ def local_time_offset(t=None):
|
||||
else:
|
||||
return -time.timezone
|
||||
|
||||
|
||||
offset = local_time_offset() // 3600
|
||||
sign = "+" if offset >= 0 else "-"
|
||||
offset = abs(offset)
|
||||
@ -56,6 +58,7 @@ i.e.
|
||||
取消所有群和全局 -autorm cancelall
|
||||
"""
|
||||
|
||||
|
||||
@listener(outgoing=True, ignore_edited=True)
|
||||
async def remove_message(context):
|
||||
""" Event handler to infinitely remove messages. """
|
||||
@ -82,12 +85,15 @@ async def remove_message(context):
|
||||
except Exception as 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,
|
||||
parameters="<time>")
|
||||
async def autorm_wrap(context):
|
||||
return await autorm(context)
|
||||
|
||||
|
||||
async def autorm(context):
|
||||
try:
|
||||
global all_chat, all_chat_delta, chats, times
|
||||
@ -96,7 +102,7 @@ async def autorm(context):
|
||||
|
||||
args = context.arguments if context.arguments is not None else ""
|
||||
args = args.strip()
|
||||
|
||||
|
||||
if not imported:
|
||||
await edit(context, "Please install dateparser first: python3 -m pip install dateparser")
|
||||
return
|
||||
@ -123,13 +129,13 @@ async def autorm(context):
|
||||
all_chat_delta = None
|
||||
await edit(context, "成功为所有群取消自动删除消息。")
|
||||
return
|
||||
|
||||
|
||||
dt = dateparser.parse(time_str, settings=settings)
|
||||
if dt is None:
|
||||
await edit(context, "无法解析所指定的时间长度。")
|
||||
return
|
||||
|
||||
delta = time.time() - dt.timestamp()
|
||||
delta = time.time() - dt.timestamp()
|
||||
if delta <= 3:
|
||||
await edit(context, "所指定的时间长度过短。")
|
||||
return
|
||||
@ -169,7 +175,7 @@ async def autorm(context):
|
||||
if delta <= 3:
|
||||
await edit(context, "所指定的时间长度过短。")
|
||||
return
|
||||
|
||||
|
||||
if chats.count(chat_id) != 0:
|
||||
index = chats.index(chat_id)
|
||||
chats.pop(index)
|
||||
@ -182,6 +188,7 @@ async def autorm(context):
|
||||
await edit(context, f"Error: {str(e)}")
|
||||
return
|
||||
|
||||
|
||||
async def edit(context, text):
|
||||
chat = await context.get_chat()
|
||||
try:
|
||||
@ -193,8 +200,8 @@ async def edit(context, text):
|
||||
else:
|
||||
return context
|
||||
|
||||
|
||||
async def sendmsg(context, chat, origin_text):
|
||||
text = origin_text.strip()
|
||||
msg = await context.client.send_message(chat, text)
|
||||
return msg
|
||||
|
||||
|
17
bc.py
17
bc.py
@ -8,15 +8,10 @@
|
||||
#
|
||||
|
||||
from asyncio import sleep
|
||||
from json.decoder import JSONDecodeError
|
||||
from time import strftime
|
||||
import json
|
||||
import urllib.request
|
||||
import time
|
||||
from telethon.tl.custom.message import Message
|
||||
from pagermaid import log
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import execute
|
||||
from pagermaid.utils import execute, alias_command
|
||||
|
||||
imported = True
|
||||
try:
|
||||
@ -48,9 +43,7 @@ def init() -> None:
|
||||
raise e
|
||||
|
||||
|
||||
@listener(is_plugin=True,
|
||||
outgoing=True,
|
||||
command="bc",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("bc"),
|
||||
description="coins",
|
||||
parameters="<num> <coin1> <coin2>")
|
||||
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.client.disconnect()
|
||||
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
|
||||
init()
|
||||
action = context.arguments.split()
|
||||
@ -83,8 +77,9 @@ async def coin(context: Message) -> None:
|
||||
text = ''
|
||||
rear_text = ''
|
||||
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
|
||||
text = f'{action[0]} {action[1].upper().strip()} = {float(action[0])*DATA[_to]/DATA[_from]:.2f} {action[2].upper().strip()}'
|
||||
|
||||
|
25
bingwall.py
25
bingwall.py
@ -1,13 +1,14 @@
|
||||
import json
|
||||
import random
|
||||
from time import sleep
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
from os import remove
|
||||
|
||||
|
||||
def get_url(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)
|
||||
url = " "
|
||||
copyright = " "
|
||||
if req.status_code == 200:
|
||||
@ -17,27 +18,29 @@ def get_url(num):
|
||||
return url, copyright
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="bingwall",
|
||||
description="获取Bing每日壁纸")
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("bingwall"),
|
||||
description="获取Bing每日壁纸")
|
||||
async def bingwall(context):
|
||||
await context.edit("获取壁纸中 . . .")
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
website = random.randint(0,0)
|
||||
num = random.randint(1,7)
|
||||
status = False
|
||||
for _ in range(20): # 最多重试20次
|
||||
website = random.randint(0, 0)
|
||||
num = random.randint(1, 7)
|
||||
url, copyright = get_url(num)
|
||||
image_url = f"https://www.bing.com{url}"
|
||||
filename = "wallpaper" + str(random.random())[2:] + ".jpg"
|
||||
try:
|
||||
if website == 0 and image_url != " ":
|
||||
img = get(image_url)
|
||||
else:
|
||||
continue
|
||||
if img.status_code == 200:
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(img.content)
|
||||
await context.edit("上传中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename,caption = f"#bing wallpaper\n{str(copyright)}")
|
||||
await context.client.send_file(context.chat_id, filename, caption=f"#bing wallpaper\n{str(copyright)}")
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
break # 成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
@ -53,4 +56,4 @@ async def bingwall(context):
|
||||
except:
|
||||
pass
|
||||
if not status:
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器 。")
|
||||
await context.client.send_message(context.chat_id, "出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器 。")
|
||||
|
@ -1,7 +1,8 @@
|
||||
from pagermaid import log, bot
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import attach_log, execute
|
||||
@listener(is_plugin=False, outgoing=True, command="cal",
|
||||
from pagermaid.utils import attach_log, execute, alias_command
|
||||
|
||||
|
||||
@listener(is_plugin=False, outgoing=True, command=alias_command("cal"),
|
||||
description="计算",
|
||||
parameters="<加减乘除>")
|
||||
async def cal(context):
|
||||
@ -9,12 +10,12 @@ async def cal(context):
|
||||
if context.is_channel and not context.is_group:
|
||||
await context.edit("`出错了呜呜呜 ~ 当前 PagerMaid-Modify 的配置禁止在频道中执行此命令。`")
|
||||
return
|
||||
|
||||
|
||||
if not command:
|
||||
await context.edit("`出错了呜呜呜 ~ 无效的参数。`")
|
||||
return
|
||||
|
||||
await context.edit(f"{command}" )
|
||||
await context.edit(f"{command}")
|
||||
cmd = f'echo "scale=4;{command}" | bc'
|
||||
result = await execute(cmd)
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
from random import randint, random
|
||||
from time import sleep
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
from os import remove
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="cosm",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("cosm"),
|
||||
description="多网站随机获取cosplay图片,会自动重试哦")
|
||||
async def joke(context):
|
||||
async def cosm(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
for _ in range(20): # 最多重试20次
|
||||
website = randint(0, 6)
|
||||
filename = "cosm" + str(random())[2:] + ".png"
|
||||
try:
|
||||
@ -26,19 +26,19 @@ async def joke(context):
|
||||
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%8A%A8%E6%BC%AB")
|
||||
elif website == 5:
|
||||
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/")
|
||||
if img.status_code == 200:
|
||||
if website == 3:
|
||||
img = get(img.content)
|
||||
if img.status_code != 200:
|
||||
continue #再试一次
|
||||
continue # 再试一次
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(img.content)
|
||||
await context.edit("上传中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename)
|
||||
await context.client.send_file(context.chat_id, filename)
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
break # 成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
@ -62,4 +62,4 @@ async def joke(context):
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器 。")
|
||||
await context.client.send_message(context.chat_id, "出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器 。")
|
||||
|
7
da.py
7
da.py
@ -1,11 +1,13 @@
|
||||
from asyncio import sleep
|
||||
from pagermaid import log
|
||||
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="以此命令删除所有消息。(非群组管理员只删除自己的消息)",
|
||||
parameters="<text>")
|
||||
async def prune(context):
|
||||
async def da(context):
|
||||
if len(context.parameter) > 2 or len(context.parameter) == 0:
|
||||
await context.edit("\n呜呜呜,请执行 `-da true` 来删除所有消息。")
|
||||
return
|
||||
@ -31,6 +33,7 @@ async def prune(context):
|
||||
await sleep(.5)
|
||||
await notification.delete()
|
||||
|
||||
|
||||
async def send_prune_notify(context, count):
|
||||
return await context.client.send_message(
|
||||
context.chat_id,
|
||||
|
@ -10,8 +10,10 @@
|
||||
from asyncio import sleep
|
||||
from telethon.tl.custom.message import Message
|
||||
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:
|
||||
if len(context.parameter) == 0:
|
||||
await context.edit('您没有输入参数.\n`-dmfg group` 删除所有群内发言\n`-dmfg private` 删除所有与人的对话消息')
|
||||
@ -48,7 +50,7 @@ async def dmfg(context: Message) -> None:
|
||||
continue
|
||||
if count_buffer == count:
|
||||
break
|
||||
await message.delete()
|
||||
await message.delete()
|
||||
count_buffer += 1
|
||||
await context.edit('成功!')
|
||||
await sleep(5)
|
||||
|
5
denyu.py
5
denyu.py
@ -4,8 +4,10 @@
|
||||
|
||||
from pagermaid import redis, log, redis_status
|
||||
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`。",
|
||||
parameters="<userid> <true|false|status> 或直接回复用户并指定 <true|false|status>")
|
||||
async def denyu(context):
|
||||
@ -53,6 +55,7 @@ async def denyu(context):
|
||||
else:
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。只能为 `<true|false|status>`。")
|
||||
|
||||
|
||||
@listener(incoming=True, ignore_edited=True)
|
||||
async def message_removal_user(context):
|
||||
""" Event handler to infinitely delete denied messages. """
|
||||
|
21
diss.py
21
diss.py
@ -1,18 +1,20 @@
|
||||
from time import sleep
|
||||
from requests import get
|
||||
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="儒雅随和版祖安语录。")
|
||||
async def diss(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status=False
|
||||
for _ in range(20): #最多尝试20次
|
||||
status = False
|
||||
for _ in range(20): # 最多尝试20次
|
||||
req = get("https://nmsl.shadiao.app/api.php?level=min&from=tntcrafthim")
|
||||
if req.status_code == 200:
|
||||
res = req.text
|
||||
await context.edit(res, parse_mode='html', link_preview=False)
|
||||
status=True
|
||||
status = True
|
||||
break
|
||||
else:
|
||||
continue
|
||||
@ -21,21 +23,22 @@ async def diss(context):
|
||||
sleep(2)
|
||||
await context.delete()
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="biss",
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("biss"),
|
||||
description="加带力度版祖安语录。")
|
||||
async def biss(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status=False
|
||||
for _ in range(20): #最多尝试20次
|
||||
status = False
|
||||
for _ in range(20): # 最多尝试20次
|
||||
req = get("https://nmsl.shadiao.app/api.php?from=tntcrafthim")
|
||||
if req.status_code == 200:
|
||||
res = req.text
|
||||
await context.edit(res, parse_mode='html', link_preview=False)
|
||||
status=True
|
||||
status = True
|
||||
break
|
||||
else:
|
||||
continue
|
||||
if status == False:
|
||||
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
|
||||
sleep(2)
|
||||
await context.delete()
|
||||
await context.delete()
|
||||
|
3
diy.py
3
diy.py
@ -3,6 +3,7 @@ from random import randint, choice
|
||||
from time import sleep
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
|
||||
def get_api(num):
|
||||
@ -38,7 +39,7 @@ def process_web_data(num, req):
|
||||
return res
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="diy",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("diy"),
|
||||
description="多个随机api。")
|
||||
async def diy(context):
|
||||
short_name = ['sao', 'qh', 'zn', 'tg', 'ba', 'gs']
|
||||
|
8
dme.py
8
dme.py
@ -5,12 +5,14 @@ from os.path import exists
|
||||
from PIL import Image
|
||||
from pagermaid import redis, log, redis_status
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="dme",
|
||||
description="编辑并删除当前对话您发送的特定数量的消息。限制:基于消息 ID 的 1000 条消息,大于 1000 条可能会触发删除消息过快限制。入群消息非管理员无法删除。(倒序)当数字足够大时即可实现删除所有消息。",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("dme"),
|
||||
description="编辑并删除当前对话您发送的特定数量的消息。限制:基于消息 ID 的 1000 条消息,大于 1000 "
|
||||
"条可能会触发删除消息过快限制。入群消息非管理员无法删除。(倒序)当数字足够大时即可实现删除所有消息。",
|
||||
parameters="<数量> [文本]")
|
||||
async def selfprune(context):
|
||||
async def dme(context):
|
||||
""" Deletes specific amount of messages you sent. """
|
||||
reply = await context.get_reply_message()
|
||||
if reply and reply.photo:
|
||||
|
4
eat.py
4
eat.py
@ -9,6 +9,8 @@ from telethon.tl.functions.users import GetFullUserRequest
|
||||
from telethon.tl.types import MessageEntityMentionName
|
||||
from struct import error as StructError
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
|
||||
positions = {
|
||||
"1": [297, 288],
|
||||
@ -37,7 +39,7 @@ def eat_it(base, mask, photo, number):
|
||||
return base
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="eat",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("eat"),
|
||||
description="生成一张 吃头像 图片,(可选:当第二个参数存在时,旋转用户头像 180°)",
|
||||
parameters="<username/uid> [随意内容]")
|
||||
async def eat(context):
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# By tg @fruitymelon
|
||||
|
||||
from pagermaid import log
|
||||
from pagermaid.utils import alias_command
|
||||
from pagermaid.listener import listener
|
||||
|
||||
helpmsg = """在不进群的情况下,强制向频道的附属群内发送消息。需要事先关注频道。
|
||||
@ -15,12 +15,15 @@ helpmsg = """在不进群的情况下,强制向频道的附属群内发送消
|
||||
在普通群内使用 -forcesend 时,效果与直接发送消息基本没有区别。因此不做特殊判断。
|
||||
"""
|
||||
|
||||
|
||||
async def sendmsg(context, chat, origin_text):
|
||||
text = origin_text.strip()
|
||||
msg = await context.client.send_message(chat, text)
|
||||
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,
|
||||
parameters="<text>")
|
||||
async def forcesend(context):
|
||||
|
34
fuck.py
34
fuck.py
@ -10,19 +10,21 @@
|
||||
from datetime import timedelta
|
||||
from telethon.tl.types import ChannelParticipantsAdmins
|
||||
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>")
|
||||
async def fuck(context):
|
||||
""" kick and ban this member """
|
||||
reply = await context.get_reply_message()
|
||||
if context.is_group:
|
||||
if reply:
|
||||
if reply.sender.last_name == None:
|
||||
if reply.sender.last_name is None:
|
||||
reply_last_name = ''
|
||||
else:
|
||||
reply_last_name = reply.sender.last_name
|
||||
if context.sender.last_name == None:
|
||||
if context.sender.last_name is None:
|
||||
context_last_name = ''
|
||||
else:
|
||||
context_last_name = context.sender.last_name
|
||||
@ -33,18 +35,23 @@ async def fuck(context):
|
||||
await context.client.send_message(
|
||||
context.chat_id,
|
||||
f'[{reply.sender.first_name}{reply_last_name}](tg://user?id={reply.sender.id}) 已被踢出群聊',
|
||||
reply_to = reply.id
|
||||
reply_to=reply.id
|
||||
)
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
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(
|
||||
context.chat_id,
|
||||
f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒',
|
||||
reply_to = context.id
|
||||
f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) '
|
||||
f'由于乱玩管理员命令 已被禁言60秒',
|
||||
reply_to=context.id
|
||||
)
|
||||
await context.delete()
|
||||
except:
|
||||
@ -61,18 +68,23 @@ async def fuck(context):
|
||||
await context.client.send_message(
|
||||
context.chat_id,
|
||||
f'[{userid}](tg://user?id={userid}) 已被踢出群聊',
|
||||
reply_to = context.id
|
||||
reply_to=context.id
|
||||
)
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
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(
|
||||
context.chat_id,
|
||||
f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒',
|
||||
reply_to = context.id
|
||||
f'[{context.sender.first_name}{context.sender.last_name}](tg://user?id={context.sender.id}) '
|
||||
f'由于乱玩管理员命令 已被禁言60秒',
|
||||
reply_to=context.id
|
||||
)
|
||||
await context.delete()
|
||||
except:
|
||||
|
17
ghs.py
17
ghs.py
@ -1,28 +1,27 @@
|
||||
import random
|
||||
from time import sleep
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
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="随机获取涩情写真")
|
||||
async def ghs(context):
|
||||
await context.edit("搞颜色中 . . .")
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
website = random.randint(0,0)
|
||||
for _ in range(20): # 最多重试20次
|
||||
website = random.randint(0, 0)
|
||||
filename = "ghs" + str(random.random())[2:] + ".png"
|
||||
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:
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(img.content)
|
||||
await context.edit("传颜色中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename,caption="#NSFW ⚠️色图警告⚠️")
|
||||
await context.client.send_file(context.chat_id, filename, caption="#NSFW ⚠️色图警告⚠️")
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
break # 成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
@ -38,4 +37,4 @@ async def ghs(context):
|
||||
except:
|
||||
pass
|
||||
if not status:
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有颜色搞啦!) 。")
|
||||
await context.client.send_message(context.chat_id, "出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有颜色搞啦!) 。")
|
||||
|
@ -1,12 +1,16 @@
|
||||
""" Pagermaid hyperlink plugin. by @OahiewUoil """
|
||||
|
||||
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="生成隐藏链接。非链接的纯文字将直接隐藏。",
|
||||
parameters="<link>")
|
||||
async def hyperlink(context):
|
||||
await context.edit(f"正在生成 . . .")
|
||||
if context.arguments:
|
||||
link = context.arguments
|
||||
else:
|
||||
link = ''
|
||||
await context.edit(f"[ㅤㅤㅤㅤㅤㅤㅤ]({link})", link_preview=False)
|
12
keyword.py
12
keyword.py
@ -1,12 +1,12 @@
|
||||
import re, time, asyncio, requests, os, json, random
|
||||
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 uuid import uuid4
|
||||
from base64 import b64encode, b64decode
|
||||
from importlib import import_module
|
||||
from pagermaid import bot, redis, log, redis_status, working_dir
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
msg_freq = 1
|
||||
group_last_time = {}
|
||||
@ -417,7 +417,7 @@ async def send_reply(chat_id, trigger, mode, reply_msg, context):
|
||||
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)",
|
||||
parameters="``new <plain|regex> '<规则>' '<回复信息>'` 或者 `del <plain|regex> '<规则>'` 或者 `list` 或者 "
|
||||
"`clear <plain|regex>")
|
||||
@ -529,7 +529,7 @@ async def reply(context):
|
||||
return
|
||||
|
||||
|
||||
@listener(outgoing=True, command="replyset",
|
||||
@listener(outgoing=True, command=alias_command("replyset"),
|
||||
description="自动回复设置",
|
||||
parameters="help")
|
||||
async def reply_set(context):
|
||||
@ -830,7 +830,7 @@ async def reply_set(context):
|
||||
return
|
||||
|
||||
|
||||
@listener(outgoing=True, command="funcset",
|
||||
@listener(outgoing=True, command=alias_command("funcset"),
|
||||
description="设置自定义函数",
|
||||
parameters="help")
|
||||
async def funcset(context):
|
||||
@ -941,7 +941,7 @@ async def funcset(context):
|
||||
pass
|
||||
|
||||
|
||||
@listener(outgoing=True, command="keydata",
|
||||
@listener(outgoing=True, command=alias_command("keydata"),
|
||||
description="设置规则数据",
|
||||
parameters="dump / load")
|
||||
async def setdata(context):
|
||||
|
@ -3,8 +3,10 @@ from asyncio import sleep
|
||||
from telethon.tl.types import ChannelParticipantsAdmins
|
||||
from telethon.errors.rpcerrorlist import FloodWaitError
|
||||
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="⚠⚠慎用! 一件扬了群内所有成员⚠⚠")
|
||||
async def killallmembers(context):
|
||||
""" PagerMaid Plugin killallmembers """
|
||||
|
100
list.json
100
list.json
@ -2,7 +2,7 @@
|
||||
"list": [
|
||||
{
|
||||
"name": "autorespond",
|
||||
"version": "0.2",
|
||||
"version": "0.21",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "1.9 kb",
|
||||
@ -12,7 +12,7 @@
|
||||
},
|
||||
{
|
||||
"name": "dme",
|
||||
"version": "1.1",
|
||||
"version": "1.11",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "4.3 kb",
|
||||
@ -22,7 +22,7 @@
|
||||
},
|
||||
{
|
||||
"name": "autochangename",
|
||||
"version": "1.01",
|
||||
"version": "1.011",
|
||||
"section": "profile",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "2.1 kb",
|
||||
@ -32,7 +32,7 @@
|
||||
},
|
||||
{
|
||||
"name": "autorm",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "fruitymelon",
|
||||
"size": "6.7 kb",
|
||||
@ -42,7 +42,7 @@
|
||||
},
|
||||
{
|
||||
"name": "sendat",
|
||||
"version": "1.3",
|
||||
"version": "1.31",
|
||||
"section": "chat",
|
||||
"maintainer": "fruitymelon",
|
||||
"size": "15.0 kb",
|
||||
@ -52,7 +52,7 @@
|
||||
},
|
||||
{
|
||||
"name": "weather",
|
||||
"version": "1.1",
|
||||
"version": "1.11",
|
||||
"section": "daily",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "2.9 kb",
|
||||
@ -62,7 +62,7 @@
|
||||
},
|
||||
{
|
||||
"name": "xtao-some",
|
||||
"version": "1.16",
|
||||
"version": "1.161",
|
||||
"section": "daily",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "18.8 kb",
|
||||
@ -72,7 +72,7 @@
|
||||
},
|
||||
{
|
||||
"name": "yb-dl",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "daily",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "18.8 kb",
|
||||
@ -82,7 +82,7 @@
|
||||
},
|
||||
{
|
||||
"name": "throwit",
|
||||
"version": "1.61",
|
||||
"version": "1.611",
|
||||
"section": "profile",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "6.9 kb",
|
||||
@ -92,7 +92,7 @@
|
||||
},
|
||||
{
|
||||
"name": "rate",
|
||||
"version": "1.4",
|
||||
"version": "1.41",
|
||||
"section": "daily",
|
||||
"maintainer": "fruitymelon",
|
||||
"size": "3.4 kb",
|
||||
@ -102,7 +102,7 @@
|
||||
},
|
||||
{
|
||||
"name": "netease",
|
||||
"version": "1.3",
|
||||
"version": "1.31",
|
||||
"section": "daily",
|
||||
"maintainer": "xtaodada、KorenKrita",
|
||||
"size": "0.7 kb",
|
||||
@ -122,7 +122,7 @@
|
||||
},
|
||||
{
|
||||
"name": "denyu",
|
||||
"version": "1.1",
|
||||
"version": "1.11",
|
||||
"section": "chat",
|
||||
"maintainer": "fruitymelon",
|
||||
"size": "2.7 kb",
|
||||
@ -132,7 +132,7 @@
|
||||
},
|
||||
{
|
||||
"name": "hyperlink",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "daily",
|
||||
"maintainer": "OahiewUoil",
|
||||
"size": "0.5 kb",
|
||||
@ -142,7 +142,7 @@
|
||||
},
|
||||
{
|
||||
"name": "nthmsg",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "seiuneko",
|
||||
"size": "0.9 kb",
|
||||
@ -152,7 +152,7 @@
|
||||
},
|
||||
{
|
||||
"name": "portball",
|
||||
"version": "1.42",
|
||||
"version": "1.43",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "2.8 kb",
|
||||
@ -162,7 +162,7 @@
|
||||
},
|
||||
{
|
||||
"name": "resou",
|
||||
"version": "1.2",
|
||||
"version": "1.21",
|
||||
"section": "daily",
|
||||
"maintainer": "KorenKrita、xtaodada",
|
||||
"size": "6.1 kb",
|
||||
@ -172,7 +172,7 @@
|
||||
},
|
||||
{
|
||||
"name": "mjx",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "profile",
|
||||
"maintainer": "KorenKrita",
|
||||
"size": "1 kb",
|
||||
@ -182,7 +182,7 @@
|
||||
},
|
||||
{
|
||||
"name": "tel",
|
||||
"version": "1.1",
|
||||
"version": "1.11",
|
||||
"section": "daily",
|
||||
"maintainer": "KorenKrita、xtaodada",
|
||||
"size": "1 kb",
|
||||
@ -192,7 +192,7 @@
|
||||
},
|
||||
{
|
||||
"name": "whois",
|
||||
"version": "1.12",
|
||||
"version": "1.13",
|
||||
"section": "daily",
|
||||
"maintainer": "KorenKrita",
|
||||
"size": "1.1 kb",
|
||||
@ -202,7 +202,7 @@
|
||||
},
|
||||
{
|
||||
"name": "eat",
|
||||
"version": "1.01",
|
||||
"version": "1.02",
|
||||
"section": "profile",
|
||||
"maintainer": "SF_PICK",
|
||||
"size": "6.4 kb",
|
||||
@ -212,7 +212,7 @@
|
||||
},
|
||||
{
|
||||
"name": "cosplay-multi",
|
||||
"version": "1.3",
|
||||
"version": "1.31",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "2.4 kb",
|
||||
@ -222,7 +222,7 @@
|
||||
},
|
||||
{
|
||||
"name": "meizi",
|
||||
"version": "1.8",
|
||||
"version": "1.81",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "4.0 kb",
|
||||
@ -232,7 +232,7 @@
|
||||
},
|
||||
{
|
||||
"name": "acg-multi",
|
||||
"version": "1.4",
|
||||
"version": "1.41",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "2.4 kb",
|
||||
@ -242,7 +242,7 @@
|
||||
},
|
||||
{
|
||||
"name": "da",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "yxkumad",
|
||||
"size": "1.6 kb",
|
||||
@ -252,7 +252,7 @@
|
||||
},
|
||||
{
|
||||
"name": "diss",
|
||||
"version": "1.1",
|
||||
"version": "1.11",
|
||||
"section": "chat",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "1.5 kb",
|
||||
@ -262,7 +262,7 @@
|
||||
},
|
||||
{
|
||||
"name": "shangliu",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "2.5 kb",
|
||||
@ -272,7 +272,7 @@
|
||||
},
|
||||
{
|
||||
"name": "neteaseshuffle",
|
||||
"version": "1.1",
|
||||
"version": "1.11",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "3.0 kb",
|
||||
@ -282,7 +282,7 @@
|
||||
},
|
||||
{
|
||||
"name": "neteasemusic",
|
||||
"version": "4.3",
|
||||
"version": "4.31",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "28.8 kb",
|
||||
@ -292,7 +292,7 @@
|
||||
},
|
||||
{
|
||||
"name": "killallmembers",
|
||||
"version": "1.10",
|
||||
"version": "1.11",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "idk",
|
||||
@ -302,7 +302,7 @@
|
||||
},
|
||||
{
|
||||
"name": "videodl",
|
||||
"version": "0.11",
|
||||
"version": "0.12",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "5.3 kb",
|
||||
@ -312,7 +312,7 @@
|
||||
},
|
||||
{
|
||||
"name": "aff",
|
||||
"version": "1.2",
|
||||
"version": "1.21",
|
||||
"section": "chat",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "2.0 kb",
|
||||
@ -322,7 +322,7 @@
|
||||
},
|
||||
{
|
||||
"name": "stickertopic",
|
||||
"version": "1.1",
|
||||
"version": "1.11",
|
||||
"section": "chat",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "3.5 kb",
|
||||
@ -332,7 +332,7 @@
|
||||
},
|
||||
{
|
||||
"name": "vip",
|
||||
"version": "0.22",
|
||||
"version": "0.23",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "4.0 kb",
|
||||
@ -342,7 +342,7 @@
|
||||
},
|
||||
{
|
||||
"name": "calculator",
|
||||
"version": "1.01",
|
||||
"version": "1.02",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "1.0 kb",
|
||||
@ -352,7 +352,7 @@
|
||||
},
|
||||
{
|
||||
"name": "paolu",
|
||||
"version": "1.01",
|
||||
"version": "1.02",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "1.0 kb",
|
||||
@ -362,7 +362,7 @@
|
||||
},
|
||||
{
|
||||
"name": "autoreplysticker",
|
||||
"version": "1.21",
|
||||
"version": "1.22",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "12 kb",
|
||||
@ -372,7 +372,7 @@
|
||||
},
|
||||
{
|
||||
"name": "deletemsgsfromgrps",
|
||||
"version": "1.01",
|
||||
"version": "1.02",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "4 kb",
|
||||
@ -382,7 +382,7 @@
|
||||
},
|
||||
{
|
||||
"name": "keyword",
|
||||
"version": "2.632",
|
||||
"version": "2.633",
|
||||
"section": "chat",
|
||||
"maintainer": "c3b2a,xtaodada",
|
||||
"size": "44.1 kb",
|
||||
@ -392,7 +392,7 @@
|
||||
},
|
||||
{
|
||||
"name": "msgst",
|
||||
"version": "1.1",
|
||||
"version": "1.11",
|
||||
"section": "chat",
|
||||
"maintainer": "c3b2a",
|
||||
"size": "3.1 kb",
|
||||
@ -402,7 +402,7 @@
|
||||
},
|
||||
{
|
||||
"name": "transfer",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "daily",
|
||||
"maintainer": "c3b2a",
|
||||
"size": "2.7 kb",
|
||||
@ -412,7 +412,7 @@
|
||||
},
|
||||
{
|
||||
"name": "xjj",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "daily",
|
||||
"maintainer": "Moriarty-989",
|
||||
"size": "1.4 kb",
|
||||
@ -422,7 +422,7 @@
|
||||
},
|
||||
{
|
||||
"name": "zpr",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "daily",
|
||||
"maintainer": "Moriarty-989",
|
||||
"size": "1.4 kb",
|
||||
@ -432,7 +432,7 @@
|
||||
},
|
||||
{
|
||||
"name": "forcesend",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "fruitymelon",
|
||||
"size": "1.3 kb",
|
||||
@ -442,7 +442,7 @@
|
||||
},
|
||||
{
|
||||
"name": "ghs",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "akun",
|
||||
"size": "1.3 kb",
|
||||
@ -452,7 +452,7 @@
|
||||
},
|
||||
{
|
||||
"name": "bc",
|
||||
"version": "1.2",
|
||||
"version": "1.21",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "8.0 kb",
|
||||
@ -462,7 +462,7 @@
|
||||
},
|
||||
{
|
||||
"name": "diy",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "ahhhiiii,xtaodada",
|
||||
"size": "2.9 kb",
|
||||
@ -472,7 +472,7 @@
|
||||
},
|
||||
{
|
||||
"name": "bingwall",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "ahhhiiii",
|
||||
"size": "1.9 kb",
|
||||
@ -482,7 +482,7 @@
|
||||
},
|
||||
{
|
||||
"name": "pl",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "lowking",
|
||||
"size": "4.0 kb",
|
||||
@ -492,7 +492,7 @@
|
||||
},
|
||||
{
|
||||
"name": "rape",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "4.0 kb",
|
||||
@ -502,7 +502,7 @@
|
||||
},
|
||||
{
|
||||
"name": "fuck",
|
||||
"version": "1.0",
|
||||
"version": "1.01",
|
||||
"section": "chat",
|
||||
"maintainer": "Pentacene",
|
||||
"size": "4.0 kb",
|
||||
|
25
meizi.py
25
meizi.py
@ -1,16 +1,16 @@
|
||||
import random
|
||||
from time import sleep
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
from os import remove
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="mz",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("mz"),
|
||||
description="多网站随机获取性感(可能)的写真")
|
||||
async def mz(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
for _ in range(20): # 最多重试20次
|
||||
website = random.randint(0, 13)
|
||||
filename = "mz" + str(random.random())[2:] + ".png"
|
||||
try:
|
||||
@ -40,15 +40,15 @@ async def mz(context):
|
||||
img = get("https://api.uomg.com/api/rand.img3")
|
||||
elif website == 12:
|
||||
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")
|
||||
if img.status_code == 200:
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(img.content)
|
||||
await context.edit("上传中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename)
|
||||
await context.client.send_file(context.chat_id, filename)
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
break # 成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
@ -64,14 +64,15 @@ async def mz(context):
|
||||
except:
|
||||
pass
|
||||
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="随机获取妹子的视频")
|
||||
async def sp(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
for _ in range(20): # 最多重试20次
|
||||
try:
|
||||
vid = get("https://mv.52.mk/video.php")
|
||||
filename = "sp" + str(random.random())[2:] + ".mp4"
|
||||
@ -79,9 +80,9 @@ async def sp(context):
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(vid.content)
|
||||
await context.edit("上传中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename)
|
||||
await context.client.send_file(context.chat_id, filename)
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
break # 成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
@ -105,4 +106,4 @@ async def sp(context):
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有妹子视频看啦!) 。")
|
||||
await context.client.send_message(context.chat_id, "出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有妹子视频看啦!) 。")
|
||||
|
5
mjx.py
5
mjx.py
@ -1,9 +1,10 @@
|
||||
import json
|
||||
from requests import get
|
||||
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="随机一个淘宝带图评价。")
|
||||
async def mjx(context):
|
||||
await context.edit("获取中 . . .")
|
||||
@ -16,7 +17,7 @@ async def mjx(context):
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="sqmjx",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("sqmjx"),
|
||||
description="一个淘宝涩气买家秀。")
|
||||
async def sqmjx(context):
|
||||
await context.edit("获取中 . . .")
|
||||
|
15
msgst.py
15
msgst.py
@ -1,6 +1,8 @@
|
||||
import time, asyncio
|
||||
from pagermaid import bot, redis, redis_status
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
|
||||
def is_num(x: str):
|
||||
try:
|
||||
@ -9,6 +11,7 @@ def is_num(x: str):
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
def get_bot():
|
||||
data = [1527463252, "msg_schedule_bot"]
|
||||
if redis_status():
|
||||
@ -18,14 +21,16 @@ def get_bot():
|
||||
if n_un: data[1] = str(n_un, "ascii")
|
||||
return data
|
||||
|
||||
|
||||
async def del_msg(context, t_lim):
|
||||
await asyncio.sleep(t_lim)
|
||||
await context.delete()
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="msgst",
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("msgst"),
|
||||
description="消息每天定时发送",
|
||||
parameters="new 时:分:秒 消息` 或 `del <msg_id>` 或 `list")
|
||||
async def process(context):
|
||||
async def msgst(context):
|
||||
params = []
|
||||
for p in context.parameter:
|
||||
if len(p.split()) != 0:
|
||||
@ -43,10 +48,11 @@ async def process(context):
|
||||
await context.edit(response.text)
|
||||
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 服务端设置",
|
||||
parameters="bot <bot_id> <bot_username>` 或 `bot clear")
|
||||
async def settings(context):
|
||||
async def msgset(context):
|
||||
if not redis_status():
|
||||
await context.edit("出错了呜呜呜 ~ Redis 离线,无法运行")
|
||||
await del_msg(context, 10)
|
||||
@ -70,6 +76,7 @@ async def settings(context):
|
||||
await context.edit("参数错误")
|
||||
await del_msg(context, 10)
|
||||
|
||||
|
||||
@listener(incoming=True, ignore_edited=True)
|
||||
async def sendmsg(context):
|
||||
bot_data = get_bot()
|
||||
|
14
netease.py
14
netease.py
@ -1,10 +1,10 @@
|
||||
import json
|
||||
from requests import get
|
||||
from pagermaid import bot, log
|
||||
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="随机一条网易云音乐评论。")
|
||||
async def netease(context):
|
||||
await context.edit("获取中 . . .")
|
||||
@ -15,9 +15,13 @@ async def netease(context):
|
||||
return
|
||||
if req.status_code == 200:
|
||||
data = json.loads(req.text)
|
||||
res = data['comments'] + '\n\n来自 @' + data[
|
||||
'nickname'] + ' 在鸽曲 <a href="' + str(data['music_url']) + '">' + \
|
||||
data['name'] + ' --by' + data['artists_name'] + '</a>' + ' 下方的评论。'
|
||||
try:
|
||||
res = data['comments'] + '\n\n来自 @' + data[
|
||||
'nickname'] + ' 在鸽曲 <a href="' + str(data['music_url']) + '">' + \
|
||||
data['name'] + ' --by' + data['artists_name'] + '</a>' + ' 下方的评论。'
|
||||
except:
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
||||
return
|
||||
await context.edit(res, parse_mode='html', link_preview=True)
|
||||
else:
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
||||
|
@ -9,7 +9,7 @@ import math
|
||||
from time import sleep
|
||||
from pagermaid.listener import listener
|
||||
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.path import exists
|
||||
from collections import defaultdict
|
||||
@ -20,16 +20,21 @@ class RetryError(Exception): # 重试错误,用于再次重试
|
||||
pass
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="nem",
|
||||
description="网易云搜/点歌。\n指令s为搜索,p为点歌,id为歌曲ID点歌,r为随机热歌(无关键词)\n搜索在s后添加数字如`-nem` `s8` `<关键词>`调整结果数量\n搜索灰色歌曲请尽量**指定歌手**\n可回复搜索结果消息`-nem` `p` `<歌曲数字序号>`点歌",
|
||||
@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` `<歌曲数字序号>`点歌",
|
||||
parameters="<指令> <关键词>")
|
||||
async def nem(context):
|
||||
proxies = {}
|
||||
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',
|
||||
"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"}
|
||||
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` `<歌曲数字序号>`点歌"
|
||||
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',
|
||||
"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"}
|
||||
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 服务器 。"
|
||||
|
||||
if len(context.parameter) < 2:
|
||||
@ -182,7 +187,8 @@ async def nem(context):
|
||||
imported = True
|
||||
except ImportError:
|
||||
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=" + \
|
||||
keyword + "&offset=0&limit=1&type=1"
|
||||
for _ in range(20): # 最多尝试20次
|
||||
@ -208,13 +214,10 @@ async def nem(context):
|
||||
else:
|
||||
result = False
|
||||
if result:
|
||||
info = {'id': '', 'title': '', 'alias': '',
|
||||
'album': '', 'albumpic': '', 'artist': '', 'br': ''}
|
||||
info['id'] = req['result']['songs'][0]['id']
|
||||
info['title'] = req['result']['songs'][0]['name']
|
||||
info['alias'] = req['result']['songs'][0]['alias']
|
||||
info['album'] = req['result']['songs'][0]['album']['name']
|
||||
info['albumpic'] = req['result']['songs'][0]['album']['picUrl']
|
||||
info = {'id': req['result']['songs'][0]['id'], 'title': req['result']['songs'][0]['name'],
|
||||
'alias': req['result']['songs'][0]['alias'],
|
||||
'album': req['result']['songs'][0]['album']['name'],
|
||||
'albumpic': req['result']['songs'][0]['album']['picUrl'], 'artist': '', 'br': ''}
|
||||
if req['result']['songs'][0]['hMusic']:
|
||||
info['br'] = req['result']['songs'][0]['hMusic']['bitrate']
|
||||
elif req['result']['songs'][0]['mMusic']:
|
||||
@ -236,7 +239,8 @@ async def nem(context):
|
||||
ccimported = True
|
||||
except ImportError:
|
||||
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 = name.encode('utf-8').decode('utf-8')
|
||||
if ccimported: # 尝试使用高清音质下载
|
||||
@ -246,14 +250,19 @@ async def nem(context):
|
||||
def __init__(self):
|
||||
self.key = '0CoJUm6Qyw8W8jud'
|
||||
self.public_key = "010001"
|
||||
self.modulus = '00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7'
|
||||
self.modulus = '00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b72515' \
|
||||
'2b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92' \
|
||||
'557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d' \
|
||||
'3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7 '
|
||||
# 偏移量
|
||||
self.iv = "0102030405060708"
|
||||
# 请求头
|
||||
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': 'MUSIC_U=f52f220df171da480dbf33ce89947961585a7fdf08c89a2a4bdd6efebd86544233a649814e309366;',
|
||||
'Cookie': 'MUSIC_U=f52f220df171da480dbf33ce899479615'
|
||||
'85a7fdf08c89a2a4bdd6efebd86544233a649814e309366;',
|
||||
"X-Real-IP": "223.252.199.66",
|
||||
}
|
||||
# 请求url
|
||||
@ -325,7 +334,8 @@ async def nem(context):
|
||||
random_num=random_num)
|
||||
# 调用两次AES加密生成params
|
||||
# 初始化歌曲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
|
||||
first_encryption = self.AES_encrypt(
|
||||
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=' + \
|
||||
str(info['id']) + '">' + \
|
||||
' <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
|
||||
duration = 0
|
||||
imagedata = requests.get(
|
||||
@ -465,7 +476,9 @@ async def nem(context):
|
||||
mkdir("plugins/NeteaseMusicExtra")
|
||||
for ____ in range(6): # 最多尝试6次
|
||||
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:
|
||||
with open("plugins/NeteaseMusicExtra/FastTelethon.py", "wb") as f:
|
||||
f.write(faster.content)
|
||||
@ -480,8 +493,14 @@ async def nem(context):
|
||||
file = name
|
||||
if not exists("plugins/NeteaseMusicExtra/NoFastTelethon.txt"):
|
||||
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并放入当前文件夹")
|
||||
await bot.send_message(context.chat_id, '`FastTelethon`支持文件导入失败,上传速度可能受到影响\n此提示仅出现**一次**,手动导入可参考:\n`' + getcwd() + '/plugins/NeteaseMusicExtra/NoFastTelethon.txt`')
|
||||
f.write("此文件出现表示FastTelethon支持文件在首次运行NeteaseMusic插件时导入失败\n这可能是因为Github"
|
||||
"服务器暂时性的访问出错导致的\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(
|
||||
context.chat_id,
|
||||
|
@ -3,9 +3,10 @@ import requests
|
||||
from time import sleep
|
||||
from pagermaid.listener import listener
|
||||
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="随机网抑云热歌。")
|
||||
async def ns(context):
|
||||
await context.edit("获取中 . . .")
|
||||
@ -23,8 +24,10 @@ async def ns(context):
|
||||
req = json.loads(req.content)
|
||||
songid = req["data"]["url"][45:]
|
||||
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',
|
||||
"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"}
|
||||
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',
|
||||
"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)
|
||||
name = str(req['data']['name']) + ".mp3"
|
||||
with open(name, 'wb') as f:
|
||||
@ -65,7 +68,7 @@ async def ns(context):
|
||||
break
|
||||
else:
|
||||
continue
|
||||
if status == False:
|
||||
if not status:
|
||||
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
|
||||
sleep(2)
|
||||
await context.delete()
|
||||
|
14
nthmsg.py
14
nthmsg.py
@ -1,10 +1,9 @@
|
||||
from pagermaid.listener import listener
|
||||
# from pagermaid import log
|
||||
from telethon import functions, types
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
|
||||
@listener(outgoing=True,
|
||||
command="nthmsg",
|
||||
@listener(outgoing=True, command=alias_command("nthmsg"),
|
||||
description="获取你发送的第 n 条消息,默认为第一条",
|
||||
parameters="<n>")
|
||||
async def nthmsg(context):
|
||||
@ -16,13 +15,8 @@ async def nthmsg(context):
|
||||
n = 1
|
||||
|
||||
m = object()
|
||||
async for m in context.client.iter_messages(context.chat_id,
|
||||
from_user="me",
|
||||
reverse=True,
|
||||
limit=n):
|
||||
async for m in context.client.iter_messages(context.chat_id, from_user="me", reverse=True, limit=n):
|
||||
pass
|
||||
r = await context.client(
|
||||
functions.channels.ExportMessageLinkRequest(channel=m.to_id,
|
||||
id=m.id,
|
||||
grouped=True))
|
||||
functions.channels.ExportMessageLinkRequest(channel=m.to_id, id=m.id, grouped=True))
|
||||
await context.edit(r.link)
|
||||
|
32
paolu.py
32
paolu.py
@ -9,31 +9,33 @@
|
||||
|
||||
from asyncio import sleep
|
||||
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="⚠一键跑路 删除群内消息并禁言⚠")
|
||||
async def paolu(context):
|
||||
"""一键跑路 删除群内消息并禁言"""
|
||||
try:
|
||||
await context.client.edit_permissions(
|
||||
entity=context.chat_id,
|
||||
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)
|
||||
entity=context.chat_id,
|
||||
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)
|
||||
except:
|
||||
pass
|
||||
await context.client.delete_messages(context.chat_id, list(range(1,context.message.id)))
|
||||
await context.client.delete_messages(context.chat_id, list(range(1, context.message.id)))
|
||||
try:
|
||||
await context.client.edit_permissions(
|
||||
entity=context.chat_id,
|
||||
send_messages=False)
|
||||
entity=context.chat_id,
|
||||
send_messages=False)
|
||||
except:
|
||||
pass
|
||||
await context.edit("Finished")
|
||||
|
12
pl.py
12
pl.py
@ -13,11 +13,13 @@ except ImportError:
|
||||
from asyncio import sleep
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
from urllib import parse
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="pl",
|
||||
description="输入【-pl 食物名】查询食物嘌呤含量",
|
||||
parameters="<食物名>")
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("pl"),
|
||||
description="输入【-pl 食物名】查询食物嘌呤含量",
|
||||
parameters="<食物名>")
|
||||
async def pl(context):
|
||||
if not imported:
|
||||
await context.edit("请先安装依赖:\n`python3 -m pip install bs4`\n随后,请重启 pagermaid。")
|
||||
@ -29,7 +31,7 @@ async def pl(context):
|
||||
|
||||
st = action[0]
|
||||
st = st.encode('gb2312')
|
||||
m = {'tj_so':st,}
|
||||
m = {'tj_so': st, }
|
||||
s = parse.urlencode(m)
|
||||
for _ in range(3): # 最多重试3次
|
||||
try:
|
||||
@ -56,7 +58,7 @@ async def pl(context):
|
||||
else:
|
||||
await context.edit(f"乱写什么东西呀!格式如下:\n"
|
||||
f"【-pl 食物名】查询食物嘌呤含量")
|
||||
|
||||
|
||||
try:
|
||||
if not status:
|
||||
await sleep(2)
|
||||
|
129
portball.py
129
portball.py
@ -1,71 +1,74 @@
|
||||
from pagermaid import bot, log
|
||||
from pagermaid.listener import listener
|
||||
from telethon.errors import rpcerrorlist
|
||||
from asyncio import sleep
|
||||
from asyncio import sleep
|
||||
from datetime import timedelta
|
||||
from telethon.tl.types import ChannelParticipantsAdmins
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="portball",
|
||||
description="回复你要临时禁言的人的消息来实现XX秒的禁言",
|
||||
parameters="<理由>(空格)<时间/秒>")
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("portball"),
|
||||
description="回复你要临时禁言的人的消息来实现XX秒的禁言",
|
||||
parameters="<理由>(空格)<时间/秒>")
|
||||
async def portball(context):
|
||||
if context.is_group:
|
||||
reply = await context.get_reply_message()
|
||||
if reply:
|
||||
action = context.arguments.split()
|
||||
if reply.sender.last_name == None:
|
||||
last_name=''
|
||||
else:
|
||||
last_name = reply.sender.last_name
|
||||
if context.is_group:
|
||||
reply = await context.get_reply_message()
|
||||
if reply:
|
||||
action = context.arguments.split()
|
||||
if reply.sender.last_name == None:
|
||||
last_name = ''
|
||||
else:
|
||||
last_name = reply.sender.last_name
|
||||
|
||||
if len(action) < 2:
|
||||
notification = await bot.send_message(context.chat_id, '格式是\n-portball 理由 秒数\n真蠢', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
if int(action[1]) < 60:
|
||||
notification = await bot.send_message(context.chat_id, '诶呀不要小于60秒啦', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
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)
|
||||
portball_message = await bot.send_message(
|
||||
context.chat_id,
|
||||
f'[{reply.sender.first_name}{last_name}](tg://user?id={reply.sender.id}) 由于 {action[0]} 被塞了{action[1]}秒口球.\n'
|
||||
f'到期自动拔出,无后遗症.',
|
||||
reply_to = reply.id
|
||||
)
|
||||
await context.delete()
|
||||
await sleep(int(action[1].replace(' ','')))
|
||||
await portball_message.delete()
|
||||
except rpcerrorlist.UserAdminInvalidError:
|
||||
notification = await bot.send_message(context.chat_id, '错误:我没有管理员权限或我的权限比被封禁的人要小', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
except rpcerrorlist.ChatAdminRequiredError:
|
||||
notification = await bot.send_message(context.chat_id, '错误:我没有管理员权限或我的权限比被封禁的人要小', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
else:
|
||||
notification = await bot.send_message(context.chat_id, '你好蠢诶,都没有回复人,我哪知道你要搞谁的事情……', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
else:
|
||||
notification = await bot.send_message(context.chat_id, '你好蠢诶,又不是群组,怎么禁言啦!', reply_to = context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
if len(action) < 2:
|
||||
notification = await bot.send_message(context.chat_id, '格式是\n-portball 理由 秒数\n真蠢', reply_to=context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
if int(action[1]) < 60:
|
||||
notification = await bot.send_message(context.chat_id, '诶呀不要小于60秒啦', reply_to=context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
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)
|
||||
portball_message = await bot.send_message(
|
||||
context.chat_id,
|
||||
f'[{reply.sender.first_name}{last_name}](tg://user?id={reply.sender.id}) 由于 {action[0]} 被塞了{action[1]}秒口球.\n'
|
||||
f'到期自动拔出,无后遗症.',
|
||||
reply_to=reply.id
|
||||
)
|
||||
await context.delete()
|
||||
await sleep(int(action[1].replace(' ', '')))
|
||||
await portball_message.delete()
|
||||
except rpcerrorlist.UserAdminInvalidError:
|
||||
notification = await bot.send_message(context.chat_id, '错误:我没有管理员权限或我的权限比被封禁的人要小', reply_to=context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
except rpcerrorlist.ChatAdminRequiredError:
|
||||
notification = await bot.send_message(context.chat_id, '错误:我没有管理员权限或我的权限比被封禁的人要小', reply_to=context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
else:
|
||||
notification = await bot.send_message(context.chat_id, '你好蠢诶,都没有回复人,我哪知道你要搞谁的事情……', reply_to=context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
else:
|
||||
notification = await bot.send_message(context.chat_id, '你好蠢诶,又不是群组,怎么禁言啦!', reply_to=context.id)
|
||||
await sleep(10)
|
||||
await notification.delete()
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
|
24
rape.py
24
rape.py
@ -10,8 +10,10 @@
|
||||
from datetime import timedelta
|
||||
from telethon.tl.types import ChannelParticipantsAdmins
|
||||
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>")
|
||||
async def rape(context):
|
||||
reply = await context.get_reply_message()
|
||||
@ -31,7 +33,7 @@ async def rape(context):
|
||||
await context.client.send_message(
|
||||
context.chat_id,
|
||||
f'[{reply.sender.first_name} {reply_last_name}](tg://user?id={reply.sender.id}) 已被移出群聊',
|
||||
reply_to = reply.id
|
||||
reply_to=reply.id
|
||||
)
|
||||
try:
|
||||
await context.delete()
|
||||
@ -39,11 +41,15 @@ async def rape(context):
|
||||
pass
|
||||
else:
|
||||
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(
|
||||
context.chat_id,
|
||||
f'[{context.sender.first_name} {context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒',
|
||||
reply_to = reply.id
|
||||
reply_to=reply.id
|
||||
)
|
||||
await context.delete()
|
||||
except:
|
||||
@ -60,18 +66,22 @@ async def rape(context):
|
||||
await context.client.send_message(
|
||||
context.chat_id,
|
||||
f'[{userid}](tg://user?id={userid}) 已被移出群聊',
|
||||
reply_to = context.id
|
||||
reply_to=context.id
|
||||
)
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
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(
|
||||
context.chat_id,
|
||||
f'[{context.sender.first_name}{context_last_name}](tg://user?id={context.sender.id}) 由于乱玩管理员命令 已被禁言60秒',
|
||||
reply_to = context.id
|
||||
reply_to=context.id
|
||||
)
|
||||
await context.delete()
|
||||
except:
|
||||
|
122
rate.py
122
rate.py
@ -1,18 +1,25 @@
|
||||
""" Pagermaid currency exchange rates plugin. Plugin by @fruitymelon and @xtaodada"""
|
||||
|
||||
import asyncio, json, time
|
||||
import json, time
|
||||
from json.decoder import JSONDecodeError
|
||||
import urllib.request
|
||||
from pagermaid.listener import listener, config
|
||||
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":
|
||||
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"
|
||||
currencies = []
|
||||
@ -22,68 +29,71 @@ inited = False
|
||||
|
||||
|
||||
def init():
|
||||
with urllib.request.urlopen(API) as response:
|
||||
result = response.read()
|
||||
try:
|
||||
global data
|
||||
data = json.loads(result)
|
||||
for key in list(enumerate(data)):
|
||||
currencies.append(key[1].upper())
|
||||
currencies.sort()
|
||||
except JSONDecodeError as e:
|
||||
raise e
|
||||
global inited
|
||||
inited = True
|
||||
with urllib.request.urlopen(API) as response:
|
||||
result = response.read()
|
||||
try:
|
||||
global data
|
||||
data = json.loads(result)
|
||||
for key in list(enumerate(data)):
|
||||
currencies.append(key[1].upper())
|
||||
currencies.sort()
|
||||
except JSONDecodeError as e:
|
||||
raise e
|
||||
global inited
|
||||
inited = True
|
||||
|
||||
|
||||
init()
|
||||
last_init = time.time()
|
||||
|
||||
|
||||
@listener(incoming=True, ignore_edited=True)
|
||||
async def refresher(context):
|
||||
global last_init
|
||||
if time.time() - last_init > 24 * 60 * 60:
|
||||
# we'd better do this to prevent ruining the log file with massive fail logs
|
||||
# as this `refresher` would be called frequently
|
||||
last_init = time.time()
|
||||
try:
|
||||
init()
|
||||
except Exception as e:
|
||||
await log(f"Warning: plugin rate failed to refresh rates data. {e}")
|
||||
global last_init
|
||||
if time.time() - last_init > 24 * 60 * 60:
|
||||
# we'd better do this to prevent ruining the log file with massive fail logs
|
||||
# as this `refresher` would be called frequently
|
||||
last_init = time.time()
|
||||
try:
|
||||
init()
|
||||
except Exception as e:
|
||||
await log(f"Warning: plugin rate failed to refresh rates data. {e}")
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="rate",
|
||||
description=lang_rate["des"],
|
||||
parameters=lang_rate["arg"])
|
||||
async def rate(context):
|
||||
if not inited:
|
||||
init()
|
||||
if not inited:
|
||||
return
|
||||
if not context.parameter:
|
||||
await context.edit(f"{lang_rate['help']}`{', '.join(currencies)}`\n\n{lang_rate['notice']}")
|
||||
return
|
||||
NB = 1.0
|
||||
if len(context.parameter) != 3:
|
||||
if len(context.parameter) != 2:
|
||||
await context.edit(f"{lang_rate['help']}`{', '.join(currencies)}`\n\n{lang_rate['notice']}")
|
||||
return
|
||||
FROM = context.parameter[0].upper().strip()
|
||||
TO = context.parameter[1].upper().strip()
|
||||
try:
|
||||
NB = NB if len(context.parameter) == 2 else float(context.parameter[2].strip())
|
||||
except:
|
||||
if not inited:
|
||||
init()
|
||||
if not inited:
|
||||
return
|
||||
if not context.parameter:
|
||||
await context.edit(f"{lang_rate['help']}`{', '.join(currencies)}`\n\n{lang_rate['notice']}")
|
||||
return
|
||||
NB = 1.0
|
||||
if currencies.count(FROM) == 0:
|
||||
await context.edit(f"{FROM}{lang_rate['nc']}`{', '.join(currencies)}`")
|
||||
return
|
||||
if currencies.count(TO) == 0:
|
||||
await context.edit(f"{TO}{lang_rate['nc']}{', '.join(currencies)}`")
|
||||
return
|
||||
endpoint = f"https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/{FROM.lower()}/{TO.lower()}.json"
|
||||
with urllib.request.urlopen(endpoint) as response:
|
||||
result = response.read()
|
||||
if len(context.parameter) != 3:
|
||||
if len(context.parameter) != 2:
|
||||
await context.edit(f"{lang_rate['help']}`{', '.join(currencies)}`\n\n{lang_rate['notice']}")
|
||||
return
|
||||
FROM = context.parameter[0].upper().strip()
|
||||
TO = context.parameter[1].upper().strip()
|
||||
try:
|
||||
rate_data = json.loads(result)
|
||||
await context.edit(f'`{FROM} : {TO} = {NB} : {round(NB * rate_data[TO.lower()], 4)}`\n\n{lang_rate["warning"]}')
|
||||
except Exception as e:
|
||||
await context.edit(str(e))
|
||||
NB = NB if len(context.parameter) == 2 else float(context.parameter[2].strip())
|
||||
except:
|
||||
NB = 1.0
|
||||
if currencies.count(FROM) == 0:
|
||||
await context.edit(f"{FROM}{lang_rate['nc']}`{', '.join(currencies)}`")
|
||||
return
|
||||
if currencies.count(TO) == 0:
|
||||
await context.edit(f"{TO}{lang_rate['nc']}{', '.join(currencies)}`")
|
||||
return
|
||||
endpoint = f"https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/{FROM.lower()}/{TO.lower()}.json"
|
||||
with urllib.request.urlopen(endpoint) as response:
|
||||
result = response.read()
|
||||
try:
|
||||
rate_data = json.loads(result)
|
||||
await context.edit(
|
||||
f'`{FROM} : {TO} = {NB} : {round(NB * rate_data[TO.lower()], 4)}`\n\n{lang_rate["warning"]}')
|
||||
except Exception as e:
|
||||
await context.edit(str(e))
|
||||
|
12
resou.py
12
resou.py
@ -1,9 +1,10 @@
|
||||
import json
|
||||
from requests import get
|
||||
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="知乎热搜。")
|
||||
async def netease(context):
|
||||
await context.edit("获取中 . . .")
|
||||
@ -26,7 +27,7 @@ async def netease(context):
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="wbrs",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("wbrs"),
|
||||
description="微博热搜。")
|
||||
async def netease(context):
|
||||
await context.edit("获取中 . . .")
|
||||
@ -53,7 +54,7 @@ async def netease(context):
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="dyrs",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("dyrs"),
|
||||
description="抖音热搜。")
|
||||
async def netease(context):
|
||||
await context.edit("获取中 . . .")
|
||||
@ -74,7 +75,8 @@ async def netease(context):
|
||||
else:
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="brank",
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("brank"),
|
||||
description="B站排行榜。")
|
||||
async def brank(context):
|
||||
await context.edit("获取中 . . .")
|
||||
@ -87,4 +89,4 @@ async def brank(context):
|
||||
data[num]['title'] + '</a>」 - ' + data[num]['author']])
|
||||
await context.edit('B站实时排行榜:\n\n' + '\n'.join(res), parse_mode='html', link_preview=False)
|
||||
else:
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
||||
|
24
sendat.py
24
sendat.py
@ -13,16 +13,20 @@ except ImportError:
|
||||
imported = False
|
||||
|
||||
import asyncio
|
||||
from pagermaid import log
|
||||
from pagermaid import log
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
DAY_SECS = 24 * 60 * 60
|
||||
|
||||
|
||||
def logsync(message):
|
||||
sys.stdout.writelines(f"{message}\n")
|
||||
|
||||
|
||||
logsync("sendat: loading... If failed, please install dateparser first.")
|
||||
|
||||
|
||||
# https://stackoverflow.com/questions/1111056/get-time-zone-information-of-the-system-in-python
|
||||
def local_time_offset(t=None):
|
||||
"""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:
|
||||
return -time.timezone
|
||||
|
||||
|
||||
offset = local_time_offset() // 3600
|
||||
sign = "+" if offset >= 0 else "-"
|
||||
offset = abs(offset)
|
||||
@ -65,12 +70,14 @@ i.e.
|
||||
-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,
|
||||
parameters="<atmsg>")
|
||||
async def sendatwrap(context):
|
||||
await sendat(context)
|
||||
|
||||
|
||||
async def sendat(context):
|
||||
if not context.parameter:
|
||||
await context.edit(helpmsg)
|
||||
@ -135,7 +142,7 @@ async def sendat(context):
|
||||
return
|
||||
sleep_time = time.time() - dateparser.parse(time_str, settings=settings).timestamp()
|
||||
if sleep_time < 5:
|
||||
await context.edit(f"Sleep time too short. Should be longer than 5 seconds. Got {sleep_time}")
|
||||
await context.edit(f"Sleep time too short. Should be longer than 5 seconds. Got {sleep_time}")
|
||||
return
|
||||
mem[mem_id] = "|".join(args)
|
||||
await context.edit(f"Registered: id {mem_id}. You can use this id to cancel the timer.")
|
||||
@ -201,7 +208,7 @@ async def sendat(context):
|
||||
return
|
||||
mem[mem_id] = "|".join(args)
|
||||
await context.edit(f"Registered: id {mem_id}. You can use this id to cancel the timer.")
|
||||
while dt.timestamp() + 2*delta > time.time() and mem[mem_id] != "":
|
||||
while dt.timestamp() + 2 * delta > time.time() and mem[mem_id] != "":
|
||||
await asyncio.sleep(2)
|
||||
if mem[mem_id] != "":
|
||||
await sendmsg(context, chat, args[1])
|
||||
@ -227,7 +234,7 @@ async def sendat(context):
|
||||
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 配置")
|
||||
async def sendatdump(context):
|
||||
clean_mem = mem[:]
|
||||
@ -237,7 +244,8 @@ async def sendatdump(context):
|
||||
clean_mem.remove("")
|
||||
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 命令的输出结果")
|
||||
async def sendatparse(context):
|
||||
chat = await context.get_chat()
|
||||
@ -255,11 +263,13 @@ async def sendatparse(context):
|
||||
pms.append(sendat(sent))
|
||||
await asyncio.wait(pms)
|
||||
|
||||
|
||||
""" Modified pagermaid autorespond plugin. """
|
||||
|
||||
from telethon.events import StopPropagation
|
||||
from pagermaid import persistent_vars
|
||||
|
||||
|
||||
async def autorespond(context):
|
||||
""" Enables the auto responder. """
|
||||
message = "我还在睡觉... ZzZzZzZzZZz"
|
||||
@ -269,8 +279,10 @@ async def autorespond(context):
|
||||
await log(f"启用自动响应器,将自动回复 `{message}`.")
|
||||
persistent_vars.update({'autorespond': {'enabled': True, 'message': message, 'amount': 0}})
|
||||
|
||||
|
||||
from pagermaid import redis, redis_status
|
||||
|
||||
|
||||
async def ghost(context):
|
||||
""" Toggles ghosting of a user. """
|
||||
if not redis_status():
|
||||
|
36
shangliu.py
36
shangliu.py
@ -1,18 +1,20 @@
|
||||
from time import sleep
|
||||
from requests import get
|
||||
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="彩虹屁生成器。")
|
||||
async def chp(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status=False
|
||||
for _ in range(20): #最多尝试20次
|
||||
status = False
|
||||
for _ in range(20): # 最多尝试20次
|
||||
req = get("https://chp.shadiao.app/api.php?from=tntcrafthim")
|
||||
if req.status_code == 200:
|
||||
res = req.text
|
||||
await context.edit(res, parse_mode='html', link_preview=False)
|
||||
status=True
|
||||
status = True
|
||||
break
|
||||
else:
|
||||
continue
|
||||
@ -21,17 +23,18 @@ async def chp(context):
|
||||
sleep(2)
|
||||
await context.delete()
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="djt",
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("djt"),
|
||||
description="毒鸡汤生成器。")
|
||||
async def djt(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status=False
|
||||
for _ in range(20): #最多尝试20次
|
||||
status = False
|
||||
for _ in range(20): # 最多尝试20次
|
||||
req = get("https://du.shadiao.app/api.php?from=tntcrafthim")
|
||||
if req.status_code == 200:
|
||||
res = req.text
|
||||
await context.edit(res, parse_mode='html', link_preview=False)
|
||||
status=True
|
||||
status = True
|
||||
break
|
||||
else:
|
||||
continue
|
||||
@ -40,13 +43,14 @@ async def djt(context):
|
||||
sleep(2)
|
||||
await context.delete()
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="yxh",
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("yxh"),
|
||||
description="营销号文案生成器(建议配合tts食用)。", parameters="<主体> <事件> <原因>")
|
||||
async def yxh(context):
|
||||
try:
|
||||
await context.edit("生成中 . . .")
|
||||
text = f"{context.parameter[0]}{context.parameter[1]}是怎么回事呢?{context.parameter[0]}相信大家都很熟悉,但是{context.parameter[0]}{context.parameter[1]}是怎么回事呢,下面就让小编带大家一起了解吧。\n{context.parameter[0]}{context.parameter[1]},其实就是{context.parameter[2]},大家可能会很惊讶{context.parameter[0]}怎么会{context.parameter[1]}呢?但事实就是这样,小编也感到非常惊讶。\n这就是关于{context.parameter[0]}{context.parameter[1]}的事情了,大家有什么想法呢,欢迎在评论区告诉小编一起讨论哦!"
|
||||
except IndexError:
|
||||
await context.edit("使用方法:-yxh <主体> <事件> <原因>")
|
||||
return
|
||||
await context.edit(text)
|
||||
try:
|
||||
await context.edit("生成中 . . .")
|
||||
text = f"{context.parameter[0]}{context.parameter[1]}是怎么回事呢?{context.parameter[0]}相信大家都很熟悉,但是{context.parameter[0]}{context.parameter[1]}是怎么回事呢,下面就让小编带大家一起了解吧。\n{context.parameter[0]}{context.parameter[1]},其实就是{context.parameter[2]},大家可能会很惊讶{context.parameter[0]}怎么会{context.parameter[1]}呢?但事实就是这样,小编也感到非常惊讶。\n这就是关于{context.parameter[0]}{context.parameter[1]}的事情了,大家有什么想法呢,欢迎在评论区告诉小编一起讨论哦!"
|
||||
except IndexError:
|
||||
await context.edit("使用方法:-yxh <主体> <事件> <原因>")
|
||||
return
|
||||
await context.edit(text)
|
||||
|
@ -1,16 +1,15 @@
|
||||
from time import sleep
|
||||
from os import remove
|
||||
from urllib import request
|
||||
from io import BytesIO
|
||||
from telethon.tl.types import DocumentAttributeFilename, MessageMediaPhoto
|
||||
from PIL import Image
|
||||
from math import floor
|
||||
from pagermaid import bot
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
from random import random
|
||||
|
||||
|
||||
@listener(outgoing=True, command="pic",
|
||||
@listener(outgoing=True, command=alias_command("pic"),
|
||||
description="将你回复的静态贴纸转换为图片", parameters="<y/n>(是否发送原图,默认为n)")
|
||||
async def stickertopic(context):
|
||||
try:
|
||||
|
8
tel.py
8
tel.py
@ -1,11 +1,13 @@
|
||||
import json
|
||||
import os,sys,codecs
|
||||
import sys, codecs
|
||||
|
||||
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
|
||||
from requests import get
|
||||
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="手机号码归属地等信息查询。")
|
||||
async def tel(context):
|
||||
await context.edit("获取中 . . .")
|
||||
|
19
throwit.py
19
throwit.py
@ -9,10 +9,13 @@ from telethon.tl.functions.users import GetFullUserRequest
|
||||
from telethon.tl.types import MessageEntityMentionName
|
||||
from struct import error as StructError
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
|
||||
def crop_max_square(pil_img):
|
||||
return crop_center(pil_img, min(pil_img.size), min(pil_img.size))
|
||||
|
||||
|
||||
def crop_center(pil_img, crop_width, crop_height):
|
||||
img_width, img_height = pil_img.size
|
||||
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_height + crop_height) // 2))
|
||||
|
||||
|
||||
def mask_circle_transparent(pil_img, blur_radius, offset=0):
|
||||
offset = blur_radius * 2 + offset
|
||||
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)
|
||||
return result
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="diu",
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("diu"),
|
||||
description="生成一张 扔头像 图片,(可选:当第二个参数存在时,旋转用户头像 180°)",
|
||||
parameters="<username/uid> [随意内容]")
|
||||
async def throwit(context):
|
||||
@ -75,10 +80,10 @@ async def throwit(context):
|
||||
return
|
||||
raise exception
|
||||
photo = await context.client.download_profile_photo(
|
||||
target_user.user.id,
|
||||
"plugins/throwit/" + str(target_user.user.id) + ".jpg",
|
||||
download_big=True
|
||||
)
|
||||
target_user.user.id,
|
||||
"plugins/throwit/" + str(target_user.user.id) + ".jpg",
|
||||
download_big=True
|
||||
)
|
||||
reply_to = context.message.reply_to_msg_id
|
||||
if exists("plugins/throwit/" + str(target_user.user.id) + ".jpg"):
|
||||
if not exists('plugins/throwit/1.png'):
|
||||
@ -94,7 +99,7 @@ async def throwit(context):
|
||||
with open("plugins/throwit/3.png", "wb") as code:
|
||||
code.write(r.content)
|
||||
# 随机数生成
|
||||
randint_r = randint(1,3)
|
||||
randint_r = randint(1, 3)
|
||||
# 将头像转为圆形
|
||||
markImg = Image.open("plugins/throwit/" + str(target_user.user.id) + ".jpg")
|
||||
if randint_r == 1:
|
||||
@ -168,4 +173,4 @@ async def throwit(context):
|
||||
pass
|
||||
return
|
||||
except TypeError:
|
||||
await context.edit("此用户未设置头像或头像对您不可见。")
|
||||
await context.edit("此用户未设置头像或头像对您不可见。")
|
||||
|
@ -1,12 +1,13 @@
|
||||
import asyncio, zipfile, os
|
||||
from io import BytesIO
|
||||
from uuid import uuid4
|
||||
from os.path import exists, isfile
|
||||
from pagermaid import bot
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
|
||||
|
||||
async def make_zip(source_dir, output_filename):
|
||||
zipf = zipfile.ZipFile(output_filename, "w")
|
||||
zipf = zipfile.ZipFile(output_filename, "w")
|
||||
pre_len = len(os.path.dirname(source_dir))
|
||||
for parent, dirnames, filenames in os.walk(source_dir):
|
||||
for filename in filenames:
|
||||
@ -15,6 +16,7 @@ async def make_zip(source_dir, output_filename):
|
||||
zipf.write(pathfile, arcname)
|
||||
zipf.close()
|
||||
|
||||
|
||||
async def del_msg(context, t_lim):
|
||||
await asyncio.sleep(t_lim)
|
||||
try:
|
||||
@ -22,7 +24,8 @@ async def del_msg(context, t_lim):
|
||||
except:
|
||||
pass
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="transfer",
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("transfer"),
|
||||
description="上传 / 下载文件",
|
||||
parameters="upload <filepath>` 或 `download <filepath>")
|
||||
async def transfer(context):
|
||||
|
@ -6,11 +6,12 @@ from os.path import exists
|
||||
from re import compile as regex_compile
|
||||
from pagermaid import bot, log
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
from telethon.tl.types import DocumentAttributeVideo
|
||||
from time import sleep
|
||||
|
||||
|
||||
@listener(outgoing=True, command="vdl",
|
||||
@listener(outgoing=True, command=alias_command("vdl"),
|
||||
description="下载 YouTube/bilibili 视频并上传",
|
||||
parameters="<url>")
|
||||
async def vdl(context):
|
||||
@ -33,7 +34,8 @@ async def vdl(context):
|
||||
from pytube import YouTube
|
||||
except ImportError:
|
||||
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` 进行卸载')
|
||||
return
|
||||
url = url.replace('www.youtube.com/watch?v=', 'youtu.be/')
|
||||
|
17
weather.py
17
weather.py
@ -2,7 +2,7 @@ import json
|
||||
import datetime
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import obtain_message
|
||||
from pagermaid.utils import obtain_message, alias_command
|
||||
|
||||
icons = {
|
||||
"01d": "🌞",
|
||||
@ -25,15 +25,19 @@ icons = {
|
||||
"50n": "🌫",
|
||||
}
|
||||
|
||||
|
||||
def timestamp_to_time(timestamp, timeZoneShift):
|
||||
timeArray = datetime.datetime.utcfromtimestamp(timestamp) + datetime.timedelta(seconds=timeZoneShift)
|
||||
return timeArray.strftime("%H:%M")
|
||||
|
||||
|
||||
def calcWindDirection(windDirection):
|
||||
dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']
|
||||
ix = round(windDirection / (360. / 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="查询天气",
|
||||
parameters="<城市>")
|
||||
async def weather(context):
|
||||
@ -44,7 +48,9 @@ async def weather(context):
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
return
|
||||
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:
|
||||
data = json.loads(req.text)
|
||||
cityName = "{}, {}".format(data["name"], data["sys"]["country"])
|
||||
@ -55,7 +61,7 @@ async def weather(context):
|
||||
humidity = data["main"]["humidity"]
|
||||
windSpeed = data["wind"]["speed"]
|
||||
windDirection = calcWindDirection(data["wind"]["deg"])
|
||||
sunriseTimeunix = data["sys"]["sunrise"]
|
||||
sunriseTimeunix = data["sys"]["sunrise"]
|
||||
sunriseTime = timestamp_to_time(sunriseTimeunix, timeZoneShift)
|
||||
sunsetTimeunix = data["sys"]["sunset"]
|
||||
sunsetTime = timestamp_to_time(sunsetTimeunix, timeZoneShift)
|
||||
@ -65,7 +71,8 @@ async def weather(context):
|
||||
icon = data["weather"][0]["icon"]
|
||||
desc = data["weather"][0]["description"]
|
||||
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)
|
||||
if req.status_code == 404:
|
||||
|
11
whois.py
11
whois.py
@ -1,11 +1,11 @@
|
||||
import json
|
||||
import os,sys,codecs
|
||||
|
||||
from requests import get
|
||||
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解析服务器等。")
|
||||
async def whois(context):
|
||||
await context.edit("获取中 . . .")
|
||||
@ -17,7 +17,10 @@ async def whois(context):
|
||||
req = get("https://tenapi.cn/whois/?url=" + message)
|
||||
if req.status_code == 200:
|
||||
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)
|
||||
else:
|
||||
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
||||
|
14
xjj.py
14
xjj.py
@ -1,17 +1,17 @@
|
||||
import random
|
||||
from time import sleep
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
from os import remove
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="xjj",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("xjj"),
|
||||
description="随机小姐姐写真")
|
||||
async def ghs(context):
|
||||
await context.edit("拍小姐姐写真中 . . .")
|
||||
status = False
|
||||
for _ in range (10): #最多重试10次
|
||||
website = random.randint(0,0)
|
||||
for _ in range(10): # 最多重试10次
|
||||
website = random.randint(0, 0)
|
||||
filename = "xjj" + str(random.random())[2:] + ".png"
|
||||
try:
|
||||
if website == 0:
|
||||
@ -20,9 +20,9 @@ async def ghs(context):
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(img.content)
|
||||
await context.edit("写真我拍好辣,上传中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename,caption="小姐姐来辣~⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄)")
|
||||
await context.client.send_file(context.chat_id, filename, caption="小姐姐来辣~⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄)")
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
break # 成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
@ -38,4 +38,4 @@ async def ghs(context):
|
||||
except:
|
||||
pass
|
||||
if not status:
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有颜色搞啦!) 。")
|
||||
await context.client.send_message(context.chat_id, "出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有颜色搞啦!) 。")
|
||||
|
13
xtao-some.py
13
xtao-some.py
@ -3,12 +3,11 @@ import json, requests, re
|
||||
from urllib.parse import urlparse
|
||||
from pagermaid import bot, log
|
||||
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 os import remove
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="guess",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("guess"),
|
||||
description="能不能好好说话? - 拼音首字母缩写释义工具(需要回复一句话)")
|
||||
async def guess(context):
|
||||
reply = await context.get_reply_message()
|
||||
@ -37,7 +36,7 @@ async def guess(context):
|
||||
await context.edit("没有匹配到拼音首字母缩写")
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="wiki",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("wiki"),
|
||||
description="查询维基百科词条",
|
||||
parameters="<词组>")
|
||||
async def wiki(context):
|
||||
@ -77,7 +76,7 @@ async def wiki(context):
|
||||
await context.edit("没有匹配到相关词条")
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="ip",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("ip"),
|
||||
description="IPINFO (或者回复一句话)",
|
||||
parameters="<ip/域名>")
|
||||
async def ipinfo(context):
|
||||
@ -170,7 +169,7 @@ async def ipinfo(context):
|
||||
await context.edit('没有找到要查询的 ip/域名 ...')
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="ipping",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("ipping"),
|
||||
description="Ping (或者回复一句话)",
|
||||
parameters="<ip/域名>")
|
||||
async def ipping(context):
|
||||
@ -272,7 +271,7 @@ async def tx_t(context):
|
||||
await context.edit(result)
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="getdel",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("getdel"),
|
||||
description="获取当前群组/频道的死号数。")
|
||||
async def getdel(context):
|
||||
""" PagerMaid getdel. """
|
||||
|
3
yb-dl.py
3
yb-dl.py
@ -6,9 +6,10 @@ from youtube_dl import YoutubeDL
|
||||
from re import compile as regex_compile
|
||||
from pagermaid import bot, log
|
||||
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",
|
||||
parameters="<url>.")
|
||||
async def ybdl(context):
|
||||
|
4
zpr.py
4
zpr.py
@ -1,11 +1,11 @@
|
||||
import random
|
||||
from time import sleep
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command
|
||||
from os import remove
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="zpr",
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("zpr"),
|
||||
description="随机小姐姐或纸片人写真")
|
||||
async def ghs(context):
|
||||
await context.edit("拍小姐姐或纸片人写真中 . . .")
|
||||
|
Loading…
Reference in New Issue
Block a user