.
675 |
--------------------------------------------------------------------------------
/Plugins/commands.py:
--------------------------------------------------------------------------------
1 | # @0AIB
2 |
3 | import logging
4 | logger = logging.getLogger(__name__)
5 |
6 | from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
7 | from pyrogram import filters
8 | from bot import channelforward
9 | from config import Config
10 | from translation import Translation
11 |
12 | url_button=InlineKeyboardMarkup(
13 | [
14 | [
15 | InlineKeyboardButton("⚙ UPDATE CHANNE", url='https://t.me/Lx0980AI'),
16 | InlineKeyboardButton("⭕️ SOURCE", url='https://github.com/0AIB/Auto-Forward-Bot')
17 | ]
18 | ]
19 | )
20 |
21 | ################################################################################################################################################################################################################################################
22 | # start command
23 |
24 | @channelforward.on_message(filters.command("start") & filters.private & filters.incoming)
25 | async def start(client, message):
26 | await message.reply(
27 | text=Translation.START,
28 | disable_web_page_preview=True,
29 | reply_markup = url_button,
30 | quote=True
31 | )
32 |
33 | ################################################################################################################################################################################################################################################
34 | # about command
35 |
36 | @channelforward.on_message(filters.command("about") & filters.private & filters.incoming)
37 | async def about(client, message):
38 | await message.reply(
39 | text=Translation.ABOUT,
40 | disable_web_page_preview=True,
41 | reply_markup = url_button,
42 | quote=True
43 | )
44 |
45 | ################################################################################################################################################################################################################################################
46 |
--------------------------------------------------------------------------------
/Plugins/forward.py:
--------------------------------------------------------------------------------
1 | import logging
2 | logger = logging.getLogger(__name__)
3 |
4 | import asyncio
5 | from pyrogram import filters
6 | from bot import channelforward
7 | from config import Config
8 |
9 |
10 | @channelforward.on_message(filters.channel)
11 | async def forward(client, message):
12 | # Forwarding the messages to the channel
13 | try:
14 | for id in Config.CHANNEL:
15 | from_channel, to_channel = id.split(":")
16 | if message.chat.id == int(from_channel):
17 | # func = message.copy if False else message.forward
18 | await message.copy(int(to_channel))
19 | print("Forwarded a message from", from_channel, "to", to_channel)
20 | await asyncio.sleep(1)
21 | except Exception as e:
22 | logger.exception(e)
23 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | worker: python3 bot.py
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | |[Repo को फोर्क करें।](https://github.com/0AIB/Auto-Forward-Bot/fork)
2 | |---
3 |
4 | # चैनल ओटो फॉरवर्ड
5 | एक सिंपल टेलीग्राम बोट जो आपके चैनल में आने वाली नई पोस्ट को दूसरे चैनल में ऑटोमेटेकली (स्वचालित) फॉरवर्ड करेगा।
6 |
7 | ## कैसे तैनात (डिप्लोय) करें?
8 | आप इस कोड को कहीं भी तैनात कर सकते हो, पर नीचे Heroku को और Railway डिप्लोय के बारे में बताया गया है।
9 |
10 | - इन 2 तरीकों में से एक का चयन करें
11 | - [](https://heroku.com/deploy?template=https://github.com/0AIB/Auto-Forward-Bot)
12 |
13 | - [](https://railway.app/new/template/P59W6v)
14 |
15 | - पहले आपका चैनल आईडी प्राप्त करें और इस प्रारूप में जमाए -10023352648:-100655379
16 | - उस चैनल के आईडी जिस चैनल से आप फॉरवर्ड करना चाहते है -10023352648
17 | - उस चैनल की आईडी जिसमें आप फॉरवर्ड करना चाहते हैं -100655379
18 |
19 | - ( आप ऐसे ही कई चैनल की आईडी सेट कर सकते हैं, पर आप इस तरह फॉरवर्ड नहीं कर सकते जैसे एक चैनल से दूसरे में और दूसरे से तीसरे में आप केवल एक से दूसरे चैंनल में ही forward कर सकते हैं। )
20 |
21 | - [my.telegram.org](https://my.telegram.org/) पर जाए और वहां से API ID, और API HASH प्राप्त करें।
22 | - आपका बोट टोकन टेलीग्राम बोट फादर से पाएं [@BotFather](https://telegram.dog/botfather)
23 |
24 |
25 |
26 |
27 | ## आदेश
28 | ### उपलब्ध आदेश
29 | ```
30 | start - चेक करें की बोट चालू है या बंद।
31 |
32 | about - मेरे बारे में।
33 | ```
34 |
35 | ## लाइसेंस
36 | [](https://github.com/Ns-AnoNymouS/TG-CONVERT-BOT/blob/main/LICENSE)
37 |
38 |
39 |
40 | ###### [English](https://github.com/0AIB/Auto-Forward-Bot/blob/main/english.md)
41 |
42 | ## श्रेय ओर इन सभी को धन्यवाद। ❤️
43 | [](https://saythanks.io/to/kennethreitz)
44 | - [Dan](https://telegram.dog/haskell) for his pyrogram docs
45 | - [MaheshMalekar](https://telegram.dog/MaheshMalekar) ❤
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Channel Auto forward bot",
3 | "description": "Telegram auto forwarding bot. Create your Fork now.",
4 | "keywords": [
5 | "telegram",
6 | "simple",
7 | "auto",
8 | "forward"
9 | ],
10 | "success_url": "https://telegram.dog/Lx0980AI",
11 | "repository": "https://github.com/0AIB/Auto-Forward-Bot",
12 | "env": {
13 | "API_HASH": {
14 | "description": "Get this value from https://my.telegram.org",
15 | "value": ""
16 | },
17 | "API_ID": {
18 | "description": "Get this value from https://my.telegram.org",
19 | "value": ""
20 | },
21 | "BOT_TOKEN": {
22 | "description": "Your bot token, as a string. Get this from @BotFather",
23 | "value": ""
24 | },
25 | "CHANNEL_ID": {
26 | "description": "your channel id in format -10023352648:-100655379 (from channel id:to channel id) if you want to give more channels seperate them with white space",
27 | "value": ""
28 | }
29 | },
30 | "buildpacks": [{"url": "heroku/python"}]
31 | }
32 |
--------------------------------------------------------------------------------
/bot.py:
--------------------------------------------------------------------------------
1 | import logging
2 | logging.basicConfig(
3 | level=logging.DEBUG,
4 | format='%(asctime)s - %(lineno)d - %(module)s - %(levelname)s - %(message)s'
5 | )
6 | logging.getLogger().setLevel(logging.INFO)
7 | logging.getLogger("pyrogram").setLevel(logging.WARNING)
8 |
9 | import uvloop
10 | uvloop.install()
11 | from config import Config
12 | from pyrogram import Client
13 |
14 |
15 | class channelforward(Client, Config):
16 | def __init__(self):
17 | super().__init__(
18 | name="CHANNELFORWARD",
19 | bot_token=self.BOT_TOKEN,
20 | api_id=self.API_ID,
21 | api_hash=self.API_HASH,
22 | workers=20,
23 | plugins={'root': 'Plugins'}
24 | )
25 |
26 | async def start(self):
27 | await super().start()
28 | me = await self.get_me()
29 | print(f"New session started for {me.first_name}({me.username})")
30 |
31 | async def stop(self):
32 | await super().stop()
33 | print("Session stopped. Bye!!")
34 |
35 |
36 | if __name__ == "__main__" :
37 | channelforward().run()
38 |
--------------------------------------------------------------------------------
/config.py:
--------------------------------------------------------------------------------
1 | from os import getenv
2 |
3 | class Config(object):
4 | API_HASH = getenv("API_HASH")
5 | API_ID = int(getenv("API_ID", 0))
6 | BOT_TOKEN = getenv("BOT_TOKEN", "")
7 | CHANNEL = list(x for x in getenv("CHANNEL_ID", "").replace("\n", " ").split(' '))
8 |
--------------------------------------------------------------------------------
/english.md:
--------------------------------------------------------------------------------
1 | |[Fork Repo](https://github.com/0AIB/Auto-Forward-Bot/fork)
2 | |---
3 |
4 | # CHANNEL AUTO FORWARD
5 | A Simple telegram bot written in python to forward your files from one channel to other channel when a new post is available. What you need to do is just deploy this code.
6 |
7 | [](https://github.com/0AIB/TG-Caption-Bot/tree/main)
8 | [](https://telegram.dog/Ns_AnoNymouS)
9 |
10 | ## How to Deploy? 🤔
11 | You can deploy this code any where you want but we provided heroku and railway deploy methods below
12 |
13 | - Select one of the methods
14 | - [](https://heroku.com/deploy?template=https://github.com/0AIB/Auto-Forward-Bot)
15 |
16 | - [](https://railway.app/new/template/P59W6v)
17 |
18 | - Go to [my.telegram.org](https://my.telegram.org/)
19 | - And get your API ID
20 | - And API Hashes
21 |
22 | - Paste the below API_HASH and API_ID respectively.
23 |
24 | - Get the your channel id and paste in below in the format -10023352648:-100655379
25 | - In the about format -10023352648 is the channel from which you need to forward
26 | - and -100655379 is the channel to which you wanted to forward
27 | [
](https://telegram.dog/Ns_bot_updates)
28 |
29 | - Get the Bot Father Token from [@BotFather](https://telegram.dog/botfather)
30 |
31 | - Paste the token below BOT_TOKEN.
32 |
33 | - Set AS_COPY value to True if you want to forward messages without forward tag.
34 |
35 |
36 | ## How to reach Me ?
37 |
38 |
39 |
40 | ## COMMANDS
41 | ### AVAILABLE COMMANDS
42 | ```
43 | start - check whether bot is alive
44 |
45 | about - to know about me
46 | ```
47 |
48 | [](https://www.python.org/)
49 |
50 | ## License
51 | [](https://github.com/Ns-AnoNymouS/TG-CONVERT-BOT/blob/main/LICENSE)
52 |
53 |
54 | ## Thanks and credits
55 | [](https://saythanks.io/to/kennethreitz)
56 | - [Dan](https://telegram.dog/haskell) for his pyrogram docs
57 | - [MaheshMalekar](https://telegram.dog/MaheshMalekar) ❤
58 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | uvloop
2 | tgcrypto
3 | pyrogram~=2.0.59
4 |
--------------------------------------------------------------------------------
/runtime.txt:
--------------------------------------------------------------------------------
1 | python-3.11.0
2 |
--------------------------------------------------------------------------------
/translation.py:
--------------------------------------------------------------------------------
1 | class Translation(object):
2 |
3 | # Start text
4 | START = "Hi there! I am a channel auto forward bot. I can forward new messages & Media from one channel to another.\n\n• Source code: Auto Forward Bot"
5 |
6 | #About text
7 | ABOUT = """
8 | 📝 Language: Python 3
9 | 🧰 Framework: Pyrogram
10 | 👨💻 Developer: @lx0980AI
11 | 🌐Source Code: https://github.com/0AIB/Auto-Forward-Bot"""
12 |
--------------------------------------------------------------------------------