Captain Ezio commited on
Commit
0f36ab0
·
2 Parent(s): daf8cc9 f872943

Merge branch 'beta' into main

Browse files
Powers/plugins/downloads.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Add instagrapi & pytube in requirements.txt
2
+ from pyrogram import Client, filters
3
+ import urllib.request
4
+ from instagrapi import Client as InstaClient
5
+ from pytube import YouTube
6
+ from Powers.bot_class import Gojo as app
7
+
8
+ insta_client = InstaClient()
9
+
10
+ @app.on_message(filters.command("download"))
11
+ def download_media(client, message):
12
+ chat_id = message.chat.id
13
+ platform = message.text.split()[1]
14
+ client.send_message(chat_id, "Enter your choice 1 for Instagram 2 For YouTube:")
15
+ if platform == "1":
16
+ client.send_message(chat_id, "Please enter the Instagram post or story URL:")
17
+ insta_link = message.text.split()[2]
18
+
19
+ media = insta_client.media_info(insta_link)
20
+
21
+ video_url = media.video_versions[0].url
22
+ urllib.request.urlretrieve(video_url, "video.mp4")
23
+
24
+ client.send_video(chat_id, video="video.mp4")
25
+
26
+ elif platform == "2":
27
+ client.send_message(chat_id, "Please enter the YouTube link:")
28
+ yt_link = message.text.split()[2]
29
+
30
+ yt = YouTube(yt_link)
31
+ stream = yt.streams.get_highest_resolution()
32
+
33
+ stream.download(output_path="./", filename="video.mp4")
34
+
35
+ client.send_video(chat_id, video="video.mp4")
36
+
37
+ else:
38
+ client.send_message(chat_id, "Invalid platform choice. Please enter 1 for Instagram or 2 for YouTube.")
Powers/plugins/flood.py CHANGED
@@ -350,15 +350,17 @@ async def flood_watcher(c: Gojo, m: Message):
350
  if not len(dic):
351
  z = {c_id : {u_id : [[],[]]}}
352
  dic.update(z)
353
- for i in dic.keys():
354
- if c_id != i:
355
- z = {c_id : {u_id : [[],[]]}}
356
- dic.update(z)
 
357
 
358
- for i in dic[c_id].keys():
359
- if u_id != i:
360
- z = {u_id : [[],[]]}
361
- dic[c_id].update(z) # make the dic something like {c_id : {u_id : [[for time],[for msg]]}}
 
362
  sec = round(time.time())
363
  try:
364
  dic[c_id][u_id][0].append(sec)
 
350
  if not len(dic):
351
  z = {c_id : {u_id : [[],[]]}}
352
  dic.update(z)
353
+ try:
354
+ dic[c_id] # access and check weather the c_id present or not
355
+ except KeyError:
356
+ z = {c_id : {u_id : [[],[]]}}
357
+ dic.update(z)
358
 
359
+ try:
360
+ dic[c_id][u_id]
361
+ except KeyError:
362
+ z = {u_id : [[],[]]}
363
+ dic[c_id].update(z) # make the dic something like {c_id : {u_id : [[for time],[for msg]]}}
364
  sec = round(time.time())
365
  try:
366
  dic[c_id][u_id][0].append(sec)
Powers/plugins/search.py CHANGED
@@ -156,7 +156,7 @@ async def anime_search(c: Gojo, m: Message):
156
  LOGGER.error(format_exc())
157
  return
158
 
159
- @Gojo.on_message(command('anime'))
160
  async def stack_search(c: Gojo, m: Message):
161
  split = m.text.split(None, 1)
162
  if len(split) == 1:
 
156
  LOGGER.error(format_exc())
157
  return
158
 
159
+ @Gojo.on_message(command('stack'))
160
  async def stack_search(c: Gojo, m: Message):
161
  split = m.text.split(None, 1)
162
  if len(split) == 1: