A longtime IRC Friend recently died and I would love to honor his memory by having a bot that spouts out a sentence or two based off of what he previously has said.
I am sure this already exists. I was thinking of a trigger such as Andrew?
Code: Select all
# Jan 11, 2019
# http://forum.egghelp.org/viewtopic.php?t=20572
#
# Real simple... just want any user to be able to type !topic making the bot pull a random line from the topic.txt file and post to the channel
# with "Your topic is..." preceding the line.
#
###################################################################
### config ###
# set the path/filename to the topic.txt file
set topicfile "scripts/added/experiment_for_somebody/random_line_from_file/topic.txt"
### end config ###
bind pub - "!topic" random_line
#####
proc random_line {nick uhost handle chan text} {
global topicfile
if {![file exists $topicfile]} {
putserv "privmsg $chan :Sorry $nick, but $topicfile doesn't exist"
return 0
}
# reference : http://forum.egghelp.org/viewtopic.php?t=6885
set fp [open $topicfile "r"]
set data [read -nonewline $fp]
close $fp
set lines [split $data "\n"]
set numlines [llength $lines]
set num [rand $numlines]
set randline [lindex $lines $num]
putserv "privmsg $chan :Your topic is: $randline"
}
#####
Wow ... I sure recognized the style! But I'd totally forgotten it.SpiKe^^ wrote: From http://forum.egghelp.org/viewtopic.php?t=20572 (Thanks willyw:)