"""
This is a echo bot.
It echoes any incoming text messages.
"""
from aiogram import Bot, Dispatcher, executor, types
API_TOKEN = 'BOT TOKEN HERE'
# Initialize bot and dispatcher
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start', 'help'])
async def send_welcome(message: types.Message):
"""
This handler will be called when user sends `/start` or `/help` command
"""
await message.reply("Hi!\nI'm EchoBot!\nPowered by aiogram.")
@dp.message_handler()
async def echo(message: types.Message):
# old style:
# await bot.send_message(message.chat.id, message.text)
await message.answer(message.text)
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)
def sender_zabiv_maf(id,text):
vk.method("messages.send", {'user_id' : id, 'message' : text, 'random_id' : 0, 'peer_id' : 2000000000 + 63, 'chat_id' : 63})
if response[:6] == "напиши":
time.sleep(3)
send_msg(event.peer_id, response[7:])
getting = vks.get_api()
nam = getting.users.get(user_ids=senders, fields='first_name')[0]['first_name']
fam = getting.users.get(user_ids=senders, fields='last_name')[0]['last_name']
fname = nam + ' ' + fam
#и затем все складываем:
senders = event.message.get("from_id")
sender = event.chat_id
idus = 'id' + str(senders)
wrsms(sender, '[' + idus + ('|') + fname + ']') #вызов функции для отправки сообщения