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
67403908
Valider
67403908
rédigé
Il y a 5 ans
par
Loïc Wikle DUBARD
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
ajout de ahah/mdr/lol
parent
d7570633
Branches
Branches contenant la validation
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
+10
-2
10 ajouts, 2 suppressions
bot.py
requirements.txt
+2
-1
2 ajouts, 1 suppression
requirements.txt
avec
12 ajouts
et
3 suppressions
bot.py
+
10
−
2
Voir le fichier @
67403908
...
@@ -6,9 +6,12 @@ from getpass import getpass
...
@@ -6,9 +6,12 @@ from getpass import getpass
from
fbchat.models
import
*
from
fbchat.models
import
*
import
useless
import
useless
import
usefull
import
usefull
import
random
class
Bot
(
Client
):
class
Bot
(
Client
):
ahah_liste
=
[
'
ahah
'
,
'
mdr
'
,
'
lol
'
,
'
Mort de rire !
'
,
'
Trop marrant
'
,
'
tu m
\'
as tué
'
,
'
xD
'
,
'
PTDR
'
]
def
onMessage
(
self
,
author_id
,
message_object
,
thread_id
,
thread_type
,
**
kwargs
):
def
onMessage
(
self
,
author_id
,
message_object
,
thread_id
,
thread_type
,
**
kwargs
):
self
.
markAsDelivered
(
thread_id
,
message_object
.
uid
)
self
.
markAsDelivered
(
thread_id
,
message_object
.
uid
)
self
.
markAsRead
(
thread_id
)
self
.
markAsRead
(
thread_id
)
...
@@ -16,8 +19,8 @@ class Bot(Client):
...
@@ -16,8 +19,8 @@ class Bot(Client):
log
.
info
(
"
{} from {} in {}
"
.
format
(
message_object
,
thread_id
,
thread_type
.
name
))
log
.
info
(
"
{} from {} in {}
"
.
format
(
message_object
,
thread_id
,
thread_type
.
name
))
to_send
=
Bot
.
tests
(
message_object
.
text
,
self
.
fetchThreadInfo
(
thread_id
)[
thread_id
].
name
)
to_send
=
Bot
.
tests
(
message_object
.
text
,
self
.
fetchThreadInfo
(
thread_id
)[
thread_id
].
name
)
if
(
author_id
!=
self
.
uid
or
'
A.N.U.B.I.S.
:
'
not
in
message_object
.
text
)
and
to_send
is
not
None
:
if
(
author_id
!=
self
.
uid
or
'
BOT
:
'
not
in
message_object
.
text
)
and
to_send
is
not
None
:
self
.
send
(
Message
(
'
A.N.U.B.I.S.
:
'
+
to_send
),
thread_id
=
thread_id
,
thread_type
=
thread_type
)
self
.
send
(
Message
(
'
BOT
:
'
+
to_send
),
thread_id
=
thread_id
,
thread_type
=
thread_type
)
@classmethod
@classmethod
def
tests
(
self
,
texte
,
channel
=
''
):
def
tests
(
self
,
texte
,
channel
=
''
):
...
@@ -35,6 +38,7 @@ class Bot(Client):
...
@@ -35,6 +38,7 @@ class Bot(Client):
!kohlanta <nom>
\n
\
!kohlanta <nom>
\n
\
!rateau
\n
\
!rateau
\n
\
!maps <nom_du_lieu> <destination(facultatif)>, not yet fully fonctionnal
\n
\
!maps <nom_du_lieu> <destination(facultatif)>, not yet fully fonctionnal
\n
\
!ping
\n\
!about -> vas-y test-moi !
\n
'
!about -> vas-y test-moi !
\n
'
return
help_text
return
help_text
if
texte
==
'
!useless
'
:
if
texte
==
'
!useless
'
:
...
@@ -52,6 +56,10 @@ class Bot(Client):
...
@@ -52,6 +56,10 @@ class Bot(Client):
return
useless
.
kohlanta
(
texte
,
channel
)
return
useless
.
kohlanta
(
texte
,
channel
)
if
texte
==
'
!pipo
'
:
if
texte
==
'
!pipo
'
:
return
useless
.
pipo
()
return
useless
.
pipo
()
if
texte
==
'
!ping
'
:
return
'
Pong !
'
if
any
(
word
.
lower
()
in
texte
.
lower
()
for
word
in
Bot
.
ahah_liste
):
return
random
.
choice
(
Bot
.
ahah_liste
)
if
texte
==
'
!rateau
'
:
if
texte
==
'
!rateau
'
:
return
useless
.
getRateau
()
return
useless
.
getRateau
()
if
'
!meteo
'
in
texte
:
if
'
!meteo
'
in
texte
:
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
requirements.txt
+
2
−
1
Voir le fichier @
67403908
requests
requests
fbchat
fbchat
wikipedia
wikipedia
googletrans
\ No newline at end of file
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