Skip to content

Instantly share code, notes, and snippets.

@pascalpoitras
Last active April 30, 2023 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pascalpoitras/03b3cb271c3c7d3dc51e617db691cf96 to your computer and use it in GitHub Desktop.
Save pascalpoitras/03b3cb271c3c7d3dc51e617db691cf96 to your computer and use it in GitHub Desktop.
different version of newsmon made for someone on IRC
/trigger addreplace news_transform line "*;irc.libera.#*;nick_newsly+irc_privmsg,nick_CarlSagan+irc_privmsg,nick_Chunt+irc_privmsg,nick_Brainstorm+irc_privmsg,nick_Bridgestorm+irc_notice"
/trigger set news_transform conditions "${channel} =~ ^(##alerts|##news|##science|#securitynews)$"
/trigger set news_transform regex "/.*/${info:news_parse,site_and_sections,${tg_message_nocolor}}/my_site_and_sections /\|/ - /my_site_and_sections /.*/${if:${channel}==##alerts?${if:,${tags},=-,irc_notice,?[${color:red}NOTICE${color:reset}] ${split:2, ,keep_eol,${tg_message_nocolor}}:[${define:my_site,${info:alert_parse,site,${tg_message_nocolor}}}${color:${info:nick_color_name,${my_site}}}${my_site}${color:reset}] ${info:alert_parse,title,${tg_message_nocolor}} ${info:alert_parse,url,${tg_message_nocolor}}}:[${color:${info:nick_color_name,${my_site_and_sections}}}${my_site_and_sections}${color:reset}] ${info:news_parse,title,${tg_message_nocolor}} ${info:news_parse,url,${tg_message_nocolor}}}/message /.*//prefix"
/trigger set news_transform command "/print -newbuffer newsbuffer \t${message}"

/trigger addreplace news_parse_tools info "news_parse"
/trigger set news_parse_tools regex "/.*/${split:1,,,${tg_arguments}}/my_var /.*/${split:2,,keep_eol,${tg_arguments}}/my_message /.*/${my_message}/my_site_and_sections /.*/${my_message}/my_title /^\[([^]]+)\].*/${re:1}/my_site_and_sections / - /|/my_site_and_sections /^\[[^]]+\] (.*)/${re:1}/my_title / → [^ ]+$//my_title /.*/${if:${split:-2, ,keep_eol,${my_message}}=*→ http*?${split:-1, ,,${my_message}}}/my_url /.*/${my_${my_var}}/tg_info"

/trigger addreplace alert_parse_tools info "alert_parse"
/trigger set alert_parse_tools regex "/.*/${split:1,,,${tg_arguments}}/my_var /.*/${split:2,,keep_eol,${tg_arguments}}/my_message /.*/${split:1,:,,${my_message}}/my_site /^New from (.*)/${re:1}/my_site /.*/${split:2,:,keep_eol,${my_message}}/my_title / (.*)/${re:1}/my_title / → [^ ]+$//my_title /.*/${if:${split:-2, ,keep_eol,${my_message}}=*→ http*?${split:-1, ,,${my_message}}}/my_url /.*/${my_${my_var}}/tg_info"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment