Answer the question
In order to leave comments, you need to log in
What to do if the bot is flooding with demotivators?
Hello, I have a code for a VK bot that generates demotivators using words and photos taken from a conversation. (example: https://vk.com/neurobred )
There are lines in the generation that are responsible for clearing the base after generating the demotivator. (text + photos are removed from the databases), and it turns out that after each generation the database of words and pictures disappears, and you have to write words in the conversation again.
Base cleaning:
f = open(dir_to_txt + str(ans.peer_id) + '.txt', 'w', encoding='utf8')
f.write('')
f.close()
f = open(dir_to_pic + str(ans.peer_id) + '.txt', 'w', encoding='utf8')
f.write('')
if lines >= 20 and pic2 >= 3:
await ans(f'', attachment=photo)
f = open(dir_to_txt + str(ans.peer_id) + '.txt', 'w', encoding='utf8')
f.write('')
f.close()
f = open(dir_to_pic + str(ans.peer_id) + '.txt', 'w', encoding='utf8')
f.write('')
f.close()
@bot.on.message()
async def lsmsg(ans: Message):
await ans('Я работаю только в беседах .-.')
bot.run_polling()
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