A
A
Alexey Fobius2020-01-03 13:49:09
Python
Alexey Fobius, 2020-01-03 13:49:09

To replenish the list of the bot just by sending him messages?

I have a bot that randomly sends a word / picture from a list
, so, is it possible to make it so
that when sending it to the bot in a personal message, for example:
"+ list and then some word."
in the script itself (or a separate file in which the list of all words will lie) was added the word that is in the message? I just don't understand how to implement it.

Let's read what the user wrote, take the text of this message and write it down, but:

1) - how do I write down exactly what is after the "+list" command (ie, through a space)? I can record his entire message, but I don’t really understand how to do it piece by piece (the most crutch that I came up with is to implement a separate request, and separately save, in other words, through two messages)

2) - what should I do if I need to add a picture?
bot sends pictures via

message=('123',
                    attachment = ('photo-000000000_000000000')

those. Roughly speaking, he takes them from VK itself, and sends them.
Based on this, it is clear that if we need to save the picture that was sent to us, and then be able to get it from the list and send it, then we need to find out its id , or what it's called. Is it even possible? or am I just putting spokes in my own wheels, and can it be easier?

I'm sorry if I worded my question wrong, I can't find the right words.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mors Clamor, 2020-01-03
@phobious

1) You need to parse the string
2) Get a link to the photo by its id, download it. Documentation for VK api to help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question