main.ру:
import logging
from aiogram import Bot, Dispatcher, executor, types
import markups as nav
TOKEN = '6207242221:AAGE4kaOFEk7g9Mcm0ZH51ZaH2lZgHuBVY'
logging.basicConfig(level=logging.INFO)
bot = Bot(token=TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'])
async def start(message: types.Message):
if message.chat.type == 'private':
await bot.send_message(message.from_user.id, "Привет!", reply_markup=nav.profileKeyboard)
@dp.message_handler()
async def bot_message(message: types.Message):
if message.chat.type == 'private':
if message.text == "ПРОФИЛЬ":
await bot.send_message(message.from_user.id, "Информация о профиле")
else:
await bot.send_message(message.from_user.id, "Не понимаю о чем вы")
if __name__ == "__main__":
executor.start_polling(dp, skip_updates=True)</>
markups.ру:
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton, InlineKeyboardMarkup, InlineKeyboardButton
btnProfile = KeyboardButton('ПРОФИЛЬ')
ptofileKeyboard = ReplyKeyboardMarkup(resize_keyboard = True).add(btnProfile)</>
ОШИБКА:
WARNING:aiogram:Goodbye!
Traceback (most recent call last):
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\main.py", line 30, in <module>
executor.start_polling(dp, skip_updates=True)
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\utils\executor.py", line 45, in start_polling
executor.start_polling(
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\utils\executor.py", line 320, in start_polling
loop.run_until_complete(self._startup_polling())
File "C:\Users\nikcm\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\utils\executor.py", line 372, in _startup_polling
await self._welcome()
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\utils\executor.py", line 361, in _welcome
user = await self.dispatcher.bot.me
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\bot\bot.py", line 30, in me
setattr(self, '_me', await self.get_me())
^^^^^^^^^^^^^^^^^^^
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\bot\bot.py", line 233, in get_me
result = await self.request(api.Methods.GET_ME, payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\bot\base.py", line 236, in request
return await api.make_request(await self.get_session(), self.server, self.__token, method, data, files,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\bot\api.py", line 140, in make_request
return check_result(method, response.content_type, response.status, await response.text())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\bot\api.py", line 121, in check_result
exceptions.Unauthorized.detect(description)
File "C:\Users\nikcm\pythonProject\pythonProject\tg-bot\venv\Lib\site-packages\aiogram\utils\exceptions.py", line 141, in detect
raise cls(description)
aiogram.utils.exceptions.Unauthorized: Unauthorized
Process finished with exit code -1073741819 (0xC0000005)