Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
ยท
9c7de01
1
Parent(s):
06ce793
may be fix
Browse files- Powers/__main__.py +1 -1
- Powers/plugins/birthday.py +5 -4
- Powers/plugins/clean_db.py +22 -8
- Powers/plugins/stickers.py +4 -2
Powers/__main__.py
CHANGED
@@ -4,4 +4,4 @@ from Powers.bot_class import Gojo
|
|
4 |
|
5 |
if __name__ == "__main__":
|
6 |
uvloop.install() # Comment it out if using on windows
|
7 |
-
Gojo().run()
|
|
|
4 |
|
5 |
if __name__ == "__main__":
|
6 |
uvloop.install() # Comment it out if using on windows
|
7 |
+
JJK = Gojo().run()
|
Powers/plugins/birthday.py
CHANGED
@@ -11,6 +11,7 @@ from pyrogram.types import InlineKeyboardMarkup as IKM
|
|
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
|
@@ -225,7 +226,7 @@ async def switch_on_off(c:Gojo, q: CallbackQuery):
|
|
225 |
scheduler = AsyncIOScheduler()
|
226 |
scheduler.timezone = TIME_ZONE
|
227 |
scheduler_time = time(0,0,0)
|
228 |
-
async def send_wishish(
|
229 |
c_list = Chats.list_chats_by_id()
|
230 |
blist = list(bday_info.find())
|
231 |
curr = datetime.now(TIME_ZONE).date()
|
@@ -248,10 +249,10 @@ async def send_wishish(c:Gojo):
|
|
248 |
agee = f"{agee}rd"
|
249 |
else:
|
250 |
agee = f"{agee}th"
|
251 |
-
U = await
|
252 |
wish = choice(birthday_wish)
|
253 |
if U.status in [ChatMemberStatus.MEMBER,ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER]:
|
254 |
-
xXx = await
|
255 |
try:
|
256 |
await xXx.pin()
|
257 |
except Exception:
|
@@ -277,7 +278,7 @@ print(days_left)
|
|
277 |
print(x.year - timm.year)
|
278 |
"""
|
279 |
if BDB_URI:
|
280 |
-
scheduler.add_job(send_wishish,'cron',[
|
281 |
scheduler.start()
|
282 |
|
283 |
__PLUGIN__ = "birthday"
|
|
|
11 |
from pyrogram.types import Message
|
12 |
|
13 |
from Powers import BDB_URI, LOGGER, TIME_ZONE
|
14 |
+
from Powers.__main__ import JJK
|
15 |
from Powers.bot_class import Gojo
|
16 |
from Powers.database.chats_db import Chats
|
17 |
from Powers.plugins import bday_cinfo, bday_info
|
|
|
226 |
scheduler = AsyncIOScheduler()
|
227 |
scheduler.timezone = TIME_ZONE
|
228 |
scheduler_time = time(0,0,0)
|
229 |
+
async def send_wishish(JJK: Gojo):
|
230 |
c_list = Chats.list_chats_by_id()
|
231 |
blist = list(bday_info.find())
|
232 |
curr = datetime.now(TIME_ZONE).date()
|
|
|
249 |
agee = f"{agee}rd"
|
250 |
else:
|
251 |
agee = f"{agee}th"
|
252 |
+
U = await JJK.get_chat_member(chat_id=j,user_id=i["user_id"])
|
253 |
wish = choice(birthday_wish)
|
254 |
if U.status in [ChatMemberStatus.MEMBER,ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER]:
|
255 |
+
xXx = await JJK.send_message(j,f"Happy {agee} birthday {U.user.mention}๐ฅณ\n{wish}")
|
256 |
try:
|
257 |
await xXx.pin()
|
258 |
except Exception:
|
|
|
278 |
print(x.year - timm.year)
|
279 |
"""
|
280 |
if BDB_URI:
|
281 |
+
scheduler.add_job(send_wishish,'cron',[JJK],hour=0,minute=0,second=0)
|
282 |
scheduler.start()
|
283 |
|
284 |
__PLUGIN__ = "birthday"
|
Powers/plugins/clean_db.py
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
import time
|
2 |
from asyncio import sleep
|
|
|
3 |
|
4 |
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
5 |
-
#from pyrogram import Client, filters
|
6 |
from pyrogram.enums import ChatMemberStatus as CMS
|
|
|
7 |
|
8 |
from Powers import LOGGER, MESSAGE_DUMP, TIME_ZONE
|
|
|
9 |
from Powers.bot_class import Gojo
|
10 |
from Powers.database.approve_db import Approve
|
11 |
from Powers.database.blacklist_db import Blacklist
|
@@ -22,8 +24,8 @@ from Powers.database.warns_db import Warns, WarnSettings
|
|
22 |
from Powers.utils.custom_filters import command
|
23 |
from Powers.vars import Config
|
24 |
|
25 |
-
|
26 |
-
|
27 |
|
28 |
async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
29 |
to_clean = list()
|
@@ -36,8 +38,12 @@ async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
|
36 |
stat = await c.get_chat_member(chat_id=chats,user_id=Config.BOT_ID)
|
37 |
if stat.status not in [CMS.MEMBER, CMS.ADMINISTRATOR, CMS.OWNER]:
|
38 |
to_clean.append(chats)
|
39 |
-
except
|
40 |
to_clean.append(chats)
|
|
|
|
|
|
|
|
|
41 |
for i in to_clean:
|
42 |
Approve(i).clean_approve()
|
43 |
Blacklist(i).clean_blacklist()
|
@@ -62,13 +68,21 @@ async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
|
62 |
for i in all_users:
|
63 |
try:
|
64 |
infos = await c.get_users(int(i))
|
65 |
-
except
|
66 |
try:
|
67 |
inn = await c.resolve_peer(int(i))
|
68 |
infos = await c.get_users(inn.user_id)
|
69 |
-
except
|
70 |
to_clean.append(i)
|
71 |
Users(i).delete_user()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
try:
|
73 |
if infos.is_deleted:
|
74 |
to_clean.append(infos.id)
|
@@ -91,5 +105,5 @@ async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
|
91 |
return
|
92 |
|
93 |
|
94 |
-
|
95 |
-
|
|
|
1 |
import time
|
2 |
from asyncio import sleep
|
3 |
+
from traceback import format_exc
|
4 |
|
5 |
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
|
|
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 |
+
from Powers.__main__ import JJK
|
11 |
from Powers.bot_class import Gojo
|
12 |
from Powers.database.approve_db import Approve
|
13 |
from Powers.database.blacklist_db import Blacklist
|
|
|
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()
|
|
|
38 |
stat = await c.get_chat_member(chat_id=chats,user_id=Config.BOT_ID)
|
39 |
if stat.status not in [CMS.MEMBER, CMS.ADMINISTRATOR, CMS.OWNER]:
|
40 |
to_clean.append(chats)
|
41 |
+
except UserNotParticipant:
|
42 |
to_clean.append(chats)
|
43 |
+
except Exception as e:
|
44 |
+
LOGGER.error(e)
|
45 |
+
LOGGER.error(format_exc())
|
46 |
+
return
|
47 |
for i in to_clean:
|
48 |
Approve(i).clean_approve()
|
49 |
Blacklist(i).clean_blacklist()
|
|
|
68 |
for i in all_users:
|
69 |
try:
|
70 |
infos = await c.get_users(int(i))
|
71 |
+
except PeerIdInvalid:
|
72 |
try:
|
73 |
inn = await c.resolve_peer(int(i))
|
74 |
infos = await c.get_users(inn.user_id)
|
75 |
+
except KeyError:
|
76 |
to_clean.append(i)
|
77 |
Users(i).delete_user()
|
78 |
+
except Exception as e:
|
79 |
+
LOGGER.error(e)
|
80 |
+
LOGGER.error(format_exc())
|
81 |
+
return
|
82 |
+
except Exception as e:
|
83 |
+
LOGGER.error(e)
|
84 |
+
LOGGER.error(format_exc())
|
85 |
+
return
|
86 |
try:
|
87 |
if infos.is_deleted:
|
88 |
to_clean.append(infos.id)
|
|
|
105 |
return
|
106 |
|
107 |
|
108 |
+
scheduler.add_job(clean_my_db,'cron',[JJK],hour=3,minute=0,second=0)
|
109 |
+
scheduler.start()
|
Powers/plugins/stickers.py
CHANGED
@@ -74,11 +74,13 @@ async def kang(c:Gojo, m: Message):
|
|
74 |
args = m.text.split()
|
75 |
if len(args) > 1:
|
76 |
sticker_emoji = str(args[1])
|
|
|
|
|
77 |
else:
|
78 |
-
edit_ = await msg.
|
79 |
ran = ["๐คฃ", "๐", "๐", "๐", "๐ฅ", "๐", "๐", "๐", "๐", "๐ฑ", "โบ๏ธ", "๐", "๐", "๐คง", "๐", "๐ฌ", "๐คฉ", "๐", "๐", "๐ฅน", "๐ฅบ", "๐ซฅ", "๐", "๐ซก", "๐ซ ", "๐คซ", "๐", "๐ฅต", "๐ฅถ", "๐ค", "๐ก", "๐คฌ", "๐คฏ", "๐ฅด", "๐คข", "๐คฎ", "๐", "๐ฟ", "๐ฉ", "๐คก", "๐ซถ", "๐", "๐", "โ", "๐", "๐ซฐ", "๐ค", "๐", "๐", "๐", "๐บ", "๐ฉโโค๏ธโ๐โ๐ฉ", "๐ฉโโค๏ธโ๐โ๐จ","๐จโโค๏ธโ๐จ", "๐", "๐ฉโโค๏ธโ๐ฉ", "๐ฉโโค๏ธโ๐จ", "๐", "๐จโโค๏ธโ๐โ๐จ", "๐ช", "๐ด", "๐ญ", "๐ฅธ", "๐ค", "๐ซค", "๐ฎ", "๐ง", "๐ฒ", "๐ฅฑ", "๐", "๐ฟ", "๐ค", "๐พ", "๐", "๐ฅด", "๐ฅฐ", "๐", "๐คฃ" ,"๐", "๐", "๐"]
|
80 |
sticker_emoji = choice(ran)
|
81 |
-
|
82 |
|
83 |
# Get the corresponding fileid, resize the file if necessary
|
84 |
try:
|
|
|
74 |
args = m.text.split()
|
75 |
if len(args) > 1:
|
76 |
sticker_emoji = str(args[1])
|
77 |
+
elif m.reply_to_message.sticker:
|
78 |
+
sticker_emoji = m.reply_to_message.sticker.emoji
|
79 |
else:
|
80 |
+
edit_ = await msg.reply_text("No emoji provided choosing a random emoji")
|
81 |
ran = ["๐คฃ", "๐", "๐", "๐", "๐ฅ", "๐", "๐", "๐", "๐", "๐ฑ", "โบ๏ธ", "๐", "๐", "๐คง", "๐", "๐ฌ", "๐คฉ", "๐", "๐", "๐ฅน", "๐ฅบ", "๐ซฅ", "๐", "๐ซก", "๐ซ ", "๐คซ", "๐", "๐ฅต", "๐ฅถ", "๐ค", "๐ก", "๐คฌ", "๐คฏ", "๐ฅด", "๐คข", "๐คฎ", "๐", "๐ฟ", "๐ฉ", "๐คก", "๐ซถ", "๐", "๐", "โ", "๐", "๐ซฐ", "๐ค", "๐", "๐", "๐", "๐บ", "๐ฉโโค๏ธโ๐โ๐ฉ", "๐ฉโโค๏ธโ๐โ๐จ","๐จโโค๏ธโ๐จ", "๐", "๐ฉโโค๏ธโ๐ฉ", "๐ฉโโค๏ธโ๐จ", "๐", "๐จโโค๏ธโ๐โ๐จ", "๐ช", "๐ด", "๐ญ", "๐ฅธ", "๐ค", "๐ซค", "๐ฎ", "๐ง", "๐ฒ", "๐ฅฑ", "๐", "๐ฟ", "๐ค", "๐พ", "๐", "๐ฅด", "๐ฅฐ", "๐", "๐คฃ" ,"๐", "๐", "๐"]
|
82 |
sticker_emoji = choice(ran)
|
83 |
+
await msg.edit_text(f"Makeing a sticker with {sticker_emoji} emoji")
|
84 |
|
85 |
# Get the corresponding fileid, resize the file if necessary
|
86 |
try:
|