generated from Nemesis/Exemple
ecowatt v5 + try/except response.displayname
This commit is contained in:
parent
085c8073cf
commit
99852a470a
1 changed files with 6 additions and 3 deletions
|
|
@ -29,7 +29,7 @@ RTE_ID = None # Bot's RTE ID
|
|||
RTE_SECRET = None # Bot's RTE SECRET
|
||||
|
||||
#ecowatt_url = 'https://digital.iservices.rte-france.com/open_api/ecowatt/v4/sandbox/signals'
|
||||
ecowatt_url = 'https://digital.iservices.rte-france.com/open_api/ecowatt/v4/signals'
|
||||
ecowatt_url = 'https://digital.iservices.rte-france.com/open_api/ecowatt/v5/signals'
|
||||
commune_url = 'https://geo.api.gouv.fr/communes?<TYPE>=<NOM>&fields=nom,code,codesPostaux,population&format=json'
|
||||
eau_url = 'https://hubeau.eaufrance.fr/api/vbeta/qualite_eau_potable/resultats_dis?<TYPE>=<NOM>&size=5'
|
||||
|
||||
|
|
@ -1262,8 +1262,11 @@ async def bienvenue(room,message): # Affichage d'un message d'accueil aux nouvea
|
|||
if (modules[room.room_id, 'welcome']):
|
||||
sender = getUser(message)
|
||||
nick = None
|
||||
response = await bot.api.async_client.get_displayname(sender)
|
||||
nick = response.displayname
|
||||
try:
|
||||
response = await bot.api.async_client.get_displayname(sender)
|
||||
nick = response.displayname
|
||||
except:
|
||||
nick = sender
|
||||
if nick == None:
|
||||
nick = sender
|
||||
membership = message.membership
|
||||
|
|
|
|||
Loading…
Reference in a new issue