Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
Β·
aa9c445
1
Parent(s):
279ed25
trying....
Browse files- Powers/plugins/info.py +1 -1
- Powers/plugins/start.py +2 -1
- Powers/plugins/utils.py +18 -15
Powers/plugins/info.py
CHANGED
|
@@ -114,7 +114,7 @@ async def user_info(c: Gojo, user, already=False):
|
|
| 114 |
if status == enums.UserStatus.OFFLINE:
|
| 115 |
try:
|
| 116 |
last_date = datetime.fromtimestamp(user.status.date).strftime("%Y-%m-%d %H:%M:%S")
|
| 117 |
-
except Exception
|
| 118 |
last_date = "User is offline"
|
| 119 |
|
| 120 |
caption = f"""
|
|
|
|
| 114 |
if status == enums.UserStatus.OFFLINE:
|
| 115 |
try:
|
| 116 |
last_date = datetime.fromtimestamp(user.status.date).strftime("%Y-%m-%d %H:%M:%S")
|
| 117 |
+
except Exception:
|
| 118 |
last_date = "User is offline"
|
| 119 |
|
| 120 |
caption = f"""
|
Powers/plugins/start.py
CHANGED
|
@@ -3,7 +3,8 @@ from random import choice
|
|
| 3 |
from pyrogram import enums, filters
|
| 4 |
from pyrogram.enums import ChatMemberStatus as CMS
|
| 5 |
from pyrogram.enums import ChatType
|
| 6 |
-
from pyrogram.errors import MediaCaptionTooLong, MessageNotModified,
|
|
|
|
| 7 |
from pyrogram.types import (CallbackQuery, InlineKeyboardButton,
|
| 8 |
InlineKeyboardMarkup, Message)
|
| 9 |
|
|
|
|
| 3 |
from pyrogram import enums, filters
|
| 4 |
from pyrogram.enums import ChatMemberStatus as CMS
|
| 5 |
from pyrogram.enums import ChatType
|
| 6 |
+
from pyrogram.errors import (MediaCaptionTooLong, MessageNotModified,
|
| 7 |
+
QueryIdInvalid, UserIsBlocked)
|
| 8 |
from pyrogram.types import (CallbackQuery, InlineKeyboardButton,
|
| 9 |
InlineKeyboardMarkup, Message)
|
| 10 |
|
Powers/plugins/utils.py
CHANGED
|
@@ -6,7 +6,6 @@ from os import remove
|
|
| 6 |
import aiofiles
|
| 7 |
from gpytranslate import Translator
|
| 8 |
from pyrogram import enums, filters
|
| 9 |
-
from pyrogram.enums import ChatType
|
| 10 |
from pyrogram.errors import MessageTooLong
|
| 11 |
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
| 12 |
from wikipedia import summary
|
|
@@ -220,8 +219,6 @@ async def github(_, m: Message):
|
|
| 220 |
REPLY = ""
|
| 221 |
if name:
|
| 222 |
REPLY += f"<b>π§βπ» GitHub Info of {name}:</b>"
|
| 223 |
-
if bio:
|
| 224 |
-
REPLY += f"\n\n<b>π― Bio:</b> <code>{bio}</code>"
|
| 225 |
if url:
|
| 226 |
REPLY += f"\n<b>π URL:</b> <a href='{url}'>{username}</a>"
|
| 227 |
REPLY += f"\n<b>π Public Repos:</b> {public_repos}"
|
|
@@ -242,6 +239,8 @@ async def github(_, m: Message):
|
|
| 242 |
REPLY += f"\n<b>π Location:</b> <code>{location}</code>"
|
| 243 |
REPLY += f"\n<b>π« Created at:</b> <code>{created_at}</code>"
|
| 244 |
REPLY += f"\n<b>βοΈ Updated at:</b> <code>{updated_at}</code>"
|
|
|
|
|
|
|
| 245 |
|
| 246 |
if avtar:
|
| 247 |
return await m.reply_photo(photo=f"{avtar}", caption=REPLY)
|
|
@@ -251,14 +250,7 @@ async def github(_, m: Message):
|
|
| 251 |
|
| 252 |
# paste here
|
| 253 |
pattern = re.compile(r"^text/|json$|yaml$|xml$|toml$|x-sh$|x-shellscript$")
|
| 254 |
-
BASE = "https://
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
async def paste(content: str):
|
| 258 |
-
resp = await post(f"{BASE}api/v2/paste", data=content)
|
| 259 |
-
if not resp["success"]:
|
| 260 |
-
return
|
| 261 |
-
return BASE + resp["message"]
|
| 262 |
|
| 263 |
|
| 264 |
@Gojo.on_message(command("paste"))
|
|
@@ -289,15 +281,26 @@ async def paste_func(_, message: Message):
|
|
| 289 |
content = await f.read()
|
| 290 |
|
| 291 |
remove(doc)
|
| 292 |
-
|
| 293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
kb = [[InlineKeyboardButton(text="Paste Link ", url=link)]]
|
| 295 |
try:
|
| 296 |
await m.delete()
|
| 297 |
await message.reply_text("Here's your paste", reply_markup=InlineKeyboardMarkup(kb))
|
| 298 |
except Exception:
|
| 299 |
-
|
| 300 |
-
|
|
|
|
|
|
|
| 301 |
|
| 302 |
@Gojo.on_message(command("tr"))
|
| 303 |
async def tr(_, message):
|
|
|
|
| 6 |
import aiofiles
|
| 7 |
from gpytranslate import Translator
|
| 8 |
from pyrogram import enums, filters
|
|
|
|
| 9 |
from pyrogram.errors import MessageTooLong
|
| 10 |
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
| 11 |
from wikipedia import summary
|
|
|
|
| 219 |
REPLY = ""
|
| 220 |
if name:
|
| 221 |
REPLY += f"<b>π§βπ» GitHub Info of {name}:</b>"
|
|
|
|
|
|
|
| 222 |
if url:
|
| 223 |
REPLY += f"\n<b>π URL:</b> <a href='{url}'>{username}</a>"
|
| 224 |
REPLY += f"\n<b>π Public Repos:</b> {public_repos}"
|
|
|
|
| 239 |
REPLY += f"\n<b>π Location:</b> <code>{location}</code>"
|
| 240 |
REPLY += f"\n<b>π« Created at:</b> <code>{created_at}</code>"
|
| 241 |
REPLY += f"\n<b>βοΈ Updated at:</b> <code>{updated_at}</code>"
|
| 242 |
+
if bio:
|
| 243 |
+
REPLY += f"\n\n<b>π― Bio:</b> <code>{bio}</code>"
|
| 244 |
|
| 245 |
if avtar:
|
| 246 |
return await m.reply_photo(photo=f"{avtar}", caption=REPLY)
|
|
|
|
| 250 |
|
| 251 |
# paste here
|
| 252 |
pattern = re.compile(r"^text/|json$|yaml$|xml$|toml$|x-sh$|x-shellscript$")
|
| 253 |
+
BASE = "https://pasty.lus.pm/"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
|
| 255 |
|
| 256 |
@Gojo.on_message(command("paste"))
|
|
|
|
| 281 |
content = await f.read()
|
| 282 |
|
| 283 |
remove(doc)
|
| 284 |
+
resp = await post(f"{BASE}api/v2/pastes", data=content)
|
| 285 |
+
if not resp["id"]:
|
| 286 |
+
return await message.reply_text(
|
| 287 |
+
f"Failed to paste contact to report it",
|
| 288 |
+
reply_markup=InlineKeyboardMarkup(
|
| 289 |
+
[[InlineKeyboardButton("Report it here",
|
| 290 |
+
url=f"https://{SUPPORT_CHANNEL}.t.me"
|
| 291 |
+
)]]
|
| 292 |
+
)
|
| 293 |
+
,)
|
| 294 |
+
link = f"{BASE}{resp['id']}"
|
| 295 |
kb = [[InlineKeyboardButton(text="Paste Link ", url=link)]]
|
| 296 |
try:
|
| 297 |
await m.delete()
|
| 298 |
await message.reply_text("Here's your paste", reply_markup=InlineKeyboardMarkup(kb))
|
| 299 |
except Exception:
|
| 300 |
+
if link:
|
| 301 |
+
return await message.reply_text(f"Here's your paste:\n [link]({link})",)
|
| 302 |
+
return
|
| 303 |
+
|
| 304 |
|
| 305 |
@Gojo.on_message(command("tr"))
|
| 306 |
async def tr(_, message):
|