Answer the question
In order to leave comments, you need to log in
How to make both Aiogram and pytelegrambotapi work in the code?
I can code on Aiogram and pytelegrambotapi. And I want to write a bot on 2 of these libraries. But
if I import Aiogram and pytelegrambotapi. Then Aiogram works fine. But pytelegrambotapi is not. This is how I imported.
-------------------------------------------------- -----------------------
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
#media
from aiogram.utils.emoji import emojize
#py import
import telebot
bot = telebot.TeleBot("186pI5Js1wIwAqMAJQZeThEQ5zHSkTbJsY")
#keyboard import
from aiogram.types import ReplyKeyboardRemove, \
ReplyKeyboardMarkup, KeyboardButton, \
InlineKeyboardMarkup, InlineKeyboardButton
#media
import asyncio
TOKEN = '186660875AJQZeThEQ5zHSkTbJsY'
bot = Bot(token=TOKEN)
dp = Dispatcher(bot)
Answer the question
In order to leave comments, you need to log in
Because you are trying to run the same bot from 2 libraries, apparently aiogram does this first and the telebot cannot reach it, but the question of why you need this remains open, create 2 separate projects for each bot and write as much as you like,
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question