Avatar Hund

Linux, plaintext & minimalism

March 14, 2019

Disable highlights based on specific strings in WeeChat with per channel rules

One of the IRC channels I’m on is a bridge to a public Minecraft server. Every time I write something in the game on that server the IRC channel shows me this:

Hemligastugan | **Admin** Hund » Example message.

WeeChat then thinks that the user “Hemligastugan” (which is a bot) mentioned me and then highlights the message for me. This got annoying pretty fast since it was me who wrote the message in Minecraft. :)

Thankfully this was easy to solve with the help of two plugins. One for the magic and another one to make it persistent:

  • unhighlight.py - Allows per-buffer specification of a regex that prevents highlights.
  • buffer_autoset.py - Auto-set buffer properties when a buffer is opened.

Installation

Install the two scripts in WeeChat:

/script install unhighlight.py buffer_autoset.py

Configuration

I created a rule (using regex) that disables highlights for all messages containing the text **Admin** Hund in the channel #Hemligastugan on the server im (Bitlbee) like this:

/buffer_autoset add irc.im.#Hemligastugan localvar_set_unhighlight_regex \*\*Admin\*\* Hund

If you want to add another rule just use the separator |. And don’t forget to save everything with the command /save when you’re done.

Tags: WeeChat

Feedback