A
A
Andrey Godunko2021-06-14 12:28:22
Python
Andrey Godunko, 2021-06-14 12:28:22

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

2 answer(s)
S
Stefan, 2021-06-14
@Noy-name-boy

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,

I
ID-B, 2021-10-19
@ID-B

And if I want one bot to perform two functions, then the problem with tokens begins!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question