├── .github
└── FUNDING.yml
├── LICENSE
├── README.md
├── Screenshots
├── Generator_QR_Code_Bot_Commands.png
├── Generator_QR_Code_Bot_Link.png
├── Generator_QR_Code_Bot_Start.png
└── Generator_QR_Code_Bot_Text.png
├── config.py
├── qr_code.py
└── requirements.txt
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | ko_fi: nikit0ns
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Nikita Kasyanenko
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://stand-with-ukraine.pp.ua/)
2 |
3 | # @Generator_QR_Code_Bot - Telegram Bot
4 |
5 | - :lock: The Telegram Bot that generates QR-Code.
6 | - :link: The Bot can generate a QR-Code from text or a link.
7 | - :books: There is the `'qrcode'` library is connected here.
8 | - :open_file_folder: The Bot has two commands: `/start` , `/help`.
9 | - :lock: The Telegram Bot Status: Doesn't Work On Hosting.
10 |
11 | ---
12 |
13 | # Screenshots
14 |
15 | 
16 | 
17 | 
18 | 
19 |
--------------------------------------------------------------------------------
/Screenshots/Generator_QR_Code_Bot_Commands.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nikit0ns/Generator_QR_Code_Bot/7ce4daea8105b87c660a9b8ce9a3d3f805b84a51/Screenshots/Generator_QR_Code_Bot_Commands.png
--------------------------------------------------------------------------------
/Screenshots/Generator_QR_Code_Bot_Link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nikit0ns/Generator_QR_Code_Bot/7ce4daea8105b87c660a9b8ce9a3d3f805b84a51/Screenshots/Generator_QR_Code_Bot_Link.png
--------------------------------------------------------------------------------
/Screenshots/Generator_QR_Code_Bot_Start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nikit0ns/Generator_QR_Code_Bot/7ce4daea8105b87c660a9b8ce9a3d3f805b84a51/Screenshots/Generator_QR_Code_Bot_Start.png
--------------------------------------------------------------------------------
/Screenshots/Generator_QR_Code_Bot_Text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nikit0ns/Generator_QR_Code_Bot/7ce4daea8105b87c660a9b8ce9a3d3f805b84a51/Screenshots/Generator_QR_Code_Bot_Text.png
--------------------------------------------------------------------------------
/config.py:
--------------------------------------------------------------------------------
1 | TOKEN = '...' #Сюда вы пишите свой токен. Узнать его можно в @BotFather
--------------------------------------------------------------------------------
/qr_code.py:
--------------------------------------------------------------------------------
1 | from aiogram import Bot, Dispatcher, types
2 | from aiogram.filters import Command
3 | from aiogram.types import FSInputFile
4 | import asyncio
5 | import config
6 | import qrcode
7 |
8 |
9 | bot = Bot(token=config.TOKEN) #Ваш токен
10 | dp = Dispatcher()
11 |
12 |
13 | @dp.message(Command(commands=['start']))
14 | async def cmd_start(message: types.Message):
15 | await message.answer('👋 Привіт, я QR-Код Бот. \n🔒 Я зможу вам згенерувати QR-Код. \n🔗 Надішліть мені текст або посилання.', parse_mode = 'HTML')
16 |
17 |
18 | @dp.message(Command(commands=['help']))
19 | async def cmd_help(message: types.Message):
20 | await message.answer("⁉️ Якщо у вас є проблеми. \n✉️ Напишіть мені @nikit0ns.", disable_web_page_preview = True, parse_mode = 'HTML')
21 |
22 |
23 | @dp.message()
24 | async def send_text_based_qr(message: types.Message):
25 | qr = qrcode.QRCode(version=1,
26 | error_correction = qrcode.constants.ERROR_CORRECT_L,
27 | box_size = 20,
28 | border = 2)
29 |
30 | qr.add_data(message.text)
31 | qr.make(fit = True)
32 |
33 | img = qr.make_image(fill_color = 'black', back_color = 'white')
34 | img.save('photo.png')
35 | img = FSInputFile('photo.png')
36 |
37 | await message.reply_photo(img, caption = f'✅ Ваш QR-Code успішно згенеровано \n\n⚙️ Створено за допомогою @Generator_QR_Code_Bot', parse_mode = 'HTML')
38 |
39 |
40 |
41 | async def main():
42 | await dp.start_polling(bot)
43 |
44 | if __name__ == "__main__":
45 | asyncio.run(main())
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | aiogram==3.0.0b6
2 | qrcode==7.3.1
--------------------------------------------------------------------------------