veiset / brunobot Goto Github PK
View Code? Open in Web Editor NEWModular IRC bot
Home Page: http://veiset.org/brunobot
Modular IRC bot
Home Page: http://veiset.org/brunobot
Adding a feature to run the bot as a daemon.
python2 main.py -v
for running it as a normal python script, and
python main.py
should run it as a daemon.
The bot is first trying to load the extra modules specified in the config.conf
file and then connect.
The bot will have to wait for the modules to be verified. This is not desired. The bot should connect and load the modules concunrrelty.
The bots current state responds to commands from ANY user on irc. Example:
.load yweather
You aren't allowed to do that. (requires admin)
.load yweather
You aren't allowed to do that. (requires admin)
.load yweather
You aren't allowed to do that. (requires admin)
.load yweather
You aren't allowed to do that. (requires admin)
This can easily be exploited with a 2 man botnet to flood the bot off a server over and over again. My proposal is to limit the amount of commands that can be executed in a certain time period or only respond verbosely to so many commands in a given time period. The time period should probably be user defined within the configuration file.
Forking new processes under Windows is not working.
Trace:
20:25:10 wx | Traceback (most recent call last):
20:25:10 wx | File "<string>", line 1, in <module>
20:25:10 wx | File "C:\Python27\lib\multiprocessing\forking.py", line 374, in main
20:25:10 wx | self = load(from_parent)
20:25:10 wx | File "C:\Python27\lib\pickle.py", line 1378, in load
20:25:10 wx | return Unpickler(file).load()
20:25:10 wx | File "C:\Python27\lib\pickle.py", line 858, in load
20:25:11 wx | dispatch[key](self)
20:25:11 wx | File "C:\Python27\lib\pickle.py", line 880, in load_eof
20:25:12 wx | raise EOFError
20:25:12 wx | EOFError
20:25:13 wx | .. running: <module 'module.extra.tvrage' from 'C:\Users\Russ\Desktop\Bruno\mo
20:25:13 wx | dule\extra\tvrage.pyc'>
20:25:14 wx | .. extra module loaded: tvrage 1.0
20:25:14 wx | Can't pickle <type 'module'>: it's not found as __builtin__.module
20:25:15 wx | !! Module 'tvrage 1.0' failed to run.
Might be incorrect usage of the pickle module for presisting data that causes the error.
Reconnect when the bot disconnects from the network.
Usage of .modlist displays init which should be ignored. Without looking at the code I'm making an assumption that the current method of recognizing modules via .modlist is buy listing all files or ".py" files in the /extras directory. I would recommend a function which reads each module first checking for a she-bang line as well as verifying that all required variables for bruno are set within the file. Files like init would not contain these items and thus not be recognized as a bruno loadable module.
test
Unable to load, unload, reload, get help (.help ) about modules that have defined name such as:
name = "word<space>word".
Will not terminate the connection, but the parser thread will stop working when this happens:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/home/vz/dev/git/Brunobot/module/core/cparser.py", line 155, in run
self.parser.parse(line)
File "/home/vz/dev/git/Brunobot/module/core/cparser.py", line 57, in parse
unicode(privmatch.group(5),'utf-8'))
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe5 in position 13: invalid continuation byte
Upon execution of 3rd party modules and handler needs to be put in place to handle any exceptions thrown that are not handled by the 3rd party module itself. If this is not done and an exception is thrown by one of these modules the bot is then put into a "stalemate" where it is still running but not responding to anything else.
Currently only support the python pickle serialize module.
SQLite is standard in python install, and should be considered when needing to persist large amount of data.
The way the bot currently works the saved variables (pickle) are always loaded in memory, and for large enough datasets this could be a problem.
Reproducible: Happened more than once. Don't know how.
Log from terminal:
^C
> .. Core Parser cparser.BufferReader().run(self) terminated.
> .. ThreadedManager threadmanager.ThreadedManager().run(self) terminated.
^C
^C
From ps:
$ ps -eLf|grep -i python
andern 3104 2205 3104 0 2 Apr21 pts/3 00:00:01 python2.7 main.py
andern 3104 2205 3115 0 2 Apr21 pts/3 00:00:00 python2.7 main.py
Try alternative nick if nickname is already taken on connect
Send and listen to CTCP events.
04:03:26 wx | def ctcp(self, target, ctcp, params):
04:03:26 wx | self.connection.irc.send('PRIVMSG \001%s%s\001' % (target, ctcp and (" " + params) or ""))
04:03:44 wx | added that to communication (untested) but i think that should allow to ctcp someone
04:04:02 wx | according to the RFC's and a quick look at irclib
> .. running: <module 'module.extra.tvrage' from '/home/vz/dev/git/Brunobot/module/extra/tvrage.pyc'>
Process ThreadModule-36:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/home/vz/dev/git/Brunobot/threadedmanager.py", line 65, in run
self.module.main(self.data)
File "/home/vz/dev/git/Brunobot/module/extra/urltitle.py", line 39, in main
communication.say(data['channel'], '[%s]' % header)
File "/home/vz/dev/git/Brunobot/module/core/communication.py", line 56, in say
self.connection.irc.send('PRIVMSG %s :%s\n' % (target, line))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 24: ordinal not in range(128)
Reload does not reload the module,
.unload
.load
does however work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.