From c72b7f6ba39258120aedf09ffdcd20bbf4646898 Mon Sep 17 00:00:00 2001 From: ser-ink <58824595+ser-ink@users.noreply.github.com> Date: Thu, 17 Oct 2024 08:39:49 -0700 Subject: [PATCH] Fix typo Update 2023-03-28-weechat-notification-ntfy.md --- content/blog/2023-03-28-weechat-notification-ntfy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/blog/2023-03-28-weechat-notification-ntfy.md b/content/blog/2023-03-28-weechat-notification-ntfy.md index f71d863e..38fcc439 100644 --- a/content/blog/2023-03-28-weechat-notification-ntfy.md +++ b/content/blog/2023-03-28-weechat-notification-ntfy.md @@ -45,7 +45,7 @@ We call the `/trigger` command with the `addreplace` subcommand. This subcommand - `hook` - This argument specifies which hook or event the trigger should listen for. WeeChat is built as an event-driven platform, so pretty much anything from mouse movements to IRC messages are handled via events. In this case, we want to trigger on the `print` event, which is fired every time a new message gets received from IRC. - `argument` - The argument is needed for some hooks, but not for the `print` hook, so we are going to ignore that one for now and just set it to an empty string `''`. - `condition` - The condition must evaluate to `true` for the trigger to fire. This is helpful because the `print` trigger fires for every new message, but we only want to be notified when the new message mentions our nick. The condition for this is `${tg_highlight}`. You can find the list of variables that you can access with the command `/trigger monitor`, which prints all variables for every trigger that gets executed. -- `variable-replace` - This took me a while to understand. This command is used to manipulate data and save it to a variable. The syntax is inspired by the sed command. Explaining it fully is out of the scope of this blog post, but you can take a look at the [docs](https://weechat.org/files/doc/devel/weechat_user.en.html#trigger_regex). In our example, we replace the whole content of the variable `tg_message` with the format string `${weechat.look.nick_prefix}${tg_prefix_nocolor}${weechat.look.nick_suffix} ${tg_message_nocolor}` which results in a sting like ` Hello world!`. +- `variable-replace` - This took me a while to understand. This command is used to manipulate data and save it to a variable. The syntax is inspired by the sed command. Explaining it fully is out of the scope of this blog post, but you can take a look at the [docs](https://weechat.org/files/doc/devel/weechat_user.en.html#trigger_regex). In our example, we replace the whole content of the variable `tg_message` with the format string `${weechat.look.nick_prefix}${tg_prefix_nocolor}${weechat.look.nick_suffix} ${tg_message_nocolor}` which results in a string like ` Hello world!`. - `command` - The last argument is the command that gets executed whenever this trigger fires. In our case, we use the `/execute` command, which starts the wget command which in turn sends a post request to ntfy.sh. Make sure you set the ntfy topic (the part after `https://ntfy.sh/`) to something private and long enough so that nobody else is going to guess it by accident. Don't forget to subscribe to the ntfy topic on your phone or whatever device you want to receive the notification on.