Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
B
Bot messenger
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Déploiement
Releases
Registre de conteneurs
Registre de modèles
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Loïc DUBARD
Bot messenger
Validations
785327ec
Valider
785327ec
rédigé
Il y a 5 ans
par
Loïc Wikle DUBARD
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
shitpostbot fix not a classmethod anymore
parent
5b3d04bd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
bot.py
+2
-2
2 ajouts, 2 suppressions
bot.py
useless/shitpostbot5k.py
+3
-2
3 ajouts, 2 suppressions
useless/shitpostbot5k.py
avec
5 ajouts
et
4 suppressions
bot.py
+
2
−
2
Voir le fichier @
785327ec
...
@@ -29,13 +29,13 @@ class Bot(Client):
...
@@ -29,13 +29,13 @@ class Bot(Client):
self
.
send
(
Message
(
'
BOT :
'
+
to_send
),
thread_id
=
thread_id
,
thread_type
=
thread_type
)
self
.
send
(
Message
(
'
BOT :
'
+
to_send
),
thread_id
=
thread_id
,
thread_type
=
thread_type
)
self
.
trigger_double_mots
(
message_object
.
text
,
thread_id
,
thread_type
)
self
.
trigger_double_mots
(
message_object
.
text
,
thread_id
,
thread_type
)
Bot
.
shitpostbot5000
()
self
.
shitpostbot5000
()
@classmethod
def
shitpostbot5000
(
self
):
def
shitpostbot5000
(
self
):
for
chan
in
Bot
.
shitpostbot
:
for
chan
in
Bot
.
shitpostbot
:
if
Bot
.
shitpostbot
[
chan
][
0
].
get_status
():
if
Bot
.
shitpostbot
[
chan
][
0
].
get_status
():
if
Bot
.
shitpostbot
[
chan
][
0
].
get_latest
():
if
Bot
.
shitpostbot
[
chan
][
0
].
get_latest
():
print
(
'
Shitpostbot5000 a dégoté une nouvelle image...
'
)
self
.
sendLocalImage
(
Bot
.
shitpostbot
[
chan
][
0
].
get_out
(),
thread_id
=
chan
,
thread_type
=
Bot
.
shitpostbot
[
chan
][
1
])
self
.
sendLocalImage
(
Bot
.
shitpostbot
[
chan
][
0
].
get_out
(),
thread_id
=
chan
,
thread_type
=
Bot
.
shitpostbot
[
chan
][
1
])
def
tests
(
self
,
texte
,
thread_id
,
thread_type
,
author_id
,
channel
=
''
):
def
tests
(
self
,
texte
,
thread_id
,
thread_type
,
author_id
,
channel
=
''
):
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
useless/shitpostbot5k.py
+
3
−
2
Voir le fichier @
785327ec
...
@@ -7,15 +7,16 @@ import datetime
...
@@ -7,15 +7,16 @@ import datetime
class
Shitpostbot5000
(
object
):
class
Shitpostbot5000
(
object
):
def
__init__
(
self
,
out
=
"
shitpostbot5k_latest.jpg
"
):
def
__init__
(
self
,
url
=
'
https://www.facebook.com/shitpostbot5k/feed
'
,
out
=
"
shitpostbot5k_latest.jpg
"
):
self
.
state
=
False
self
.
state
=
False
self
.
image
=
''
self
.
image
=
''
self
.
date
=
datetime
.
datetime
.
now
()
self
.
date
=
datetime
.
datetime
.
now
()
self
.
out
=
out
self
.
out
=
out
self
.
url
=
url
def
get_latest
(
self
):
def
get_latest
(
self
):
if
datetime
.
datetime
.
now
()
>
self
.
date
+
datetime
.
timedelta
(
minutes
=
30
):
if
datetime
.
datetime
.
now
()
>
self
.
date
+
datetime
.
timedelta
(
minutes
=
30
):
html
=
urlopen
(
'
https://www.facebook.com/shitpostbot5k/feed
'
)
html
=
urlopen
(
self
.
url
)
bs
=
BeautifulSoup
(
html
,
'
html.parser
'
)
bs
=
BeautifulSoup
(
html
,
'
html.parser
'
)
image
=
bs
.
find_all
(
'
img
'
,
{
'
src
'
:
re
.
compile
(
'
.jpg
'
)})[
-
1
][
'
src
'
]
image
=
bs
.
find_all
(
'
img
'
,
{
'
src
'
:
re
.
compile
(
'
.jpg
'
)})[
-
1
][
'
src
'
]
if
image
!=
self
.
image
:
if
image
!=
self
.
image
:
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter