Skip to content

Commit e7f75e2

Browse files
committed
set cred
1 parent 28aacb1 commit e7f75e2

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

run.sh

+2-30
Original file line numberDiff line numberDiff line change
@@ -36,37 +36,9 @@ set_bot_credentials() {
3636
fi
3737

3838
yellow "--------------Getting credntials--------------"
39-
python3 <<EOF
40-
import os
41-
import pickle
42-
43-
# File to store the allowed_ids and admin_id
44-
pickle_file = '/root/spotbot/spotbot_config.pkl'
45-
46-
def save_allowed_ids():
47-
data = {'allowed_ids': allowed_ids,
48-
'admin_id': admin_id,
49-
'spotdl_client_id': spotdl_client_id,
50-
'spotdl_client_secret': spotdl_client_secret,
51-
'telegram_bot_token': telegram_bot_token,
52-
}
53-
with open(pickle_file, 'wb') as f:
54-
pickle.dump(data, f)
55-
56-
# Initialize allowed_ids and admin_id from pickle if available, else start fresh
57-
allowed_ids = []
58-
admin_id = int(input("Enter the admin's Telegram user ID: "))
59-
telegram_bot_token = input("\nEnter Telegram Bot Token from @Botfather: ")
60-
spotify_cred = input("\nDo you want to use your own spotify credentials (y/n): ")
61-
if spotify_cred == 'y':
62-
spotdl_client_id = input("\n Enter your Spotify client ID: ")
63-
spotdl_client_secret = input("\n Enter your Spotify client secret: ")
64-
elif spotify_cred == 'n':
65-
spotdl_client_id = '5f573c9620494bae87890c0f08a60293'
66-
spotdl_client_secret = '212476d9b0f3472eaa762d90b19b0ba8'
67-
save_allowed_ids()
68-
EOF
39+
python3 spotbot/set_cred.py
6940
yellow "----------------------------------------------"
41+
echo
7042
readp "Press Enter to continue..."
7143
}
7244
get_spotbot_add_service() {

set_cred.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import os
2+
import pickle
3+
4+
# File to store the allowed_ids and admin_id
5+
pickle_file = '/root/spotbot/spotbot_config.pkl'
6+
7+
def save_allowed_ids():
8+
data = {'allowed_ids': allowed_ids,
9+
'admin_id': admin_id,
10+
'spotdl_client_id': spotdl_client_id,
11+
'spotdl_client_secret': spotdl_client_secret,
12+
'telegram_bot_token': telegram_bot_token,
13+
}
14+
with open(pickle_file, 'wb') as f:
15+
pickle.dump(data, f)
16+
17+
# Initialize allowed_ids and admin_id from pickle if available, else start fresh
18+
allowed_ids = []
19+
admin_id = int(input("Enter the admin's Telegram user ID: "))
20+
telegram_bot_token = input("\nEnter Telegram Bot Token from @Botfather: ")
21+
spotify_cred = input("\nDo you want to use your own spotify credentials (y/n): ")
22+
if spotify_cred == 'y':
23+
spotdl_client_id = input("\n Enter your Spotify client ID: ")
24+
spotdl_client_secret = input("\n Enter your Spotify client secret: ")
25+
elif spotify_cred == 'n':
26+
spotdl_client_id = '5f573c9620494bae87890c0f08a60293'
27+
spotdl_client_secret = '212476d9b0f3472eaa762d90b19b0ba8'
28+
save_allowed_ids()

0 commit comments

Comments
 (0)