Skip to content

Commit

Permalink
0.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
onlive1337 committed Sep 5, 2024
1 parent fc4be21 commit 60b9f1d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
27 changes: 4 additions & 23 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@


[0.9.2] - 2024-09-05
[0.9.3] - 2024-09-05
RU:

Пофикшено:

Исчезновение криптовалюты когда идёт настройка в чате

Изменено:

Текст /start
И текст раздела Помощь

Добавлено:

1) Добавлены триггеры к сокращениям на русском ( сум , лир , лиры , лира , гривны , грн , тон, доллар, долларов, доллары )
2) Добавлены триггеры к буквенным обозначениям цифр ( 1 млн сум ) и тд
3) Было добавлено предупреждение если юзер пишет неправильную валюту
Кнопка удаления как и в лс бота так и в чатах

EN:

Fixed:
Disappearance of cryptocurrency when chat customization is in progress

Modified:
/start text
And the text of the Help section

Added:
1) Added triggers to abbreviations in Russian ( сум , лир , лиры , лира , гривны , грн , тон )
2) Added triggers for alphabetic digits ( 1 млн сум ) etc.
3) A warning was added if user writes wrong currency

Delete button in both bot dm and chat
12 changes: 11 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,15 +860,21 @@ async def process_conversion(message: types.Message, amount: float, from_currenc
response += f"{LANGUAGES[user_lang]['cryptocurrencies_output']}\n"
response += "\n".join(crypto_conversions)

kb = InlineKeyboardBuilder()
kb.button(text=LANGUAGES[user_lang].get('delete_button', "Delete"), callback_data="delete_conversion")

logger.info(f"Sending conversion response for {amount} {from_currency} to user {user_id} in chat {chat_id}")
await message.answer(response)
await message.answer(response, reply_markup=kb.as_markup())
except OverflowError:
await message.answer(LANGUAGES[user_lang].get('number_too_large', "The number is too large to process."))
except Exception as e:
logger.error(f"Error in process_conversion for user {user_id}: {e}")
logger.exception("Full traceback:")
await message.answer(LANGUAGES[user_lang]['error'])

async def delete_conversion_message(callback_query: CallbackQuery):
await callback_query.message.delete()
await callback_query.answer()

async def process_about(callback_query: CallbackQuery):
user_data.update_user_data(callback_query.from_user.id)
Expand Down Expand Up @@ -987,6 +993,9 @@ async def process_callback(callback_query: CallbackQuery, state: FSMContext):
await process_about(callback_query)
elif action == 'view':
await view_changelog(callback_query)
elif action == 'delete':
if callback_query.data == 'delete_conversion':
await delete_conversion_message(callback_query)

async def main():
bot = Bot(token=BOT_TOKEN)
Expand Down Expand Up @@ -1020,6 +1029,7 @@ async def main():
dp.callback_query.register(save_chat_settings, F.data.startswith("save_chat_settings_"))
dp.callback_query.register(back_to_settings, F.data == "back_to_settings")
dp.callback_query.register(back_to_chat_settings, F.data.startswith("back_to_chat_settings_"))
dp.callback_query.register(delete_conversion_message, F.data == "delete_conversion")
dp.callback_query.register(process_callback)

dp.inline_query.register(inline_query_handler)
Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
BOT_TOKEN = os.getenv('TELEGRAM_BOT_TOKEN')
ADMIN_IDS = [810587766]
USER_DATA_FILE = 'user_data.json'
CURRENT_VERSION = "0.9.2"
CURRENT_VERSION = "0.9.3"

CACHE_EXPIRATION_TIME = 600

Expand Down
2 changes: 2 additions & 0 deletions languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
'current_version': "Текущая версия:",
'view_changelog': "Посмотреть список изменений",
'invalid_currency': "Извините, я не могу распознать валюту '{currency}'. Пожалуйста, используйте стандартные коды валют, например: USD, EUR, RUB.",
'delete_button': "Удалить",
},
'en': {
'welcome': """Hello! I'm a currency conversion bot. 🌍💱
Expand Down Expand Up @@ -146,5 +147,6 @@
'current_version': "Current version:",
'view_changelog': "View changelog",
'invalid_currency': "Sorry, I can't recognize the currency '{currency}'. Please use standard currency codes, for example: USD, EUR, RUB.",
'delete_button': "Delete",
}
}

0 comments on commit 60b9f1d

Please sign in to comment.