1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-25 15:24:17 +00:00

More fixes

This commit is contained in:
Steffo 2018-05-15 17:31:30 +02:00
parent d3505802a1
commit 25c52855a6
2 changed files with 9 additions and 4 deletions

View file

@ -113,6 +113,10 @@ conversation_live_orders_start = "Sei in modalità di <b>Ricezione Ordini</b>!\n
# Conversation: help menu has been opened
conversation_open_help_menu = "Che tipo di assistenza desideri ricevere?"
# Conversation: confirm promotion to admin
conversation_confirm_admin_promotion = "Sei sicuro di voler promuovere questo utente a 💼 Gestore?\n" \
"E' un'azione irreversibile!"
# Conversation: switching to user mode
conversation_switch_to_user_mode = "Stai passando alla modalità 👤 Cliente.\n" \
"Se vuoi riassumere il ruolo di 💼 Gestore, riavvia la conversazione con /start."

View file

@ -486,9 +486,9 @@ class ChatWorker(threading.Thread):
value -= cart[product][0].price * cart[product][1]
# Create {quantity} new OrderItems
for i in range(0, cart[product][1]):
orderitem = db.OrderItem(product=cart[product][0],
order_item = db.OrderItem(product=cart[product][0],
order_id=order.order_id)
self.session.add(orderitem)
self.session.add(order_item)
# Ensure the user has enough credit to make the purchase
if self.user.credit + value < 0:
self.bot.send_message(self.chat.id, strings.error_not_enough_credit)
@ -1141,7 +1141,7 @@ class ChatWorker(threading.Thread):
admin = self.session.query(db.Admin).filter_by(user_id=user.user_id).one_or_none()
if admin is None:
# Create the keyboard to be sent
keyboard = telegram.ReplyKeyboardMarkup([[strings.emoji_yes, strings.emoji_no]])
keyboard = telegram.ReplyKeyboardMarkup([[strings.emoji_yes, strings.emoji_no]], one_time_keyboard=True)
# Ask for confirmation
self.bot.send_message(self.chat.id, strings.conversation_confirm_admin_promotion, reply_markup=keyboard)
# Wait for an answer
@ -1156,6 +1156,7 @@ class ChatWorker(threading.Thread):
create_transactions=False,
is_owner=False,
display_on_help=False)
self.session.add(admin)
# Send the empty admin message and record the id
message = self.bot.send_message(self.chat.id, strings.admin_properties.format(name=str(admin.user)))
# Start accepting edits