Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(flix): add filmkritiker IRC bot #31

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/scripts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ in

playlist = import ./pls.nix {inherit pkgs;};

flix = import ./flix.nix {inherit pkgs;};

mpv-tv = import ./mpv-tv.nix {inherit pkgs lib;};

favicon = wrapScript {
Expand Down
65 changes: 65 additions & 0 deletions packages/scripts/flix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{pkgs}: let
inherit (pkgs) lib;

sendIRC = pkgs.writers.writeDash "send-irc" ''
${pkgs.ircaids}/bin/ircsink \
--nick filmkritiker \
--server irc.r \
--port 6667 \
--target '#flix' >/dev/null 2>&1
'';

messages.good = [
"what a banger"
"ooh i love this film"
"this is top notch stuff!"
"nice!"
"noice!"
"yesss!"
"cool song!"
"i like this"
"that just sounds awesome!"
"that's a good song!"
"👍"
"vibin'"
];
messages.bad = [
"how can anyone watch this?"
"(╯°□°)╯ ┻━┻"
"skip this!"
"next, please! i'm suffering!"
"that's just bad taste in movies"
"nope"
"that sucks!"
"👎"
"turn that down"
"make it stooop"
"noooo"
];

messages.neutral = [
"meh"
"i have no opinion about this film"
"idk man"
];
in
pkgs.writers.writeDashBin "pls" ''
case "$1" in
good|like|cool|nice|noice|top|yup|yass|yes|+)
${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/good"
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.good)} | shuf -n1 | ${sendIRC}
;;
skip|next|bad|sucks|no|nope|flop|-)
${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/skip"
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.bad)} | shuf -n1 | ${sendIRC}
;;
0|meh|neutral)
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.neutral)} | shuf -n1 | ${sendIRC}
;;
say|msg)
shift
echo "$@" | ${sendIRC}
;;
esac
wait
''