fix some bugs

This commit is contained in:
xtaodada 2021-07-15 16:12:49 +08:00
parent 8271821071
commit 8619b795a7
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
7 changed files with 44 additions and 18 deletions

View File

@ -41,6 +41,9 @@ async def private_autorespond(context):
@listener(incoming=True)
async def mention_autorespond(context):
if persistent_vars['autorespond']['enabled']:
try:
if context.message.mentioned and not (await context.get_sender()).bot:
persistent_vars['autorespond']['amount'] += 1
await context.reply(persistent_vars['autorespond']['message'])
except AttributeError:
return

6
bin.py
View File

@ -1,7 +1,9 @@
import json, requests
from json.decoder import JSONDecodeError
from pagermaid.listener import listener
from pagermaid.utils import obtain_message, alias_command
@listener(is_plugin=True, outgoing=True, command=alias_command("bin"),
description="查询信用卡信息",
parameters="<bin4到8位数字>")
@ -24,7 +26,11 @@ async def card(context):
await context.edit("出错了呜呜呜 ~ 每分钟限额超过,请等待一分钟再试")
return
try:
bin_json = json.loads(r.content.decode("utf-8"))
except JSONDecodeError:
await context.edit("出错了呜呜呜 ~ 无效的参数。")
return
msg_out = []
msg_out.extend(["BIN" + card_bin])

View File

@ -1,8 +1,7 @@
from pagermaid.listener import listener
from pagermaid.utils import alias_command
from telethon.tl.types import ChannelParticipantsAdmins
from telethon.errors.rpcerrorlist import UserAdminInvalidError
from telethon.errors.rpcerrorlist import FloodWaitError
from telethon.errors.rpcerrorlist import UserAdminInvalidError, ChatAdminRequiredError, FloodWaitError
from asyncio import sleep
from random import uniform
@ -71,6 +70,9 @@ async def fuck_member(context):
except UserAdminInvalidError:
await context.edit('无管理员权限,停止查询。')
return
except ChatAdminRequiredError:
await context.edit('无管理员权限,停止查询。')
return
if msg == 1:
msg = 0
else:
@ -82,13 +84,16 @@ async def fuck_member(context):
# Wait flood secs
await context.edit(f'触发 Flood ,暂停 {e.seconds + uniform(0.5, 1.0)} 秒。')
try:
sleep(e.seconds + uniform(0.5, 1.0))
await sleep(e.seconds + uniform(0.5, 1.0))
except Exception as e:
print(f"Wait flood error: {e}")
return
except UserAdminInvalidError:
await context.edit('无管理员权限,停止查询。')
return
except ChatAdminRequiredError:
await context.edit('无管理员权限,停止查询。')
return
# 每一百人修改一次
if members == 100:
members_count += 1

View File

@ -2,7 +2,7 @@
"list": [
{
"name": "autorespond",
"version": "0.21",
"version": "0.211",
"section": "chat",
"maintainer": "xtaodada",
"size": "1.9 kb",
@ -292,7 +292,7 @@
},
{
"name": "neteasedown",
"version": "1.12",
"version": "1.121",
"section": "daily",
"maintainer": "xtaodada",
"size": "15.6 kb",
@ -492,7 +492,7 @@
},
{
"name": "rape",
"version": "1.03",
"version": "1.031",
"section": "chat",
"maintainer": "Pentacene",
"size": "4.0 kb",
@ -582,7 +582,7 @@
},
{
"name": "bin",
"version": "1.0",
"version": "1.01",
"section": "daily",
"maintainer": "paulkm",
"size": "1.8 kb",
@ -592,7 +592,7 @@
},
{
"name": "fuckmember",
"version": "1.03",
"version": "1.031",
"section": "daily",
"maintainer": "xtaodada",
"size": "3.0 kb",
@ -602,7 +602,7 @@
},
{
"name": "unbanby",
"version": "1.0",
"version": "1.01",
"section": "daily",
"maintainer": "xtaodada",
"size": "2.8 kb",

View File

@ -236,7 +236,7 @@ async def ned(context):
await context.edit("**使用方法:** `-ned` `<关键词/id>`")
return
else:
if not eyed3_imported and not cc_imported:
if not eyed3_imported or not cc_imported:
try:
await context.edit("支持库 `eyed3` `PyCryptodome` 未安装...\n正在尝试自动安装...")
await execute(f'{executable} -m pip install eyed3')
@ -254,6 +254,7 @@ async def ned(context):
return
except:
return
return
type = 'keyword'
id = context.parameter[0]
# 测试是否为 id

View File

@ -9,6 +9,7 @@
from datetime import timedelta
from telethon.tl.types import ChannelParticipantsAdmins
from telethon.errors.rpcerrorlist import ChatAdminRequiredError
from pagermaid.listener import listener
from pagermaid.utils import alias_command
@ -29,7 +30,15 @@ async def rape(context):
context_last_name = context.sender.last_name
admins = await context.client.get_participants(context.chat, filter=ChannelParticipantsAdmins)
if context.sender in admins:
user = admins[admins.index(context.sender)]
if not user.participant.admin_rights.ban_users:
await context.edit('无封禁用户权限。')
return
try:
await context.client.kick_participant(context.chat_id, reply.sender.id)
except ChatAdminRequiredError:
await context.edit('无管理员权限。')
return
await context.client.send_message(
context.chat_id,
f'[{reply.sender.first_name} {reply_last_name}](tg://user?id={reply.sender.id}) 已被移出群聊',

View File

@ -1,8 +1,7 @@
from pagermaid.listener import listener
from pagermaid.utils import alias_command
from telethon.tl.types import ChannelParticipantsKicked, ChannelParticipantsAdmins
from telethon.errors.rpcerrorlist import UserAdminInvalidError
from telethon.errors.rpcerrorlist import FloodWaitError
from telethon.errors.rpcerrorlist import UserAdminInvalidError, ChatAdminRequiredError, FloodWaitError
from asyncio import sleep
from random import uniform
@ -53,6 +52,9 @@ async def unban_by_bot(context):
except UserAdminInvalidError:
await context.edit('无管理员权限,停止查询。')
return
except ChatAdminRequiredError:
await context.edit('无管理员权限,停止查询。')
return
# 每一百人修改一次
if members == 100:
members_count += 1