Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Commit e0af3a2

Browse files
authored
#Heroku Support (again) (#45)
* Create app.json * Update sample_config.py * Update main.py * Update and rename sample_config.py to config.py * Create generate_string_session.py * Update README.md * Update README.md * Rename config.py to sample_config.py * Update main.py * Create runtime.txt * Update main.py * Update README.md
1 parent 5b84b27 commit e0af3a2

File tree

6 files changed

+85
-2
lines changed

6 files changed

+85
-2
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ Edit **config.py** with your own values.
3434
$ python3 main.py
3535
```
3636

37+
## Heroku
38+
39+
#### Generate String session [IMPORTANT]
40+
41+
Download this file [generate_string_session.py](https://raw.githubusercontent.com/thehamkercat/Telegram_VC_Bot/master/generate_string_session.py)
42+
43+
44+
```sh
45+
$ pip3 install pyrogram TgCrypto
46+
$ python3 generate_string_session.py
47+
```
48+
Fork this repository and change name of `sample_config.py` to `config.py`
49+
Then you will need get a session string, copy it, then press heroku deploy button.
50+
51+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/Tejas61900/Telegram_VC_Bot/tree/master)
52+
3753

3854
Send [commands](https://github.com/thehamkercat/Telegram_VC_Bot/blob/master/README.md#commands) to bot to
3955
play music.

app.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "Telegram Voice Chat Bot",
3+
"description": "Telegram Voice-Chat Bot Written In Python Using Pytgcalls & Pyrogram.",
4+
"repository": "https://github.com/thehamkercat/Telegram_VC_Bot",
5+
"logo": "https://i.imgur.com/8S8NVy0.png",
6+
"keywords": [
7+
"python",
8+
"telegram",
9+
"bot",
10+
"voicechat",
11+
"youtube",
12+
"telegram-bot",
13+
"pyrogram",
14+
"pytgcalls",
15+
"tgcalls",
16+
"jiosaavn",
17+
"telegram-vcbot",
18+
"telegram-musicbot"
19+
],
20+
"stack": "heroku-20",
21+
"buildpacks": [
22+
{
23+
"url": "heroku/python"
24+
},
25+
{
26+
"url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git"
27+
}
28+
],
29+
"env": {
30+
"API_ID": {
31+
"description": "API_ID of your Telegram Account my.telegram.org/apps",
32+
"required": true
33+
},
34+
"API_HASH": {
35+
"description": "API_HASH of your Telegram Account my.telegram.org/apps",
36+
"required": true
37+
},
38+
"SESSION_STRING": {
39+
"description": "Session string, Check the readme if you don't know how to get this.",
40+
"required": true
41+
},
42+
"SUDO_CHAT_ID": {
43+
"description": "ID of your chat in which you want the bot to play music, Ex- -1001485393652",
44+
"required": true
45+
},
46+
"OWNER_ID": {
47+
"description": "ID of your owner account",
48+
"required": true
49+
}
50+
}}

generate_string_session.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from pyrogram import Client as c
2+
3+
API_ID = input("\nEnter Your API_ID:\n > ")
4+
API_HASH = input("\nEnter Your API_HASH:\n > ")
5+
6+
print("\n\n Enter Phone number when asked.\n\n")
7+
8+
i = c(":memory:", api_id=API_ID, api_hash=API_HASH)
9+
10+
with i:
11+
ss = i.export_session_string()
12+
print("\nHERE IS YOUR STRING SESSION, COPY IT, DON'T SHARE!!\n")
13+
print(f"\n{ss}\n")

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
generate_cover_square,
1818
)
1919

20-
from config import API_ID, API_HASH, SUDO_CHAT_ID, SUDOERS, ARQ_API
20+
from config import API_ID, API_HASH, SUDO_CHAT_ID, SUDOERS, ARQ_API, SESSION_STRING
2121

2222
queue = [] # This is where the whole song queue is stored
2323
playing = False # Tells if something is playing or not
2424

2525

2626
# Pyrogram Client
27-
app = Client("tgvc", api_id=API_ID, api_hash=API_HASH)
27+
app = Client("session_string=SESSION_STRING", api_id=API_ID, api_hash=API_HASH)
2828

2929
# Pytgcalls Client
3030
vc = GroupCall(

runtime.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python-3.9.4

sample_config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
from os import environ
2+
13
API_ID = 14371
24
API_HASH = "e46b6c854d2bf58a0"
35
SUDO_CHAT_ID = -1001485876964 # Chat where the bot will play the music.
46
SUDOERS = [1243703097, 13216546] # Users which have special control over the bot.
7+
SESSION_STRING = "sgjiidhehje:jkeooh" #Check Readme for session
58

69
# don't make changes below this line
710
ARQ_API = "https://thearq.tech"

0 commit comments

Comments
 (0)