Skip to content

Commit

Permalink
fix rt command for 15 and 16; add shell.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
UlyssesZh committed Apr 5, 2024
1 parent d200af7 commit df8737a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ data
docker-compose.yml
docker-compose.yml.example
Rakefile
shell.nix
2 changes: 1 addition & 1 deletion lib/lyricat/bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def b15 lang, session_token
s.concat "- #{song.name lang}\t#{Song.diff_name_in_game diff_id, lang}\n"
end
unless middle_result.empty?
middle_result = "**#{Song.diff_in_game_and_abbr_precise diff, lang}**\n" + middle_result
middle_result = "**#{Song.diff_in_game_and_abbr_precise diff, lang, special: nil}**\n" + middle_result
if result.length + middle_result.length + link.length + 1 > 2000
if event.channel.pm?
try_reply event.message, result
Expand Down
6 changes: 5 additions & 1 deletion lib/lyricat/song.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ class << self
attr_accessor :max_version

def diff_in_game_and_abbr_precise diff, lang = LANGS.first, special: false
in_game = (special ? DIFFS_SP_IN_GAME : DIFFS_IN_GAME)[diff.to_i][lang]
if special.nil?
in_game = [DIFFS_IN_GAME[diff.to_i], DIFFS_SP_IN_GAME[diff.to_i]].compact.map { _1[lang] }.join '/'
else
in_game = (special ? DIFFS_SP_IN_GAME : DIFFS_IN_GAME)[diff.to_i][lang]
end
in_game += DIFF_PLUS[lang] if diff % 1 > 0.5
"#{in_game}(.#{(diff % 1 * 10).round})"
end
Expand Down
11 changes: 11 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# currently not working: https://github.com/stackgl/headless-gl/issues/283
{ pkgs ? import <nixpkgs> {} }: with pkgs; mkShell {
packages = [
opencc
];
shellHook = ''
export LD_LIBRARY_PATH=${lib.makeLibraryPath [
opencc
]}
'';
}

0 comments on commit df8737a

Please sign in to comment.