mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-24 00:24:11 +00:00
parent
c16a4c52c3
commit
8d75af6ff4
39
base64.py
Normal file
39
base64.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
from base64 import b64decode, b64encode
|
||||||
|
from pagermaid import version
|
||||||
|
from pagermaid.listener import listener
|
||||||
|
from pagermaid.utils import attach_log, execute, alias_command, obtain_message
|
||||||
|
|
||||||
|
@listener(outgoing=True, command=alias_command("b64e"),
|
||||||
|
description="将文本转为Base64"
|
||||||
|
,parameters="<text>")
|
||||||
|
async def b64e(context):
|
||||||
|
try:
|
||||||
|
msg = await obtain_message(context)
|
||||||
|
except:
|
||||||
|
return await context.edit("`出错了呜呜呜 ~ 无效的参数。`")
|
||||||
|
|
||||||
|
result = b64encode(msg.encode("utf-8")).decode("utf-8")
|
||||||
|
|
||||||
|
if result:
|
||||||
|
if len(result) > 4096:
|
||||||
|
return await attach_log(result, context.chat_id, "output.log", context.id)
|
||||||
|
await context.edit(f"`{result}`")
|
||||||
|
|
||||||
|
|
||||||
|
@listener(outgoing=True, command=alias_command("b64d"),
|
||||||
|
description="将Base64转为文本"
|
||||||
|
,parameters="<text>")
|
||||||
|
async def b64d(context):
|
||||||
|
try:
|
||||||
|
msg = await obtain_message(context)
|
||||||
|
except:
|
||||||
|
return await context.edit("`出错了呜呜呜 ~ 无效的参数。`")
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = b64decode(msg).decode("utf-8")
|
||||||
|
except:
|
||||||
|
return await context.edit("`出错了呜呜呜 ~ 无效的参数。`")
|
||||||
|
if result:
|
||||||
|
if len(result) > 4096:
|
||||||
|
return await attach_log(result, context.chat_id, "output.log", context.id)
|
||||||
|
await context.edit(f"`{msg}` ==> `{result}`")
|
10
list.json
10
list.json
@ -889,6 +889,16 @@
|
|||||||
"supported": true,
|
"supported": true,
|
||||||
"des-short": "查询英语单词/俚语的意思。",
|
"des-short": "查询英语单词/俚语的意思。",
|
||||||
"des": "查询英语单词/俚语的意思。\n指令:-dictionary -urbandictionary"
|
"des": "查询英语单词/俚语的意思。\n指令:-dictionary -urbandictionary"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "base64",
|
||||||
|
"version": "1.00",
|
||||||
|
"section": "chat",
|
||||||
|
"maintainer": "zhxycn,xtaodada",
|
||||||
|
"size": "1.4 kb",
|
||||||
|
"supported": true,
|
||||||
|
"des-short": "Base64编码/解码。",
|
||||||
|
"des": "Base64编码/解码。\n指令:-b64e -b64d"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user