for _ in lines:
if word in old_words:
continue
else:
new_words.append(word)
msg
или все таки message
photo
- это список фото разных размеров. А send_photo принимает file_id
photo=msg.photo[0].file_id
будет работать корректно from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
import asyncio
tokens = ['token1', 'token2']
async def start_bot(dp):
event_loop.create_task(dp.start_polling())
def bot_init(event_loop, token):
bot = Bot(token)
dp = Dispatcher(bot=bot)
@dp.message_handler(commands=['start'])
async def process_start_command(message: types.Message):
await message.reply("Привет!\nНапиши мне что-нибудь!")
event_loop.run_until_complete(start_bot(dp))
if __name__ == '__main__':
event_loop = asyncio.get_event_loop()
for token in tokens: # тут можешь реализовать приемник токенов извне
bot_init(event_loop, token)
event_loop.run_forever()
async def start_bot():
event_loop.create_task(dp.start_polling())
if __name__ == '__main__':
event_loop = asyncio.get_event_loop()
event_loop.run_until_complete(start_server())
event_loop.run_until_complete(start_bot())
event_loop.run_forever()
await self.count_TF(self, key)
asyncio.create_task(self.count_TF(self, key))
time.sleep(5)
await asyncio.sleep(5)
k = await self.send_message(destination, text)
while True:
for key in self.port:
@bot.message_handler(content_types=['text'])
def messages(message):
if message.json.get('entities'):
print(f"tg length: {message.json['entities'][0]['length']}")
print(f"calc length: {len(message.json['text'].encode('utf-16-le')) // 2}")
bot.polling(none_stop = True, timeout=123)
response = requests.get("""https://steamcommunity.com/market/listings/730/AK-47%20%7C%20Asiimov%20(Field-Tested)/render/?query=&start=0&count=100&country=BY&language=english¤cy=1""")
link = response.json()
print(link['assets']['730']['2']['27405178623']['actions'][0]['link'])