Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
module:ircbot [2019/04/18 15:27] – Added initial bot docs hansolomodule:ircbot [2019/05/30 23:43] (current) – Created sections digital man
Line 1: Line 1:
-====== Ircbot ======+====== IRC Bot ======
  
-<code> +===== Install =====
-<cellguy> can anyone answer a Sychronet IRC question for me?  has to do with the bot scripts included with synchronet package +
-<cellguy> How do you get them working?  Cant find any documentation on them +
-<cellguy> need to get one oman IRC channel on my server +
-<cellguy> saw them in the directory and looked at the configs, just need a jump start +
-<Troice> You set up the ini file and run it using jsexec. +
-<cellguy> ok sweet, thats the jump start I was looking for +
-<Troice> ctrl/ircbot.ini +
-<Troice> sbbs/exec/jsexec -d ircbot.js +
-<cellguy> thanks a bunch +
-</code>+
  
-I'm going to start working on revising this page.  Since there is not a great deal of info about the ircBot included with the BBS packageI've been doing some experimenting.  Based on what I find, I'll be updating the page here.+The IRC bot is included with Synchronet BBS, at ''exec/ircbot.js''.  Additional IRC bot modules are available in ''exec/ircbots/''.
  
-**Installation +===== Configure =====
-------------** +
-There is an ircBot program included with the Synchro.net BBS package, but it is not enabled by default.  I have found that the only method to get the bot running is to run it from a separate CMD window as Troice states above.  Create a shortcut to it with the command line of **sbbs/exec/jsexec -d ircbot.js** to start.  This assumes you already have the ircd configured and running.+
  
-**Configuration +The IRC bot configuration file is [[:config:ircbot.ini:]].
--------------** +
-The ircBot is controlled via a settings file //ctrl/ircbot.ini// +
-Most important are the server settings (omit the bullets I just needed them for formatting in this wiki);+
  
-  * [server_ServerName] +<code> 
-  addresses=add.ress.one, add.ress.two +[server_ServerName] 
-  nick=BotNickname +addresses=add.ress.one, add.ress.two 
-  services_password=? +nick=BotNickname 
-  channels=#channelone, #channeltwo +services_password=? 
-  port=6667+channels=#channelone, #channeltwo 
 +port=6667 
 +</code>
  
 //Notes:// //Notes://
-  - If running from the same machine as the ircD then using localhost or 127.0.0.1 works OK.  But if you have multiple IP's configured use the specific IP's.   +  - If you are running the Synchronet ircd, you can connect the bot to localhost127.0.0.1, or the specific interface that the ircd binds to as configured in [[:config:services.ini:]] 
-  - Port is required but if you use the default 6667 or a dedicated port doesn't matter.  If all running from the same machine I find 6667 works fine, really depends on how my activity your ircd is getting.  If under heavy load and/or running from another machine, you might want to us e a different port that is not open to the outside.  Whatever you decide, if not 6667 be sure you have listed it in //ctrl/irc.conf// as a P line (P:*:*:*:7000). +  - You may place more than one server section in [[:config:ircbot.ini:]], however connecting to multiple servers with one bot currently does not work.  Insteadyou would need to run multiple instances of ircbot.js.
-  - Passwords are important but quite honestly I have not figured out how to authenticate a bot other than with /oper lines.  Which I don't suggest giving a bot.  More on this later... +
-  - I have found that you may place more than one server section in the //ini// and it does in fact create more than one bot in the ircd.  Howeverthe subsequent bots do not see to behave the same as the default and I need to experiment more with using dedicated ports / running multiple command windows to host individual bots.+
  
-**Modules +**Modules** 
--------** +There are a number of modules available for the IRC botbut they are not all enabled (or listed) in ''ctrl/ircbot.ini'' by default.
-There are a number of modules available for the ircBot to hostalthough they are not all enabled (or listed) in the //ctrl/ircbot.ini// by default.+
  
-  * [module_ModuleName] +<code> 
-  channels=#channelone <key>,!#channeltwo +[module_ModuleName] 
-  dir=/sbbs/exec/ircbots/mybot/ +channels=#channelone <key>,!#channeltwo 
-  lib=mylib.js +dir=/sbbs/exec/ircbots/mybot/ 
-  global=true+lib=mylib.js 
 +global=true 
 +</code>
  
-Looking at the //sbbs/exec/ircbots// directory for your version of the BBS you may see more modules that are installed but bot configured.  As of BBS v3.17 I find the following;+Looking at the ''exec/ircbots'' directoryyou may see more modules that are installed but bot configured.  As of the time of this writing, the following are available:
  
-  * [module_Admin] +<code>
-  * global=true +
-  * dir=/sbbs/exec/ircbots/admin/+
  
-  * [module_Antispam+;[module_Trivia
-  * global=true +;dir=/sbbs/exec/ircbots/trivia/
-  * dir=/sbbs/exec/ircbots/antispam/+
  
-  * [module_Decider+[module_Admin
-  global=true +global=true 
-  dir=/sbbs/exec/ircbots/decider/+dir=/sbbs/exec/ircbots/admin/
  
-  * [module_Dice+[module_Antispam
-  global=true +global=true 
-  dir=/sbbs/exec/ircbots/dice/+channels = #channelname 
 +dir=/sbbs/exec/ircbots/antispam/
  
-  * [module_Dis+[module_Decider
-  dir=/sbbs/exec/ircbots/dis/+global=true 
 +dir=/sbbs/exec/ircbots/decider/
  
-  * ;[module_Google+[module_Dice
-  * ;global=true +global=true 
-  * ;dir=/sbbs/exec/ircbots/google/+dir=/sbbs/exec/ircbots/dice/
  
-  * [module_Ham+[module_Dis
-  dir=/sbbs/exec/ircbots/ham/+dir=/sbbs/exec/ircbots/dis/
  
-  * [module_Humanity+;[module_Google
-  dir=/sbbs/exec/ircbots/humanity/+;global=true 
 +;dir=/sbbs/exec/ircbots/google/
  
-  * [module_Info+[module_Ham
-  * global=true +dir=/sbbs/exec/ircbots/ham/
-  * dir=/sbbs/exec/ircbots/info/ +
-  * lib=http.js+
  
-  * [module_Poker+[module_Humanity
-  dir=/sbbs/exec/ircbots/poker/ +dir=/sbbs/exec/ircbots/humanity/
-  * lib=cardlib.js+
  
-  * [module_Presence+[module_Info
-  dir=/sbbs/exec/ircbots/presence/+global=true 
 +dir=/sbbs/exec/ircbots/info/ 
 +lib=http.js
  
-  * [module_Weather+[module_Poker
-  * global=true +dir=/sbbs/exec/ircbots/poker
-  * dir=/sbbs/exec/ircbots/weather+lib=cardlib.js
-  lib=http.js+
  
-  * [module_WhereIs+[module_Presence
-  * global=true +dir=/sbbs/exec/ircbots/presence/
-  * dir=/sbbs/exec/ircbots/whereis/ +
-  * lib=http.js+
  
-  * [module_RPG] +[module_Weather] 
-  dir=/sbbs/exec/ircbots/rpgbot/+global=true 
 +dir=/sbbs/exec/ircbots/weather/ 
 +lib=http.js 
 + 
 +[module_WhereIs] 
 +global=true 
 +dir=/sbbs/exec/ircbots/whereis/ 
 +lib=http.js 
 + 
 +[module_RPG] 
 +channels = #channelname 
 +dir=/sbbs/exec/ircbots/rpgbot/ 
 +</code>
  
 //Notes// //Notes//
-  - Google seems to have some file dependencies and doesn't execute so I have it commented out.  +  - Google seems to have some missing file dependencies and doesn't execute so I have it commented out.  
   - No trivia directory although it is listed in the ini file.     - No trivia directory although it is listed in the ini file.  
-  - Otherwise, by adding the modules to the ini and restarting the bot you may make these available in your ircd.   +  - Add a module to a channel by adding the line channels = #channelname to the block. 
-  - See the help by sending **/msg <botnick> help**. +  - Otherwise, by adding the modules to the ini and restarting the bot you may make these available in your ircd
-  - You will need to **/msg <botnick> IDENT <password>** against your bot to see the full menu of items+ 
 +**Running the IRC Bot** 
 + 
 +The IRC bot can be executed via [[:util:jsexec]], ''jsexec ircbot.js'', and an alternate configuration file may be specified like so: ''jsexec ircbot.js -f /some/other/ircbot.ini''
 + 
 +You can also run the IRC bot via your services thread by adding an entry to [[:config:services.ini:]]: 
 + 
 +<code> 
 +[IRCBot] 
 +Port=6668 
 +Options=STATIC|LOOP 
 +Command=ircbot.js 
 +</code> 
 + 
 +Note that the //Port// value must be supplied, but is irrelevant; the bot does not listen for connections.  Just pick an unused port. 
 + 
 +You can add '' -f /some/other/ircbot.ini'' to the //Command// line to specify an alternate configuration file. 
 + 
 +===== Use =====  
 + 
 +  - See the help menu by sending **/msg <botnick> help**. 
 +  - Some commands are restricted and will not show up in the help menu (or be usable), until you have identified yourself to the bot.  To identify, use **/msg <botnick> identify <password>**.  (Your IRC nickname must be the same as your username on the BBS for this to work.)
    
 Without **IDENT** the help looks like; Without **IDENT** the help looks like;
  
 +<code>
 Usage: HELP <module> <command> | HELP <command> Usage: HELP <module> <command> | HELP <command>
 [main] help,?,ident,quote [main] help,?,ident,quote
Line 134: Line 150:
 for help creating a characer, type 'rpg help create' for help creating a characer, type 'rpg help create'
 for help with the editor, type 'rpg help editor' for help with the editor, type 'rpg help editor'
 +</code>
  
 With **IDENT** it looks like; With **IDENT** it looks like;
  
 +<code>
 Usage: HELP <module> <command> | HELP <command> Usage: HELP <module> <command> | HELP <command>
 [main] reload,load,join,part,die,restart,help,?,ident,addquote,quote,greet,save,prefix,nick,module,modules,abort,ignore [main] reload,load,join,part,die,restart,help,?,ident,addquote,quote,greet,save,prefix,nick,module,modules,abort,ignore
Line 159: Line 177:
 for help creating a characer, type 'rpg help create' for help creating a characer, type 'rpg help create'
 for help with the editor, type 'rpg help editor' for help with the editor, type 'rpg help editor'
 +</code>
  
 +The main module functions are contained in the ''/exec/load/ircbot_commands.js'' file.  All other modules are free standing and have separate files in their respective directories under ''/exec/ircbots/'' The help associated with the various modules/commands is not complete.  if you choose to add/update look for the lines;
 +
 +<code>
 +Bot_Commands["RELOAD"].usage =
 + get_cmd_prefix() + "RELOAD";
 +Bot_Commands["RELOAD"].help = 
 + "Reloads the internal bot command and function structure.  No arguments.";
 +</code>
 +
 +This is an example from the command RELOAD.
 +The usage line dictates the syntax required to execute the command.
 +The help line contains a text description of the command's function.
 +
 +**Module Main**
 +  * reload - Reloads the internal bot command and function structure.  No arguments. (see note below)
 +  * load - ??? Unconfirmed ??? I suspect this loads messages from a BBS message area but am unable to get this working.
 +  * join - Instructs the specified bot to JOIN a new channel. [Note: may also be specified in the [[:config:ircbot.ini:]] file as well]
 +  * part - Instructs the specified bot to dePART from a channel.
 +  * die - Causes bot to die (shut down). You don't want that, do you?
 +  * restart - Forces bot to restart, only works with bots running as a service.  If using JSExec the bot will DIE but not restart.
 +  * help - Displays helpful information about bot commands.
 +  * ? - This is the same as help above [Note: This is a command alias, created via //Bot_Commands["?"] = Bot_Commands["HELP"];//
 +  * ident - Identifies a user by alias and password. Use via private message only. [Note: create an alias for IDENT too.]
 +  * addquote - Adds a quote from your nick to the database.  Use QUOTE to see. [Note: quotes held in [[:config:ircbot.ini:]] file appended to bottom.]
 +  * quote - QUOTE returns quote assoicated with your nick, or search for a string to quote.
 +  * greet - Sets or clears the greeting I will display when you enter the room.
 +  * save - ??? Unconfirmed ??? Save some data locally?
 +  * prefix - Changes the bot command prefix. Default is BOT. Only needed in channels, not in private msgs.
 +  * nick - Change the bots nickname.
 +  * module - Toggle the status of modules in channels.
 +  * modules - Same as modules above.
 +  * abort - Instruct the bot to ABORT server output.
 +  * ignore - Tell the bot to IGNORE the specified nickname.
 +
 +Note: The RELOAD command throws an error in it's default config. This should result in reloading [[:config:ircbot.ini:]] as well as all the modules, but fails with the following error;
 +
 +<code>
 +TypeError: redeclaration of const MODULE_NAME
 +file: /sbbs/exec/ircbots/presence/presence.js
 +line: 27
 +</code>
 +
 +You may comment out this section in the ''/exec/load/ircbot_commands.js'' file to avoid, but then you don't RELOAD modules, just the bot.
 +
 +<code>
 +Bot_Commands["RELOAD"].command = function (target,onick,ouh,srv,lvl,cmd) {
 + srv.o(target,"Reloading the bot configuration...","NOTICE");
 + load("load/ircbot_commands.js");
 + load("load/ircbot_functions.js");
 + for(var m in Modules) {
 + /* Don't reload libraries?? 
 + for(var l in Modules[m].load) {
 + if(Modules[m].load[l]) load(Modules[m],Modules[m].load[l]);
 + } */
 + }
 + srv.o(target,"Reloaded.","NOTICE");
 + return;
 +}
 +</code>
  
-am going to begin going through all the commands for the bot and will list them out here.+I'll start creating separate pages for the other modules as I work though them.
  
 ===== See Also ===== ===== See Also =====
   * [[:module:|module index]]   * [[:module:|module index]]
  
-{{tag>}}+{{tag>irc chat}}