mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 11:26:47 +00:00
Aff插件写完辽,可以让你做一个手速爆表的Affman(意义不明的插件) (#58)
Co-authored-by: TNTcraftHIM <TNTcraftHIM@users.noreply.github.com>
This commit is contained in:
parent
10ef4c477c
commit
529fc0371d
50
aff.py
Normal file
50
aff.py
Normal file
@ -0,0 +1,50 @@
|
||||
from time import sleep
|
||||
from os.path import exists
|
||||
from os import mkdir, remove
|
||||
from pagermaid import redis, log, redis_status
|
||||
from pagermaid.listener import listener
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="aff",
|
||||
description="在别人要打算买机场的时候光速发出自己的aff信息(请尽量配合短链接)",
|
||||
parameters="<save|remove> (可选,用于保存|删除aff信息)")
|
||||
async def aff(context):
|
||||
if not context.parameter: #发送aff信息
|
||||
try:
|
||||
with open("plugins/AffExtra/aff.txt", "r") as f:
|
||||
msg = f.read()
|
||||
except:
|
||||
msg = ""
|
||||
if msg == "":
|
||||
await context.edit("出错了呜呜呜 ~ Aff消息不存在。\n(你有提前保存好嘛?)")
|
||||
return
|
||||
try:
|
||||
await context.edit(msg)
|
||||
except:
|
||||
await context.edit("出错了呜呜呜 ~ 信息无变化。")
|
||||
sleep(3)
|
||||
await context.delete()
|
||||
elif context.parameter[0] == "save": #保存aff信息
|
||||
reply = await context.get_reply_message()
|
||||
if not reply:
|
||||
await context.edit("出错了呜呜呜 ~ 请回复一条消息以保存新的Aff信息。")
|
||||
return
|
||||
msg = reply.message
|
||||
if not exists("plugins/AffExtra"):
|
||||
mkdir("plugins/AffExtra")
|
||||
with open("plugins/AffExtra/aff.txt", "w") as f:
|
||||
f.write(msg)
|
||||
await context.edit("好耶 ! Aff信息保存成功。")
|
||||
sleep(3)
|
||||
await context.delete()
|
||||
elif context.parameter[0] == "remove": #删除aff信息
|
||||
try:
|
||||
remove("plugins/AffExtra/aff.txt")
|
||||
await context.edit("好耶 ! Aff信息删除成功。")
|
||||
except:
|
||||
await context.edit("出错了呜呜呜 ~ Aff信息删除失败。")
|
||||
sleep(3)
|
||||
await context.delete()
|
||||
else:
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
sleep(3)
|
||||
await context.delete()
|
12
list.json
12
list.json
@ -305,10 +305,20 @@
|
||||
"version": "0.1",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "5.3",
|
||||
"size": "5.3 kb",
|
||||
"supported": true,
|
||||
"des-short": "下载YTB/B站视频",
|
||||
"des": "随手写的youtube/B站下载视频插件,B站的似乎因为TG编码问题不支持在线播放,先这样吧(我懒)。命令:vdl。"
|
||||
},
|
||||
{
|
||||
"name": "aff",
|
||||
"version": "1.0",
|
||||
"section": "chat",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "2.0 kb",
|
||||
"supported": true,
|
||||
"des-short": "光速发Aff信息",
|
||||
"des": "在别人要打算买机场的时候光速发出提前准备好的Aff信息与链接~ (尽量用短链接哦)。命令:aff。"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user