mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 07:08:18 +00:00
shift 增加白名单
This commit is contained in:
parent
76841ce561
commit
defd39485c
@ -722,7 +722,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shift",
|
"name": "shift",
|
||||||
"version": "1.0",
|
"version": "1.01",
|
||||||
"section": "daily",
|
"section": "daily",
|
||||||
"maintainer": "xtaodada",
|
"maintainer": "xtaodada",
|
||||||
"size": "5.3 kb",
|
"size": "5.3 kb",
|
||||||
|
15
shift.py
15
shift.py
@ -32,6 +32,9 @@ async def shift_set(context):
|
|||||||
except Exception:
|
except Exception:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
||||||
return
|
return
|
||||||
|
if channel in [-1001441461877]:
|
||||||
|
await context.edit('出错了呜呜呜 ~ 此对话位于白名单中。')
|
||||||
|
return
|
||||||
# 检查目标频道
|
# 检查目标频道
|
||||||
try:
|
try:
|
||||||
to = int(context.parameter[2])
|
to = int(context.parameter[2])
|
||||||
@ -41,6 +44,9 @@ async def shift_set(context):
|
|||||||
except Exception:
|
except Exception:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。")
|
||||||
return
|
return
|
||||||
|
if to in [-1001441461877]:
|
||||||
|
await context.edit('出错了呜呜呜 ~ 此对话位于白名单中。')
|
||||||
|
return
|
||||||
redis.set("shift." + str(channel), f"{to}")
|
redis.set("shift." + str(channel), f"{to}")
|
||||||
await context.edit(f"已成功配置将对话 {channel} 的新消息转发到 {to} 。")
|
await context.edit(f"已成功配置将对话 {channel} 的新消息转发到 {to} 。")
|
||||||
await log(f"已成功配置将对话 {channel} 的新消息转发到 {to} 。")
|
await log(f"已成功配置将对话 {channel} 的新消息转发到 {to} 。")
|
||||||
@ -77,6 +83,9 @@ async def shift_set(context):
|
|||||||
except Exception:
|
except Exception:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的来源对话。")
|
||||||
return
|
return
|
||||||
|
if channel in [-1001441461877]:
|
||||||
|
await context.edit('出错了呜呜呜 ~ 此对话位于白名单中。')
|
||||||
|
return
|
||||||
# 检查目标频道
|
# 检查目标频道
|
||||||
try:
|
try:
|
||||||
to = int(context.parameter[2])
|
to = int(context.parameter[2])
|
||||||
@ -86,6 +95,9 @@ async def shift_set(context):
|
|||||||
except Exception:
|
except Exception:
|
||||||
await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。")
|
await context.edit("出错了呜呜呜 ~ 无法识别的目标对话。")
|
||||||
return
|
return
|
||||||
|
if to in [-1001441461877]:
|
||||||
|
await context.edit('出错了呜呜呜 ~ 此对话位于白名单中。')
|
||||||
|
return
|
||||||
# 开始遍历消息
|
# 开始遍历消息
|
||||||
await context.edit(f'开始备份频道 {channel} 到 {to} 。')
|
await context.edit(f'开始备份频道 {channel} 到 {to} 。')
|
||||||
async for msg in context.client.iter_messages(int(channel), reverse=True):
|
async for msg in context.client.iter_messages(int(channel), reverse=True):
|
||||||
@ -107,6 +119,9 @@ async def shift_channel_message(context):
|
|||||||
return
|
return
|
||||||
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]:
|
||||||
|
await context.edit('出错了呜呜呜 ~ 此对话位于白名单中。')
|
||||||
|
return
|
||||||
cid = int(redis.get("shift." + str(context.chat_id)).decode())
|
cid = int(redis.get("shift." + str(context.chat_id)).decode())
|
||||||
try:
|
try:
|
||||||
await context.forward_to(cid)
|
await context.forward_to(cid)
|
||||||
|
Loading…
Reference in New Issue
Block a user