Skip to content
Extraits de code Groupes Projets
Valider 5428186c rédigé par Loïc Wikle DUBARD's avatar Loïc Wikle DUBARD
Parcourir les fichiers

shitpostbot send image instead of link

parent e4637148
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -59,7 +59,7 @@ class Bot(Client):
'!memes <image_name_or_url> ; <texte1> ; <texte2(facultatif)> ... not yet implemented\n' + \
'!ping \n' + \
'!translate <phrase> ; <lang_source> ; <lang_dest>\n' + \
'!shitpostbot5000 [status|on|off|random|timer] ... ne pas utiliser PLEASE\n' + \
'!shitpostbot5000 [status|on|off|random <keyword(facultatif)>] ... ne pas utiliser PLEASE\n' + \
'!about -> vas-y test-moi !\n'
return help_text
elif '!translate' in texte:
......@@ -105,9 +105,9 @@ class Bot(Client):
elif '!shitpostbot5000 random' in texte:
texte = texte.replace('!shitpostbot5000 random', '')
if texte == '':
return useless.Shitpostbot5000.random()
self.sendLocalImage(useless.Shitpostbot5000.random(), thread_id=thread_id, thread_type=thread_type)
else:
return useless.Shitpostbot5000.random(texte)
self.sendLocalImage(useless.Shitpostbot5000.random(texte), thread_id=thread_id, thread_type=thread_type)
# pour rigoler
elif '!memes templates' in texte:
......
......@@ -62,7 +62,8 @@ class Shitpostbot5000(object):
self.ctx = ssl.create_default_context()
self.ctx.check_hostname = False
self.ctx.verify_mode = ssl.CERT_NONE
return random.choice(self.getlinks(hashtag, 'https://www.instagram.com/explore/tags/' + hashtag + '/'))
urllib.request.urlretrieve(random.choice(self.getlinks(hashtag, 'https://www.instagram.com/explore/tags/' + hashtag + '/')), 'insta_random.jpg')
return 'insta_random.jpg'
if __name__ == "__main__":
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter