lundi 11 juin 2018

How to always shuffle different comment?

I am writting bot using Selenium to auto comment photos on Instagram. My bot click on photo, write comment, click on next photo, write comment, click on next photo, write comment,etc. Problem is that my bot shuffle one of comments but it uses always same shuffled comment... How to solve it? How to improve my function as to after each click or each post the choosen comment was different?

def randomComments(self):
    messages = [
        'Nice cat',
        'What a lovely cat',
        'Wow, great picture',
        'Amaizing, I am in love <3',
        'Beautiful',
        'I have same cat :)'
    ]

    r = random.randint(0, len(messages))

    return messages[r]




Aucun commentaire:

Enregistrer un commentaire