Skip to content

Commit

Permalink
Merge branch 'master' into dev/advanced_menu_handling
Browse files Browse the repository at this point in the history
# Conflicts:
#	collectors/core.py
#	main.py
#	plugins/inline.py
#	utypes/bclient.py
#	utypes/states.py
  • Loading branch information
SyberiaK committed Jan 19, 2024
2 parents e875202 + 2580bd1 commit d764268
Show file tree
Hide file tree
Showing 25 changed files with 343 additions and 357 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ and most of the codebase was rewritten to be more modular and perfomant.

Here are some noteworthy changes:
- Bot now uses inline keyboards instead of reply ones
- Most of the bot messages stay in one, reducing the clutter in messages
- Most of the bot messages stay in one, reducing the clutter in message history
- More user-friendly approach for inline queries with the help of tags
- Personal settings (only language settings available for now)
- Translated on **8** different languages, thanks to our beloved community
Expand All @@ -31,7 +31,7 @@ We also have plans on adding more functionality and QoL features.
- Extended Inline Keyboard Markups (**ExtendedIKM**s),
made to integrate extra functionality into regular **IKM**s (e.g. localization, selection indicators)
- Use of decorators to support transitions between menus and clean up the codebase
- Using sqlite instead of csv for database!
- Using sqlite instead of csv for a database!

### How can I contribute?

Expand Down
16 changes: 10 additions & 6 deletions collectors/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@
('netherlands', 'amsterdam'): 'EU Holland',
('austria', 'vienna'): 'EU Austria',
('poland', 'warsaw'): 'EU Poland',
('us_north', 'northcentral', 'chicago'): 'US Chicago',
('us_north', 'northeast', 'sterling'): 'US Virginia',
('us_north', 'northwest', 'new_york'): 'US NewYork',
('us_north', 'northwest', 'seattle'): 'US Seattle',
('us_south', 'southwest', 'los_angeles'): 'US California',
('us_south', 'southeast', 'atlanta'): 'US Atlanta',
('us_east', 'chicago'): 'US Chicago',
('us_east', 'sterling'): 'US Virginia',
('us_east', 'new_york'): 'US NewYork',
('us_east', 'atlanta'): 'US Atlanta',
('us_west', 'seattle'): 'US Seattle',
('us_west', 'los_angeles'): 'US California',
('brazil', 'sao_paulo'): 'Brazil',
('chile', 'santiago'): 'Chile',
('peru', 'lima'): 'Peru',
('argentina', 'buenos_aires'): 'Argentina',
'hongkong': 'Hong Kong',
('india', 'mumbai'): 'India Mumbai',
('india', 'chennai'): 'India Chennai',
('india', 'bombay'): 'India Bombay',
('china', 'shanghai'): 'China Shanghai',
('china', 'tianjin'): 'China Tianjin',
('china', 'guangzhou'): 'China Guangzhou',
Expand Down Expand Up @@ -164,6 +165,9 @@ async def unique_monthly():
with open(config.CACHE_FILE_PATH, encoding='utf-8') as f:
cache = json.load(f)

if cache.get('monthly_unique_players') is None:
cache['monthly_unique_players'] = data

if data != cache.get('monthly_unique_players'):
await send_alert('monthly_unique_players',
(cache['monthly_unique_players'], data))
Expand Down
8 changes: 4 additions & 4 deletions functions/datacenter_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ def sweden(locale: Locale):
return _format_dc_data(DatacenterAtlas.SWEDEN, locale)


def us_north(locale: Locale):
return _format_dc_data(DatacenterAtlas.US_NORTH, locale)
def us_east(locale: Locale):
return _format_dc_data(DatacenterAtlas.US_EAST, locale)


def us_south(locale: Locale):
return _format_dc_data(DatacenterAtlas.US_SOUTH, locale)
def us_west(locale: Locale):
return _format_dc_data(DatacenterAtlas.US_WEST, locale)


def argentina(locale: Locale):
Expand Down
10 changes: 8 additions & 2 deletions functions/info_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ def format_game_world_leaderboard(data: list[LeaderboardStats], locale: Locale)

for person in data:
name = person.name.replace('`', r"'") # escape for formatting
text += f'`{person.rank:2d}.` `{name:<35} {person.rating:,}` {person.region}\n'
name_span_limit = 19
if len(name) > name_span_limit:
name = name[:name_span_limit - 2] = '...'
text += f'`{person.rank:2d}.` `{name:<{name_span_limit}}` `{person.rating:>6,}` `{person.region}`\n'

text += f'\n{link_text}'
return text
Expand All @@ -173,7 +176,10 @@ def format_game_regional_leaderboard(region: str, data: list[LeaderboardStats],

for person in data:
name = person.name.replace('`', r"'") # escape for formatting
text += f'`{person.rank:2d}.` `{name:<35} {person.rating:,}`\n'
name_span_limit = 21
if len(name) > name_span_limit:
name = name[:name_span_limit - 2] = '...'
text += f'`{person.rank:2d}.` `{name:<{name_span_limit}}` `{person.rating:>6,}`\n'

text += f'\n{link_text}'
return text
6 changes: 3 additions & 3 deletions keyboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@

# DC USA

_us_northwest = ExtendedIKB(LK.dc_north, LK.dc_us_north)
_us_southwest = ExtendedIKB(LK.dc_south, LK.dc_us_south)
_us_east = ExtendedIKB(LK.dc_east, LK.dc_us_east)
_us_west = ExtendedIKB(LK.dc_west, LK.dc_us_west)

dc_us_markup = ExtendedIKM([
[_us_northwest, _us_southwest],
[_us_east, _us_west],
[back_button]
])

Expand Down
40 changes: 27 additions & 13 deletions l10n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,30 @@ Then check [Contributing](#contributing) section to know how to start translatin

Here you can see translations' progress and contributors' list:

| Code | Language | Progress | Summary | Contributors |
|:----:|--------------|:---------------:|:----------------------------------------------:|:--------------------------:|
| gb | English | ██████████ 100% | built in | |
| ru | Russian | ██████████ 100% | built in | |
| fa | Persian | █████████▒ 80% | settings, leaderboard missing | [@A460N] (telegram) |
| tr | Turkish | ███████▒▒▒ 70% | settings, leaderboard, tags missing | [@ITMiroN] (telegram) |
| uz | Uzbek | ███████▒▒▒ 70% | user game stats, settings, leaderboard missing | [@d1az1337] (telegram) |
| uk | Ukrainian | █████████▒ 90% | leaderboard missing | [akimerslys], [Agent47Dev] |
| be | Belarusian | █████████▒ 90% | leaderboard missing | [HiddenDeath] |
| it | Italian | █████████▒ 90% | leaderboard missing | [MrJiavo] |
| Code | Language | Progress | Summary | Contributors |
|:----:|--------------|:---------------:|:----------------------------------------------------------------:|:--------------------------:|
| en | English | ██████████ 100% | built in | |
| ru | Russian | ██████████ 100% | built in | |
| ar | Arabic | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| be | Belarusian | ██████████ 100% | fully done | [HiddenDeath] |
| da | Danish | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| de | German | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| es | Spanish | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| fa | Persian | ████████▒▒ 80% | missing: settings, leaderboard, USA DC | [@A460N] |
| fi | Finnish | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| fr | French | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| hi | Hindi | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| it | Italian | ████████▒▒ 80% | missing: leaderboard, USA DC | [MrJiavo] |
| ja | Japanese | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| no | Norwegian | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| pl | Polish | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| pt | Portuguese | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| sv | Swedish | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |
| tr | Turkish | ███████▒▒▒ 70% | missing: settings, leaderboard, tags, USA DC | [@ITMiroN] |
| uk | Ukrainian | ████████▒▒ 80% | missing: leaderboard, USA DC | [akimerslys], [Agent47Dev] |
| uz | Uzbek | ███████▒▒▒ 70% | missing: user game stats, settings, leaderboard, USA DC | [@d1az1337] |
| zh | Chinese | ▒▒▒▒▒▒▒▒▒▒ 0% | contributors needed | |


## Contributing

Expand All @@ -29,7 +43,7 @@ Here you can see translations' progress and contributors' list:

### Steps

1. Fork this repository. [100%]
1. Fork this repository.
\
![forking repository](../media/fork_repo.png)
2. Open Git Bash and clone the forked repository: `git clone {your fork link}`.
Expand All @@ -46,8 +60,8 @@ Here you can see translations' progress and contributors' list:
Just copy `en.json` and rename it with ISO 639-1 code of prefered language (e.g. `de.json`).
- [List of ISO 639-1 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
5. Open the file and start translating it based on string keys and original text.
- We highly recommend checking the bot functionality to have more text context.
6. You can also add some tags in your language to `tags.json`.
- We highly recommend checking the bot functionality to have more context.
6. Remember to add some tags in your language to `tags.json`.
7. In Git, add new files, then commit and push all the changes.
\
![commiting changes](../media/commit_changes.png)
Expand Down
47 changes: 24 additions & 23 deletions l10n/data/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
],
"dc_north": "Поўнач",
"dc_south": "Поўдзень",
"dc_east": "East",
"dc_west": "West",
"dc_africa_title": "дата-цэнтра Паўднёвай Афрыкі",
"dc_africa_inline_title": "Афрыканскі ДЦ",
"dc_africa_johannesburg": "Ёханэсбург",
Expand Down Expand Up @@ -128,21 +130,18 @@
"dc_spain_inline_title": "Іспанскі ДЦ",
"dc_spain_madrid": "Мадрыд",
"dc_us": "ЗША",
"dc_us_north": "dc_us_north / internally used key, no need to translate it",
"dc_us_south": "dc_us_south / internally used key, no need to translate it",
"dc_us_north_inline_title": "ДЦ паўночнай часткі ЗША",
"dc_us_north_central_title": "паўночна-цэнтральнага дата-цэнтра",
"dc_us_north_central_chicago": "Чыкага",
"dc_us_north_east_title": "паўночна-ўсходняга дата-цэнтра",
"dc_us_north_east_sterling": "Стэрлінг",
"dc_us_north_west_title": "паўночна-заходняга дата-цэнтра",
"dc_us_north_west_new_york": "Нью-Ёрк",
"dc_us_north_west_seattle": "Сіэтл",
"dc_us_south_inline_title": "ДЦ паўднёвай часткі ЗША",
"dc_us_south_east_title": "паўднёва-ўсходняга дата-цэнтра",
"dc_us_south_east_atlanta": "Атланта",
"dc_us_south_west_title": "паўднёва-заходняга дата-цэнтра",
"dc_us_south_west_los_angeles": "Лос-Анджэлес",
"dc_us_east": "dc_us_east / internally used key, no need to translate it",
"dc_us_east_title": "усходніх дата-цэнтраў ЗША",
"dc_us_east_inline_title": "ДЦ усходняй часткі ЗША",
"dc_us_chicago": "Чыкага",
"dc_us_sterling": "Стэрлінг",
"dc_us_new_york": "Нью-Ёрк",
"dc_us_atlanta": "Атланта",
"dc_us_west": "dc_us_west / internally used key, no need to translate it",
"dc_us_west_title": "заходніх дата-цэнтраў ЗША",
"dc_us_west_inline_title": "ДЦ заходняй часткі ЗША",
"dc_us_seattle": "Сіэтл",
"dc_us_los_angeles": "Лос-Анджэлес",
"dc_argentina": "Аргенціна",
"dc_argentina_title": "дата-цэнтра Аргенціны",
"dc_argentina_inline_title": "Аргентынскі ДЦ",
Expand All @@ -163,6 +162,7 @@
"dc_india_title": "дата-цэнтраў Індыі",
"dc_india_inline_title": "Індыйскія ДЦ",
"dc_india_mumbai": "Мумбаі",
"dc_india_bombay": "Bombay",
"dc_india_chennai": "Чэннай",
"dc_japan": "Японія",
"dc_japan_title": "дата-цэнтра Японіі",
Expand Down Expand Up @@ -245,7 +245,7 @@
"exchangerate_inline_text_default": [
"Выкарыстуйце код або назву валюты: ",
"`@INCS2bot price {валюта}`",
"(например, `@INCS2bot price rub` або `@INCS2bot price рубель`)"
"(напрыклад, `@INCS2bot price rub` або `@INCS2bot price рубель`)"
],
"exchangerate_inline_title_selected": "Паглядзець кошт ключа ў {}",
"exchangerate_inline_description_selected": "1x Ключ ад кейса ў Counter-Strike каштуе {} {}",
Expand Down Expand Up @@ -276,11 +276,11 @@
"game_dropcaptimer_inline_title": "Скід абмежаванняў",
"game_dropcaptimer_inline_description": "Час да скіду абмежаванняў вопыту і дропу",
"game_dropcaptimer_text": "⏳ Час да скіду абмежаванняў вопыту і дропу: {} д. {} г. {} мін. {} сек.",
"game_leaderboard_button_title": "🆕 Таблица лидеров CS2",
"game_leaderboard_button_title": "🆕 Табліца лідэраў CS2",
"game_leaderboard_world": "Свет",
"game_leaderboard_header_world": "Лучшие игроки CS2 по миру:",
"game_leaderboard_header_regional": "Лучшие игроки CS2 по этому региону:",
"game_leaderboard_detailed_link": "Полную таблицу лидеров, а также подробную статистику игроков можно посмотреть [тут]({}).",
"game_leaderboard_header_world": "Лепшыя гульцы CS2 па свеце:",
"game_leaderboard_header_regional": "Лепшыя гульцы CS2 па гэтым рэгіёне:",
"game_leaderboard_detailed_link": "Поўную табліцу лідэраў, а таксама падрабязную статыстыку гульцоў можна паглядзець [тут]({}).",
"gun_button_text": "Дадзеныя аб зброі",
"gun_select_category": "#️⃣ Выберыце катэгорыю, якая Вас цікавіць:",
"gun_pistols": "Пісталеты",
Expand Down Expand Up @@ -330,7 +330,7 @@
"gun_origin_uk": "Злучанае Каралеўства",
"gun_origin_south_africa": "Паўднёвая Афрыка",
"latest_data_update": "Апошняе абнаўленне дадзеных: {}",
"data_not_found": "Данные не найдены.",
"data_not_found": "Дадзеныя не знойдзены.",
"notifs_build_public": [
"⚡️ [Публічная зборка](https://t.me/cstracker/28) Counter-Strike была абноўлена.",
"",
Expand Down Expand Up @@ -396,7 +396,7 @@
"regions_australia": "Аўстралія",
"regions_china": "Кітай",
"regions_europe": "Еўропа",
"regions_northamerica": "Северная Америка",
"regions_northamerica": "Паўночная Амерыка",
"regions_southamerica": "Паўднёвая Амерыка",
"states_low": "нізкая",
"states_medium": "сярэдняя",
Expand Down Expand Up @@ -464,7 +464,7 @@
"user_gamestats_shots": "Стрэлаў:",
"user_gamestats_hits": "Пападанняў:",
"user_gamestats_aim_accuracy": "Дакладнасць стральбы:",
"user_gamestats_hs_percentage": "Працэнт пападанняў ў галаву:",
"user_gamestats_hs_percentage": "Працэнт пападанняў у галаву:",
"user_gamestats_maps_stats": "🗺️ Статыстыка карт:",
"user_gamestats_best_map": "Найлепшая карта:",
"user_gamestats_misc_stats": "🔰 Іншае:",
Expand Down Expand Up @@ -495,6 +495,7 @@
"user_gamestats_share": "Падзяліцца",
"user_invalidlink_error": "⚠️ Адпраўленая вамі спасылка несапраўдная, праверце яе правільнасць і паспрабуйце яшчэ раз.",
"user_invalidrequest_error": "⚠️ Няправільны запыт.",
"user_nostatsavailable_error": "⚠️ Для дадзенага профіля няма даступнай статыстыкі CS2.",
"user_telegraph_error": "⚠️ Адбылася ўнутраная памылка Telegraph, калі ласка, увядзіце спасылку нанова.",
"user_privateprofile_error": "❕ Гэты акаўнт прыватны, немагчыма атрымаць статыстыку. Калі ласка, змяніце настройкі прыватнасці.",
"user_profileinfo_title": "Блакіроўкі і абмежаванні",
Expand Down
Loading

0 comments on commit d764268

Please sign in to comment.