mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-24 14:54:18 +00:00
Some bugfixes
This commit is contained in:
parent
9017680044
commit
b0186edd42
3 changed files with 9 additions and 12 deletions
3
core.py
3
core.py
|
@ -29,6 +29,9 @@ def main():
|
|||
# TimedOut / NetworkError counter, increases by 1 every time get_updates fails and resets to 0 when it succedes
|
||||
timed_out_counter = 0
|
||||
|
||||
# Notify on the console that the bot is starting
|
||||
print("greed-bot is now starting!")
|
||||
|
||||
# Main loop of the program
|
||||
while True:
|
||||
# Get a new batch of 100 updates and mark the last 100 parsed as read
|
||||
|
|
|
@ -95,7 +95,7 @@ ask_product_description = "Quale deve essere la descrizione del prodotto?"
|
|||
|
||||
# Add product: price?
|
||||
ask_product_price = "Quanto deve costare il prodotto?\n" \
|
||||
"Scrivi <code>skip</code> se vuoi che il prodotto non sia ancora in vendita."
|
||||
"Scrivi <code>X</code> se vuoi che il prodotto non sia ancora in vendita."
|
||||
|
||||
# Add product: image?
|
||||
ask_product_image = "Che immagine vuoi che abbia il prodotto?"
|
||||
|
@ -134,11 +134,8 @@ bot_info = 'Questo bot utilizza <a href="https://github.com/Steffo99/greed">gree
|
|||
' <a href="https://github.com/Steffo99/greed/blob/master/LICENSE">Affero General Public License 3.0</a>.\n' \
|
||||
'Il codice sorgente di questa versione è disponibile <i>qui</i>.\n'
|
||||
|
||||
# Success: product has been added to the database
|
||||
success_product_added = "✅ Il prodotto è stato aggiunto con successo!"
|
||||
|
||||
# Success: product has been added to the database
|
||||
success_product_edited = "✅ Il prodotto è stato modificato con successo!"
|
||||
# Success: product has been added/edited to the database
|
||||
success_product_edited = "✅ Il prodotto è stato aggiunto/modificato con successo!"
|
||||
|
||||
# Error: message received not in a private chat
|
||||
error_nonprivate_chat = "⚠️ Questo bot funziona solo in chat private."
|
||||
|
|
|
@ -374,7 +374,7 @@ class ChatWorker(threading.Thread):
|
|||
# Otherwise, set the fee to 0 to ensure no accidental discounts are applied
|
||||
total_fee = 0
|
||||
# Create the invoice keyboard
|
||||
inline_keyboard = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton(strings.menu_pay)],
|
||||
inline_keyboard = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton(strings.menu_pay, pay=True)],
|
||||
[telegram.InlineKeyboardButton(strings.menu_cancel, callback_data="cmd_cancel")]])
|
||||
# The amount is valid, send the invoice
|
||||
self.bot.send_invoice(self.chat.id,
|
||||
|
@ -504,7 +504,7 @@ class ChatWorker(threading.Thread):
|
|||
# Wait for an answer
|
||||
description = self.__wait_for_regex(r"(.*)", cancellable=bool(product))
|
||||
# Ask for the product price
|
||||
self.bot.send_message(self.chat.id, strings.ask_product_price)
|
||||
self.bot.send_message(self.chat.id, strings.ask_product_price, parse_mode="HTML")
|
||||
# Display the current name if you're editing an existing product
|
||||
if product:
|
||||
self.bot.send_message(self.chat.id, strings.edit_current_value.format(value=(strings.currency_format_string.format(symbol=strings.currency_symbol, value=(product.price / (10 ** int(configloader.config["Payments"]["currency_exp"]))))) if product.price is not None else 'Non in vendita'), parse_mode="HTML", reply_markup=cancel)
|
||||
|
@ -555,10 +555,7 @@ class ChatWorker(threading.Thread):
|
|||
# Commit the session changes
|
||||
self.session.commit()
|
||||
# Notify the user
|
||||
if product:
|
||||
self.bot.send_message(self.chat.id, strings.success_product_edited)
|
||||
else:
|
||||
self.bot.send_message(self.chat.id, strings.success_product_added)
|
||||
self.bot.send_message(self.chat.id, strings.success_product_edited)
|
||||
|
||||
def __orders_menu(self):
|
||||
raise NotImplementedError()
|
||||
|
|
Loading…
Reference in a new issue