fix some bug

This commit is contained in:
xtaodada 2021-06-19 15:15:43 +08:00
parent 436eaac281
commit e38b747347
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
7 changed files with 34 additions and 15 deletions

View File

@ -12,6 +12,7 @@ from os.path import exists
from asyncio import sleep
from random import randint
import yaml
from telethon.errors.rpcerrorlist import StickersetInvalidError
from telethon.tl.custom.message import Message
from telethon.tl.functions.messages import GetAllStickersRequest
from telethon.tl.functions.messages import GetStickerSetRequest
@ -239,10 +240,14 @@ async def process_message(context):
pass
if reply and reply_user_id == me.id:
stickers = await context.client(
GetStickerSetRequest(
stickerset=InputStickerSetID(
id=_sticker_id, access_hash=_sticker_hash)))
try:
stickers = await context.client(
GetStickerSetRequest(
stickerset=InputStickerSetID(
id=_sticker_id, access_hash=_sticker_hash)))
except StickersetInvalidError:
await log('配置错误。')
return
try:
i = randint(0, len(_num) - 1)
sticker = await context.client.send_file(

View File

@ -60,7 +60,11 @@ async def fuck(context):
if context.arguments == '':
return
else:
userid = int(context.arguments)
try:
userid = int(context.arguments)
except ValueError:
await context.edit('输入值错误。')
return
admins = await context.client.get_participants(context.chat, filter=ChannelParticipantsAdmins)
if context.sender in admins:
try:

View File

@ -35,7 +35,7 @@ async def killallmembers(context):
await context.delete()
return False
if (not is_channel) and (context.sender.id not in admins_ids):
if (not is_channel) and (context.sender_id not in admins_ids):
await context.edit('你又不是管理员,你在这儿干个屁?')
await sleep(10)
await context.delete()

View File

@ -62,7 +62,7 @@
},
{
"name": "xtao-some",
"version": "1.201",
"version": "1.202",
"section": "daily",
"maintainer": "xtaodada",
"size": "18.8 kb",
@ -152,7 +152,7 @@
},
{
"name": "portball",
"version": "1.43",
"version": "1.44",
"section": "chat",
"maintainer": "Pentacene",
"size": "2.8 kb",
@ -292,7 +292,7 @@
},
{
"name": "killallmembers",
"version": "1.11",
"version": "1.12",
"section": "chat",
"maintainer": "Pentacene",
"size": "idk",
@ -362,7 +362,7 @@
},
{
"name": "autoreplysticker",
"version": "1.22",
"version": "1.23",
"section": "chat",
"maintainer": "Pentacene",
"size": "12 kb",
@ -392,7 +392,7 @@
},
{
"name": "transfer",
"version": "1.01",
"version": "1.02",
"section": "daily",
"maintainer": "c3b2a",
"size": "2.7 kb",
@ -492,7 +492,7 @@
},
{
"name": "fuck",
"version": "1.01",
"version": "1.02",
"section": "chat",
"maintainer": "Pentacene",
"size": "4.0 kb",

View File

@ -14,7 +14,7 @@ async def portball(context):
reply = await context.get_reply_message()
if reply:
action = context.arguments.split()
if reply.sender.last_name == None:
if reply.sender.last_name is None:
last_name = ''
else:
last_name = reply.sender.last_name
@ -60,6 +60,10 @@ async def portball(context):
notification = await bot.send_message(context.chat_id, '错误:我没有管理员权限或我的权限比被封禁的人要小', reply_to=context.id)
await sleep(10)
await notification.delete()
except OverflowError:
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)

View File

@ -57,7 +57,11 @@ async def transfer(context):
message = await context.get_reply_message()
if message and message.media:
_file = BytesIO()
await bot.download_file(message.media.document, _file)
try:
await bot.download_file(message.media.document, _file)
except AttributeError:
await context.edit('无法下载此类型的文件。')
return
if not exists(file_list[0]):
with open(file_list[0], "wb") as f:
f.write(_file.getvalue())

View File

@ -5,7 +5,7 @@ from pagermaid import bot, log
from pagermaid.listener import listener, config
from pagermaid.utils import clear_emojis, obtain_message, attach_log, alias_command
from telethon.errors import ChatAdminRequiredError
from telethon.errors.rpcerrorlist import FloodWaitError
from telethon.errors.rpcerrorlist import FloodWaitError, UserAdminInvalidError
from telethon.tl.types import ChannelParticipantsAdmins, ChannelParticipantsBots, ChannelParticipantAdmin
@ -300,6 +300,8 @@ async def getdel(context):
except FloodWaitError:
await context.edit('处理失败,您已受到 TG 服务器限制。')
return
except UserAdminInvalidError:
pass
if need_kick and parameter:
await context.edit(f'此频道/群组的死号数:`{member_count}`,并且已经清理完毕。')
else: