generated from Nemesis/Exemple
verifPM
This commit is contained in:
parent
a341588b59
commit
cb3e923dd8
1 changed files with 8 additions and 3 deletions
11
asmodee.py
11
asmodee.py
|
|
@ -925,10 +925,15 @@ async def verifPMRoom(room, message): # Pour obtenir ou créer un salon pour les
|
||||||
sender = ""
|
sender = ""
|
||||||
sender = getUser(message)
|
sender = getUser(message)
|
||||||
nick = await getNick(room, message)
|
nick = await getNick(room, message)
|
||||||
|
try:
|
||||||
|
nick.index("@")
|
||||||
|
nick.index(":")
|
||||||
|
nick = nick.split(':')[0].split('@')[1]
|
||||||
|
except:
|
||||||
|
print("Nick bien formé")
|
||||||
client_id = bot.creds.username.split(':')[0].split('@')[1]
|
client_id = bot.creds.username.split(':')[0].split('@')[1]
|
||||||
client_host = bot.creds.username.split(':')[1]
|
client_host = bot.creds.username.split(':')[1]
|
||||||
room_nick = client_id + "_" + nick.split(':')[0].split('@')[1]
|
room_nick = client_id + "_" + nick
|
||||||
bot_nick = await getNick(room, message)
|
|
||||||
salon = None
|
salon = None
|
||||||
room_id = prive.get(sender)
|
room_id = prive.get(sender)
|
||||||
create = False
|
create = False
|
||||||
|
|
@ -945,7 +950,7 @@ async def verifPMRoom(room, message): # Pour obtenir ou créer un salon pour les
|
||||||
new_salon.is_direct=True
|
new_salon.is_direct=True
|
||||||
return(new_salon)
|
return(new_salon)
|
||||||
else:
|
else:
|
||||||
salon = await bot.async_client.room_create(alias=room_nick, name=bot_nick, topic="Informations d'Asmodee",is_direct=True,invite=[sender])
|
salon = await bot.async_client.room_create(alias=room_nick, name="Asmodee", topic="Informations d'Asmodee",is_direct=True,invite=[sender])
|
||||||
if isinstance(salon, nio.responses.RoomCreateError):
|
if isinstance(salon, nio.responses.RoomCreateError):
|
||||||
print("Impossible de creer : " + room_nick + " pour " + sender)
|
print("Impossible de creer : " + room_nick + " pour " + sender)
|
||||||
return(room)
|
return(room)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue