Commit Graph

177 Commits

Author SHA1 Message Date
Pragmatic Software 8fb98d614f Add ability to override command effective-level 2017-12-11 12:44:19 -08:00
Pragmatic Software 1d2d057d45 Properly flag whether a command was processed and interpreted 2017-12-09 13:26:20 -08:00
Pragmatic Software f24c26d2ef Straighten out nickoverride a bit 2017-12-09 13:25:11 -08:00
Pragmatic Software b2273d32fb Extract nested command substitutions and pipes 2017-12-08 20:26:08 -08:00
Pragmatic Software 4338455e11 Properly extract embedded commands 2017-12-08 19:28:08 -08:00
Pragmatic Software e2db94c354 Add WebPaste.pm for rotating paste sites 2017-12-05 21:05:44 -08:00
Pragmatic Software 1378e41c1b Improve handling of /say, etc, in output text 2017-12-04 21:22:19 -08:00
Pragmatic Software 0d0c12e798 Unescape escaped command substitutions 2017-12-04 20:12:27 -08:00
Pragmatic Software 43d227d1a9 Support command substitution 2017-12-04 18:34:34 -08:00
Pragmatic Software f6da7f5662 Prevent /msg to serv@network (currently only abusable by admins) 2017-12-03 19:09:34 -08:00
Pragmatic Software 3ab8f44a8a No need to show debugcontext log for empty result 2017-12-02 15:04:36 -08:00
Pragmatic Software 7a53f74e83 Handle commands/pipes with newlines 2017-11-30 18:50:17 -08:00
Pragmatic Software 51735494b3 Minor improvement to nick addressing 2017-11-30 13:11:39 -08:00
Pragmatic Software 6ddfce4cc3 Remove code duplication 2017-11-28 19:10:22 -08:00
Pragmatic Software ed5a34f16e Fix piping from aliases containing pipes 2017-11-28 19:07:01 -08:00
Pragmatic Software e0e8434b85 Fix piping code-factoids 2017-11-28 18:30:35 -08:00
Pragmatic Software 3b36634fa9 Fix factoid case duplication; enable me/my for pipes 2017-11-27 02:14:34 -08:00
Pragmatic Software 1222436616 Pipes can now be escaped for easy factadding, etc 2017-11-25 20:01:34 -08:00
Pragmatic Software 78a12b3a46 Improve nickoverride processing 2017-11-25 20:00:55 -08:00
Pragmatic Software a7f298520d Temporarily fix /msg, sort of 2017-11-23 14:12:23 -08:00
Pragmatic Software 51b1b25b16 Add `debugcontext` registry item for $stuff dumps 2017-11-20 16:10:48 -08:00
Pragmatic Software fc6e0759d3 Fix dead argument in pipe 2017-11-19 14:39:03 -08:00
Pragmatic Software 45dcefc752 /kick factoids can now be piped 2017-11-17 21:38:28 -08:00
Pragmatic Software 7b903854a3 Remove secretstuff; use $stuff context instead 2017-11-17 21:37:54 -08:00
Pragmatic Software 656adae53c Improvements to piping and stuff 2017-11-17 13:53:23 -08:00
Pragmatic Software 3ed4d58570 Significant refactoring of command passing
Instead of passing locally-scoped short-lived parameters to subroutines,
we now create and pass around a "stuff" context hash.

This allows contextual state to be passed and updated throughout the life
of a command.

This commit is a WIP and is 90% finished. There are likely to be a couple of
edge-cases where strange things may happen. But command-piping mostly works!
2017-11-16 09:23:58 -08:00
Pragmatic Software 68279d7a82 Minor refactor of process_line to ignore embedded commands within full commands 2017-11-14 15:27:30 -08:00
Pragmatic Software d644ac04d5 Limit factoid keywords to 30 characters 2017-11-13 12:00:34 -08:00
Pragmatic Software d771d66d8f fact_find no longer treats some aliases as regex when they alias a built-in command 2017-10-09 19:35:11 -07:00
Pragmatic Software f07c34f53f Paste to ix.io instead of sprunge; set 10 second timeout for pastes 2017-10-05 14:31:58 -07:00
Pragmatic Software 8ba0664b85 Improve parsing of embedded factoids 2017-10-05 14:31:00 -07:00
Pragmatic Software 85693f905a Convert code-factoids to use VM
Code-factoids can now use the compiler virtual machine. Any languages installed
in the VM are valid candidates for code-factoids!

Syntax: factadd keyword /code language code here
2017-09-10 19:53:29 -07:00
Pragmatic Software d6a845f988 Do some basic string validation for factoids and such 2017-09-05 00:27:28 -07:00
Pragmatic Software 1b70de807b Change split / / to split /\s+/ throughout 2017-09-02 00:39:29 -07:00
Pragmatic Software 5ee07e08d2 Replace control chars with escaped ordinals 2017-09-02 00:19:39 -07:00
Pragmatic Software 0fd81482d7 Follow factoid aliases when checking for use_output_queue 2017-08-30 18:03:10 -07:00
Pragmatic Software b0b1d1affa Fix incorrect fact_find in interpreter 2017-08-30 06:54:23 -07:00
Pragmatic Software 2ac7b6feb6 Exclude "Why would I want to do that to myself?" from specific commands 2017-08-26 04:06:36 -07:00
Pragmatic Software 1a08156443 Add $0 in factoid action to expand to first keyword used to invoke factoid 2017-08-26 01:45:18 -07:00
Pragmatic Software 17a62b48e4 Limit truncation pastes to 8000 bytes 2017-08-24 15:16:42 -07:00
Pragmatic Software f6827aa886 Give embedded commands lowest priority so they are not extracted from actual commands 2017-08-24 15:13:20 -07:00
Pragmatic Software 375dd52b41 Add some more commands to me/my-expansion exclusion-list 2017-08-23 19:22:03 -07:00
Pragmatic Software 63bbcb0941 Handle command queue results 2017-08-12 23:42:56 -07:00
Pragmatic Software c8fa308113 Fix harmless undefined variable warning 2017-08-08 21:18:45 -07:00
Pragmatic Software e723379c4d Improve the bot's understanding of "me" and "my" 2017-08-01 21:34:57 -07:00
Tomasz Kramkowski b5d8f72254 License project under MPL2
This patch adds the file LICENSE which is the verbatim copy of the
Mozilla Public License Version 2.0 as retreived from
https://www.mozilla.org/media/MPL/2.0/index.815ca599c9df.txt on
2017-03-05.

This patch also places license headers for the MPL2 type A variant of
the license header in the following files:

PBot/AntiFlood.pm
PBot/BanTracker.pm
PBot/BlackList.pm
PBot/BotAdminCommands.pm
PBot/BotAdmins.pm
PBot/ChanOpCommands.pm
PBot/ChanOps.pm
PBot/Channels.pm
PBot/Commands.pm
PBot/DualIndexHashObject.pm
PBot/EventDispatcher.pm
PBot/FactoidCommands.pm
PBot/FactoidModuleLauncher.pm
PBot/Factoids.pm
PBot/HashObject.pm
PBot/IRCHandlers.pm
PBot/IgnoreList.pm
PBot/IgnoreListCommands.pm
PBot/Interpreter.pm
PBot/LagChecker.pm
PBot/Logger.pm
PBot/MessageHistory.pm
PBot/MessageHistory_SQLite.pm
PBot/NickList.pm
PBot/PBot.pm
PBot/Plugins.pm
PBot/Plugins/AntiAway.pm
PBot/Plugins/AntiKickAutoRejoin.pm
PBot/Plugins/AntiRepeat.pm
PBot/Plugins/AntiTwitter.pm
PBot/Plugins/AutoRejoin.pm
PBot/Plugins/Counter.pm
PBot/Plugins/Quotegrabs.pm
PBot/Plugins/Quotegrabs/Quotegrabs_Hashtable.pm
PBot/Plugins/Quotegrabs/Quotegrabs_SQLite.pm
PBot/Plugins/UrlTitles.pm
PBot/Plugins/_Example.pm
PBot/Refresher.pm
PBot/Registerable.pm
PBot/Registry.pm
PBot/RegistryCommands.pm
PBot/SQLiteLogger.pm
PBot/SQLiteLoggerLayer.pm
PBot/SelectHandler.pm
PBot/StdinReader.pm
PBot/Timer.pm
PBot/Utils/ParseDate.pm
PBot/VERSION.pm
build/update-version.pl
modules/acronym.pl
modules/ago.pl
modules/c11std.pl
modules/c2english.pl
modules/c2english/CGrammar.pm
modules/c2english/c2eng.pl
modules/c99std.pl
modules/cdecl.pl
modules/cfaq.pl
modules/cjeopardy/IRCColors.pm
modules/cjeopardy/QStatskeeper.pm
modules/cjeopardy/Scorekeeper.pm
modules/cjeopardy/cjeopardy.pl
modules/cjeopardy/cjeopardy_answer.pl
modules/cjeopardy/cjeopardy_filter.pl
modules/cjeopardy/cjeopardy_hint.pl
modules/cjeopardy/cjeopardy_qstats.pl
modules/cjeopardy/cjeopardy_scores.pl
modules/cjeopardy/cjeopardy_show.pl
modules/codepad.pl
modules/compiler_block.pl
modules/compiler_client.pl
modules/compiler_vm/Diff.pm
modules/compiler_vm/cc
modules/compiler_vm/compiler_client.pl
modules/compiler_vm/compiler_server.pl
modules/compiler_vm/compiler_server_vbox_win32.pl
modules/compiler_vm/compiler_server_watchdog.pl
modules/compiler_vm/compiler_vm_client.pl
modules/compiler_vm/compiler_vm_server.pl
modules/compiler_vm/compiler_watchdog.pl
modules/compiler_vm/languages/_c_base.pm
modules/compiler_vm/languages/_default.pm
modules/compiler_vm/languages/bash.pm
modules/compiler_vm/languages/bc.pm
modules/compiler_vm/languages/bf.pm
modules/compiler_vm/languages/c11.pm
modules/compiler_vm/languages/c89.pm
modules/compiler_vm/languages/c99.pm
modules/compiler_vm/languages/clang.pm
modules/compiler_vm/languages/clang11.pm
modules/compiler_vm/languages/clang89.pm
modules/compiler_vm/languages/clang99.pm
modules/compiler_vm/languages/clangpp.pm
modules/compiler_vm/languages/clisp.pm
modules/compiler_vm/languages/cpp.pm
modules/compiler_vm/languages/freebasic.pm
modules/compiler_vm/languages/go.pm
modules/compiler_vm/languages/haskell.pm
modules/compiler_vm/languages/java.pm
modules/compiler_vm/languages/javascript.pm
modules/compiler_vm/languages/ksh.pm
modules/compiler_vm/languages/lua.pm
modules/compiler_vm/languages/perl.pm
modules/compiler_vm/languages/python.pm
modules/compiler_vm/languages/python3.pm
modules/compiler_vm/languages/qbasic.pm
modules/compiler_vm/languages/scheme.pm
modules/compiler_vm/languages/server/_c_base.pm
modules/compiler_vm/languages/server/_default.pm
modules/compiler_vm/languages/server/c11.pm
modules/compiler_vm/languages/server/c89.pm
modules/compiler_vm/languages/server/c99.pm
modules/compiler_vm/languages/server/clang.pm
modules/compiler_vm/languages/server/clang11.pm
modules/compiler_vm/languages/server/clang89.pm
modules/compiler_vm/languages/server/clang99.pm
modules/compiler_vm/languages/server/cpp.pm
modules/compiler_vm/languages/server/freebasic.pm
modules/compiler_vm/languages/server/haskell.pm
modules/compiler_vm/languages/server/java.pm
modules/compiler_vm/languages/server/qbasic.pm
modules/compiler_vm/languages/server/tendra.pm
modules/compiler_vm/languages/sh.pm
modules/compiler_vm/languages/tendra.pm
modules/compliment
modules/cstd.pl
modules/define.pl
modules/dice_roll.pl
modules/excuse.sh
modules/expand_macros.pl
modules/fnord.pl
modules/funnyish_quote.pl
modules/g.pl
modules/gdefine.pl
modules/gen_cfacts.pl
modules/gencstd.pl
modules/get_title.pl
modules/getcfact.pl
modules/google.pl
modules/gspy.pl
modules/gtop10.pl
modules/gtop15.pl
modules/headlines.pl
modules/horoscope
modules/horrorscope
modules/ideone.pl
modules/insult.pl
modules/love_quote.pl
modules/man.pl
modules/map.pl
modules/math.pl
modules/prototype.pl
modules/qalc.pl
modules/random_quote.pl
modules/seen.pl
modules/urban
modules/weather.pl
modules/wikipedia.pl
pbot.pl
pbot.sh

It is highly recommended that this list of files is reviewed to ensure
that all files are the copyright of the sole maintainer of the
repository. If any files with license headers contain the intellectual
property of anyone else, it is recommended that a request is made to
revise this patch or that the explicit permission of the co-author is
gained to allow for the license of the work to be changed.

I (Tomasz Kramkowski), the contributor, take no responsibility for any
legal action taken against the maintainer of this repository for
incorrectly claiming copyright to any work not owned by the maintainer
of this repository.
2017-03-06 00:31:15 +00:00
Pragmatic Software f3b3e90cdc Add factoid effective-level metadata and ability to kick from such factoids
Factoids can now have an effective-level metadata field. When set, certain
functionality requiring an effective-level will be enabled.

For now, that is currently only the /kick command, which has an effective-level
of 10.

Factoids with an effective-level set will also have the locked metadata
attribute set as well to prevent people from changing the factoid.  The
locked and/or effective-level attributes will be removable only by admins
whose level is equal to or greater than the effective-level.
2016-11-16 19:07:01 -08:00
Pragmatic Software 170dac5776 Improve `!cmd` and `nick: !cmd` processing 2016-10-23 03:51:59 -07:00
Pragmatic Software 8addeb5d49 Allow "nick: !command" to address to nick; minor improvements 2016-10-14 05:56:54 -07:00
Pragmatic Software f34854fcec Add nick similarity completion
Previously, the bot wouldn't address people by nick if the provided nick
argument doesn't exist in the channel.

Now, the bot's nick list is searched for a nick with a certain similarity
percentage in the order of most recently spoken nicks first. This allows
the bot to address nicks when somebody may have forgotten to add a trailing
underscore/punctuation or may have typoed the nick.

The similarity percentage can be set via the interpreter->nick_similiarty
registry key.  A value of 0 should disable the behavior.
2016-09-25 00:03:37 -07:00
Pragmatic Software 949dc14525 Command queue no longer delays commands relative to each other 2016-07-01 13:29:26 -07:00
Pragmatic Software b215dfe9de Add command queue for delayed command processing 2016-07-01 13:00:20 -07:00
Pragmatic Software dcacec18c6 Totally not a bug
Extremely minor rearrangement of interpreter logic so that `!commands` are
parsed before `command, botnick`. Totally not a bug at all. Pay no attention.
2016-06-25 18:09:47 -07:00
Pragmatic Software 14124da3ac Embedded triggers now work at beginning of message 2016-01-19 06:51:40 -08:00
Pragmatic Software 2962a44c12 No longer remove trailing punctuation from embedded factoid commands 2015-11-26 12:36:36 -08:00
Pragmatic Software 43418c1bc6 Require curly braces or backticks around embedded commands 2015-10-10 06:07:24 -07:00
Pragmatic Software 43c0361354 Add botnick to "Why would I want to do that to myself?" condition 2015-09-19 20:02:11 -07:00
Pragmatic Software 70f091545b Replace "me" in factoid arguments only during first interpretation pass 2015-09-10 01:51:24 -07:00
Pragmatic Software e5097eee69 Move URL titles to UrlTitles.pm plugin
Add $event->{interpreted} field to events to notify other handlers
whether an event was successfully interpreted by the interpreter.

An $event->{interpreted} that is equal to or greater than 100 means the entire
message was consumed and handlers shouldn't do any further processing of it
that would generate any output to channels or users.

Otherwise, $event->{interpreted} is incremented by 1 for each referenced
command that was processed.
2015-09-08 01:37:34 -07:00
Pragmatic Software d51d2367a1 Correct logic of `login` command ignore check 2015-09-07 05:04:54 -07:00
Pragmatic Software 8c16fbd3e5 Allow factoids to be referenced from within messages
E.g.,

<pragma-> Userbob: You can learn more about candide by reading its !help page and checking out its !source
<candide> Userbob: To learn all about me, see http://www.iso-9899.info/wiki/Candide
<candide> Userbob: My guts can be browsed at https://github.com/pragma-/pbot

Only three triggers will be processed per message.  (I should create a
registry entry to customize this.)

Messages that are addressed at a specific user that exists in the channel will
have that user's name prepended to the factoid output.

Factoid triggers that are referenced from within messages will not produce
error messages if the factoid is not found.

Factoids that have an $arg or $nick special variable will not be triggered as
a reference.

Factoids that have the `noembed` meta-data value set to a true value will not
be invoked as a reference.
2015-09-03 20:56:44 -07:00
Pragmatic Software 499d91e07d Do not exempt bot-admins lower than level 10 from ignore list 2015-08-08 12:39:17 -07:00
Pragmatic Software dbfb8a6add Remove unnecessary printing of ignored messages 2015-07-23 17:47:16 -07:00
Pragmatic Software 7cc8b9c34d Allow chat-flood antiflood settings to be overridable on a per-channel basis 2015-07-08 14:05:55 -07:00
Pragmatic Software 0c1e573ef8 Do not invoke compilation for compile-blocks if nick-prefix is specified and does not exist in channel 2015-06-19 16:16:23 -07:00
Pragmatic Software 3012297183 Do not require whitespace next to nick when triggering by bot-nick 2015-05-27 10:44:26 -07:00
Pragmatic Software 0b1d5c29bf Fall back to codepad if sprunge fails to paste
Refactor rate-ratelimiting.
2015-05-15 17:53:13 -07:00
Pragmatic Software a997705ea4 Correct sprunge error message 2015-05-06 21:22:22 -07:00
Pragmatic Software 898aa18783 Add rate-limit to paste_sprunge function
Improve formatting of truncate/paste output when an error has occurred.
2015-05-06 21:15:25 -07:00
Pragmatic Software 715ff8ee78 Find factoids in proper channel namespace 2015-04-26 16:05:03 -07:00
Pragmatic Software f20932b442 Allow setting channel-specific registry item `no_url_titles` and `no_compile_blocks` to prevent invoking these in those channels
Rename $mynick to $botnick throughout
2015-04-19 01:55:52 -07:00
Pragmatic Software 9ff76ad500 Reduce pseudo-AI typing delay 2015-04-13 15:41:11 -07:00
Pragmatic Software 17afac5908 Check commands table for keyword before searching regexs 2015-04-03 15:33:19 -07:00
Pragmatic Software 383c194966 Don't remove trailing punctuation from arguments
Rename $count to $depth to reflect recursion
2015-04-03 12:32:35 -07:00
Pragmatic Software c73f8b6a01 Minor refactor 2015-03-30 15:04:08 -07:00
Pragmatic Software b36a4fb2c9 Improve message output queue
- Use distinct per-channel queues
- Use timestamp of last message in queue to add delay
- Increase typing speed from 4 characters per second to 7 cps
2015-03-29 20:24:36 -07:00
Pragmatic Software e199f6309a Factoids can now be set to use a delayed output queue instead of immediately responding 2015-03-28 17:50:43 -07:00
Pragmatic Software 44bdf26ebc Add support for per-channel bot trigger characters 2015-03-23 04:27:41 -07:00
Pragmatic Software 9a52fffcdd Rename ShitList to BlackList; minor refactor of IgnoreList 2015-03-16 21:08:25 -07:00
Pragmatic Software 46fa0d52b3 Minor code formatting improvement 2014-10-14 02:30:57 +00:00
Pragmatic Software 321fdc401c Improve handling of white-space when splitting output on new-lines 2014-08-11 07:32:24 +00:00
Pragmatic Software 48382de916 Add ability to set maximum number of newlines allowed before truncating for preserve newlines 2014-08-05 23:15:11 +00:00
Pragmatic Software dddc9c3be9 Paste remaining lines to paste site if truncated with more lines remaining when preserve newlines is in effect 2014-08-05 23:11:51 +00:00
Pragmatic Software b15ab7f84f Add ability to preserve newlines in output; require explicit `factadd` to add factoids 2014-08-04 22:48:32 +00:00
Pragmatic Software 60d8235999 Add registry entry to control max recursion depth for interpreter 2014-05-31 01:05:47 +00:00
Pragmatic Software 40b2393d05 Add registry values to manage showing url titles and compiling blocks 2014-05-19 21:34:24 +00:00
Pragmatic Software 937282a114 Add more values to registry for antiflood and lagchecker 2014-05-19 02:42:18 +00:00
Pragmatic Software 30e3c5ce35 Remove PBot getter/setters; move anti-flood registry defaults to AntiFlood.pm 2014-05-18 20:09:05 +00:00
Pragmatic Software d955bfa06c Add centralized configuration registry module
Allows changing of bot configuration values without needing to restart
bot instance or needing to edit pbot.pl script.

Registry will initially be populated with default values from pbot.pl,
but if a registry file exists then the registry values will take
precedence over the pbot.pl values. For instance, if you regset the
bot trigger to '%' then the trigger will be '%' even if pbot.pl has '!'
or something else explicitly set.

Some registry items can have trigger hooks associated with them.  For
instance, the irc->botnick registry entry has a change_botnick_trigger
associated with it which changes the IRC nick on the server when a new
value is set via regset/regadd.

Tons of other fixes and improvements throughout.
2014-05-17 20:08:19 +00:00
Pragmatic Software 54ac8ec0ef Convert message history to use SQLite database instead of Perl hashtable
Added MessageHistory.pm and MessageHistory_SQLite.pm.  May eventually port
and add MessageHistory_Hashtable.pm as was done with Quotegrabs, but this is
not particularly high on the todo list.

Antiflood.pm has been updated to use the new MessageHistory API.

The `recall` command has been moved from Quotegrabs into MessageHistory.  It
also now has the ability to ignore messages containing the recall command
itself, for improved usability.

Likewise, the `grab` command will now ignore previous `grab` commands when
grabbing by regex in order to prevent accidentally grabbing previous grab
attempts.

The `join` and `part` commands have been improved to accept multiple channels,
and `part` will use the current channel if none is provided.
2014-05-13 10:15:52 +00:00
Pragmatic Software 7fa458ab34 Do not expand `me` or remove trailing punctuation for factset/factchange 2014-04-29 04:05:20 +00:00
Pragmatic Software f998f974c0 Truncate module launcher piped result 2014-03-15 01:53:33 +00:00
Pragmatic Software 36b7e1fa6f Improve handling of interpreter result and module execution 2014-03-14 10:05:11 +00:00
Pragmatic Software 921c9917a5 Add $channel special variable for factoids/modules that expands to $from parameter 2014-03-04 21:40:13 +00:00
Pragmatic Software 91a9c69fa5 Interpreter: check for {} code command before regular commands 2014-02-25 03:47:12 +00:00
Pragmatic Software 1155205f0e Bot now keeps message history for itself -- can now be grabbed for quotegrabs 2013-10-22 18:57:08 +00:00
Pragmatic Software c91a8e5c3d Fix /say substitution derp that allowed "/say /msg foo bar" to actually invoke /msg rather than saying "/msg foo bar" 2013-10-12 15:06:27 +00:00
Pragmatic Software 553eceeb77 Fix interpretation of /me commands 2013-07-24 12:33:19 +00:00
Pragmatic Software 208f89837f Improve handling of auto-op and op-commands on per-channel basis
Restore functionality to log out admins when they part/quit
Improve display of quit messages in log
2012-10-27 21:03:10 +00:00
Pragmatic Software 2b5ff48a4c Interpreter: tell <nick> about <command> now case-insensitive
AntiFlood: Correct use of ignore list
IgnoreList: Ignoring user without args now permanent instead of 5 mins
            Save time when ignore expires instead of seconds remaining
            Improve output of `ignore list` command for readability
2012-09-06 10:09:44 +00:00