feat: add !paste command and unit tests for 5 core plugins

Add cmd_paste to flaskpaste plugin (create paste, return URL).
Add test suites for encode, hash, defang, cidr, and dns plugins
(83 new test cases, 1093 total).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
user
2026-02-21 16:54:18 +01:00
parent 3ab85428be
commit 9abf8dce64
11 changed files with 809 additions and 7 deletions

View File

@@ -192,3 +192,33 @@ async def cmd_shorten(bot, message):
await bot.reply(message, short)
else:
await bot.reply(message, "shorten failed: no URL returned")
@command("paste", help="Create a paste: !paste <text>")
async def cmd_paste(bot, message):
"""Create a paste via FlaskPaste.
Usage:
!paste some text to paste
"""
parts = message.text.split(None, 1)
if len(parts) < 2:
await bot.reply(message, "Usage: !paste <text>")
return
content = parts[1]
base_url = _get_base_url(bot)
loop = asyncio.get_running_loop()
try:
url = await loop.run_in_executor(
None, _create_paste, base_url, content,
)
except Exception as exc:
await bot.reply(message, f"paste failed: {exc}")
return
if url:
await bot.reply(message, url)
else:
await bot.reply(message, "paste failed: no URL returned")