news: add reaktor with helper commands
This commit is contained in:
parent
39a3ee0429
commit
a2ca5f2e21
@ -60,25 +60,46 @@
|
|||||||
hooks.PRIVMSG = [
|
hooks.PRIVMSG = [
|
||||||
{
|
{
|
||||||
activate = "match";
|
activate = "match";
|
||||||
pattern = "^(?:.*\\s)?\\s*brockman-helper:\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$";
|
pattern = "^brockman-helper:\\s*(\\S*)(?:\\s+(.*\\S))?\\s*$";
|
||||||
command = 1;
|
command = 1;
|
||||||
arguments = [2];
|
arguments = [2];
|
||||||
commands = {
|
commands = {
|
||||||
add-telegram.filename = pkgs.writeDash "add-telegram" ''
|
add-reddit.filename = pkgs.writeDash "add-reddit" ''
|
||||||
|
set -euf
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo 'usage: brockman-helper: add-telegram $telegramname'
|
echo 'usage: brockman-helper: add-reddit $reddit_channel'
|
||||||
echo "$#"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "brockman: add t_$1 http://rss.r/?action=display&bridge=Telegram&username=$1&format=Mrss"
|
reddit_channel=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
|
||||||
|
echo "brockman: add r_$reddit_channel http://rss.r/?action=display&bridge=Telegram&username=$reddit_channel&format=Mrss"
|
||||||
|
'';
|
||||||
|
add-telegram.filename = pkgs.writeDash "add-telegram" ''
|
||||||
|
set -euf
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo 'usage: brockman-helper: add-telegram $telegram_user'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
telegram_user=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
|
||||||
|
echo "brockman: add t_$telegram_user http://rss.r/?action=display&bridge=Telegram&username=$telegram_user&format=Mrss"
|
||||||
|
'';
|
||||||
|
add-youtube.filename = pkgs.writeDash "add-youtube" ''
|
||||||
|
set -euf
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo 'usage: brockman-helper: add-youtube $nick $channelid'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
youtube_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
|
||||||
|
youtube_id=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][1]')
|
||||||
|
echo "brockman: add yt_$youtube_nick http://rss.r/?action=display&bridge=Youtube&context=By+channel+id&c=$youtube_id&duration_min=&duration_max=&format=Mrss"
|
||||||
'';
|
'';
|
||||||
search.filename = pkgs.writeDash "search" ''
|
search.filename = pkgs.writeDash "search" ''
|
||||||
|
set -euf
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo 'usage: brockman-helper: search $searchterm'
|
echo 'usage: brockman-helper: search $searchterm'
|
||||||
echo "$#"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
${pkgs.curl}/bin/curl -Ss "https://feedsearch.dev/api/v1/search?url=$1&info=true&favicon=false" |
|
searchterm=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
|
||||||
|
${pkgs.curl}/bin/curl -Ss "https://feedsearch.dev/api/v1/search?url=$searchterm&info=true&favicon=false" |
|
||||||
${pkgs.jq}/bin/jq '.[].url'
|
${pkgs.jq}/bin/jq '.[].url'
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user