Commit Graph

224 Commits

Author SHA1 Message Date
Brian S. Stephan a314809671 weather: use requests library over urllib/json 2016-01-16 19:39:33 -06:00
Brian S. Stephan 90d20dfe75 transform: use new py3 base64 API 2016-01-16 19:37:24 -06:00
Brian S. Stephan 59c593f60b transform: use codecs library for rot13 2016-01-16 19:36:51 -06:00
Brian S. Stephan c3c54b9f10 ircbot: use % formatting in some debugging 2016-01-16 19:36:10 -06:00
Brian S. Stephan cdde966733 ircbot: properly output exception msg to string 2016-01-16 19:34:06 -06:00
Brian S. Stephan 570a4e1962 twitter: don't re-encode response as utf-8 2016-01-16 19:33:03 -06:00
Brian S. Stephan 47a1352a0a change __unicode__()s to __str__()s 2016-01-16 18:21:46 -06:00
Brian S. Stephan 9112ad0ae7 convert the project via 2to3 2016-01-16 18:02:17 -06:00
Brian S. Stephan f513b241d2 ircbot: force lowercase IrcChannel channel name 2015-09-17 22:55:25 -05:00
Brian S. Stephan d9c39d3db9 markov: better context/target creation ex handling 2015-09-17 22:35:23 -05:00
Brian S. Stephan 4f17234a0a markov: force the target/context to lowercase 2015-09-17 22:35:04 -05:00
Brian S. Stephan e8d57b29b2 irclib.bot: don't del sys.modules[badname]
this makes no sense to do on ImportError since that's probably why we
got here. testing, not 100% sure this is right
2015-09-17 22:23:36 -05:00
Brian S. Stephan 91594117bc remove deprecated TEMPLATE_DIRS setting 2015-09-17 22:23:14 -05:00
Brian S. Stephan 505dc8799c markov: configure what channels to learn from 2015-09-17 22:22:59 -05:00
Brian S. Stephan 91bbabec67 facts: get rid of the soap stuff
interesting, but i don't really care to use it ever, so deleted
2015-09-17 21:56:52 -05:00
Brian S. Stephan 8504a2556d facts: trivial comment cleanups 2015-09-16 16:57:12 -05:00
Brian S. Stephan b9b626d2ef remove useless import 2015-08-14 16:55:02 -05:00
Brian S. Stephan 425bf64baa facts: proof of concept grade SOAP WS
mostly just to prove to myself that i can use pysimplesoap and be kinda
pleased with the results
2015-08-14 16:54:31 -05:00
Brian S. Stephan 68cf0f8816 facts: don't require nickmask in admin form 2015-08-14 16:53:37 -05:00
Brian S. Stephan f18569b636 enable sites framework, useful for some SOAP stuff 2015-08-14 16:52:57 -05:00
Brian S. Stephan 4abcef58c1 karma: ignore commands or chatter separately 2015-07-11 08:12:25 -05:00
Brian S. Stephan bf0445149b twitter: handle twitter API errors better
i think i need to make this client (re)connect on demand or something,
though, i'm getting a lot of timeouts
2015-07-11 08:10:35 -05:00
Brian S. Stephan 6bf2732d7f dispatch: handle writing unicode to file properly 2015-07-11 08:09:53 -05:00
Brian S. Stephan e2d4e29750 use LenientDecodingLineBuffer in bot guts
should make the bot more resilient to clients that send non-unicode text
2015-06-22 17:43:45 -05:00
Brian S. Stephan ac3e71c32a karma: option to ignore targets 2015-06-20 16:34:18 -05:00
Brian S. Stephan 598a158300 dispatch: helps if i actually use the new text 2015-06-20 11:26:35 -05:00
Brian S. Stephan f542a862b8 dispatch: have option to include key in output 2015-06-20 11:23:28 -05:00
Brian S. Stephan 98bb608291 dispatch: allow dispatcher key in API URLs as well 2015-06-20 11:22:17 -05:00
Brian S. Stephan 241de26dd5 facts: allow adding facts via IRC 2015-06-20 10:58:40 -05:00
Brian S. Stephan 934f83b734 facts: show the source of facts, if desired 2015-06-20 10:46:52 -05:00
Brian S. Stephan d507e8f7ac facts: add the timestamp back too 2015-06-20 10:22:49 -05:00
Brian S. Stephan 69ca220b5e facts: add fact source back into model
it was silly for me to have dropped this
2015-06-20 10:19:11 -05:00
Brian S. Stephan 772df777ba ircbot: tie bot users to django auth user, part 3
get rid of is_admin(), instead check for django permissions. a couple
things were using is_admin(), so now there's an example of the
permission adding and usage, as those were ported
2015-06-20 10:08:51 -05:00
Brian S. Stephan df17e68456 ircbot: tie bot users to django auth user, part 2
rename BotAdmin to BotUser

other stuff will check whether or not they're an "admin", which will
actually be standard django permissions
2015-06-20 09:50:52 -05:00
Brian S. Stephan 123acbbd8d ircbot: tie bot users to django auth user, part 1
sets up the foreign key and changes how is_admin() works, though it will
be going away pretty soon, i just need to do this migration in parts so
as to not confuse django too much
2015-06-20 09:27:50 -05:00
Brian S. Stephan 243531c017 add prospector and config 2015-06-20 02:00:56 -05:00
Brian S. Stephan e194ae0319 dispatch: don't override get_object() in /message 2015-06-20 01:13:11 -05:00
Brian S. Stephan 4a092ec603 markov: have context in target's __unicode__() 2015-06-20 01:09:42 -05:00
Brian S. Stephan 397ae2243c ircbot: recurse if we had an alias hit
the idea is that there may be two aliases in the string, or the alias
may have created another alias
2015-06-19 21:40:35 -05:00
Brian S. Stephan e11d7280de countdown: display negative numbers better
this kinda removes an old BUGS line that isn't actually correct for this
change, but it was old and fixed a while ago anyway (mostly)
2015-06-19 21:40:21 -05:00
Brian S. Stephan 4854eb17ac storycraft: fix the line count in progress 2015-06-19 21:10:26 -05:00
Brian S. Stephan 1c88aa1189 dispatch: unicode_literals in models 2015-06-19 21:07:45 -05:00
Brian S. Stephan 1193ce5b6a storycraft: port to ircbot v2
this silly storytelling game has been lightly tested, but it appears to
not blow up miserably, so i'm going to commit it until i can spend more
time testing it/caring about it
2015-06-19 21:06:58 -05:00
Brian S. Stephan 095221a7b2 dispatch: properly write bytes to file 2015-06-19 16:46:46 -05:00
Brian S. Stephan 9296123f25 dispatch: require explicit send_message permission 2015-06-19 16:45:10 -05:00
Brian S. Stephan bece1745b3 dispatch: include 'message': "" in /message GET
mostly as a hint to illustrate how to use the thing
2015-06-19 15:10:21 -05:00
Brian S. Stephan 3532b073c4 dispatch: nest the dispatcher -> action serializer 2015-06-19 15:08:57 -05:00
Brian S. Stephan 4f717cb1c2 dispatch: break Dispatcher actions into 2nd model
decouple the dispatcher (a key, basically) with the actions to take upon
receiving such a message. allows us to have multiple actions for one key
without weird hacks
2015-06-19 11:29:00 -05:00
Brian S. Stephan dac7999c0f dispatch: use generics better (?) in /message
use GenericAPIView rather than APIView in order to get some common idiom
stuff done for us. we continue to support GET and POST in
DispatchMessage, now it's just a bit cleaner. i think.

anyway if we were doing this stuff more we could/should probably create
mixins for them, but at the moment this is pretty sane i think
2015-06-19 10:51:11 -05:00
Brian S. Stephan 0641e1c062 dispatch: port to django REST framework
this moves the dispatcher functionality that used to be in the old
ircbot directly to django REST framework, which is more robust and
allows for cooler stuff down the road. this still retains the ability to
have the bot privmsg, that still happens over the XML-RPC interface,
this is just a more convenient frontend to that
2015-06-18 23:57:43 -05:00
Brian S. Stephan 8fe5dbc0d3 acro: port acro to ircbot v2 2015-06-18 18:48:38 -05:00
Brian S. Stephan ae0f56cd58 seen: this shouldn't do anything w/privmsg 2015-06-18 10:34:02 -05:00
Brian S. Stephan 6560327984 countdown: app for noting points in time 2015-06-18 09:19:53 -05:00
Brian S. Stephan 76e9046549 port twitter module to ircbot v2
handles the on-demand commands but no timeline polling
2015-06-16 20:27:44 -05:00
Brian S. Stephan bef66e3427 ircbot: specify commands after connecting
happens before the sleep and the autojoins
2015-06-16 19:02:00 -05:00
Brian S. Stephan f0072fb633 ircbot: configure a sleep before autojoin channels 2015-06-16 19:01:41 -05:00
Brian S. Stephan 1af5f67daf port races irc module to new bot 2015-06-13 13:41:37 -05:00
Brian S. Stephan a345f4567e make the markov admin view URLs a bit better 2015-06-13 13:08:14 -05:00
Brian S. Stephan d9f905c691 privmsg interface to ircbot in django admin
fill out the form, send a privmsg
2015-06-13 13:07:52 -05:00
Brian S. Stephan 56b495e8fb add an XML-RPC interface to the irc bot
this allows plugins to register methods that can be called over XML-RPC

the old bot used this interface behind apache for a web service, but i
think in this version it will only be for django -> ircbot, and django
will have a rest API for other things
2015-06-13 13:06:10 -05:00
Brian S. Stephan 65a03ced03 use adminplus to add admin views
move the markov learning views into the admin
2015-06-13 12:20:10 -05:00
Brian S. Stephan 871c8e1db8 dice: irc plugin for !roll commands
basically a straight port from the old code. handles normal dice rolling
and cthulhutech style
2015-05-27 21:01:28 -05:00
Brian S. Stephan 91f0b8c651 transform: port TextTransform to bot v2
this just has some simple (and occasionally handy?) text transformations
as an irc plugin, like upper/lower case, base64, and similar
2015-05-27 20:05:38 -05:00
Brian S. Stephan fefbcf695e karma: use unicode_literals 2015-05-27 20:05:04 -05:00
Brian S. Stephan eb006db04d facts: store facts in the database for retrieval
should be able to accomplish a variety of things, from actual helpful
facts to quotes to fortune commands
2015-05-21 22:32:57 -05:00
Brian S. Stephan 7d13119176 standardize logging logger names 2015-05-21 22:05:10 -05:00
Brian S. Stephan bd4b2e176a pi: meta options on PiLog 2015-05-21 22:04:57 -05:00
Brian S. Stephan 1ec1b54e5a remove a bunch of old vi modelines 2015-05-21 21:57:54 -05:00
Brian S. Stephan 7046b53f20 pi: add an app to simulate pi via monte carlo 2015-05-21 21:41:42 -05:00
Brian S. Stephan e647fc9b4d ircbot: don't require topic/setter in IrcChannel
one may want to set autojoin for a channel that hasn't yet had topic
stuff logged, so don't require it in the form
2015-05-21 21:14:01 -05:00
Brian S. Stephan ed5f164092 ircbot: guess at nickmask in __init__()
some ircds don't lead to a welcome signal, so our attempts to set the
nickmask there may never happen. guess at one first, in the event that
_on_welcome() never fires
2015-05-21 18:45:01 -05:00
Brian S. Stephan 6205be109b ircbot: migration for the IrcPlugin ordering 2015-05-19 22:00:30 -05:00
Brian S. Stephan 062348ef99 karma: app for managing karma, aka ++s and --s
this is a djangoification of the old (really old, actually) karma stuff
written by mike bloy. functionality should be the same, and might be a
bit faster through the ORM now
2015-05-19 21:57:01 -05:00
Brian S. Stephan 2fbd76dba6 seen: make handle_seeing a @staticmethod 2015-05-19 21:55:11 -05:00
Brian S. Stephan e77dc571be markov: remove unused imports in ircplugin 2015-05-19 21:54:39 -05:00
Brian S. Stephan 53604c3184 ircbot: specify IrcPlugin ordering 2015-05-19 21:53:40 -05:00
Brian S. Stephan 0ce83c4fa8 seen: port to irc bot v2 2015-05-15 22:40:13 -05:00
Brian S. Stephan 53caf2b94b reference handlers directly rather than w/getattr
mostly just picking a convention
2015-05-15 22:21:15 -05:00
Brian S. Stephan 903a8f5c80 ircbot: list to remove_global_regex_handler
same as previous commit, inverse of add_, for convenience
2015-05-15 22:15:43 -05:00
Brian S. Stephan 134c02dc59 ircbot: list of events to add_global_regex_handler
for convenience, pass a list of events to add_global_regex_handler if
you want to have multiple things fire the same handler. common case is
pubmsg and privmsg
2015-05-15 22:08:00 -05:00
Brian S. Stephan a3484b0d3a topicmonitor: monitor when channel topic changes
comes with a migration to add topic tracking to IrcChannel
2015-05-15 21:48:19 -05:00
Brian S. Stephan 41a7628c63 weather: port weather to new style bot 2015-05-15 21:22:14 -05:00
Brian S. Stephan 80eca4781c ircmgmt: cleanups, remove some unused stuff 2015-05-15 21:21:39 -05:00
Brian S. Stephan fd85d37474 ircbot: use unicode_literals
desperate attempt to make unicode handling in this code better
2015-05-15 21:20:10 -05:00
Brian S. Stephan 16fa94cb24 markov: don't learn recursive stuff 2015-05-15 18:38:00 -05:00
Brian S. Stephan 43da4bff5a markov: add !markov reply command 2015-05-15 18:37:48 -05:00
Brian S. Stephan 67411ad0bc echo: a simple echo plugin 2015-05-15 18:22:13 -05:00
Brian S. Stephan 5716e285b6 ircbot: attempt to bring recursion back
so initial tests suggest this is working well, but it's not exactly the
clearest code, so let's call this a rough proof of concept of recursion
in the bot
2015-05-15 18:20:59 -05:00
Brian S. Stephan 115e82f0fc ircmgmt, markov: actually use bot.reply() right 2015-05-15 18:19:55 -05:00
Brian S. Stephan 67098c34bb ircmgmt: unregister handle_quit 2015-05-15 17:36:51 -05:00
Brian S. Stephan 07ca50dfb6 ircbot: reply() method that supports recursion
undecided if i'll bother to bring recursion back, but if it works out,
provide this method to either reply or give text to the thing recursing.
either way this is a bit clearer than using privmsg() directly, usually
2015-05-15 17:35:03 -05:00
Brian S. Stephan 94656b71d2 markov: irc plugin
doesn't support the (unused?) commands of the old bot yet, but does do
basic irc watching and replying
2015-05-15 17:02:28 -05:00
Brian S. Stephan 950ad4cc4c markov: get_or_create_target_context properly 2015-05-15 17:02:13 -05:00
Brian S. Stephan bf68099f2f ircbot: handle more plugin load failures
possibly handle them a bit more cleanly, too, by deleting sys.modules
entries
2015-05-15 17:01:25 -05:00
Brian S. Stephan c371df5eb0 markov: move shared methods into lib.py 2015-05-15 08:36:17 -05:00
Brian S. Stephan 1570bc28f9 markov: increase context/target name size 2015-05-15 08:32:36 -05:00
Brian S. Stephan 34e0c76dce migration for aliases plural 2015-05-15 08:31:19 -05:00
Brian S. Stephan 92bea5f629 Django 1.8 port: move markov templates to app dir 2015-05-15 08:30:58 -05:00
Brian S. Stephan 7b93c7d63c provide reason for failure to load plugin 2015-05-14 21:43:35 -05:00
Brian S. Stephan 0428c30faf add Alias support
allows stuff like ^!die$ -> !quit

no recursion (yet? or maybe i'll never bother), but this should allow
the basic aliases
2015-05-14 21:39:20 -05:00
Brian S. Stephan e7de9f840d minor comment cleanup so pycharm highlights it 2015-05-14 10:34:20 -05:00
Brian S. Stephan 34c73fccf9 create a plugin to do common basic irc actions 2015-05-12 22:39:53 -05:00
Brian S. Stephan 438ab414ff use bot.die() over bot.disconnect() 2015-05-12 22:34:27 -05:00
Brian S. Stephan 14e5fb4d6f ircbotlib.reply_destination_for_event
common idiom that'll only get used more and more, so might as well make
a library method of it
2015-05-12 22:33:09 -05:00
Brian S. Stephan 8c39b017d3 better _handle_event debug message 2015-05-12 22:30:32 -05:00
Brian S. Stephan cf01114390 remove vim modeline 2015-05-12 20:56:36 -05:00
Brian S. Stephan c4bfcf3e1b add BotAdmin, IrcPlugin models
a lot of stuff in here around support for loading plugins from arbitrary
files. plugins have a basic amount of initialization and then hook into
the core IRC event system

it makes sense to have modules respond to regexes, so there's some
handler stuff for that --- it was the most popular way to do stuff in
the old version of the bot

we need to check that people trying to load plugins are admins, so
there's some stuff for that, too

the expectation is that many features from here are happen in plugins,
rather than modifying the core bot
2015-05-12 20:45:18 -05:00
Brian S. Stephan bd3ffd4067 add channel model, support autojoining
known channels in the database can be set to autojoin when the bot
starts (when it gets the MOTD, because i couldn't find an "on_connect"
event)
2015-05-10 10:02:25 -05:00
Brian S. Stephan 0ea9c3a164 rename ircbot.py to bot.py
ircbot/ircbot.py confused the importer
2015-05-09 20:03:55 -05:00
Brian S. Stephan 3d61838a92 start the new ircbot framework 2015-05-09 18:56:26 -05:00
Brian S. Stephan 1dd8e76942 bump django to 1.8.1 2015-05-08 22:53:38 -05:00
Brian S. Stephan 518ad4174a django bump to 1.7.8 2015-05-08 22:32:04 -05:00
Brian S. Stephan 1484aded84 reorganizing project directories, part 2 2015-05-08 20:44:24 -05:00
Brian S. Stephan 2ffdf26ec2 reorganizing project directories, part 1 2015-05-08 20:37:22 -05:00
Brian S. Stephan 77e52acc75 Markov: first cut of markov in django
this is just a basic port of the tables into django models right now.
there's some serious slowness in the state creation that i need to fix
before this does anything, but i want to get this in a real database on
a real linode before i go too much further, so here it is
2014-04-05 10:52:29 -05:00
Brian S. Stephan f9c7388bae just return a blank page for the index
i'll keep the index.html around for when we eventually use it, though
2014-04-05 10:49:23 -05:00
Brian S. Stephan 54b6da689d Races: really basic races site with a detail page
getting this out there so that i maybe feel motivated to make it not
suck in the future
2014-03-20 19:21:56 -05:00
Brian S. Stephan db1f77e102 blank index page. code stolen from polycephaly 2014-03-20 19:21:11 -05:00
Brian S. Stephan 92b7e3b333 templates and static dirs for when they happen 2014-03-20 19:19:43 -05:00
Brian S. Stephan 5fff9411a5 Races: add module to do a crude racebot thing
join/start/update/finish/leave. good enough start i think
2014-03-16 15:46:15 -05:00
Brian S. Stephan 2553e6bed1 load django_extensions 2014-03-16 14:02:02 -05:00
Brian S. Stephan 84ee09d4a3 migrate Seen to django models and whatnot
this also adds south and django_extensions stuff, because that is the
natural thing to do. this is a pretty good start, i think
2014-03-16 11:35:01 -05:00
Brian S. Stephan 6d85a580f3 normal django localsettings.py import thing 2014-03-16 09:34:39 -05:00
Brian S. Stephan e21bebc24c django skeleton 2014-03-16 09:22:11 -05:00