diff --git a/misskaty/plugins/dev.py b/misskaty/plugins/dev.py
index 0319a774..d17c4afb 100644
--- a/misskaty/plugins/dev.py
+++ b/misskaty/plugins/dev.py
@@ -158,11 +158,11 @@ async def update_restart(_, message):
out = (await shell_exec("git pull"))[0]
if "Already up to date." in str(out):
return await message.reply_text("Its already up-to date!")
- await message.reply_text(f"```{out}```")
+ await message.reply_text(f"{out}")
except Exception as e:
return await message.reply_text(str(e))
await message.reply_text(
- "**Updated with default branch, restarting now.**"
+ "Updated with default branch, restarting now."
)
os.execvp(sys.executable, [sys.executable, "-m", "misskaty"])
diff --git a/misskaty/plugins/inline_search.py b/misskaty/plugins/inline_search.py
index e57d4836..38553398 100644
--- a/misskaty/plugins/inline_search.py
+++ b/misskaty/plugins/inline_search.py
@@ -1,4 +1,5 @@
import json
+import re
import traceback
from sys import platform
from sys import version as pyver
@@ -137,6 +138,9 @@ async def inline_menu(_, inline_query: InlineQuery):
switch_pm_parameter="inline",
)
userr = inline_query.query.split(None, 1)[1].strip()
+ if "t.me" in userr:
+ r = re.search(r"t.me/(\w+)", userr)
+ userr = r[1]
try:
diaa = await app.get_users(userr)
except Exception: # pylint: disable=broad-except
@@ -152,7 +156,7 @@ async def inline_menu(_, inline_query: InlineQuery):
msg += f"🌏 DC: {diaa.dc_id}\n"
msg += f"✨ Premium: {diaa.is_premium}\n"
msg += f"⭐️ Verified: {diaa.is_verified}\n"
- msg += f"🤖 Verified: {diaa.is_bot}\n"
+ msg += f"🤖 Bot: {diaa.is_bot}\n"
if diaa.language_code:
msg += f"🇮🇩 Language: {diaa.language_code}"
results = [
diff --git a/misskaty/plugins/paste.py b/misskaty/plugins/paste.py
index 231bb149..20e16b8b 100644
--- a/misskaty/plugins/paste.py
+++ b/misskaty/plugins/paste.py
@@ -19,7 +19,8 @@ from misskaty.vars import COMMAND_HANDLER
__MODULE__ = "Paste"
__HELP__ = """
-/paste [Text/Reply To Message] - Post text to Spacebin.
+/paste [Text/Reply To Message] - Post text to My Pastebin.
+/sbin [Text/Reply To Message] - Post text to Spacebin.
/neko [Text/Reply To Message] - Post text to Nekobin.
/rentry [Text/Reply To Message] - Post text to Rentry using markdown style.
/temp_paste [Text/Reply To Message] - Post text to tempaste.com using html style.
@@ -62,6 +63,71 @@ def humanbytes(size: int):
# Pattern if extension supported, PR if want to add more
pattern = compiles(r"^text/|json$|yaml$|xml$|toml$|x-sh$|x-shellscript$|x-subrip$")
+# Default Paste to Wastebin using Deta
+@app.on_message(filters.command(["paste"], COMMAND_HANDLER))
+async def wastepaste(_, message):
+ reply = message.reply_to_message
+ target = str(message.command[0]).split("@", maxsplit=1)[0]
+ if not reply and len(message.command) < 2:
+ return await message.reply_text(f"**Reply To A Message With /{target} or with command**")
+
+ msg = await message.reply_text("`Pasting to Wastebin...`")
+ data = ""
+ limit = 1024 * 1024
+ if reply and reply.document:
+ if reply.document.file_size > limit:
+ return await msg.edit(f"**You can only paste files smaller than {humanbytes(limit)}.**")
+ if not pattern.search(reply.document.mime_type):
+ return await msg.edit("**Only text files can be pasted.**")
+ file = await reply.download()
+ try:
+ with open(file, "r") as text:
+ data = text.read()
+ remove(file)
+ except UnicodeDecodeError:
+ try:
+ remove(file)
+ except:
+ pass
+ return await msg.edit("`File Not Supported !`")
+ elif reply and (reply.text or reply.caption):
+ data = reply.text.markdown or reply.caption.markdown
+ elif not reply and len(message.command) >= 2:
+ data = message.text.split(None, 1)[1]
+
+ if message.from_user:
+ if message.from_user.username:
+ uname = f"@{message.from_user.username}"
+ else:
+ uname = f"[{message.from_user.first_name}](tg://user?id={message.from_user.id})"
+ else:
+ uname = message.sender_chat.title
+
+ try:
+ json_data = {
+ "content": data,
+ "highlighting_language": "auto",
+ "ephemeral": False,
+ "expire_at": 0,
+ "expire_in": 0,
+ "date_created": 0,
+ }
+ response = await http.post('https://yasirbin.deta.dev/api/new', json=json_data)
+ url = f"https://yasirbin.deta.dev/{response.json()['id']}"
+ except Exception as e:
+ await msg.edit(f"ERROR: {e}")
+ return
+
+ if not url:
+ return await msg.edit("Text Too Short Or File Problems")
+ button = [
+ [InlineKeyboardButton("Open Link", url=url)],
+ [InlineKeyboardButton("Share Link", url=f"https://telegram.me/share/url?url={url}")],
+ ]
+
+ pasted = f"**Successfully pasted your data to Nekobin.\n\nPaste by {uname}**"
+ await msg.edit(pasted, reply_markup=InlineKeyboardMarkup(button))
+
# Nekobin Paste
@app.on_message(filters.command(["neko"], COMMAND_HANDLER))
async def nekopaste(_, message):
@@ -116,11 +182,11 @@ async def nekopaste(_, message):
[InlineKeyboardButton("Share Link", url=f"https://telegram.me/share/url?url={url}")],
]
- pasted = f"**Successfully pasted your data to Spacebin.\n\nPaste by {uname}**"
+ pasted = f"**Successfully pasted your data to Nekobin.\n\nPaste by {uname}**"
await msg.edit(pasted, reply_markup=InlineKeyboardMarkup(button))
-# Default as spacebin
-@app.on_message(filters.command(["paste"], COMMAND_HANDLER))
+# Paste as spacebin
+@app.on_message(filters.command(["sbin"], COMMAND_HANDLER))
async def spacebinn(_, message):
reply = message.reply_to_message
target = str(message.command[0]).split("@", maxsplit=1)[0]