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

Fix typo #220

Open
wants to merge 1 commit into
base: source
Choose a base branch
from
Open
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: 1 addition & 1 deletion content/blog/2023-03-28-weechat-notification-ntfy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<tiim> 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 `<tiim> 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.
Expand Down