Answer the question
In order to leave comments, you need to log in
Why does the "One of the parameters specified was missing or invalid" exception occur?
What is wrong here?
Traceback:
File "C:/Users/madwayz1337/PycharmProjects/vkbot/chat_bot.py", line 23, in
write_msg(item['user_id'], 'Hi! This is a test bot!')
File "C:/Users/madwayz1337 /PycharmProjects/vkbot/chat_bot.py", line 13, in write_msg
vk.method('messages.send', {'user_id':user_id, 'messages':msg})
vk_api.exceptions.ApiError: [100] One of the parameters specified were missing or invalid: message is empty or invalid
# Функция, отвечающая за отправку сообщения
def write_msg(chat_id, msg):
vk.method('messages.send', {'chat_id': chat_id, 'messages': msg})
print('Бот успешно запущен!')
print('Бот ждёт сообщений')
while True:
response = vk.method('messages.get', values)
if response['items']:
values['last_message_id'] = response['items'][0]['id']
for item in response['items']:
write_msg(item['chat_id'], 'Привет! Это тестовый бот!')
time.sleep(1)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question