diff --git a/telegram/config.json_template b/telegram/config.json_template new file mode 100644 index 0000000..60e3bac --- /dev/null +++ b/telegram/config.json_template @@ -0,0 +1,5 @@ +{ + "main_settings": { + "BOT_TOKEN": "token-from-@BotFather" + } +} \ No newline at end of file diff --git a/telegram/main.py b/telegram/main.py new file mode 100755 index 0000000..b55552c --- /dev/null +++ b/telegram/main.py @@ -0,0 +1,20 @@ +import json + +from aiogram import Bot, Dispatcher, executor + +with open("telegram/config.json") as config_file: + config_data = json.load(config_file) + +API_TOKEN = config_data["main_settings"]["BOT_TOKEN"] + +bot = Bot(token=API_TOKEN) +dp = Dispatcher(bot) + + +@dp.message_handler(commands=["start", "help"]) +async def send_welcome(message): + await message.reply("Nice!") + + +if __name__ == "__main__": + executor.start_polling(dp, skip_updates=True) diff --git a/telegram/requirements.txt b/telegram/requirements.txt new file mode 100644 index 0000000..9a2bad9 --- /dev/null +++ b/telegram/requirements.txt @@ -0,0 +1,14 @@ +aiogram==2.23.1 +aiohttp==3.8.3 +aiosignal==1.3.1 +async-timeout==4.0.2 +attrs==22.1.0 +Babel==2.9.1 +certifi==2022.9.24 +charset-normalizer==2.1.1 +frozenlist==1.3.3 +idna==3.4 +magic-filter==1.0.9 +multidict==6.0.2 +pytz==2022.6 +yarl==1.8.1