├── requirements.txt
├── thumb.jpg
├── .gitignore
├── main
├── __init__.py
├── logo.py
└── __main__.py
├── config.py
└── README.md
/requirements.txt:
--------------------------------------------------------------------------------
1 | pyrogram
2 | TgCrypto
3 | aiohttp
4 | python-dotenv
--------------------------------------------------------------------------------
/thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TechShreyash/TechZ-Logo-Maker-Bot/HEAD/thumb.jpg
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | __pycache__/config.cpython-39.pyc
2 | *.pyc
3 | *.session
4 | *.session-journal
--------------------------------------------------------------------------------
/main/__init__.py:
--------------------------------------------------------------------------------
1 | import aiohttp
2 | from pyrogram import Client
3 | from config import *
4 |
5 | app = Client(
6 | "bot",
7 | api_id=API_ID,
8 | api_hash=API_HASH,
9 | bot_token=BOT_TOKEN
10 | )
11 |
12 | print("[INFO]: STARTING BOT...")
13 | app.start()
14 |
15 | print("[INFO]: STARTING AIOHTTP CLIENT")
16 | session = aiohttp.ClientSession()
--------------------------------------------------------------------------------
/main/logo.py:
--------------------------------------------------------------------------------
1 | from main import LOGO_API_URL1, LOGO_API_URL2, session
2 | from typing import Optional
3 | import aiohttp
4 | from string import ascii_letters, digits
5 | import random
6 |
7 |
8 | async def generate_logo(text: str, square: Optional[bool] = False):
9 | "To Create Logos. text = What you want to write on the logo. square = If You Want Square Logo Or Not. Returns Telgraph Image Url"
10 |
11 | try:
12 | square = str(square).capitalize()
13 |
14 | if square == "True":
15 | url = LOGO_API_URL2 + text
16 | else:
17 | url = LOGO_API_URL1 + text
18 |
19 | resp = await session.get(url)
20 | img = "".join(random.choices(ascii_letters + digits, k=10)) + ".jpg"
21 | with open(img, "wb") as f:
22 | f.write(await resp.read())
23 | except Exception as e:
24 | print("error" + str(e))
25 | return "error" + str(e)
26 | return img
27 |
--------------------------------------------------------------------------------
/config.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from os import getenv
3 | from dotenv import load_dotenv
4 |
5 | load_dotenv()
6 |
7 | # Get it from my.telegram.org
8 | API_ID = ""
9 | API_HASH = ""
10 |
11 | # Get it from @Botfather in Telegram.
12 | BOT_TOKEN = ""
13 |
14 | # Create Your Own ApiKey From @TechZApiBot To Use Logo Api
15 | API_KEY = ""
16 |
17 |
18 | # Don't Change Anything Below This Line
19 |
20 |
21 | if not API_ID or API_ID.strip() == "":
22 | API_ID = int(getenv("API_ID"))
23 | if not API_HASH or API_HASH.strip() == "":
24 | API_HASH = getenv("API_HASH")
25 | if not BOT_TOKEN or BOT_TOKEN.strip() == "":
26 | BOT_TOKEN = getenv("BOT_TOKEN")
27 | if not API_KEY or API_KEY.strip() == "":
28 | API_KEY = getenv("API_KEY")
29 |
30 |
31 | LOGO_API_URL1 = f"https://techzapi.azurewebsites.net/logo?api_key={API_KEY}&text="
32 |
33 | LOGO_API_URL2 = (
34 | f"https://techzapi.azurewebsites.net//logo?api_key={API_KEY}&square=True&text="
35 | )
36 |
37 |
38 | if not API_KEY:
39 | print("Error: API_KEY Not Found!")
40 | print("Please Get Your Own ApiKey From @TechZApiBot To Use Logo Api")
41 | sys.exit()
42 | elif API_KEY.strip() == "":
43 | print("Error: API_KEY Not Found!")
44 | print("Please Get Your Own ApiKey From @TechZApiBot To Use Logo Api")
45 | sys.exit()
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |

2 |
3 | Logo-Maker-Bot
4 | A Telegram Bot To Create Cool Logos, Powered By TechZBots API.
5 |
6 |
7 |
8 | ### 📘 Powered By TechZBots API
9 | * **Docs :** https://techzapi.azurewebsites.net/docs
10 | * **Base Url :** `https://techzapi.azurewebsites.net/logo?api_key=YOUR_KEY&text=`
11 | * **Base Url For Square Logos :** `https://techzapi.azurewebsites.net/logo?api_key=YOUR_KEY&square=true&text=`
12 |
13 | ### ♻️ Features
14 | * 35+ Stylish & Cool Fonts
15 | * Random Awesome Color Generator (Will Generate All Colors Randomly)
16 | * Logos With Strokes & Borders
17 | * Thousands Of Random Background Images From Unsplash
18 | * Get Direct Telegraph Links Of Images
19 | * Can Make Square Logos Or Normal Ones
20 |
21 | ### 🧲 Required Variables
22 |
23 | * `APP_ID` - Get this value from my.telegram.org
24 | * `API_HASH` - Get this value from my.telegram.org
25 | * `BOT_TOKEN` - Get this from @BotFather
26 | * `API_KEY` - Get this from @TechZApiBot
27 |
28 | ### 📤 Deploy
29 | - Fill all vars in config.py or in .env file
30 | - pip3 install -r requirements.txt
31 | - python3 -m main
32 |
33 | ### 👤 Contact Me
34 | [](https://telegram.me/TechZBots)[](https://telegram.me/TechZBots_Support)
35 |
--------------------------------------------------------------------------------
/main/__main__.py:
--------------------------------------------------------------------------------
1 | from main import app
2 | import pyrogram
3 | from pyrogram import filters, idle
4 | from pyrogram.errors import FloodWait
5 | from pyrogram.types import (
6 | InlineKeyboardButton,
7 | InlineKeyboardMarkup,
8 | Message,
9 | CallbackQuery,
10 | )
11 | from main.logo import generate_logo
12 |
13 | START = """
14 | **🔮 Hello There, You Can Use Me To Create Awesome Logos...**
15 |
16 | ➤ Click /help Or The Button Below To Know How To Use Me
17 | """
18 |
19 | HELP = """
20 | **🖼 How To Use Me ?**
21 |
22 | **To Make Logo -** `/logo Your Name`
23 | **To Make Square Logo - ** `/logosq Your Name`
24 |
25 | **♻️ Example:**
26 | `/logo TechZBots`
27 | `/logosq TechZBots`
28 | """
29 |
30 | # Commands
31 | @app.on_message(filters.command("start"))
32 | async def start(bot, message):
33 | await message.reply_text(
34 | START,
35 | reply_markup=InlineKeyboardMarkup(
36 | [
37 | [
38 | InlineKeyboardButton(text="Help", callback_data="help_menu"),
39 | InlineKeyboardButton(
40 | text="Repo",
41 | url="https://github.com/TechShreyash/TechZ-Logo-Maker-Bot",
42 | ),
43 | ]
44 | ]
45 | ),
46 | )
47 |
48 |
49 | @app.on_message(filters.command("help"))
50 | async def help(bot, message):
51 | await message.reply_text(
52 | HELP,
53 | reply_markup=InlineKeyboardMarkup(
54 | [[InlineKeyboardButton(text="Back", callback_data="start_menu")]]
55 | ),
56 | )
57 |
58 |
59 | @app.on_message(
60 | filters.command("logo")
61 | & filters.incoming
62 | & filters.text
63 | & ~filters.forwarded
64 | & (filters.group | filters.private)
65 | )
66 | async def logo(bot, message):
67 | try:
68 | text = (" ".join(message.text.split(" ")[1:])).strip()
69 |
70 | if text == "":
71 | return await message.reply_text(HELP)
72 |
73 | x = await message.reply_text("`🔍 Generating Logo For You...`")
74 | logo = await generate_logo(text)
75 | print(logo)
76 |
77 | if "error" in logo:
78 | return await x.edit(
79 | f"`❌ Something Went Wrong...`\n\nReport This Error In @TechZBots_Support \n\n`{logo}`"
80 | )
81 |
82 | await x.edit("`🔄 Done Generated... Now Sending You`")
83 |
84 | await message.reply_photo(
85 | logo,
86 | caption="**🖼 Logo Generated By TechZApi**",
87 | reply_markup=InlineKeyboardMarkup(
88 | [
89 | [
90 | InlineKeyboardButton(
91 | text="Upload As File 📁", callback_data=f"flogo {logo}"
92 | )
93 | ]
94 | ]
95 | ),
96 | )
97 | await x.delete()
98 | except FloodWait:
99 | pass
100 | except Exception as e:
101 | try:
102 | await x.delete()
103 | except:
104 | pass
105 | return await message.reply_text(
106 | "`❌ Something Went Wrong...`\n\nReport This Error In @TechZBots_Support"
107 | )
108 |
109 |
110 | # Square Logo
111 | @app.on_message(
112 | filters.command("logosq")
113 | & filters.incoming
114 | & filters.text
115 | & ~filters.forwarded
116 | & (filters.group | filters.private)
117 | )
118 | async def logo(bot, message):
119 | try:
120 | text = (" ".join(message.text.split(" ")[1:])).strip()
121 |
122 | if text == "":
123 | return await message.reply_text(HELP)
124 |
125 | x = await message.reply_text("`🔍 Generating Logo For You...`")
126 | logo = await generate_logo(text, True)
127 |
128 | if "error" in logo:
129 | return await x.edit(
130 | f"`❌ Something Went Wrong...`\n\nReport This Error In @TechZBots_Support \n\n`{logo}`"
131 | )
132 |
133 | await x.edit("`🔄 Done Generated... Now Sending You`")
134 |
135 | await message.reply_photo(
136 | logo,
137 | caption="**🖼 Logo Generated By TechZApi**",
138 | reply_markup=InlineKeyboardMarkup(
139 | [
140 | [
141 | InlineKeyboardButton(
142 | text="Upload As File 📁", callback_data=f"flogo {logo}"
143 | )
144 | ]
145 | ]
146 | ),
147 | )
148 | await x.delete()
149 | except FloodWait:
150 | pass
151 | except Exception as e:
152 | try:
153 | await x.delete()
154 | except:
155 | pass
156 | return await message.reply_text(
157 | "`❌ Something Went Wrong...`\n\nReport This Error In @TechZBots_Support"
158 | )
159 |
160 |
161 | # Callbacks
162 | @app.on_callback_query(filters.regex("start_menu"))
163 | async def start_menu(_, query):
164 | await query.answer()
165 | await query.message.edit(
166 | START,
167 | reply_markup=InlineKeyboardMarkup(
168 | [
169 | [
170 | InlineKeyboardButton(text="Help", callback_data="help_menu"),
171 | InlineKeyboardButton(
172 | text="Repo",
173 | url="https://github.com/TechShreyash/TechZ-Logo-Maker-Bot",
174 | ),
175 | ]
176 | ]
177 | ),
178 | )
179 |
180 |
181 | @app.on_callback_query(filters.regex("help_menu"))
182 | async def help_menu(_, query):
183 | await query.answer()
184 | await query.message.edit(
185 | HELP,
186 | reply_markup=InlineKeyboardMarkup(
187 | [[InlineKeyboardButton(text="Back", callback_data="start_menu")]]
188 | ),
189 | )
190 |
191 |
192 | @app.on_callback_query(filters.regex("flogo"))
193 | async def logo_doc(_, query):
194 | await query.answer()
195 | try:
196 | x = await query.message.reply_text("`🔄 Sending You The Logo As File`")
197 | await query.message.edit_reply_markup(reply_markup=None)
198 | logo = query.data.replace("flogo", "").strip()
199 |
200 | await query.message.reply_document(
201 | logo, caption="**🖼 Logo Generated By TechZApi**"
202 | )
203 | except FloodWait:
204 | pass
205 | except Exception as e:
206 | try:
207 | return await x.edit(
208 | f"`❌ Something Went Wrong...`\n\nReport This Error In @TechZBots_Support \n\n`{str(e)}`"
209 | )
210 | except:
211 | return
212 |
213 | return await x.delete()
214 |
215 |
216 | if __name__ == "__main__":
217 | print("==================================")
218 | print("[INFO]: LOGO MAKER BOT STARTED BOT SUCCESSFULLY")
219 | print("==========JOIN @TECHZBOTS=========")
220 |
221 | idle()
222 | print("[INFO]: LOGO MAKER BOT STOPPED")
223 |
--------------------------------------------------------------------------------