Skip to content

aji/gre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

  This is a script for the WeeChat IRC client to allow a command to be
  executed under certain conditions for certain nicknames and channels.

  gre will iterate backwards over the PRIVMSGs in certain buffers and
  compare the text of each message to a regex. If the text matches the
  regex, it will execute a command. Options are available to execute
  commands once for each nick or channel or both.


SYNTAX

  /gre [-try] [-channel|-server|-global] [-n|-c|-cn] [-###] /regex/ command args...


OPTIONS

  -try       Print commands into the buffer they will be executed
             in rather than executing them in the buffer as a command.

  -me        Do NOT exclude yourself from the command. Default
             behavior is to exclude the person issuing the command from
             any matches.

  -channel   Iterate over lines in the current channel only (the default)
  -server    Iterate over lines in all channels in the current server
  -global    Iterate over all lines in all channels

  -n         Execute the command once for each nicknames only (the default)
  -c         Execute the command once in each channel only
  -cn        Execute the command once for each nickname in each channel

  -###       A number indicating the maximum number of privmsgs to check
             going backwards. Good to narrow your search and to prevent any
             unintended matches.


COMMAND REPLACEMENTS

  The strings $n and $c in the command will be replaced with the nickname
  and channel of matching lines respectively. Also, $0..9 can be used
  for back substitution as is typical with regexes.


EXAMPLES

  /gre -n /SPAMSPAMSPAM/ /kill $n Don't spam, please
      This will kill all users in the current channel who have said
      something matching /SPAMSPAMSPAM/

  /gre -server -cn /i love ramen/ /kick $c $n ME TOO
      This will kick all users on the server from channels they have said
      "i love ramen" in.

  /gre -server -c -20 /morespam/ /mode +mz
      This will set flags +mz on channels in which something matching
      /morespam/ has been said in the last 20 PRIVMSGs.

  /gre -try -server -n /^trololol$/ /msg OperServ AKILL ADD $n !T 1d trololol
      This will do a dry-run to add a 1-day AKILL for users who have
      sent messages consisting only of the text 'trololol'


QUIRKS

  I am lazy and took the easy way out with regex extraction. It simply
  cuts at /, so your regex cannot contain the / character or gre will
  get confused. This is on the back burner because such limitations can
  be worked around easily, i.e. /one.two/ instead of /one\/two/

About

A script for WeeChat for executing commands based on regex matches.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages