Gestion erreurs

This commit is contained in:
nyanloutre 2017-10-08 16:47:59 +02:00
parent e5a448118a
commit 6964bcd702
Signed by: nyanloutre
GPG Key ID: F85D93686A3A9063
1 changed files with 9 additions and 6 deletions

15
run.py
View File

@ -92,12 +92,15 @@ def dogetip(bot, update, args):
if unit == "doge": if unit == "doge":
response = transaction(update.message.from_user.username, destinataire, montant) response = transaction(update.message.from_user.username, destinataire, montant)
txid = response['data']['txid'] try:
txid = response['data']['txid']
message = '🚀 Transaction effectuée 🚀\n\n' \ except TypeError:
+ str(montant) + ' ' + NETWORK + '\n' \ message = response
+ '@' + update.message.from_user.username + ' → @' + destinataire + '\n\n' \ else:
+ '<a href="https://chain.so/tx/' + NETWORK + '/' + txid + '">Voir la transaction</a>' message = '🚀 Transaction effectuée 🚀\n\n' \
+ str(montant) + ' ' + NETWORK + '\n' \
+ '@' + update.message.from_user.username + ' → @' + destinataire + '\n\n' \
+ '<a href="https://chain.so/tx/' + NETWORK + '/' + txid + '">Voir la transaction</a>'
bot.send_message(chat_id=update.message.chat_id, parse_mode=ParseMode.HTML, text=message) bot.send_message(chat_id=update.message.chat_id, parse_mode=ParseMode.HTML, text=message)