forked from An0nimia/DeezSpot_bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
169 lines (147 loc) · 4.25 KB
/
settings.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/python3
import os
import platform
from telegram import InlineKeyboardButton
from configparser import ConfigParser
not_interface = False
default_time = 0.0
roots = [560950095]
limit = 2000000000
seconds_limits_album = 40000
max_songs = 400
telegram_file_api_limit = 1500000000
telegram_audio_api_limit = 50000000
db_file = "dwsongs.db"
#loc_dir = "/songs"
#ini_file = "/data/settings.ini"
photo = "example.png"
bot_name = "DeezloaderAn0n_bot"
api_chart = "https://api.deezer.com/chart"
api_artist = "https://api.deezer.com/artist/%s"
api_type1 = "https://api.deezer.com/search/{}/?q={}"
api_type2 = "https://api.deezer.com/search/?q={}:\"{}\""
song_default_image = "https://e-cdns-images.dzcdn.net/images/cover/1000x1000-000000-80-0-0.jpg"
services_supported = ["spotify", "deezer"]
comandss = ["start", "settings", "info", "shazam", "help"]
settingss = ["quality", "tongue"]
qualities = ["FLAC", "MP3_320", "MP3_256", "MP3_128"]
send_image_track_query = "🎧 Track: %s \n👤 Artist: %s \n💽 Album: %s \n📅 Date: %s"
send_image_album_query = "💽 Album: %s \n👤 Artist: %s \n📅 Date: %s \n🎧 Tracks amount: %d"
send_image_artist_query = "👤 Artist: %s \n💽 Album numbers: %d \n👥 Fans on Deezer: %d"
tags_query = "💽 Album: %s\n📅 Date: %s\n📀 Label: %s\n🎵 Genre: %s"
info_msg = "🔺 Version: %s\n🔻 Name: @%s\n✒️ Creator: @%s\n💵 Donation: %s\n📣 Forum: %s\n👥 Users: %d\n⬇️ Total downloads: %d"
send_image_playlist_query = "📅 Creation: %s \n👤 User: %s \n🎧 Tracks amount: %d"
insert_query = "INSERT INTO DWSONGS (id, query, quality) values ('%s', '%s', '%s')"
where_query = "SELECT query FROM DWSONGS WHERE id = '{}' and quality = '{}'"
user_exist = "SELECT chat_id FROM CHAT_ID where chat_id = '%d'"
share_message = "tg://msg?text=Start @%s for download all the songs which you want ;)" % bot_name
start_message = "Welcome to @%s \nPress '/' to get commands list" % bot_name
not_supported_links = "Sorry :( The bot doesn't support this link %s :("
rate_link = "https://t.me/BotsArchive/298"
end_message = "FINISHED :) Rate me here %s" % rate_link
SECRET_KEY = os.environ.get('AM_I_IN_A_DOCKER_CONTAINER', False)
if platform.system() == 'Linux':
if SECRET_KEY:
ini_file = "/data/settings.ini"
else:
ini_file = "settings.ini"
elif platform.system() == 'Windows':
ini_file = "settings.ini"
else:
ini_file = "settings.ini"
config = ConfigParser()
config.read(ini_file)
try:
loc_dir = config['storing_rules']['output']
except KeyError:
print("Bot settings: Something went wrong with configuration file")
exit()
help_message = (
"/start: Start the bot" +
"\n\n/settings: Manage settings" +
"\n\n/shazam: Identify a song by a voice or audio message (You can do without calling this command, just send the media)" +
"\n\n/help: Show this message" +
"\n\n" +
"Just send a spotify or deezer link to download, or type what you are looking for"
)
end_keyboard = [
[
InlineKeyboardButton(
"SHARE",
url = share_message
)
]
]
qualities_keyboard = [
[
InlineKeyboardButton(
qualities[a],
callback_data = qualities[a]
),
InlineKeyboardButton(
qualities[a + 1],
callback_data = qualities[a + 1]
)
] for a in range(
0, len(qualities), 2
)
]
first_time_keyboard = [
[
InlineKeyboardButton(
"✅",
url = "t.me/%s?start" % bot_name
)
]
]
queries = {
"top": {
"query": "%s/top?limit=30",
"text": "TOP 30 🔝"
},
"albums": {
"query": "%s/albums",
"text": "ALBUMS 💽"
},
"radio": {
"query": "%s/radio",
"text": "RADIO 📻"
},
"related": {
"query": "%s/related",
"text": "RELATED 🗣"
},
"download": {
"text": "Download ⬇️"
},
"info": {
"text": "Info ❕"
},
"back": {
"text": "BACK 🔙"
},
"s_art": {
"query": "art: %s",
"text": "Search by artist 👤"
},
"s_alb": {
"query": "alb: %s",
"text": "Search by album 💽"
},
"s_pla": {
"query": "pla: %s",
"text": "Search playlist 📂"
},
"s_lbl": {
"query": "lbl: %s",
"text": "Search label 📀"
},
"s_trk": {
"query": "trk: %s",
"text": "Search track 🎧"
},
"s_": {
"query": "%s",
"text": "Global search 📊"
}
}