Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
aee3bb4
1
Parent(s):
1c68821
...
Browse files- Powers/__main__.py +13 -1
- Powers/plugins/birthday.py +0 -3
- Powers/plugins/clean_db.py +1 -4
- Powers/plugins/start.py +15 -2
- Powers/plugins/utils.py +1 -1
- Powers/utils/web_helpers.py +1 -1
Powers/__main__.py
CHANGED
@@ -1,7 +1,19 @@
|
|
1 |
-
import uvloop
|
|
|
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()
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import uvloop # Comment it out if using on windows
|
2 |
+
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
3 |
|
4 |
+
from Powers import BDB_URI, TIME_ZONE
|
5 |
from Powers.bot_class import Gojo
|
6 |
+
from Powers.plugins.birthday import send_wishish
|
7 |
+
from Powers.plugins.clean_db import clean_my_db
|
8 |
+
|
9 |
+
scheduler = AsyncIOScheduler()
|
10 |
+
scheduler.timezone = TIME_ZONE
|
11 |
|
12 |
if __name__ == "__main__":
|
13 |
uvloop.install() # Comment it out if using on windows
|
14 |
Gojo().run()
|
15 |
+
scheduler.add_job(clean_my_db,'cron',[Gojo()],hour=3,minute=0,second=0)
|
16 |
+
scheduler.start()
|
17 |
+
if BDB_URI:
|
18 |
+
scheduler.add_job(send_wishish,'cron',[Gojo()],hour=0,minute=0,second=0)
|
19 |
+
scheduler.start()
|
Powers/plugins/birthday.py
CHANGED
@@ -276,9 +276,6 @@ else:
|
|
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 |
|
|
|
276 |
print(days_left)
|
277 |
print(x.year - timm.year)
|
278 |
"""
|
|
|
|
|
|
|
279 |
|
280 |
__PLUGIN__ = "birthday"
|
281 |
|
Powers/plugins/clean_db.py
CHANGED
@@ -23,8 +23,6 @@ from Powers.database.warns_db import Warns, WarnSettings
|
|
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,5 +102,4 @@ async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
|
104 |
return
|
105 |
|
106 |
|
107 |
-
|
108 |
-
# scheduler.start()
|
|
|
23 |
from Powers.utils.custom_filters import command
|
24 |
from Powers.vars import Config
|
25 |
|
|
|
|
|
26 |
|
27 |
async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
28 |
to_clean = list()
|
|
|
102 |
return
|
103 |
|
104 |
|
105 |
+
|
|
Powers/plugins/start.py
CHANGED
@@ -94,6 +94,15 @@ async def start(c: Gojo, m: Message):
|
|
94 |
quote=True,
|
95 |
)
|
96 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
try:
|
98 |
cpt = f"""
|
99 |
Hey [{m.from_user.first_name}](http://t.me/{m.from_user.username})! I am Gojo ✨.
|
@@ -161,7 +170,10 @@ Hey **[{q.from_user.first_name}](http://t.me/{q.from_user.username})**! I am Goj
|
|
161 |
I'm here to help you manage your groups!
|
162 |
Commands available:
|
163 |
× /start: Start the bot
|
164 |
-
× /help: Give's you this message.
|
|
|
|
|
|
|
165 |
|
166 |
await q.edit_message_caption(
|
167 |
caption=cpt,
|
@@ -181,7 +193,8 @@ Commands available:
|
|
181 |
@Gojo.on_message(command("help"))
|
182 |
async def help_menu(_, m: Message):
|
183 |
if len(m.text.split()) >= 2:
|
184 |
-
|
|
|
185 |
help_msg, help_kb = await get_help_msg(m, help_option)
|
186 |
|
187 |
if not help_msg:
|
|
|
94 |
quote=True,
|
95 |
)
|
96 |
return
|
97 |
+
else:
|
98 |
+
await m.reply_photo(
|
99 |
+
photo=str(choice(StartPic)),
|
100 |
+
caption=help_msg,
|
101 |
+
parse_mode=enums.ParseMode.MARKDOWN,
|
102 |
+
reply_markup=help_kb,
|
103 |
+
quote=True,
|
104 |
+
)
|
105 |
+
return
|
106 |
try:
|
107 |
cpt = f"""
|
108 |
Hey [{m.from_user.first_name}](http://t.me/{m.from_user.username})! I am Gojo ✨.
|
|
|
170 |
I'm here to help you manage your groups!
|
171 |
Commands available:
|
172 |
× /start: Start the bot
|
173 |
+
× /help: Give's you this message.
|
174 |
+
|
175 |
+
You can use `$` and `!` in placec of `/` as your prefix handler
|
176 |
+
"""
|
177 |
|
178 |
await q.edit_message_caption(
|
179 |
caption=cpt,
|
|
|
193 |
@Gojo.on_message(command("help"))
|
194 |
async def help_menu(_, m: Message):
|
195 |
if len(m.text.split()) >= 2:
|
196 |
+
textt = m.text.replace(" ","_")
|
197 |
+
help_option = (textt.split(None, 1)[1]).lower()
|
198 |
help_msg, help_kb = await get_help_msg(m, help_option)
|
199 |
|
200 |
if not help_msg:
|
Powers/plugins/utils.py
CHANGED
@@ -222,7 +222,7 @@ async def github(_, m: Message):
|
|
222 |
LOGGER.info(f"{m.from_user.id} used github cmd in {m.chat.id}")
|
223 |
else:
|
224 |
await m.reply_text(
|
225 |
-
f"Usage: <code
|
226 |
)
|
227 |
return
|
228 |
username = username.split("/")[-1].strip("@")
|
|
|
222 |
LOGGER.info(f"{m.from_user.id} used github cmd in {m.chat.id}")
|
223 |
else:
|
224 |
await m.reply_text(
|
225 |
+
f"Usage: <code>/github username</code>",
|
226 |
)
|
227 |
return
|
228 |
username = username.split("/")[-1].strip("@")
|
Powers/utils/web_helpers.py
CHANGED
@@ -134,7 +134,7 @@ async def song_search(query, max_results=1):
|
|
134 |
if len(durr) == 2:
|
135 |
minutes_to_sec = int(durr[0])*60
|
136 |
total = minutes_to_sec + int(durr[1])
|
137 |
-
if not (total >
|
138 |
dict_form = {
|
139 |
"link": f"https://www.youtube.com{i['url_suffix']}",
|
140 |
"title": i['title'],
|
|
|
134 |
if len(durr) == 2:
|
135 |
minutes_to_sec = int(durr[0])*60
|
136 |
total = minutes_to_sec + int(durr[1])
|
137 |
+
if not (total > 600):
|
138 |
dict_form = {
|
139 |
"link": f"https://www.youtube.com{i['url_suffix']}",
|
140 |
"title": i['title'],
|