Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
d5a4401
1
Parent(s):
47a10d1
now fine...
Browse files- Powers/__init__.py +0 -14
- Powers/__main__.py +0 -1
- Powers/bot_class.py +0 -1
- Powers/plugins/birthday.py +3 -4
- Powers/plugins/clean_db.py +4 -5
- Powers/plugins/utils.py +11 -11
- Powers/plugins/web_con.py +52 -53
- Powers/utils/web_helpers.py +0 -26
- requirements.txt +0 -1
Powers/__init__.py
CHANGED
@@ -13,7 +13,6 @@ from traceback import format_exc
|
|
13 |
import lyricsgenius
|
14 |
import pyrogram
|
15 |
import pytz
|
16 |
-
from telegraph import Telegraph
|
17 |
|
18 |
LOG_DATETIME = datetime.now().strftime("%d_%m_%Y-%H_%M_%S")
|
19 |
LOGDIR = f"{__name__}/logs"
|
@@ -79,19 +78,6 @@ LOGGER.info(f"Time zone set to {Config.TIME_ZONE}")
|
|
79 |
LOGGER.info("Source Code: https://github.com/Gojo-Bots/Gojo_Satoru\n")
|
80 |
LOGGER.info("Checking lyrics genius api...")
|
81 |
LOGGER.info("Initialising telegraph client")
|
82 |
-
telegraph = Telegraph()
|
83 |
-
acc_name = ["iamgojoof6eyes","Gojo_bots","Captain","Ezio","Captain_Ezio","Hell","Forgo10god","kap10","Gojo_Satoru","Naruto","Itachi","DM","HellBots"]
|
84 |
-
name_tel = choice(acc_name)
|
85 |
-
l = 0
|
86 |
-
while True:
|
87 |
-
try:
|
88 |
-
telegraph.create_account(name_tel)
|
89 |
-
break
|
90 |
-
except Exception:
|
91 |
-
LOGGER.exception(f"Failed to create telegraph client retrying...{l if l else ''}")
|
92 |
-
l += 1
|
93 |
-
pass
|
94 |
-
LOGGER.info(f"Created telegraph client with name {name_tel} in {l} tries")
|
95 |
|
96 |
# API based clients
|
97 |
if Config.GENIUS_API_TOKEN:
|
|
|
13 |
import lyricsgenius
|
14 |
import pyrogram
|
15 |
import pytz
|
|
|
16 |
|
17 |
LOG_DATETIME = datetime.now().strftime("%d_%m_%Y-%H_%M_%S")
|
18 |
LOGDIR = f"{__name__}/logs"
|
|
|
78 |
LOGGER.info("Source Code: https://github.com/Gojo-Bots/Gojo_Satoru\n")
|
79 |
LOGGER.info("Checking lyrics genius api...")
|
80 |
LOGGER.info("Initialising telegraph client")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
# API based clients
|
83 |
if Config.GENIUS_API_TOKEN:
|
Powers/__main__.py
CHANGED
@@ -2,7 +2,6 @@ import uvloop # Comment it out if using on windows
|
|
2 |
|
3 |
from Powers.bot_class import Gojo
|
4 |
|
5 |
-
|
6 |
if __name__ == "__main__":
|
7 |
uvloop.install() # Comment it out if using on windows
|
8 |
Gojo().run()
|
|
|
2 |
|
3 |
from Powers.bot_class import Gojo
|
4 |
|
|
|
5 |
if __name__ == "__main__":
|
6 |
uvloop.install() # Comment it out if using on windows
|
7 |
Gojo().run()
|
Powers/bot_class.py
CHANGED
@@ -2,7 +2,6 @@ from platform import python_version
|
|
2 |
from threading import RLock
|
3 |
from time import gmtime, strftime, time
|
4 |
|
5 |
-
import pyroaddon
|
6 |
from pyrogram import Client, __version__
|
7 |
from pyrogram.raw.all import layer
|
8 |
from pyrogram.types import BotCommand
|
|
|
2 |
from threading import RLock
|
3 |
from time import gmtime, strftime, time
|
4 |
|
|
|
5 |
from pyrogram import Client, __version__
|
6 |
from pyrogram.raw.all import layer
|
7 |
from pyrogram.types import BotCommand
|
Powers/plugins/birthday.py
CHANGED
@@ -11,7 +11,6 @@ from pyrogram.types import InlineKeyboardMarkup as IKM
|
|
11 |
from pyrogram.types import Message
|
12 |
|
13 |
from Powers import BDB_URI, LOGGER, TIME_ZONE
|
14 |
-
|
15 |
from Powers.bot_class import Gojo
|
16 |
from Powers.database.chats_db import Chats
|
17 |
from Powers.plugins import bday_cinfo, bday_info
|
@@ -277,9 +276,9 @@ else:
|
|
277 |
print(days_left)
|
278 |
print(x.year - timm.year)
|
279 |
"""
|
280 |
-
if BDB_URI:
|
281 |
-
|
282 |
-
|
283 |
|
284 |
__PLUGIN__ = "birthday"
|
285 |
|
|
|
11 |
from pyrogram.types import Message
|
12 |
|
13 |
from Powers import BDB_URI, LOGGER, TIME_ZONE
|
|
|
14 |
from Powers.bot_class import Gojo
|
15 |
from Powers.database.chats_db import Chats
|
16 |
from Powers.plugins import bday_cinfo, bday_info
|
|
|
276 |
print(days_left)
|
277 |
print(x.year - timm.year)
|
278 |
"""
|
279 |
+
# if BDB_URI:
|
280 |
+
# scheduler.add_job(send_wishish,'cron',[Gojo()],hour=0,minute=0,second=0)
|
281 |
+
# scheduler.start()
|
282 |
|
283 |
__PLUGIN__ = "birthday"
|
284 |
|
Powers/plugins/clean_db.py
CHANGED
@@ -7,7 +7,6 @@ from pyrogram.enums import ChatMemberStatus as CMS
|
|
7 |
from pyrogram.errors import PeerIdInvalid, UserNotParticipant
|
8 |
|
9 |
from Powers import LOGGER, MESSAGE_DUMP, TIME_ZONE
|
10 |
-
|
11 |
from Powers.bot_class import Gojo
|
12 |
from Powers.database.approve_db import Approve
|
13 |
from Powers.database.blacklist_db import Blacklist
|
@@ -24,8 +23,8 @@ from Powers.database.warns_db import Warns, WarnSettings
|
|
24 |
from Powers.utils.custom_filters import command
|
25 |
from Powers.vars import Config
|
26 |
|
27 |
-
scheduler = AsyncIOScheduler()
|
28 |
-
scheduler.timezone = TIME_ZONE
|
29 |
|
30 |
async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
31 |
to_clean = list()
|
@@ -105,5 +104,5 @@ async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
|
105 |
return
|
106 |
|
107 |
|
108 |
-
scheduler.add_job(clean_my_db,'cron',[Gojo()],hour=3,minute=0,second=0)
|
109 |
-
scheduler.start()
|
|
|
7 |
from pyrogram.errors import PeerIdInvalid, UserNotParticipant
|
8 |
|
9 |
from Powers import LOGGER, MESSAGE_DUMP, TIME_ZONE
|
|
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.database.approve_db import Approve
|
12 |
from Powers.database.blacklist_db import Blacklist
|
|
|
23 |
from Powers.utils.custom_filters import command
|
24 |
from Powers.vars import Config
|
25 |
|
26 |
+
# scheduler = AsyncIOScheduler()
|
27 |
+
# scheduler.timezone = TIME_ZONE
|
28 |
|
29 |
async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
30 |
to_clean = list()
|
|
|
104 |
return
|
105 |
|
106 |
|
107 |
+
# scheduler.add_job(clean_my_db,'cron',[Gojo()],hour=3,minute=0,second=0)
|
108 |
+
# scheduler.start()
|
Powers/plugins/utils.py
CHANGED
@@ -18,7 +18,6 @@ from Powers.utils.custom_filters import command
|
|
18 |
from Powers.utils.extract_user import extract_user
|
19 |
from Powers.utils.http_helper import *
|
20 |
from Powers.utils.parser import mention_html
|
21 |
-
from Powers.utils.web_helpers import telegraph_up
|
22 |
|
23 |
|
24 |
@Gojo.on_message(command("wiki"))
|
@@ -92,6 +91,7 @@ async def get_lyrics(_, m: Message):
|
|
92 |
return
|
93 |
|
94 |
query = m.text.split(None, 1)[1]
|
|
|
95 |
song = ""
|
96 |
if not query:
|
97 |
await m.edit_text(text="You haven't specified which song to look for!")
|
@@ -99,7 +99,10 @@ async def get_lyrics(_, m: Message):
|
|
99 |
song_name = query
|
100 |
em = await m.reply_text(text=f"Finding lyrics for <code>{song_name}<code>...")
|
101 |
try:
|
102 |
-
|
|
|
|
|
|
|
103 |
except Exception as e:
|
104 |
await em.delete()
|
105 |
await m.reply_text("Connection error try again after sometime")
|
@@ -109,7 +112,10 @@ async def get_lyrics(_, m: Message):
|
|
109 |
if song.lyrics:
|
110 |
reply = song.lyrics
|
111 |
reply = reply.split("\n",1)[1]
|
112 |
-
|
|
|
|
|
|
|
113 |
else:
|
114 |
reply = "Couldn't find any lyrics for that song!"
|
115 |
else:
|
@@ -118,17 +124,11 @@ async def get_lyrics(_, m: Message):
|
|
118 |
await em.edit_text(f"**{query.capitalize()} by {artist}**\n`{reply}`")
|
119 |
except MessageTooLong:
|
120 |
header = f"{query.capitalize()} by {artist}"
|
121 |
-
page_url = await telegraph_up(name=header,content=reply)
|
122 |
-
kb = InlineKeyboardMarkup([
|
123 |
-
[
|
124 |
-
InlineKeyboardButton("Telegraph link", url=page_url)
|
125 |
-
]
|
126 |
-
])
|
127 |
with BytesIO(str.encode(await remove_markdown_and_html(reply))) as f:
|
128 |
f.name = "lyrics.txt"
|
129 |
await m.reply_document(
|
130 |
document=f,
|
131 |
-
|
132 |
)
|
133 |
await em.delete()
|
134 |
return
|
@@ -408,7 +408,7 @@ Some utils provided by bot to make your tasks easy!
|
|
408 |
• /id: Get the current group id. If used by replying to a message, get that user's id.
|
409 |
• /info: Get information about a user.
|
410 |
• /gifid: Reply to a gif to me to tell you its file ID.
|
411 |
-
• /lyrics `<song name>` : Find your song and give the lyrics of the song
|
412 |
• /wiki: `<query>`: wiki your query.
|
413 |
• /tr `<language>`: Translates the text and then replies to you with the language you have specifed, works as a reply to message.
|
414 |
• /git `<username>`: Search for the user using github api!
|
|
|
18 |
from Powers.utils.extract_user import extract_user
|
19 |
from Powers.utils.http_helper import *
|
20 |
from Powers.utils.parser import mention_html
|
|
|
21 |
|
22 |
|
23 |
@Gojo.on_message(command("wiki"))
|
|
|
91 |
return
|
92 |
|
93 |
query = m.text.split(None, 1)[1]
|
94 |
+
artist = m.text.split("-")[-1].strip()
|
95 |
song = ""
|
96 |
if not query:
|
97 |
await m.edit_text(text="You haven't specified which song to look for!")
|
|
|
99 |
song_name = query
|
100 |
em = await m.reply_text(text=f"Finding lyrics for <code>{song_name}<code>...")
|
101 |
try:
|
102 |
+
if artist:
|
103 |
+
song = genius_lyrics.search_song(query,artist)
|
104 |
+
else:
|
105 |
+
song = genius_lyrics.search_song(query)
|
106 |
except Exception as e:
|
107 |
await em.delete()
|
108 |
await m.reply_text("Connection error try again after sometime")
|
|
|
112 |
if song.lyrics:
|
113 |
reply = song.lyrics
|
114 |
reply = reply.split("\n",1)[1]
|
115 |
+
if not artist:
|
116 |
+
artist = song.artist
|
117 |
+
else:
|
118 |
+
artist = artist
|
119 |
else:
|
120 |
reply = "Couldn't find any lyrics for that song!"
|
121 |
else:
|
|
|
124 |
await em.edit_text(f"**{query.capitalize()} by {artist}**\n`{reply}`")
|
125 |
except MessageTooLong:
|
126 |
header = f"{query.capitalize()} by {artist}"
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
with BytesIO(str.encode(await remove_markdown_and_html(reply))) as f:
|
128 |
f.name = "lyrics.txt"
|
129 |
await m.reply_document(
|
130 |
document=f,
|
131 |
+
caption=header
|
132 |
)
|
133 |
await em.delete()
|
134 |
return
|
|
|
408 |
• /id: Get the current group id. If used by replying to a message, get that user's id.
|
409 |
• /info: Get information about a user.
|
410 |
• /gifid: Reply to a gif to me to tell you its file ID.
|
411 |
+
• /lyrics `<song name>`-`<artist name>` : Find your song and give the lyrics of the song
|
412 |
• /wiki: `<query>`: wiki your query.
|
413 |
• /tr `<language>`: Translates the text and then replies to you with the language you have specifed, works as a reply to message.
|
414 |
• /git `<username>`: Search for the user using github api!
|
Powers/plugins/web_con.py
CHANGED
@@ -16,52 +16,6 @@ from Powers.utils.http_helper import *
|
|
16 |
from Powers.utils.sticker_help import toimage
|
17 |
from Powers.utils.web_helpers import *
|
18 |
|
19 |
-
|
20 |
-
@Gojo.on_message(command(["telegraph","tgh","tgm"]))
|
21 |
-
async def telegraph_upload(c:Gojo,m:Message):
|
22 |
-
if not m.reply_to_message:
|
23 |
-
await m.reply_text("Reply to media/text to upload it to telegraph")
|
24 |
-
return
|
25 |
-
XnX = await m.reply_text("⏳")
|
26 |
-
file = m.reply_to_message
|
27 |
-
if file.text:
|
28 |
-
if len(m.command) == 1:
|
29 |
-
name = file.from_user.first_name + file.text.split()[1]
|
30 |
-
elif len(m.command) > 1:
|
31 |
-
name = " ".join(m.command[1:5])
|
32 |
-
try:
|
33 |
-
upload = await telegraph_up(file,name)
|
34 |
-
except Exception as e:
|
35 |
-
await m.reply_text(f"Got an error\n{e}")
|
36 |
-
return
|
37 |
-
if upload:
|
38 |
-
await XnX.delete()
|
39 |
-
kb = IKM([[IKB("Here is link to the uploaded text",url=upload)]])
|
40 |
-
await m.reply_text("Here is your uploaded text",disable_web_page_preview=True,reply_markup=kb)
|
41 |
-
return
|
42 |
-
elif not upload:
|
43 |
-
await m.reply_text("Failed to upload the text to telegraph")
|
44 |
-
return
|
45 |
-
if m.reply_to_message.photo or m.reply_to_message.document or m.reply_to_message.audio or m.reply_to_message.video:
|
46 |
-
size = await get_file_size(m.reply_to_message)
|
47 |
-
form = size.split(None,1)
|
48 |
-
if (form[-1] == "mb" and int(form[0]) > 5) or form[-1] == "gb":
|
49 |
-
await XnX.edit_text("File size too big to upload\nLimit: 5mbs")
|
50 |
-
return
|
51 |
-
await XnX.delete()
|
52 |
-
try:
|
53 |
-
upload = await telegraph_up(file)
|
54 |
-
except Exception as e:
|
55 |
-
await m.reply_text(f"Got an error\n{e}")
|
56 |
-
return
|
57 |
-
if upload:
|
58 |
-
kb = IKM([[IKB("Here is link to the file",url=upload)]])
|
59 |
-
await m.reply_text(f"Here is your file link\n`{upload}`",reply_markup=kb)
|
60 |
-
return
|
61 |
-
elif not upload:
|
62 |
-
await m.reply_text("Failed to upload the file to telegraph")
|
63 |
-
return
|
64 |
-
|
65 |
# @Gojo.on_message(command(["songname","insong","songinfo","whichsong","rsong","reversesong"]))
|
66 |
# • /whichsong (/songname, /songinfo, /insong, /rsong, /reversesong) : Reply to file to get the song playing in it.
|
67 |
# async def get_song_info(c: Gojo, m: Message):
|
@@ -150,11 +104,12 @@ async def telegraph_upload(c:Gojo,m:Message):
|
|
150 |
# pass
|
151 |
# return
|
152 |
|
|
|
153 |
|
154 |
@Gojo.on_callback_query(filters.regex("^lyrics_"))
|
155 |
async def lyrics_for_song(c: Gojo, q: CallbackQuery):
|
156 |
data = q.data.split("_")[1].split(":")
|
157 |
-
song = data[0]
|
158 |
try:
|
159 |
artist = data[1]
|
160 |
except IndexError:
|
@@ -163,20 +118,26 @@ async def lyrics_for_song(c: Gojo, q: CallbackQuery):
|
|
163 |
song = genius_lyrics.search_song(song,artist)
|
164 |
elif not artist:
|
165 |
song = genius_lyrics.search_song(song)
|
|
|
166 |
if not song.lyrics:
|
167 |
await q.answer("‼️ No lyrics found ‼️",True)
|
168 |
return
|
169 |
-
header = f"{
|
170 |
if song.lyrics:
|
171 |
await q.answer("Fetching lyrics")
|
172 |
reply = song.lyrics.split("\n",1)[1]
|
173 |
if len(reply) >= 4096:
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
176 |
new_kb = [
|
177 |
[
|
178 |
-
IKB("
|
179 |
-
]
|
180 |
[
|
181 |
IKB("Close","f_close")
|
182 |
]
|
@@ -192,6 +153,45 @@ async def lyrics_for_song(c: Gojo, q: CallbackQuery):
|
|
192 |
await q.message.delete()
|
193 |
return
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
@Gojo.on_message(command(["removebackground","removebg","rmbg"]))
|
196 |
async def remove_background(c: Gojo, m: Message):
|
197 |
if not is_rmbg:
|
@@ -305,7 +305,6 @@ __PLUGIN__ = "web support"
|
|
305 |
|
306 |
__HELP__ = """
|
307 |
**Available commands**
|
308 |
-
• /telegraph (/tgh, /tgm) <page name> : Reply to media which you want to upload to telegraph.
|
309 |
• /rmbg (/removebg, /removebackground) : Reply to image file or sticker of which you want to remove background
|
310 |
• /song (/yta) <songname or youtube link>
|
311 |
• /vsong (/ytv) <songname or youtube link>
|
|
|
16 |
from Powers.utils.sticker_help import toimage
|
17 |
from Powers.utils.web_helpers import *
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
# @Gojo.on_message(command(["songname","insong","songinfo","whichsong","rsong","reversesong"]))
|
20 |
# • /whichsong (/songname, /songinfo, /insong, /rsong, /reversesong) : Reply to file to get the song playing in it.
|
21 |
# async def get_song_info(c: Gojo, m: Message):
|
|
|
104 |
# pass
|
105 |
# return
|
106 |
|
107 |
+
songs = dict()
|
108 |
|
109 |
@Gojo.on_callback_query(filters.regex("^lyrics_"))
|
110 |
async def lyrics_for_song(c: Gojo, q: CallbackQuery):
|
111 |
data = q.data.split("_")[1].split(":")
|
112 |
+
song = songe = data[0]
|
113 |
try:
|
114 |
artist = data[1]
|
115 |
except IndexError:
|
|
|
118 |
song = genius_lyrics.search_song(song,artist)
|
119 |
elif not artist:
|
120 |
song = genius_lyrics.search_song(song)
|
121 |
+
artist = song.artist
|
122 |
if not song.lyrics:
|
123 |
await q.answer("‼️ No lyrics found ‼️",True)
|
124 |
return
|
125 |
+
header = f"{songe.capitalize()} by {artist}"
|
126 |
if song.lyrics:
|
127 |
await q.answer("Fetching lyrics")
|
128 |
reply = song.lyrics.split("\n",1)[1]
|
129 |
if len(reply) >= 4096:
|
130 |
+
cap = f"{header}\n{reply[0:4080]}..."
|
131 |
+
if artist:
|
132 |
+
songs[f"{songe}"][f"{artist}"] = reply
|
133 |
+
art = '_'+artist
|
134 |
+
else:
|
135 |
+
songs[f"{songe}"] = reply
|
136 |
+
art = ''
|
137 |
new_kb = [
|
138 |
[
|
139 |
+
IKB("Next",f"lyrics_next_{songe}{art}")
|
140 |
+
]
|
141 |
[
|
142 |
IKB("Close","f_close")
|
143 |
]
|
|
|
153 |
await q.message.delete()
|
154 |
return
|
155 |
|
156 |
+
@Gojo.on_callback_query(filters.regex("^lyrics_next_") | filters.regex("^lyrics_prev_"))
|
157 |
+
async def lyrics_for_song_next(c: Gojo, q: CallbackQuery):
|
158 |
+
split = q.data.split("_")
|
159 |
+
song = split[2]
|
160 |
+
todo = split[1]
|
161 |
+
try:
|
162 |
+
artist = split[3]
|
163 |
+
header = f"{song.capitalize()} by {artist}"
|
164 |
+
art = '_'+artist
|
165 |
+
except IndexError:
|
166 |
+
artist = False
|
167 |
+
header = f"{song.capitalize()}"
|
168 |
+
art = ''
|
169 |
+
try:
|
170 |
+
if artist:
|
171 |
+
songe = songs[song][artist]
|
172 |
+
else:
|
173 |
+
songe = songs[song]
|
174 |
+
except KeyError:
|
175 |
+
if artist:
|
176 |
+
songe = genius_lyrics.search_song(song,artist)
|
177 |
+
elif not artist:
|
178 |
+
songe = genius_lyrics.search_song(song)
|
179 |
+
if todo == "next":
|
180 |
+
next_part = songe[4080:]
|
181 |
+
else:
|
182 |
+
next_part = songe[:4080]
|
183 |
+
next_part = f"{header}\n{next_part}"
|
184 |
+
new_kb = [
|
185 |
+
[
|
186 |
+
IKB("Next",f"lyrics_prev_{song}{art}")
|
187 |
+
]
|
188 |
+
[
|
189 |
+
IKB("Close","f_close")
|
190 |
+
]
|
191 |
+
]
|
192 |
+
await q.edit_message_text(next_part, reply_markup=new_kb)
|
193 |
+
|
194 |
+
|
195 |
@Gojo.on_message(command(["removebackground","removebg","rmbg"]))
|
196 |
async def remove_background(c: Gojo, m: Message):
|
197 |
if not is_rmbg:
|
|
|
305 |
|
306 |
__HELP__ = """
|
307 |
**Available commands**
|
|
|
308 |
• /rmbg (/removebg, /removebackground) : Reply to image file or sticker of which you want to remove background
|
309 |
• /song (/yta) <songname or youtube link>
|
310 |
• /vsong (/ytv) <songname or youtube link>
|
Powers/utils/web_helpers.py
CHANGED
@@ -6,9 +6,7 @@ import yt_dlp
|
|
6 |
from pyrogram.types import InlineKeyboardButton as IKB
|
7 |
from pyrogram.types import InlineKeyboardMarkup as IKM
|
8 |
from pyrogram.types import Message
|
9 |
-
from telegraph import upload_file
|
10 |
|
11 |
-
from Powers import telegraph
|
12 |
from Powers.bot_class import Gojo
|
13 |
from Powers.utils.http_helper import *
|
14 |
|
@@ -35,30 +33,6 @@ async def get_file_size(file: Message):
|
|
35 |
size = size/1024
|
36 |
return f"{round(size)} gb"
|
37 |
|
38 |
-
async def telegraph_up(file:Message=None,name=None,content=None):
|
39 |
-
if not name:
|
40 |
-
name = "Captain_Ezio_Gojo_Bots"
|
41 |
-
if content:
|
42 |
-
page = telegraph.create_page(name,html_content=content)
|
43 |
-
if page:
|
44 |
-
return page['url']
|
45 |
-
else:
|
46 |
-
return
|
47 |
-
if file.text:
|
48 |
-
to_upload = file.text.html
|
49 |
-
page = telegraph.create_page(name,html_content=to_upload)
|
50 |
-
if page:
|
51 |
-
return page['url']
|
52 |
-
else:
|
53 |
-
return
|
54 |
-
doc = await file.download()
|
55 |
-
media_url = upload_file(doc)
|
56 |
-
tg_url = f"https://telegra.ph/{media_url[0]}"
|
57 |
-
os.remove(doc)
|
58 |
-
if tg_url:
|
59 |
-
return tg_url
|
60 |
-
else:
|
61 |
-
return
|
62 |
|
63 |
class GOJO_YTS:
|
64 |
"""
|
|
|
6 |
from pyrogram.types import InlineKeyboardButton as IKB
|
7 |
from pyrogram.types import InlineKeyboardMarkup as IKM
|
8 |
from pyrogram.types import Message
|
|
|
9 |
|
|
|
10 |
from Powers.bot_class import Gojo
|
11 |
from Powers.utils.http_helper import *
|
12 |
|
|
|
33 |
size = size/1024
|
34 |
return f"{round(size)} gb"
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
class GOJO_YTS:
|
38 |
"""
|
requirements.txt
CHANGED
@@ -28,7 +28,6 @@ search-engine-parser==0.6.8
|
|
28 |
six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
|
29 |
sniffio==1.3.0; python_full_version >= "3.6.2" and python_version >= "3.7"
|
30 |
soupsieve==2.4; python_version >= "3.6" and python_full_version >= "3.6.0"
|
31 |
-
telegraph==2.2.0
|
32 |
tgcrypto==1.2.5; python_version >= "3.6" and python_version < "4.0"
|
33 |
tswift==0.7.0
|
34 |
typing-extensions==4.5.0; python_full_version >= "3.6.2" and python_version >= "3.7" and python_version < "3.8"
|
|
|
28 |
six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
|
29 |
sniffio==1.3.0; python_full_version >= "3.6.2" and python_version >= "3.7"
|
30 |
soupsieve==2.4; python_version >= "3.6" and python_full_version >= "3.6.0"
|
|
|
31 |
tgcrypto==1.2.5; python_version >= "3.6" and python_version < "4.0"
|
32 |
tswift==0.7.0
|
33 |
typing-extensions==4.5.0; python_full_version >= "3.6.2" and python_version >= "3.7" and python_version < "3.8"
|