1
1
1azar2021-01-15 00:51:45
Python
1azar, 2021-01-15 00:51:45

What method of secure storage, writing and reading of data can be applied to a bot in python 3 that forwards messages from social networks. networks.?

I am writing a bot that forwards messages from VK to Discord. The algorithm is as follows: Incoming messages are written to a dictionary and added to the "Buffer" list (Example: Buffer = [{'text': "message text", 'date': "a specific date that is extracted from the text",'time':" time that is extracted from the text"}, ...] )
In parallel, another method works, which checks every 60 seconds whether the time specified in the Buffer[] elements has come, if yes, then the message is sent to the discord chat, and the element is deleted. But there is a problem - the bot may restart, and Buffer[] will be deleted accordingly, and data will be lost. Question: What is the best way to proceed in this case?
PS: I was thinking of using sqllite3, but I don't know how to implement the .pop() and .append() functions there. + I don't understand how the values ​​in the table columns are indexed there

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1azar, 2021-01-15
@1azar

I thought it could somehow be stored in json, but it is not known what will happen when the bot decides to read the file during recording, most likely this will damage the data, I think

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question