Allow substitution of bot's nick in RunCommands (irc) (#1890)

* Allow substitution of bot's nick in RunCommands

* Tweak description of "{BOTNICK}"

Made the description of "{BOTNICK}" consistent with that of other keywords
pull/1889/head^2
Kufat 2 years ago committed by GitHub
parent 3ad5deaff1
commit 6d5a3dff22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -243,6 +243,7 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) {
func (b *Birc) handleRunCommands() { func (b *Birc) handleRunCommands() {
for _, cmd := range b.GetStringSlice("RunCommands") { for _, cmd := range b.GetStringSlice("RunCommands") {
cmd = strings.ReplaceAll(cmd, "{BOTNICK}", b.Nick)
if err := b.i.Cmd.SendRaw(cmd); err != nil { if err := b.i.Cmd.SendRaw(cmd); err != nil {
b.Log.Errorf("RunCommands %s failed: %s", cmd, err) b.Log.Errorf("RunCommands %s failed: %s", cmd, err)
} }

@ -122,10 +122,11 @@ RejoinDelay=0
#Only works in IRC right now. #Only works in IRC right now.
ColorNicks=false ColorNicks=false
#RunCommands allows you to send RAW irc commands after connection #RunCommands allows you to send RAW irc commands after connection.
#The string {BOTNICK} (case sensitive) will be replaced with the bot's current nickname.
#Array of strings #Array of strings
#OPTIONAL (default empty) #OPTIONAL (default empty)
RunCommands=["PRIVMSG user hello","PRIVMSG chanserv something"] RunCommands=["PRIVMSG user hello","PRIVMSG chanserv something", "MODE {BOTNICK} +B"]
#PingDelay specifies how long to wait to send a ping to the irc server. #PingDelay specifies how long to wait to send a ping to the irc server.
#You can use s for second, m for minute #You can use s for second, m for minute

Loading…
Cancel
Save