refactor: remove !paste command, keep as internal helper

Paste creation is only used internally by the bot for multi-line
output. The create_paste() helper remains importable by other plugins.
This commit is contained in:
user
2026-02-16 23:17:53 +01:00
parent 546570d21b
commit c92fdbfc30
3 changed files with 1 additions and 48 deletions

View File

@@ -276,11 +276,11 @@ VT rate limit: 4 req/min. Email check: max 5, admin only.
## FlaskPaste
```
!paste some text here # Create paste, get URL
!shorten https://long-url.com/x # Shorten URL
```
Auto-shortens URLs in `!alert` announcements and history when plugin is loaded.
Paste helper used internally for multi-line bot output.
Config: `[flaskpaste]` in `config/derp.toml` or `FLASKPASTE_URL` env var.
### Data Setup

View File

@@ -131,7 +131,6 @@ format = "text" # Log format: "text" (default) or "json"
| `!abuse <ip> report <cats> <comment>` | Report IP to AbuseIPDB (admin) |
| `!vt <hash\|ip\|domain\|url>` | VirusTotal lookup |
| `!emailcheck <email> [email2 ...]` | SMTP email verification (admin) |
| `!paste <text>` | Create a paste on FlaskPaste |
| `!shorten <url>` | Shorten a URL via FlaskPaste |
### Command Shorthand
@@ -848,24 +847,6 @@ bad@example.com -- SMTP 550 User unknown (mx: mail.example.com)
- 15-second timeout per connection
- Max 5 emails per invocation
### `!paste` -- Create Paste
Upload text to FlaskPaste and get a shareable URL.
```
!paste some long text here
```
Output format:
```
https://paste.mymx.me/abc12345
```
- mTLS client cert skips PoW; falls back to PoW challenge if no cert
- Content sent as JSON body to FlaskPaste API
- Raw content available at `<paste_url>/raw`
### `!shorten` -- Shorten URL
Shorten a URL via FlaskPaste's URL shortener.

View File

@@ -151,34 +151,6 @@ def create_paste(bot, content: str) -> str | None:
# -- Commands ----------------------------------------------------------------
@command("paste", help="Create a paste: !paste <text>")
async def cmd_paste(bot, message):
"""Create a paste on FlaskPaste and return the URL.
Usage:
!paste some long text here
"""
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")
@command("shorten", help="Shorten a URL: !shorten <url>")
async def cmd_shorten(bot, message):
"""Shorten a URL via FlaskPaste.