Franklin is a ChatGPT backed IRC bot

Setup

  1. Install Irssi and the perl interpreter from your system's package manager.

  2. Install the following Perl CPAN modules: Proc::Simple, Sanitize, JSON, and Irssi.
  3. Get it on GitHub

  4. You should configure franklin.pl to autoload on irssi start, and optionally configure your channel autojoins.

  5. Create an API key, then run /set franklin_api_key [api key].

  6. You'll need to create a block.lst file, and point franklin towards it with /set franklin_block_file [filename].

  7. You’ll need to set up a webserver with a directory under it’s root called said (usually something like /var/www/html/said/), that is writable by the franklin.pl script. Franklin should set the umask correctly for the files automatically.

  8. Edit any variables in franklin.pl you need to, but most settings can be changed with the /set franklin... command.

  9. Finally, test it by calling Franklin: hey buddy, send me a test message so I know that you are working.



Options

  • /set franklin_response_webserver_addr [address]This is the webserver address where responses should be stored on the website.
  • /set franklin_http_location [dir]This is the dir location of where the responses are stored on the drive.
  • /set franklin_hard_limit [int]This is a hard limit of characters for the IRC.
  • /set franklin_word_limit [int]This is a soft word limit for ChatGPT.
  • /set franklin_chatterbox_mode [int]This is how often Franklin will talk by itself when on chatterbox mode. 1 is barely at all, 1000 is every line it says something (only go up to 950 or so)
  • /set franklin_history_length [int]How many messages back Franklin's history buffer goes for context.
  • /set franklin_blocklist_file [file]Add users that cannot use Franklin to this filename and set it here.
  • /set franklin_server_info [str]Some information on the servers Franklin is connected to.
  • /set franklin_asshat_threshold [int]How much of an asshole someone has to be before Franklin kicks if Franklin happens to have hops or ops. Usually around 7 or 8.
  • /set franklin_google_gtag [G-tag]The Gtag for your google analytics should go here.
  • /set franklin_txid_chans [#chan1 #chan2]This is a list of channels that the TXID should appear appended to the end of Franklin's message in.
  • /set franklin_admin [str]This is Franlin's owner or administration user's irc nick. This is used for ACLs.
  • /set franklin_log [file]This is the location of Franklin's use and error collection log.
  • /set fanklin_log_verbosity [int]Ths is how noisey the log is, ranges from 0 to 5, 0 being terse, 5 being debug.
Franklin responds to the following internal commands, and unless listed below, everything else is considered a query.

reloadReloads the bot through the assistance of a helper module, and brings it back to an initial state, as if it just connected to IRC. All settings are kept the same.
continue [txid] [chunknum]Allows the bot to look back through previous queries/replies, and can replay the reply in it's entirety, each chunk is 400 characters, and the chunk number currently at hand is identified by (chunk/total) at the end of the message.
link [txid]Instructs Franklin to generate a URL to the specified TXID on it's server.
levelupGives the user who called levelup the highest operator status in the current channel that Franklin itself has priveleges to give. Franklin must be an op itself for this to work.
rebootReboots the server Franklin is hosted on. This can only be used by the irc user set as franklin_admin.


Debugging

… Test the bot by calling it with “Franklin: print me a test message” in channel (do this from a different nick, not Franklin’s nick!)
You may have errors that franklin can't read from or write to something, check your permissions! (I set ownership to franklin:staff).
If text is to long, try using /set franklin_hard_limit to decrease the maximum number of characters on the line.
After edits you can just do /script load franklin to reload the bot without restarting irssi. Any user may also reload Franklin by typing "Franklin: reload" in channel with the bot, if the franklin_helper.pl module is loaded.


There is also a log generated, at the location set with /set franklin_log [logfile] that may be helpful, you can change the verbosity by settings /set franklin_log_verbosity [int], with values from 0 through 3. 2 is recommended unless debugging.