mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 06:32:47 +00:00
shift 修复 telethon 错误识别 id 的问题
This commit is contained in:
parent
2f8929c3e1
commit
2b6d7be27b
@ -722,7 +722,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shift",
|
"name": "shift",
|
||||||
"version": "1.02",
|
"version": "1.03",
|
||||||
"section": "daily",
|
"section": "daily",
|
||||||
"maintainer": "xtaodada",
|
"maintainer": "xtaodada",
|
||||||
"size": "5.3 kb",
|
"size": "5.3 kb",
|
||||||
|
22
shift.py
22
shift.py
@ -29,14 +29,14 @@ async def shift_set(context):
|
|||||||
if not channel.broadcast:
|
if not channel.broadcast:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
||||||
return
|
return
|
||||||
channel = channel.id
|
channel = int(f'-100{channel.id}')
|
||||||
except Exception:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
channel = await context.client.get_entity(context.parameter[1])
|
channel = await context.client.get_entity(context.parameter[1])
|
||||||
if not channel.broadcast:
|
if not channel.broadcast:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
||||||
return
|
return
|
||||||
channel = channel.id
|
channel = int(f'-100{channel.id}')
|
||||||
except Exception:
|
except Exception:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
||||||
return
|
return
|
||||||
@ -48,7 +48,11 @@ async def shift_set(context):
|
|||||||
to = int(context.parameter[2])
|
to = int(context.parameter[2])
|
||||||
except Exception:
|
except Exception:
|
||||||
try:
|
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:
|
except Exception:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。")
|
||||||
return
|
return
|
||||||
@ -68,6 +72,8 @@ async def shift_set(context):
|
|||||||
except Exception:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
channel = (await context.client.get_entity(context.parameter[1])).id
|
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:
|
except Exception:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
||||||
return
|
return
|
||||||
@ -88,14 +94,14 @@ async def shift_set(context):
|
|||||||
if not channel.broadcast:
|
if not channel.broadcast:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
||||||
return
|
return
|
||||||
channel = channel.id
|
channel = int(f'-100{channel.id}')
|
||||||
except Exception:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
channel = await context.client.get_entity(context.parameter[1])
|
channel = await context.client.get_entity(context.parameter[1])
|
||||||
if not channel.broadcast:
|
if not channel.broadcast:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
||||||
return
|
return
|
||||||
channel = channel.id
|
channel = int(f'-100{channel.id}')
|
||||||
except Exception:
|
except Exception:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
||||||
return
|
return
|
||||||
@ -107,7 +113,11 @@ async def shift_set(context):
|
|||||||
to = int(context.parameter[2])
|
to = int(context.parameter[2])
|
||||||
except Exception:
|
except Exception:
|
||||||
try:
|
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:
|
except Exception:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user