shift update

This commit is contained in:
xtaodada 2021-08-06 23:35:52 +08:00
parent defd39485c
commit 2f8929c3e1
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 21 additions and 6 deletions

View File

@ -722,7 +722,7 @@
}, },
{ {
"name": "shift", "name": "shift",
"version": "1.01", "version": "1.02",
"section": "daily", "section": "daily",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "5.3 kb", "size": "5.3 kb",

View File

@ -25,10 +25,18 @@ async def shift_set(context):
return return
# 检查来源频道 # 检查来源频道
try: try:
channel = int(context.parameter[1]) channel = await context.client.get_entity(int(context.parameter[1]))
if not channel.broadcast:
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
return
channel = channel.id
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])
if not channel.broadcast:
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
return
channel = channel.id
except Exception: except Exception:
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。") await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
return return
@ -76,10 +84,18 @@ async def shift_set(context):
return return
# 检查来源频道 # 检查来源频道
try: try:
channel = int(context.parameter[1]) channel = await context.client.get_entity(int(context.parameter[1]))
if not channel.broadcast:
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
return
channel = channel.id
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])
if not channel.broadcast:
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
return
channel = channel.id
except Exception: except Exception:
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。") await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
return return
@ -120,7 +136,6 @@ async def shift_channel_message(context):
if not redis.get("shift." + str(context.chat_id)): if not redis.get("shift." + str(context.chat_id)):
return return
if context.chat_id in [-1001441461877]: if context.chat_id in [-1001441461877]:
await context.edit('出错了呜呜呜 ~ 此对话位于白名单中。')
return return
cid = int(redis.get("shift." + str(context.chat_id)).decode()) cid = int(redis.get("shift." + str(context.chat_id)).decode())
try: try: