diff -uNr a/logotron/MANIFEST.TXT b/logotron/MANIFEST.TXT --- a/logotron/MANIFEST.TXT 3e5f450c0784d29263bdd8e4d6fb1ca707fe181f7f233f7c78fdc3bd9e5b33fee304fdd4f49d9e24ddfc14dc636de49d5f4c12cfadfd4a9a94d331597246d491 +++ b/logotron/MANIFEST.TXT 0b96586a2510cca44fd5be14d95ba57c0bd29a0e33b8563b512502aa8ace23cafb9b2bcef463f42a8820e20c52da3672367b3abad3e724fe8e4af44a2d3e31e2 @@ -25,3 +25,4 @@ 696566 archived_chans asciilifeform "Allow marking a chan as 'archived' to improve DB performance." 697872 classic_css_tweaks billymg "Use list-based chan nav, fix highlight current chan bug from 684804, wrap chans when they overflow." 700821 fix_multiln_hlite billymg "Fix bug from 684804 where the highlighting of multiple selected log lines is not rendered properly." +719633 fix_bot_recursion billymg "Prevent bots from speaking to each other. Also add a flag for handling pest log lines." diff -uNr a/logotron/bot.py b/logotron/bot.py --- a/logotron/bot.py 048fcb73260b4b85459e1e8ca4529df95a1e4d6898b74a8259c38a690aeb0840cf77fef9fd5f16445287f0d4091e18ddf7e2da478e9cb09db157f16eeb4c85ec +++ b/logotron/bot.py fa93d94c684695b4ac20f57b9580d2e1faf9e82e83145eaca7a9ff2d1130d5e296c0e1007d771ba7cd17b4dde33d4da2c6975af8d9e3a29412dcd3f5d013f25e @@ -14,7 +14,7 @@ ############################################################################## # Version. If changing this program, always set this to same # as in MANIFEST -Ver = 689331 +Ver = 719633 ## As of version 689331, this program will NOT work with Freenode !!! @@ -64,12 +64,14 @@ TX_Delay = float(cfg.get("tcp", "t_delay")) Servers = [x.strip() for x in cfg.get("irc", "servers").split(',')] Port = int(cfg.get("irc", "port")) + Is_Pest = int(cfg.get("irc", "is_pest")) Nick = cfg.get("irc", "nick") Pass = cfg.get("irc", "pass") Channels = [x.strip() for x in cfg.get("irc", "chans").split(',')] SkipInitLn = int(cfg.get("irc", "skip_init_lines")) Discon_TO = int(cfg.get("irc", "disc_t")) Prefix = cfg.get("control", "prefix") + Bots = [x.strip() for x in cfg.get("control", "bots").split(',')] # DBism: DB_Name = cfg.get("db", "db_name") DB_User = cfg.get("db", "db_user") @@ -214,8 +216,11 @@ save_line(datetime.now(), channel, Nick, False, message) -# Standard incoming IRC line (excludes fleanode liquishit, etc) -irc_line_re = re.compile("""^:([^!]+)\!\S+\s+PRIVMSG\s+\#(\S+)\s+\:(.*)""") +# Standard incoming IRC (or PestNet) line (excludes fleanode liquishit, etc) +if (Is_Pest): + irc_line_re = re.compile("""^:(\S+)\s+PRIVMSG\s+\#(\S+)\s+\:(.*)""") +else: + irc_line_re = re.compile("""^:([^!]+)\!\S+\s+PRIVMSG\s+\#(\S+)\s+\:(.*)""") # The '#' prevents interaction via PM, this is not a PM-able bot. @@ -527,6 +532,10 @@ # First, add the line to the log: save_line(datetime.now(), chan, user, action, text) + # End here if the line came from another bot + if user in Bots: + return + # Then, see if the line was a command for this bot: if text.startswith(Prefix): cmd = text.partition(Prefix)[2].strip() diff -uNr a/logotron/nsabot.conf b/logotron/nsabot.conf --- a/logotron/nsabot.conf b2117eaa3fbedff592b133635a84997b236d781936c9e8473d771ad67ab4e20a4a36062c9449b4ac0ee0fc7cd4c2bced405105a250378bd3a6a5658de05c3a30 +++ b/logotron/nsabot.conf ad5f570234ff7f7afa4e2d43669c36e502c820a6645c5f241a255e608ce897133ca31caf2d26269204d63ed7b49c793589987581aba503dad6c3a64a502849cd @@ -6,6 +6,8 @@ [irc] servers = irc.dulap.xyz port = 6667 +# If the bot is on a Pest network, set to 1, otherwise 0 +is_pest = 0 # Bot's nick (change to yours, as with all knobs) nick = snsabot @@ -40,7 +42,10 @@ [control] # Command Trigger for IRC bot -prefix = !q +prefix = YOUR_BOT_TRIGGER + +# Other people's bots (for www colouration and bot rebellion suppression) +bots = dulapbot, bitbot, bitdashbot, gribble, atcbot, punkbot, []bot, assbot, a111, deedbot, deedBot, deedbot-, feedbot, auctionbot, lobbesbot, snsabot, watchglass, trbexplorer, lekythion, sourcerer, ossabot, ericbot, sonofawitch, btcinfobot, BusyBot, drunkbot, spykedbot, pehbot, BingoBot, pokarBot, scoopbot, scoopbot_revived, ozbot, mpexbot [logotron] # The current era. @@ -67,9 +72,6 @@ css_file = classic.css -# Other people's bots (for colouration strictly) -bots = gribble, atcbot, punkbot, []bot, assbot, a111, deedbot, deedBot, deedbot-, feedbot, auctionbot, lobbesbot, snsabot, watchglass, trbexplorer, lekythion, sourcerer, ossabot, ericbot, sonofawitch, btcinfobot, BusyBot, drunkbot, spykedbot, pehbot, oglafbot, BingoBot, pokarBot, scoopbot, scoopbot_revived, ozbot, mpexbot - # Days of inactivity after which chan is hidden by default days_hide = 14 diff -uNr a/logotron/reader.py b/logotron/reader.py --- a/logotron/reader.py c249c7a987199fd5e0356b13c36401654b4df837e238c8c91c10c3a988b91ba6a19c908f7e33298e559ef40b058e6c67ec6e9da4bb8539c8153aa6cbf17bbabc +++ b/logotron/reader.py 3b02f186daaee1b4fe93a53324fbd3c09924538f15d607c01cdb1381434ed9155671d5f239065ed431630ce3c6585c14dfcd8f3443a56189300a10d6f6288ee3 @@ -39,7 +39,7 @@ Nick = cfg.get("irc", "nick") Channels = [x.strip() for x in cfg.get("irc", "chans").split(',')] OldChans = [x.strip() for x in cfg.get("irc", "oldchans").split(',')] - Bots = [x.strip() for x in cfg.get("logotron", "bots").split(',')] + Bots = [x.strip() for x in cfg.get("control", "bots").split(',')] Bots.append(Nick) # Add our own bot to the bot list # DBism: DB_Name = cfg.get("db", "db_name") diff -uNr a/logotron/release_notes.txt b/logotron/release_notes.txt --- a/logotron/release_notes.txt c2a29c23d3e5e2af1d5cb7b41aa00dc5ba297bcf957b2c57a00909544e829747923f98e74b5f8c7ed16500d2c8ac9afa0040a53c1421a964f8fe3f65b02a8cb8 +++ b/logotron/release_notes.txt 7680df3082e7221fbc218f95a8be4cb8403d105f39f4ccf1dca840d31f79fe798b8b7b00db9c40eab4e5fe5192b5f8ec8dbd27cba8f0ce65fa18aabfc9224e71 @@ -1,4 +1,14 @@ ################### +2022 Jan 20 Update: +################### +---------------------------------------------------------------------------------------------------------------------------- +719633 fix_bot_recursion billymg "Prevent bots from speaking to each other. Also add a flag for handling pest log lines." +---------------------------------------------------------------------------------------------------------------------------- +(1) Fix bug where a bot would echo a log reference from another bot, potentially causing an infinite loop between two bots. +(2) Add flag 'is_pest' to the config, use flag to select which regex to use for parsing incoming log lines. + + +################### 2021 Sep 16 Update: ################### ----------------------------------------------------------------------------------------------------------------------------------------------