yilbegan / vbio Goto Github PK
View Code? Open in Web Editor NEWPython модуль для написания скриптов, использующих Bots API для социальной сети Вконтакте (vk.com)
License: MIT License
Python модуль для написания скриптов, использующих Bots API для социальной сети Вконтакте (vk.com)
License: MIT License
После каждого события в консоль выводится ошибка KeyError:
* [2019/Sep/09 01:39:31] ERROR: From message_typing_state
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/vbio/handlers/longpoll.py", line 51, in run
self.bot.process_event(update['object'])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/vbio/bot.py", line 91, in process_event
req = VkEvent(req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/vbio/types.py", line 248, in __init__
self.type = data['type']
KeyError: 'type'
* [2019/Sep/09 01:39:32] INFO: Processed message from 49461083: Test
* [2019/Sep/09 01:39:32] ERROR: From message_reply
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/vbio/handlers/longpoll.py", line 51, in run
self.bot.process_event(update['object'])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/vbio/bot.py", line 91, in process_event
req = VkEvent(req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/vbio/types.py", line 248, in __init__
self.type = data['type']
KeyError: 'type'
Log:
* [2019/May/04 18:16:43] INFO: Pooling started!
* [2019/May/04 18:16:48] ERROR: From message_new
Traceback (most recent call last):
File "C:\Users\Evgeny\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vbio\handlers\longpoll.py", line 46, in run
self.bot.process_message(update['object'])
File "C:\Users\Evgeny\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vbio\bot.py", line 68, in process_message
if msg.from_id in self.message_register_next_step:
File "C:\Users\Evgeny\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vbio\types.py", line 160, in __getattr__
return self.data[item]
KeyError: 'from_id'
Source code
import vk_requests
# import emoji
from vbio import VkBot, LongPollClient
api = vk_requests.create_api(service_token='#') # Токен ВКонтакте
bot = VkBot(api=api)
handler = LongPollClient(bot)
@bot.message_handler()
def hello_world(m):
m.answer(message='Привет мир!')
if __name__ == '__main__':
handler.run()
У меня сейчас такой код и вылетает исключение, отправляется только сообщение без вложения:
def picture_prepare:
image = Image.open(BytesIO(image_bytes))
#работа с картинкой
return image
@bot.message_handler()
def no_command(m):
m.answer(message='Привет!',
attachment = picture_prepare())
Как правильно прикреплять изображение?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.