From 2b6d7be27b1376d438bfc4c6db7a8ca0e8afb6fc Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 7 Aug 2021 23:52:36 +0800 Subject: [PATCH] =?UTF-8?q?shift=20=E4=BF=AE=E5=A4=8D=20telethon=20?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E8=AF=86=E5=88=AB=20id=20=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.json | 2 +- shift.py | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/list.json b/list.json index db884d7..1688117 100644 --- a/list.json +++ b/list.json @@ -722,7 +722,7 @@ }, { "name": "shift", - "version": "1.02", + "version": "1.03", "section": "daily", "maintainer": "xtaodada", "size": "5.3 kb", diff --git a/shift.py b/shift.py index 1dcf8bd..32c3c00 100644 --- a/shift.py +++ b/shift.py @@ -29,14 +29,14 @@ async def shift_set(context): if not channel.broadcast: await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。") return - channel = channel.id + channel = int(f'-100{channel.id}') except Exception: try: channel = await context.client.get_entity(context.parameter[1]) if not channel.broadcast: await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。") return - channel = channel.id + channel = int(f'-100{channel.id}') except Exception: await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。") return @@ -48,7 +48,11 @@ async def shift_set(context): to = int(context.parameter[2]) except Exception: try: - to = (await context.client.get_entity(context.parameter[2])).id + to = await context.client.get_entity(context.parameter[2]) + if to.broadcast or to.gigagroup or to.megagroup: + to = int(f'-100{to.id}') + else: + to = to.id except Exception: await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。") return @@ -68,6 +72,8 @@ async def shift_set(context): except Exception: try: channel = (await context.client.get_entity(context.parameter[1])).id + if channel.broadcast or channel.gigagroup or channel.megagroup: + channel = int(f'-100{channel.id}') except Exception: await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。") return @@ -88,14 +94,14 @@ async def shift_set(context): if not channel.broadcast: await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。") return - channel = channel.id + channel = int(f'-100{channel.id}') except Exception: try: channel = await context.client.get_entity(context.parameter[1]) if not channel.broadcast: await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。") return - channel = channel.id + channel = int(f'-100{channel.id}') except Exception: await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。") return @@ -107,7 +113,11 @@ async def shift_set(context): to = int(context.parameter[2]) except Exception: try: - to = (await context.client.get_entity(context.parameter[2])).id + to = await context.client.get_entity(context.parameter[2]) + if to.broadcast or to.gigagroup or to.megagroup: + to = int(f'-100{to.id}') + else: + to = to.id except Exception: await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。") return