Skip to content

Commit

Permalink
Merge pull request #20 from Mr-Sunglasses/actions/black
Browse files Browse the repository at this point in the history
Format Python code with psf/black push
  • Loading branch information
AnjumanHasan authored Sep 14, 2022
2 parents 547edd6 + c2484ff commit 633d1f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions pastebin-bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from yt_download_shorts import download_video, get_title
import instaloader
from link_shortner import short

bot = telebot.TeleBot(API_KEY)

# TBD
Expand Down Expand Up @@ -154,6 +155,7 @@ def handle_video_download_yt(message):
except instaloader.ConnectionException:
bot.reply_to(message, "IP is Blocked Please Try After Some Time")


# This Decorator Deals with /short
@bot.message_handler(commands=["short"])
def handle_short(message):
Expand All @@ -165,5 +167,6 @@ def handle_short(message):
except:
bot.reply_to(message, f"We can't abel to short{payload_link_data}")


if __name__ == "__main__":
bot.infinity_polling()
4 changes: 1 addition & 3 deletions pastebin-bot/link_shortner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ def short(url: str):
headers = {
"content-type": "application/x-www-form-urlencoded",
"X-RapidAPI-Key": "e02923797dmshddea57448263f98p13ab17jsn9e252949aa6f",
"X-RapidAPI-Host": "url-shortener-service.p.rapidapi.com"
"X-RapidAPI-Host": "url-shortener-service.p.rapidapi.com",
}
response = requests.request("POST", url, data=payload, headers=headers)
x = dict(response.json())
return_link = ""
for i in x.values():
return_link = i
return return_link


9 changes: 6 additions & 3 deletions pastebin-bot/quotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
def preload_quotes():
global quotes
quotes.clear()

randon_quote = requests.get(api, headers={'X-Api-Key': 'ZSVhux9848gfWCCCLMlESQ==UwDZ4yCxgj0irhQu'}).json()

randon_quote = requests.get(
api, headers={"X-Api-Key": "ZSVhux9848gfWCCCLMlESQ==UwDZ4yCxgj0irhQu"}
).json()
content = randon_quote[0]
author = content["author"]
quote = content["quote"] + "\n\n" + "By " + author
quotes.append(quote)

#print(quotes[0])

# print(quotes[0])

# preload_quotes()
#
Expand Down

0 comments on commit 633d1f8

Please sign in to comment.