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

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
......@@ -71,9 +71,9 @@ class Bot(Client):
'!translate <phrase> ; <lang_source> ; <lang_dest>\n' + \
'!shitpostbot5000 [status|on|off|random <keyword(facultatif)>] ... ne pas utiliser PLEASE\n' + \
'!title <newtitle>\n'\
'!listuser <newtitle>\n'\
'!userlist\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:
texte = texte.replace('!translate ', '').split(' ; ')
try:
......@@ -103,6 +103,7 @@ class Bot(Client):
for user in self.fetchAllUsersFromThreads([self.fetchThreadInfo(thread_id)[thread_id]]):
if user.name == texte[0]:
self.changeNickname(nickname=texte[1], user_id=user.uid, thread_id=thread_id, thread_type=thread_type)
return None
else:
return random.choice(['T\'es sur de ton coup là ?', 'chais pas qui c\'est...'])
......@@ -118,7 +119,10 @@ class Bot(Client):
author_name = user.name
if user_to_remove is not None:
log.info("{} will be removed from {} by {}".format(user_to_remove.uid, thread_id, author_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:
Bot.kicked[thread_id].append(user_to_remove)
else:
......@@ -127,12 +131,12 @@ class Bot(Client):
else:
return random.choice(['T\'es sur de ton coup là ?', 'chais pas qui c\'est...'])
elif texte == '!userlist':
return "la liste des gens dans le groupe :\n\n" "".join([user.name for user in self.fetchAllUsersFromThreads([self.fetchThreadInfo(thread_id)[thread_id]])])
elif texte == '!userlist' and thread_type == Thread.GROUP:
return ", ".join([user.name for user in self.fetchAllUsersFromThreads([self.fetchThreadInfo(thread_id)[thread_id]])])
# réinviter le dernier mec kické du group
# TODO: test reinvite
elif texte == '!reinvite':
elif texte == '!reinvite' and thread_type == Thread.GROUP:
if 'thread_id' in Bot.kicked:
self.addUsersToGroup(Bot.kicked[thread_id][-1].uid, thread_id=thread_id)
elif '!reinvite ' in texte:
......
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