nu_plugin_twitch 0.1.1

A Nu Shell plugin to interact with Twitch IRC and API, making scripting easier.
Documentation
# https://just.systems

# Deploy the plugin from sources, differ from `install` by not loading the plugin in debug mode
deploy: clean
    cargo build
    nu -c 'plugin add ./target/debug/nu_plugin_twitch'

# Unload and remove the plugin from nu
clean:
    nu -c 'plugin list | where name == "twitch" and status != "removed" |  each { plugin rm $in.filename }'

# Install the plugin from sources globally in release mode
install:
    cargo install --path . --locked
    nu -c 'plugin add ~/.cargo/bin/nu_plugin_twitch'

alias uninstall := clean

# Display the help of the provided comands (require the plugin to be installed)
plugin-help:
    nu -c 'plugin list | where name == "twitch" | $in.commands | flatten | each { help $in }'

# Listen to a channel chat (require the plugin to be installed)
listen CHANNEL:
    nu -c 'twitch chat {{CHANNEL}}'

# Listen to a channel notices (require the plugin to be installed)
notices CHANNEL:
    nu -c 'twitch notices {{CHANNEL}}'

# Send a "Hello World!" message to the given channel (require the plugin to be installed)
say-hello CHANNEL:
    nu -c '"Hello World!" | twitch say {{CHANNEL}}'

# Run the authentification wizard
auth:
    nu -c 'twitch auth'

# Archive both chat and notices of a channel
[parallel]
archive CHANNEL: (archive-chat CHANNEL) (archive-notices CHANNEL)

# Archive a channel chat into the examples/archive.db SQLite file
archive-chat CHANNEL:
    nu -c 'twitch chat {{CHANNEL}} | into sqlite examples/archive.db -t {{CHANNEL}}'

# Archive a channel notices into the examples/notices.db SQLite file
archive-notices CHANNEL:
    nu -c 'twitch notices {{CHANNEL}} | update event { to json } | into sqlite examples/notices.db -t {{CHANNEL}}'