Skip to content

Commit

Permalink
Implemented auto region detection for Mastery Chart profile opening
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinscham committed Feb 22, 2024
1 parent e689267 commit 2d6c488
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/modules/open_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ def open_stats
end

def open_masterychart(client)
server = ask("Which server do you play on (EUW/NA/BR/TR...)?\n".light_cyan)
player = client.req_get_current_summoner
url = "https://masterychart.com/profile/#{server}/#{player['gameName']}-#{player['tagLine']}?ref=disenchanter"
region = client.req_get_region

region = region[0...-1] if region[-1] == '1' || region[-1] == '2'
region = region.downcase

url = "https://masterychart.com/profile/#{region}/#{player['gameName']}-#{player['tagLine']}?ref=disenchanter"
puts I18n.t(:'handler.url.opening_mastery_chart', url:).light_blue
Launchy.open(url)
end

def translation_url
"https://github.com/marvinscham/disenchanter/blob/main/CONTRIBUTING.md"
'https://github.com/marvinscham/disenchanter/blob/main/CONTRIBUTING.md'
end

0 comments on commit 2d6c488

Please sign in to comment.