Weechat add hook command in every send Messages

261 views Asked by At

I am a new user in Weechat. I have made a customized weechat script from another existing script. To run that script I need to use hook command every time i send text to channel . For example /myhook message_to_channel . I want to automate this process so every time I send messages to a channel i wouldn't need to write /myhook but just message_to_channel . Is there any way I could make it happen. Thanks.

1

There are 1 answers

0
Worthwelle On

The alias plugin that is included in WeeChat by default can facilitate this.

You can run the following command to create the alias you want.

/alias add message_to_channel /myhook message_to_channel

After that, you should be able to just use /message_to_channel. You can also add arguments if you like:

    $n: argument 'n' (between 1 and 9)
   $-m: arguments from 1 to 'm'
   $n-: arguments from 'n' to last
  $n-m: arguments from 'n' to 'm'
    $*: all arguments
    $~: last argument
  $var: where "var" is a local variable of buffer (see /buffer localvar)
        examples: $nick, $channel, $server, $plugin, $name

The documentation is here.