it works btww

This commit is contained in:
Simple_Not 2023-02-04 13:18:33 +10:00
commit bd0f7ac12f

75
manybot.py Normal file
View File

@ -0,0 +1,75 @@
import logging
from aiogram import Bot, Dispatcher
from aiogram import types
import asyncio
tokens = [
'1345759065:AAHliizoNem_5Z2A9pRvQVeD-UknKVZOv6U', # @asdf1123_bot
'979241477:AAG_rxiD4q-yFgNmw81EYkyI57tazg5QK3Q', # @insels_uchun_bot
]
def make_bots():
bots = []
for token in tokens:
bot = Bot(token=token, parse_mode="HTML")
bots.append(Dispatcher(bot))
return bots
BOTS = make_bots()
logging.basicConfig(level=logging.DEBUG)
#@dp.message_handler(commands=['start'])
async def start_func(message: types.Message):
await message.reply('похуй')
async def start_another_bot_func(message: types.Message):
await message.reply('тебе ответит другой бот')
def start_another_bot_func(b2):
async def start_another_bot_inner_func(message: types.Message):
await message.reply('тебе ответит другой бот')
await b2.bot.send_dice(chat_id = message.from_id)
return start_another_bot_inner_func
def register_handlers_StartHelp(dp: Dispatcher):
dp.register_message_handler(start_func)
def register_handlers_OtherBotAll(b1, b2 ):
b1.register_message_handler(start_another_bot_func(b2))
async def los_botos():
tasts = []
flag = True
for b in BOTS:
if flag:
register_handlers_OtherBotAll(BOTS[0], BOTS[1])
flag = False
k = asyncio.create_task( b.start_polling() )
tasts.append(k)
for tt in tasts:
await tt
if __name__ == '__main__':
asyncio.run(los_botos())