From 744211ddfc45b6c4ca9983565dcce91d4f8d1da3 Mon Sep 17 00:00:00 2001 From: b miao Date: Thu, 27 Aug 2020 18:33:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=8F=97=E5=90=AF=E5=8F=91,=E5=86=99?= =?UTF-8?q?=E4=BA=86=E4=B8=AA=E6=89=AC=E7=BE=A4=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- killallmembers.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++ list.json | 10 ++++++++++ 2 files changed, 59 insertions(+) create mode 100644 killallmembers.py diff --git a/killallmembers.py b/killallmembers.py new file mode 100644 index 0000000..c074c27 --- /dev/null +++ b/killallmembers.py @@ -0,0 +1,49 @@ +from pagermaid import bot, log +from pagermaid.listener import listener +from asyncio import sleep +from telethon.tl.types import ChannelParticipantsAdmins +from telethon.tl.functions.channels import EditBannedRequest +from telethon.tl.types import ChatBannedRights + +@listener(is_plugin=True, outgoing=True, command="killallmembers", + description="⚠⚠慎用! 一件扬了群内所有成员⚠⚠") +async def killallmembers(context): + await context.edit('正在准备扬了这个破群的所有人...') + chat = await context.get_chat() + if not context.is_group: + await context.edit('发生错误,请在群组中运行本命令。') + await sleep(10) + await context.delete() + return False + else: + try: + chat = await context.get_chat() + admins = await context.client.get_participants(chat, filter=ChannelParticipantsAdmins) + users = await context.client.get_participants(chat) + admins_ids = [a.id for a in admins] + users_ids = [u.id for u in users] + users_wo_admins = list(set(users_ids).difference(set(admins_ids))) + except: + await context.edit('发生错误,无法获取本群名单。') + await sleep(10) + await context.delete() + return False + + if context.sender.id in admins_ids: + i = 0 + for user_id in users_wo_admins: + try: + await bot.edit_permissions(context.chat_id, user_id, view_messages=False) + i += 1 + await context.edit(f'进度:{i}/{len(users_wo_admins)}') + await sleep(.5) + except: + await context.edit('发生错误') + await sleep(10) + await context.delete() + await sleep(5) + await context.delete() + else: + await context.edit('你又不是管理员,你在这儿干个屁?') + await sleep(10) + await context.delete() \ No newline at end of file diff --git a/list.json b/list.json index 1711182..cb4cd1c 100644 --- a/list.json +++ b/list.json @@ -289,6 +289,16 @@ "supported": true, "des-short": "网易云点歌", "des": "可以在线搜索并且快速点歌,歌曲信息齐全,支持直接回复点歌。命令:nem。" + }, + { + "name": "killallmembers", + "version": "1.0", + "section": "chat", + "maintainer": "Pentacene", + "size": "idk", + "supported": true, + "des-short": "一键扬了群", + "des": "⚠⚠慎用! 一件扬了群内所有成员⚠⚠" } ] } From 5c48bd4626b4a05e50f7d6e00d835ef08201e50c Mon Sep 17 00:00:00 2001 From: b miao Date: Fri, 28 Aug 2020 22:26:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?atadmins=5Fatall=20=E5=8F=AA=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E8=87=AA=E5=B7=B1=E4=B8=8D=E5=93=8D=E5=BA=94=E5=88=AB?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- atadmins_atall.py | 4 ++-- list.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/atadmins_atall.py b/atadmins_atall.py index 44a47f5..598995d 100644 --- a/atadmins_atall.py +++ b/atadmins_atall.py @@ -6,7 +6,7 @@ from os import remove import re import time -@listener(is_plugin=True, incoming=True, outgoing=True, command="atadmins", +@listener(is_plugin=True, outgoing=True, command="atadmins", description="一键 AT 本群管理员(仅在群组中有效)", parameters="<要说的话>") async def atadmins(context): @@ -34,7 +34,7 @@ async def atadmins(context): # await context.reply(' , '.join(admin_list)) await context.delete() -@listener(is_plugin=True, incoming=True, outgoing=True, command="atall", +@listener(is_plugin=True, outgoing=True, command="atall", description="一键 AT 本群成员(仅在群组中有效)") async def atall(context): await context.edit('正在获取成员列表中...') diff --git a/list.json b/list.json index 350b1ec..817a879 100644 --- a/list.json +++ b/list.json @@ -112,7 +112,7 @@ }, { "name": "atadmins_atall", - "version": "1.1", + "version": "1.11", "section": "chat", "maintainer": "Pentacene", "size": "2.5 kb", From 3d7b7592a4e2e67a7b949691f3d3c6b8c5941f79 Mon Sep 17 00:00:00 2001 From: AAA <35992542+TNTcraftHIM@users.noreply.github.com> Date: Sat, 29 Aug 2020 19:07:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?NeteaseMusic=E4=BF=AE=E5=A4=8D=E4=BA=86bug?= =?UTF-8?q?=20(#45)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: TNTcraftHIM --- list.json | 4 ++-- neteasemusic.py | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/list.json b/list.json index a2ff67b..e24fedd 100644 --- a/list.json +++ b/list.json @@ -282,10 +282,10 @@ }, { "name": "neteasemusic", - "version": "2.7", + "version": "2.8", "section": "daily", "maintainer": "TNTcraftHIM", - "size": "24.3 kb", + "size": "25.3 kb", "supported": true, "des-short": "网易云点歌", "des": "可以在线搜索并且快速点歌,歌曲信息齐全,支持直接回复点歌。命令:nem。" diff --git a/neteasemusic.py b/neteasemusic.py index 1bf7801..6e6e09d 100644 --- a/neteasemusic.py +++ b/neteasemusic.py @@ -14,7 +14,8 @@ from os.path import exists from collections import defaultdict from telethon.tl.types import DocumentAttributeAudio -class RetryError(Exception): #重试错误,用于再次重试 + +class RetryError(Exception): # 重试错误,用于再次重试 pass @@ -26,7 +27,8 @@ async def nem(context): 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://192.210.137.108:8080', 'https': 'http://192.210.137.108:8080'}, {'http': 'http://music.lolico.me:39000', 'https': 'http://music.lolico.me:39000'}, {'http': 'http://aimer.one:2333', 'https': 'http://aimer.one:2333'}, {'http': 'http://fs2.ilogic.net.cn:5200','https': 'http://fs2.ilogic.net.cn:5200'}, {'http': 'http://64.64.250.246:8080', 'https': 'http://64.64.250.246:8080'}] + proxy = [{'http': 'http://192.210.137.108:8080', 'https': 'http://192.210.137.108:8080'}, {'http': 'http://music.lolico.me:39000', 'https': 'http://music.lolico.me:39000'}, {'http': 'http://aimer.one:2333', + 'https': 'http://aimer.one:2333'}, {'http': 'http://fs2.ilogic.net.cn:5200', 'https': 'http://fs2.ilogic.net.cn:5200'}, {'http': 'http://64.64.250.246:8080', 'https': 'http://64.64.250.246:8080'}] if len(context.parameter) < 2: await context.edit("**使用方法:** `-nem` `<指令>` `<关键词>`\n\n指令s为搜索,p为点歌,id为歌曲ID点歌\n搜索灰色歌曲请给出歌手\n可回复搜索结果消息`-nem` `p` `<歌曲数字序号>`点歌") return @@ -144,7 +146,8 @@ async def nem(context): proxies = proxy[proxynum] proxynum += 1 if idplay: # 指定ID播放 - url = "http://music.163.com/api/song/detail?id="+ idplay +"&ids=[" + idplay + "]" + url = "http://music.163.com/api/song/detail?id=" + \ + idplay + "&ids=[" + idplay + "]" # 搜索后播放 req = requests.request("GET", url, headers=headers) if req.status_code == 200: @@ -189,6 +192,7 @@ async def nem(context): name = info['title'].replace('/', " ") + ".mp3" if ccimported: # 尝试使用高清音质下载 songid = str(info['id']) + class WangyiyunDownload(object): def __init__(self): self.key = '0CoJUm6Qyw8W8jud' @@ -329,7 +333,7 @@ async def nem(context): try: content = requests.get( url=real_url, headers=self.headers).content - with open(file, 'wb') as fp: + with open(file, 'wb', encoding='utf8') as fp: fp.write(content) except: print('服务器连接出错') @@ -368,7 +372,7 @@ async def nem(context): ';', ', ') + " - " + "**" + info['title'] + "**" if ccimported is False: - with open(name, 'wb') as f: + with open(name, 'wb', encoding='utf8') as f: f.write(music.content) if (path.getsize(name) / 1024) < 100: remove(name) @@ -383,14 +387,16 @@ async def nem(context): ' 这里 ' + '' + '前往网页版收听' await bot.send_message(context.chat_id, f"【{info['title']}】\n" + "歌曲获取失败,资源获取可能受限,你可以再次尝试。\n" + res, parse_mode='html', link_preview=True) return + duration = 0 if imported is True: await context.edit(f"{title}信息导入中 . . .") try: imagedata = requests.get( info['albumpic'], headers=headers).content except: - await bot.send_message(context.chat_id, '唔 ~ 封面好像获取失败了呢,不要在意不要在意 ~ ') + await bot.send_message(context.chat_id, '唔 封面好像获取失败了呢,不要在意不要在意 ~ ') tag = eyed3.load(name) + duration = int(tag.info.time_secs) tag.initTag() tag = tag.tag tag.artist = info['artist'] @@ -417,7 +423,7 @@ async def nem(context): link_preview=False, force_document=False, attributes=(DocumentAttributeAudio( - 0, False, info['title'], info['artist']),) + duration, False, info['title'], info['artist']),) ) try: if reply.sender.is_self: