forked from RafiqBotutihe/Telegram-Spotify-Downloader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot.py
97 lines (76 loc) · 2.51 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import logging
import os
from handlers import sender
from handlers.helpers import spotifydl
from telegram import Update
from telegram.ext import CallbackContext, CommandHandler, Updater
logger = logging.getLogger(__name__)
def setup_logging():
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO
)
def start(update: Update, context: CallbackContext):
context.bot.send_message(chat_id=update.effective_chat.id, text="""
-·=»‡«=·- ֆքօȶɨʄʏ ɖօառʟօǟɖ ɮօȶ -·=»‡«=·-
🍭 🎀 Featureʂ 🎀 🍭
* Can download any spotify song.
* Can download any spotify playlist-(❌BETA-SLOW❌)
* Premium song supported
* Free Lol!
* 𝕌𝕊𝔼 /help 𝔽𝕆ℝ 𝕄𝕆ℝ𝔼 𝕀ℕ𝔽𝕆*
Made with💚by @MennerDaendels
[https://telegra.ph/file/ff06b4802f3a2ac7b6343.jpg]
""")
def help(update: Update, context: CallbackContext):
context.bot.send_message(chat_id=update.effective_chat.id, text="""
🍮♠ ʊֆǟɢɛ ♠🍮\n
*SINGLE - Type /𝙨𝙥𝙤𝙩𝙞𝙛𝙮 "Song url"
*PLAYLIST- Type /𝙨𝙥𝙤𝙩𝙞𝙛𝙮 "Playlist url" (❌BETA-SLOW❌)""")
def error(update: Update, context: CallbackContext, error):
logger.warning('Update "%s" caused error "%s"', update, error)
def main():
TOKEN = os.environ.get('TOKEN')
APP_NAME = os.environ.get('APP_NAME')
# Port is given by Heroku
PORT = os.environ.get('PORT')
# Set up the Updater
updater = Updater(
TOKEN,
use_context=True,
)
dp = updater.dispatcher
# Add handlers
dp.add_handler(CommandHandler('start', start))
dp.add_handler(CommandHandler('help', help))
dp.add_error_handler(error)
dp.add_handler(
CommandHandler(
'spotify',
sender.botify,
pass_args=True,
pass_job_queue=True,
pass_chat_data=True
)
)
dp.add_handler(
CommandHandler(
'spotifydl',
sender.botify,
pass_args=True,
pass_job_queue=True,
pass_chat_data=True
)
)
dp.add_handler(CommandHandler(
'help',
sender.botify,
pass_args=True,
pass_job_queue=True,
pass_chat_data=True
)
)
updater.start_polling()
updater.idle()
if __name__ == "__main__":
main()