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 conteneur
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é
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Loïc DUBARD
Bot messenger
Validations
0d56b79e
Valider
0d56b79e
rédigé
5 years ago
par
Loïc Wikle DUBARD
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
fix remove user and reinvite and rename
parent
a49b1f4b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
bot.py
+10
-6
10 ajouts, 6 suppressions
bot.py
avec
10 ajouts
et
6 suppressions
bot.py
+
10
−
6
Voir le fichier @
0d56b79e
...
@@ -71,9 +71,9 @@ class Bot(Client):
...
@@ -71,9 +71,9 @@ class Bot(Client):
'
!translate <phrase> ; <lang_source> ; <lang_dest>
\n
'
+
\
'
!translate <phrase> ; <lang_source> ; <lang_dest>
\n
'
+
\
'
!shitpostbot5000 [status|on|off|random <keyword(facultatif)>] ... ne pas utiliser PLEASE
\n
'
+
\
'
!shitpostbot5000 [status|on|off|random <keyword(facultatif)>] ... ne pas utiliser PLEASE
\n
'
+
\
'
!title <newtitle>
\n
'
\
'
!title <newtitle>
\n
'
\
'
!list
user <newtitle>
\n
'
\
'
!
user
list
\n
'
\
'
!about -> vas-y test-moi !
\n
'
'
!about -> vas-y test-moi !
\n
'
return
'
Hummmm non j
\'
ai la flemme là
'
return
random
.
choice
(
'
Hummmm non j
\'
ai la flemme là
'
,
help_text
)
elif
'
!translate
'
in
texte
:
elif
'
!translate
'
in
texte
:
texte
=
texte
.
replace
(
'
!translate
'
,
''
).
split
(
'
;
'
)
texte
=
texte
.
replace
(
'
!translate
'
,
''
).
split
(
'
;
'
)
try
:
try
:
...
@@ -103,6 +103,7 @@ class Bot(Client):
...
@@ -103,6 +103,7 @@ class Bot(Client):
for
user
in
self
.
fetchAllUsersFromThreads
([
self
.
fetchThreadInfo
(
thread_id
)[
thread_id
]]):
for
user
in
self
.
fetchAllUsersFromThreads
([
self
.
fetchThreadInfo
(
thread_id
)[
thread_id
]]):
if
user
.
name
==
texte
[
0
]:
if
user
.
name
==
texte
[
0
]:
self
.
changeNickname
(
nickname
=
texte
[
1
],
user_id
=
user
.
uid
,
thread_id
=
thread_id
,
thread_type
=
thread_type
)
self
.
changeNickname
(
nickname
=
texte
[
1
],
user_id
=
user
.
uid
,
thread_id
=
thread_id
,
thread_type
=
thread_type
)
return
None
else
:
else
:
return
random
.
choice
([
'
T
\'
es sur de ton coup là ?
'
,
'
chais pas qui c
\'
est...
'
])
return
random
.
choice
([
'
T
\'
es sur de ton coup là ?
'
,
'
chais pas qui c
\'
est...
'
])
...
@@ -118,7 +119,10 @@ class Bot(Client):
...
@@ -118,7 +119,10 @@ class Bot(Client):
author_name
=
user
.
name
author_name
=
user
.
name
if
user_to_remove
is
not
None
:
if
user_to_remove
is
not
None
:
log
.
info
(
"
{} will be removed from {} by {}
"
.
format
(
user_to_remove
.
uid
,
thread_id
,
author_id
))
log
.
info
(
"
{} will be removed from {} by {}
"
.
format
(
user_to_remove
.
uid
,
thread_id
,
author_id
))
self
.
removeUserFromGroup
(
user_to_remove
.
uid
,
thread_id
=
thread_id
)
try
:
self
.
removeUserFromGroup
(
user_to_remove
.
uid
,
thread_id
=
thread_id
)
except
:
return
"
J
'
ai pas le droit de faire ça moi
"
if
thread_id
in
Bot
.
kicked
:
if
thread_id
in
Bot
.
kicked
:
Bot
.
kicked
[
thread_id
].
append
(
user_to_remove
)
Bot
.
kicked
[
thread_id
].
append
(
user_to_remove
)
else
:
else
:
...
@@ -127,12 +131,12 @@ class Bot(Client):
...
@@ -127,12 +131,12 @@ class Bot(Client):
else
:
else
:
return
random
.
choice
([
'
T
\'
es sur de ton coup là ?
'
,
'
chais pas qui c
\'
est...
'
])
return
random
.
choice
([
'
T
\'
es sur de ton coup là ?
'
,
'
chais pas qui c
\'
est...
'
])
elif
texte
==
'
!userlist
'
:
elif
texte
==
'
!userlist
'
and
thread_type
==
Thread
.
GROUP
:
return
"
la liste des gens dans le groupe :
\n\n
"
"
"
.
join
([
user
.
name
for
user
in
self
.
fetchAllUsersFromThreads
([
self
.
fetchThreadInfo
(
thread_id
)[
thread_id
]])])
return
"
,
"
.
join
([
user
.
name
for
user
in
self
.
fetchAllUsersFromThreads
([
self
.
fetchThreadInfo
(
thread_id
)[
thread_id
]])])
# réinviter le dernier mec kické du group
# réinviter le dernier mec kické du group
# TODO: test reinvite
# TODO: test reinvite
elif
texte
==
'
!reinvite
'
:
elif
texte
==
'
!reinvite
'
and
thread_type
==
Thread
.
GROUP
:
if
'
thread_id
'
in
Bot
.
kicked
:
if
'
thread_id
'
in
Bot
.
kicked
:
self
.
addUsersToGroup
(
Bot
.
kicked
[
thread_id
][
-
1
].
uid
,
thread_id
=
thread_id
)
self
.
addUsersToGroup
(
Bot
.
kicked
[
thread_id
][
-
1
].
uid
,
thread_id
=
thread_id
)
elif
'
!reinvite
'
in
texte
:
elif
'
!reinvite
'
in
texte
:
...
...
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