Skip to content

Commit 38ad8fc

Browse files
committed
Some fixes
Heroku files removed. ! some minor code fixes.
1 parent 4d4b8d2 commit 38ad8fc

14 files changed

+83
-145
lines changed

README.md

+58-49
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,97 @@
1-
<h1 align="left">
2-
<a target="_blank">
3-
Clonebot
4-
<img src="http://www.randomnoun.com/wpf/shell32-avi/tshell32_160.gif" width="272" height="60">
5-
</a>
6-
</h1>
7-
8-
#### An <a href="https://choosealicense.com/licenses/gpl-3.0/" target="_blank"> opensource </a> Telegram robot can clone media & text from any chat to your own chat.<br>
9-
Read the <a href="https://space4renjith.blogspot.com/2022/05/clonebot-technical-documentation.html" target="_blank"> documentation </a>to know how to use the bot
1+
# Clonebot
2+
3+
[![Clonebot Logo](http://www.randomnoun.com/wpf/shell32-avi/tshell32_160.gif)](#)
4+
5+
#### An [opensource](https://choosealicense.com/licenses/gpl-3.0/) Telegram robot can clone media & text from any chat to your own chat.
6+
Read the [documentation](https://space4renjith.blogspot.com/2022/05/clonebot-technical-documentation.html) to know how to use the bot
7+
8+
---
9+
10+
**DUE TO SOME SECURITY REASONS, DEPLOY TO HEROKU FROM THIS REPOSITORY HAS BEEN ABOLISHED!**
1011
<br>
11-
<p align="left">
12-
<br>
13-
<b>DUE TO SOME SECURITY REASONS, DEPLOY TO HEROKU FROM THIS REPOSITORY HAS BEEN ABOLISHED !</b>
14-
<br>
15-
<u>This repository is no longer supporting Heroku deployment. Use a paid VPS / Raspberry Pi / Local pc instead. See the documentation for more.</u>
16-
<br><br>
17-
<a href="https://t.me/rmprojects" target="_blank">@M4Mallu</a>
18-
</p>
12+
*This repository is no longer supporting Heroku deployment. Use a paid VPS / Raspberry Pi / Local PC instead. See the documentation for more.*
13+
14+
[@M4Mallu](https://t.me/rmprojects)
1915

2016
<details>
2117
<summary><b>Deploy Using Docker</b></summary>
22-
1. Deploying on VPS Using Docker
2318

24-
- Start Docker daemon (skip if already running), if installed by snap then use 2nd command:
19+
1. **Deploying on VPS Using Docker**
20+
21+
- Start Docker daemon (skip if already running), if installed by snap then use 2nd command:
2522

23+
```bash
2624
sudo dockerd
2725
sudo snap start docker
26+
```
2827

29-
Note: If not started or not starting, run the command below then try to start.
28+
Note: If not started or not starting, run the command below then try to start.
3029

30+
```bash
3131
sudo apt install docker.io
32+
```
3233

33-
- Build Docker image:
34+
- Build Docker image:
3435

36+
```bash
3537
sudo docker build . -t clone-bot
38+
```
3639

37-
- Run the image:
40+
- Run the image:
3841

42+
```bash
3943
sudo docker run clone-bot
44+
```
4045

41-
- To stop the image:
46+
- To stop the image:
4247

48+
```bash
4349
sudo docker ps
4450
sudo docker stop id
51+
```
4552

46-
- To clear the container:
53+
- To clear the container:
4754

55+
```bash
4856
sudo docker container prune
57+
```
4958

50-
- To delete the images:
59+
- To delete the images:
5160

61+
```bash
5262
sudo docker image prune -a
63+
```
5364

54-
2. Deploying on VPS Using docker-compose
55-
56-
**NOTE**: If you want to use port other than 80, change it in docker-compose.yml
57-
58-
```
59-
sudo apt install docker-compose
60-
```
61-
- Build and run Docker image:
62-
```
63-
sudo docker-compose up
64-
```
65-
- After editing files with nano for example (nano start.sh):
66-
```
67-
sudo docker-compose up --build
68-
```
69-
- To stop the image:
70-
```
71-
sudo docker-compose stop
72-
```
73-
- To run the image:
74-
```
75-
sudo docker-compose start
76-
```
65+
2. **Deploying on VPS Using docker-compose**
7766

78-
</details>
67+
**NOTE**: If you want to use a port other than 80, change it in docker-compose.yml
7968

69+
```bash
70+
sudo apt install docker-compose
71+
```
8072

73+
- Build and run Docker image:
8174

75+
```bash
76+
sudo docker-compose up
77+
```
8278

79+
- After editing files with nano for example (nano start.sh):
8380

81+
```bash
82+
sudo docker-compose up --build
83+
```
8484

85+
- To stop the image:
8586

87+
```bash
88+
sudo docker-compose stop
89+
```
8690

91+
- To run the image:
8792

93+
```bash
94+
sudo docker-compose start
95+
```
8896

97+
</details>

app.json

-32
This file was deleted.

bot.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
#----------------------------------- https://github.com/m4mallu/clonebot --------------------------------------------#
2-
import os
32
import sys
43
from user import User
54
from pyrogram import Client
65
from presets import Presets as Msg
76
from pyrogram.enums import ParseMode
87

9-
10-
if bool(os.environ.get("ENV", False)):
11-
from sample_config import Config
12-
from sample_config import LOGGER
13-
else:
14-
from config import Config
15-
from config import LOGGER
8+
from config import Config
9+
from config import LOGGER
1610

1711

1812
class Bot(Client):

library/chat_support.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ async def date_time_calc(start_date, start_time, cur_date, cur_time):
102102
return f'{date_diff}D', time_diff
103103

104104

105-
# Functions to set the bot vaiables to default values
105+
# Functions to set the bot variables to default values
106106
async def set_to_defaults(id):
107107
await reset_all(id)
108108
file_types.clear()

library/sql.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import os
21
import threading
2+
from config import Config
33
from sqlalchemy import create_engine
44
from sqlalchemy import Column, Boolean, Numeric
55
from sqlalchemy.ext.declarative import declarative_base
66
from sqlalchemy.orm import sessionmaker, scoped_session
77

8-
98
clone_cancel_key = {} # Clone cancel status key
109
clone_btn_count = {} # Clone button single click actuator key
1110
index_skip_key = {} # Skip indexing function key
@@ -15,11 +14,6 @@
1514
master_index = [] # Unique id index of cloning medias (including target chat)
1615
file_types = ["document", "video", "audio", "voice", "photo", "text"]
1716

18-
if bool(os.environ.get("ENV", False)):
19-
from sample_config import Config
20-
else:
21-
from config import Config
22-
2317
def start() -> scoped_session:
2418
engine = create_engine(Config.DB_URI, client_encoding="utf8")
2519
BASE.metadata.bind = engine

plugins/cb_button.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# ----------------------------------- https://github.com/m4mallu/clonebot ---------------------------------------------#
2+
import os
23
import sys
34
from bot import Bot
45
from library.sql import *
@@ -12,12 +13,6 @@
1213
from plugins.commands import reply_markup_home
1314
from plugins.index_files import index_target_chat, purge_media
1415

15-
if bool(os.environ.get("ENV", False)):
16-
from sample_config import Config
17-
else:
18-
from config import Config
19-
20-
2116
@Client.on_callback_query(filters.regex(r'^start_btn$'))
2217
async def start_settings(client: Bot, cb: CallbackQuery):
2318
user = await Bot.get_me(self=client.USER)

plugins/clone.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async def clone_medias(bot: Bot, m: Message):
4545
else:
4646
delay = 3
4747
#
48-
# The vaulues will be swithed if the start message id is greater than the end message id
48+
# The values will be switched if the start message id is greater than the end message id
4949
if start_id > end_id:
5050
start_id = start_id ^ end_id
5151
end_id = end_id ^ start_id

plugins/commands.py

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ async def force_reply_msg(client: Bot, message: Message):
7676
chat_info = message.text
7777
id = int(message.from_user.id)
7878
chat_status = []
79-
member_status = []
8079
user_bot_me = await client.USER.get_me()
8180
query = await query_msg(id)
8281
a = int(query.s_chat_msg_id)

plugins/index_files.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# ----------------------------------- https://github.com/m4mallu/clonebot ---------------------------------------------#
2+
import os
23
import asyncio
34
from bot import Bot
45
from library.sql import *

presets.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,6 @@ class Presets(object):
179179
180180
<u><b>Credits:</u></b> https://github.com/m4mallu
181181
"""
182-
GET_CHAT_ID_MSG = "<b>You have been forwaded a message\nfrom a chat having the id:</b>\n\n<code>{" \
182+
GET_CHAT_ID_MSG = "<b>You have been forwarded a message\nfrom a chat having the id:</b>\n\n<code>{" \
183183
"}</code>\n<b>Message Id: </b><code>{}</code>\n\n<i>Tap the above text to copy !</i> "
184-
CLONE_REPORT_INFO = "A report has been generted in your SAVED MESSAGES folder. Thanks for using this bot 🤝"
184+
CLONE_REPORT_INFO = "A report has been generated in your SAVED MESSAGES folder. Thanks for using this bot 🤝"

run.bat

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
echo
2-
echo
31
echo "Credits: m4mallu> https://github.com/m4mallu"
4-
echo
2+
sleep 1
3+
clear >$(tty)
4+
virtualenv -p python3 venv > /dev/null
5+
. ./venv/bin/activate > /dev/null
56
echo "Installing requirements, please wait..."
67
pip3 install -r requirements.txt > /dev/null
7-
echo "Done! Starting the bot..."
8-
echo
8+
sleep 1
9+
clear >$(tty)
10+
echo "Starting the bot, please wait..."
11+
sleep 1
12+
clear >$(tty)
913
python3 main.py

sample-vps-config.py

-20
This file was deleted.

sample_config.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#----------------------------------- https://github.com/m4mallu/clonebot --------------------------------------------#
2-
import os
32
import logging
43

54
logging.basicConfig(
@@ -12,19 +11,19 @@
1211
class Config(object):
1312

1413
# Get a bot token from botfather
15-
TG_BOT_TOKEN = os.environ.get("TG_BOT_TOKEN", "")
14+
TG_BOT_TOKEN = "Your_Telegram_bot_token"
1615

1716
# Get from my.telegram.org
18-
APP_ID = int(os.environ.get("APP_ID", ""))
17+
APP_ID = int(Your_telegram_App_Id)
1918

2019
# Get from my.telegram.org
21-
API_HASH = os.environ.get("API_HASH", "")
20+
API_HASH = "Your_Telegram_Api_Hash"
2221

2322
# Generate a user session string
24-
TG_USER_SESSION = os.environ.get("TG_USER_SESSION", "")
23+
TG_USER_SESSION = "Your_user_session_string_compatible_with_Pyrogram_v2"
2524

2625
# Database URI
27-
DB_URI = os.environ.get("DATABASE_URL", "")
26+
DB_URI = "Your_database_URI"
2827

2928

3029
def LOGGER(name: str) -> logging.Logger:

user.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
#----------------------------------- https://github.com/m4mallu/clonebot --------------------------------------------#
2-
import os
32
from pyrogram import Client
43
from pyrogram.enums import ParseMode
54

6-
if os.environ.get("ENV", False):
7-
from sample_config import Config
8-
from sample_config import LOGGER
9-
else:
10-
from config import Config
11-
from config import LOGGER
5+
from config import Config
6+
from config import LOGGER
127

138
class User(Client):
149
def __init__(self):

0 commit comments

Comments
 (0)