Skip to content

Commit aca66a2

Browse files
authored
Add files via upload
1 parent ad76e70 commit aca66a2

15 files changed

+1466
-0
lines changed

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM python:3.10
2+
RUN apt update && apt upgrade -y
3+
RUN apt install git -y
4+
RUN pip install --upgrade pip
5+
6+
RUN pip install ffmpeg
7+
RUN pip install openai==0.28
8+
RUN pip install spotipy
9+
RUN pip install yt_dlp
10+
RUN pip install spotdl
11+
RUN pip instalL pafy
12+
RUN pip install pytube
13+
RUN pip install youtube-search
14+
15+
16+
COPY requirements.txt /requirements.txt
17+
18+
RUN cd /
19+
RUN pip install -U pip && pip install -U -r requirements.txt
20+
WORKDIR /app
21+
22+
COPY . .
23+
CMD ["python3", "bot.py"]

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: python3 bot.py

README.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<p align="center">
2+
<img src="https://telegra.ph/file/43e9e3a2e604ea243d3f7.jpg" alt="Sakura">
3+
</p>
4+
5+
<a href="https://t.me/mrtgcoderbot">
6+
<img src="https://img.shields.io/badge/ʙᴏᴛ-blue?logo=telegram" width="80">
7+
8+
<p align="center">
9+
<img src="https://img.shields.io/github/contributors/master-code-r/coder?style=for-the-badge&logo=appveyor" alt="Contributors">
10+
<img src="https://img.shields.io/github/repo-size/master-code-r/coder?style=for-the-badge&logo=appveyor" alt="Repository Size"> <br>
11+
<img src="https://img.shields.io/github/issues/master-code-r/coder?style=for-the-badge&logo=appveyor" alt="Issues">
12+
<img src="https://img.shields.io/github/forks/master-code-r/coder?style=for-the-badge&logo=appveyor" alt="Forks">
13+
<img src="https://img.shields.io/github/stars/master-code-r/coder?style=for-the-badge&logo=appveyor" alt="Stars">
14+
</p>
15+
16+
## Credits
17+
<details>
18+
19+
<a href="https://t.me/MrTG_Coder">
20+
<img src="https://img.shields.io/badge/ᴏᴡɴᴇʀ-blue?logo=telegram" width="80">
21+
22+
23+
<a href="https://t.me/masterolic">
24+
<img src="https://img.shields.io/badge/ᴛʜᴀɴᴋs ᴛᴏ-blue?logo=telegram" width="80">
25+
26+
27+
<a href="https://t.me/Sunrises_24">
28+
<img src="https://img.shields.io/badge/ᴛʜᴀɴᴋs ᴛᴏ-blue?logo=telegram" width="80">
29+
30+
</details>
31+
32+
## Language
33+
34+
[![Pyrogram Version](https://img.shields.io/badge/Pyrogram-2.0.30-orange)](https://docs.pyrogram.org/)
35+
[![Python Version](https://img.shields.io/badge/Python-.10.8-blue)](https://www.python.org/)
36+
37+
## Acknowledgements
38+
39+
- [BASE_REPO](https://github.com/Devil-Botz/Elsa)
40+
41+
ᴡᴇ ᴡɪʟʟ ᴛʀʏ ᴛᴏ ᴀᴅᴅ ᴅᴏɴᴡʟᴏᴀᴅ ғʀᴏᴍ sᴏɴɢ ғʀᴏᴍ sᴘᴏᴛɪғʏ.
42+
43+
## License
44+
45+
[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://github.com/master-code-r/coder/blob/main/LICENSE)
46+
47+
48+
49+
50+
51+
## Features
52+
53+
- [x] ᴛᴇʟᴇɢʀᴀᴘʜ
54+
- [x] ᴏᴘᴇɴᴀɪ
55+
- [x] sᴏɴɢ ᴅᴏᴡɴʟᴏᴀᴅᴇʀ (ғʀᴏᴍ ʏᴏᴜᴛᴜʙᴇ)
56+
- [x] ʀɪɴɢᴛᴜɴᴇ ᴅᴏᴡɴʟᴏᴀᴅᴇʀ
57+
- [x] sᴛɪᴄᴋᴇʀ ɪᴅ
58+
- [x] sᴘᴏᴛɪғʏ (ɴᴏᴡ ᴏɴʟʏ ғɪɴᴅ ᴛʜᴇ ᴅᴇᴛᴀɪʟs ᴏғ sᴏɴɢ)
59+
- [x] ʀᴇᴘᴏ sᴇᴀʀᴄʜ
60+
- [x] ᴘɪɴɢ(ᴀᴅᴍɪɴs) ᴄᴏᴍᴍᴀɴᴅ ʜᴀɴᴅʟᴇʀ "."
61+
- [x] ʙƦᴏᴀᴅᴄᴀsᴛ (ᴀᴅᴍɪɴs)
62+
- [x] sᴛᴀᴛs
63+
- [x] ɪᴅ ᴀɴᴅ ᴜsᴇʀ ɪɴғᴏ
64+
- [x] ᴏᴛʜᴇʀ ᴀᴅᴍɪɴ ᴄᴏᴍᴍᴀɴᴅs
65+
66+
## Variables
67+
68+
### Required Variables
69+
* `BOT_TOKEN`: Create a bot using [@BotFather](https://telegram.dog/BotFather), and get the Telegram API token.
70+
* `API_ID`: Get this value from [telegram.org](https://my.telegram.org/apps)
71+
* `API_HASH`: Get this value from [telegram.org](https://my.telegram.org/apps)
72+
* `S_GROUP` : Add the link of your support group (add in this form eg:- "https://t.me/{ur_support_group_link}")
73+
* `S_CHANNEL` : Add the link of your support channel (add in this form eg:- "https://t.me/{ur_support_channel_link}")
74+
* `ADMINS`: Username or ID of Admin. Separate multiple Admins by space
75+
* `DATABASE_URI`: [mongoDB](https://www.mongodb.com) URI. Get this value from [mongoDB](https://www.mongodb.com).
76+
* `DATABASE_NAME`: Name of the database in [mongoDB](https://www.mongodb.com). For more help watch this
77+
* `LOG_CHANNEL` : A channel to log the activities of bot. Make sure bot is an admin in the channel.
78+
* `OPENAI_API_KEY` : Get the value from [OPENAI](https://platform.openai.com/api-keys)
79+
* `SPOTIFY_CLIENT_ID` : Get the value from [spotify developer](https://developer.spotify.com/)
80+
* `SPOTIFY_CLIENT_SECRET` : Get the value from [spotify developer](https://developer.spotify.com/)
81+
82+
## CMD
83+
84+
```
85+
* /start - to check i am in alive
86+
* /about - to get the bot details
87+
* /telegraph - reply to a media
88+
* /openai - your query
89+
* /song - to get the song from youtube
90+
* /ringtune - to get the ringtune
91+
* /sticker_id - to get the sticker id
92+
* /spotify - to get the details of song from spotify
93+
* /repo - to search repo from github
94+
* /broadcast - to broadcast a message to all bot users
95+
* /stats - to get the users of the bot
96+
```
97+
98+
## CMD USAGE
99+
100+
```
101+
* /telegraph reply to a supported media media
102+
* /openai {your query}
103+
* /song {song_name}
104+
* /ringtune {song_name} or {song_name + artist_name}
105+
* /sticker_id reply to a sticker
106+
* /spotify {song_name}
107+
* /repo {repo_name}
108+
* /broadcast - reply to your message
109+
* /stats - to get the stats of the bot
110+
```
111+
112+
## Telegram Bot - Music Downloader and More!
113+
114+
Welcome to our Telegram Bot for downloading songs from YouTube, download ringtune, searching for songs on Spotify, generating telegraph, getting sticker id, chat gpt function and even searching for repositories on GitHub.
115+
116+
117+
## How to Use
118+
119+
Simply add our bot (https://t.me/mrtgcoderbot) on Telegram and start using its amazing features. You can either type commands or use the buttons provided for each feature. Our bot is user-friendly and easy to use, even for beginners.
120+
121+
## Why use our bot?
122+
123+
- User-friendly and easy to use
124+
- Provides quick access to various music-related features
125+
- Saves time and effort in downloading songs and downlaod ringtunes
126+
- Makes it easier to discover new music on Spotify
127+
- Convenient for generating telegraphs and getting sticker ids
128+
- Useful for developers in searching for repositories on GitHub
129+
130+
## Feedback
131+
132+
We are constantly working on improving our bot and would love to hear your feedback. You can send us your suggestions and queries by in https://t.me/amal_nath_bot.
133+
134+
Thank you for choosing our Telegram Bot for all your music and messaging needs! Enjoy your experience with our bot and don't forget to share it with your friends and family. 🎶❤️
135+

SECURITY.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Use this section to tell people about which versions of your project are
6+
currently being supported with security updates.
7+
8+
| Version | Supported |
9+
| ------- | ------------------ |
10+
| 5.1.x | :white_check_mark: |
11+
| 5.0.x | :x: |
12+
| 4.0.x | :white_check_mark: |
13+
| < 4.0 | :x: |
14+
15+
## Reporting a Vulnerability
16+
17+
Use this section to tell people how to report a vulnerability.
18+
19+
Tell them where to go, how often they can expect to get an update on a
20+
reported vulnerability, what to expect if the vulnerability is accepted or
21+
declined, etc.

Script.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
class script(object):
2+
LOG_TEXT_G = """<b>#ɴᴇᴡ_ɢʀᴏᴜᴩ
3+
4+
◉ ɢʀᴏᴜᴩ: {}(<code>{}</code>)
5+
◉ ᴍᴇᴍʙᴇʀꜱ: <code>{d}</code>
6+
◉ ᴀᴅᴅᴇᴅ ʙʏ: {}"""
7+
8+
LOG_TEXT_P = """#ɴᴇᴡ_ᴜꜱᴇʀ
9+
10+
◉ ᴜꜱᴇʀ-ɪᴅ: <code>{}</code>
11+
◉ ᴀᴄᴄ-ɴᴀᴍᴇ: {}"""
12+
13+
START_TXT = """Hᴇʟʟᴏ {}.
14+
Mʏ Nᴀᴍᴇ Is <a href=https://t.me/{}>{}</a>. ɪ ᴀᴍ ᴀ sᴘᴇᴄɪᴀʟ ʙᴏᴛ"""
15+
16+
HELP_TXT = """Hᴇʀᴇ ɪs Mʏ Hᴇʟᴩ.
17+
ᴄʟɪᴄᴋ ᴛʜɪs /support"""
18+
19+
ABOUT_TXT = """<b>✯ Mʏ ɴᴀᴍᴇ ɪs {} </>
20+
✯ Dᴇᴠᴇʟᴏᴩᴇʀ: <a href='https://t.me/MrTG_Coder'>ᴍʀ.ʙᴏᴛ ᴛɢ</a>
21+
✯ Lɪʙʀᴀʀʏ: <a href='https://docs.pyrogram.org/'>Pʏʀᴏɢʀᴀᴍ</a>
22+
✯ Lᴀɴɢᴜᴀɢᴇ: <a href='https://www.python.org/download/releases/3.0/'>Pʏᴛʜᴏɴ 3</a>
23+
✯ Mʏ Sᴇʀᴠᴇʀ: <a href='https://www.render.com'>ʀᴇɴᴅᴇʀ </a>
24+
✯ Pʏʀᴏɢʀᴀᴍ ᴠᴇʀsɪᴏɴ: ᴠ2.0.30
25+
✯ Mʏ ᴠᴇʀsɪᴏɴ: ᴠ1.8"""
26+
27+
WELCME_TXT ="""ʜᴇʏ {} ✨,\n🗓️ᴊᴏɪɴ ᴅᴀᴛᴇ :- {}\n🕛ᴊᴏɪɴ ᴛɪᴍᴇ :- {}\n\nᴡᴇʟᴄᴏᴍᴇ ᴛᴏ ᴍʏ {}🍃\n"""
28+
29+
RRB_TXT = """ɪғ ᴀɴʏ ʙᴜɢs ɪɴ ᴛʜɪs ʙᴏᴛ ғᴏʀᴡᴀʀᴅ ᴛʜᴇ ᴍᴇssᴀɢᴇ ᴛᴏ sᴜᴘᴘᴏʀᴛ ᴀᴅᴍɪɴ. ᴛʜɪs ʙᴏᴛ ɪs ᴀ ᴏᴘᴇɴ sᴏᴜʀᴄᴇ ᴘʀᴏᴊᴇᴄᴛ"""
30+
31+
SUPPORT_TXT = """ᴛʜᴇsᴇ ᴀʀᴇ ᴍʏ sᴜᴘᴘᴏʀᴛ ᴄʜᴀɴɴᴇʟ ᴀɴᴅ ɢʀᴏᴜᴘ. ɪғ ᴀɴʏ ᴘʀᴏʙʟᴇᴍ, ʀᴇᴘᴏʀᴛ ᴛᴏ ᴛʜᴇ ᴀᴅᴍɪɴ"""
32+
33+
STATUS_TXT = """<b>◉ ᴛᴏᴛᴀʟ ᴜꜱᴇʀꜱ: <code>{}</code></b>"""
34+
35+
ADMIN_CMD_TXT = """/broadcast ᴛᴏ ʙʀᴏᴀᴅᴄᴀsᴛ ᴀ ᴍᴇssɢᴇ ᴛᴏ ʟʟ ᴜsᴇʀs\n/leave ᴛᴏ ʟᴇᴀᴠᴇ ғʀᴏᴍ ᴀ ɢʀᴏᴜᴘ\n/ban ᴛᴏ ʙᴀɴ ᴀ ᴜsᴇʀ\n/unban ᴛᴏ ᴜɴʙᴀɴ ᴛʜᴇ ʙᴀɴɴᴇᴅ ᴜsᴇʀ\n/users ᴛᴏ ɢᴇᴛ ᴛʜᴇ ʟɪsᴛ ᴏғ ᴜsᴇʀs\n.ping ғᴏʀ ᴛʜᴇ ᴘᴏɴɢ"""
36+
37+
TELEGRAGH_TXT = """/telegraph Rᴇᴘʟʏ Tᴏ A Pʜᴏᴛᴏ Oʀ Vɪᴅᴇᴏ"""
38+
39+
OPENAI_TXT = """/openai {ᴜʀ ǫᴜᴇsᴛɪᴏɴ}\n sᴏᴍᴇᴛɪᴍᴇs ɪᴛ ᴡɪʟʟ ɴᴏᴛ ᴡᴏʀᴋ ᴘʀᴏᴘᴇʀʟʏ"""
40+
41+
SONG_TXT = """/song {song_name} .ᴅᴏᴡɴʟᴏᴀᴅ sᴏɴɢ ғʀᴏᴍ ʏᴏᴜᴛᴜʙᴇ
42+
ᴄʀᴇᴅɪᴛs @MrTG_Coder"""
43+
44+
RINGTUNE_TXT = """ʏᴏᴜ ᴄᴀɴ ᴀsᴋ ʀɪɴɢᴛᴜɴᴇ ɪɴ ᴛʜᴇ ғʀᴏᴍ ᴏғ /ringtune {sᴏɴɢ_ɴᴀᴍᴇ + ᴀʀᴛɪsᴛ_ɴᴀᴍᴇ} ᴏʀ {sᴏɴɢ_ɴᴀᴍᴇ}\n <a href='https://t.me/amal_nath_05/197'>ʀᴇᴀsᴏɴ</a>
45+
ᴄʀᴇᴅɪᴛs @MrTG_Coder"""
46+
47+
STICKER_TXT = """reply to the sticker as /sticker_id"""
48+
49+
SPOTIFY_TXT = """/spotify {song_name}\nɴᴏᴡ ᴡᴇ ᴏɴʟʏ ᴀᴅᴅ ғɪɴᴅ ᴛʜᴇ sᴏɴɢ ᴅᴇᴛᴀɪʟs ʙʏ ᴜʀ ʀᴇǫᴜᴇsᴛ.
50+
ᴄʀᴇᴅɪᴛs @MrTG_Coder"""

app.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "CODER-BOT",
3+
"description": "The Telegram Bot",
4+
"keywords": ["Telegram", "bot", "coder"],
5+
"repository": "https://github.com/MrMKN/PROFESSOR-BOT",
6+
"env": {
7+
"BOT_TOKEN": {
8+
"description": "Your bot token.",
9+
"required": true
10+
},
11+
"API_ID": {
12+
"description": "Get this value from https://my.telegram.org",
13+
"required": true
14+
},
15+
"API_HASH": {
16+
"description": "Get this value from https://my.telegram.org",
17+
"required": true
18+
}
19+
}

bot.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
from pyrogram import Client, __version__, filters
2+
from info import API_ID, API_HASH, BOT_TOKEN, PORT, ADMINS, LOG_CHANNEL
3+
import os, math, logging, datetime, pytz
4+
from pytz import timezone
5+
import logging.config
6+
from pyrogram.errors import BadRequest, Unauthorized
7+
from typing import Union, Optional, AsyncGenerator
8+
from plugins import web_server
9+
import pytz
10+
import aiohttp
11+
from aiohttp import web
12+
from utils import temp
13+
from pyrogram.raw.all import layer
14+
from pyrogram import types
15+
from Script import script
16+
import aiohttp
17+
18+
19+
logging.config.fileConfig("logging.conf")
20+
logging.getLogger().setLevel(logging.INFO)
21+
logger = logging.getLogger(__name__)
22+
23+
class Bot(Client):
24+
25+
def __init__(self):
26+
super().__init__(
27+
name="simple-bot",
28+
api_id=API_ID,
29+
api_hash=API_HASH,
30+
bot_token=BOT_TOKEN,
31+
workers=50,
32+
plugins={"root": "plugins"},
33+
sleep_threshold=5,
34+
)
35+
async def start(self):
36+
await super().start()
37+
me = await self.get_me()
38+
temp.ME = me.id
39+
temp.U_NAME = me.username
40+
temp.B_NAME = me.first_name
41+
self.username = '@' + me.username
42+
logging.info(f"{me.first_name} with for Pyrogram v{__version__} (Layer {layer}) started on {me.username}.")
43+
app = web.AppRunner(await web_server())
44+
await app.setup()
45+
await web.TCPSite(app, "0.0.0.0", 8080).start()
46+
logger.info("Running...")
47+
print(f"{me.first_name} | @{me.username} 𝚂𝚃𝙰𝚁𝚃𝙴𝙳...")
48+
if LOG_CHANNEL:
49+
try:
50+
curr = datetime.now(timezone("Asia/Kolkata"))
51+
date = curr.strftime('%d %B, %Y')
52+
time = curr.strftime('%I:%M:%S %p')
53+
await self.send_message(LOG_CHANNEL, f"**__{me.mention} Iꜱ Rᴇsᴛᴀʀᴛᴇᴅ !!**\n\n📅 Dᴀᴛᴇ : `{date}`\n⏰ Tɪᴍᴇ : `{time}`\n🌐 Tɪᴍᴇᴢᴏɴᴇ : `Asia/Kolkata`\n\n🉐 Vᴇʀsɪᴏɴ : `v{__version__} (Layer {layer})`</b>")
54+
except:
55+
print("Pʟᴇᴀꜱᴇ Mᴀᴋᴇ Tʜɪꜱ Iꜱ Aᴅᴍɪɴ Iɴ Yᴏᴜʀ Lᴏɢ Cʜᴀɴɴᴇʟ")
56+
57+
58+
async def stop(self, *args):
59+
await super().stop()
60+
print("Bot Restarting...")
61+
62+
async def iter_messages(self, chat_id: Union[int, str], limit: int, offset: int = 0) -> Optional[AsyncGenerator["types.Message", None]]:
63+
current = offset
64+
while True:
65+
new_diff = min(200, limit - current)
66+
if new_diff <= 0:
67+
return
68+
messages = await self.get_messages(chat_id, list(range(current, current+new_diff+1)))
69+
for message in messages:
70+
yield message
71+
current += 1
72+
73+
74+
if __name__ == "__main__":
75+
app = Bot()
76+
app.run()

info.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import re
2+
import os
3+
from os import environ
4+
from pyrogram import enums
5+
6+
import asyncio
7+
import json
8+
from pyrogram import Client
9+
10+
id_pattern = re.compile(r'^.\d+$')
11+
def is_enabled(value, default):
12+
if value.strip().lower() in ["on", "true", "yes", "1", "enable", "y"]: return True
13+
elif value.strip().lower() in ["off", "false", "no", "0", "disable", "n"]: return False
14+
else: return default
15+
16+
# basic information
17+
API_ID = int(os.environ.get('API_ID', '8914119'))
18+
API_HASH = os.environ.get('API_HASH', '652bae601b07c928b811bdb310fdb4b0')
19+
BOT_TOKEN = os.environ.get('BOT_TOKEN', '6645084082:AAEvdcfTZ0uFS_Gu6KvVPVBMNlrlWiESPiM')
20+
PORT = os.environ.get("PORT", "8080")
21+
CACHE_TIME = int(environ.get('CACHE_TIME', 300))
22+
ADMINS = [int(admin) if id_pattern.search(admin) else admin for admin in environ.get('ADMINS', '1342641151').split()]
23+
LOG_CHANNEL = int(environ.get('LOG_CHANNEL', '-1002084798134'))
24+
25+
26+
# important information for your bot
27+
S_GROUP = environ.get('S_GROUP', "https://t.me/+1YR5aYuCdr40N2M1")
28+
S_CHANNEL = environ.get('S_CHANNEL', "https://t.me/amal_nath_05")
29+
30+
# for mongodb
31+
DATABASE_NAME = os.environ.get("DB_NAME", "mrtg")
32+
DATABASE_URI = os.environ.get("DB_URL", "mongodb+srv://mrtg:3rqnL0nfKO1DgVM2@cluster0.m4nrgsu.mongodb.net/?retryWrites=true&w=majority")
33+
COLLECTION_NAME = environ.get('COLLECTION_NAME', 'Telegram_files')
34+
MONGO_URL = os.environ.get('MONGO_URL', "")
35+
36+
# for openai
37+
OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY', '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')
38+
39+
#for spotify
40+
SPOTIFY_CLIENT_ID = os.environ.get('SPOTIFY_CLIENT_ID', 'd3a0f15a75014999945b5628dca40d0a')
41+
SPOTIFY_CLIENT_SECRET = os.environ.get('SPOTIFY_CLIENT_SECRET', 'e39d1705e35c47e6a0baf50ff3bb587f')

0 commit comments

Comments
 (0)