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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user