xrogaan / apib Goto Github PK
View Code? Open in Web Editor NEWAnother Python Irc Bot
Another Python Irc Bot
If the latest post is deleted, on next parse the bot will repost the new latest message (but only that one, not the whole feed).
This is related to the time marker feature.
Warning: bozo error in effect!!!
Traceback (most recent call last):
File "main.py", line 339, in <module>
bot.our_start()
File "main.py", line 120, in our_start
self.start()
File "/home/swh/apib/irclib/ircbot.py", line 247, in start
SimpleIRCClient.start(self)
File "/home/swh/apib/irclib/irclib.py", line 1141, in start
self.ircobj.process_forever()
File "/home/swh/apib/irclib/irclib.py", line 234, in process_forever
self.process_once(timeout)
File "/home/swh/apib/irclib/irclib.py", line 222, in process_once
self.process_timeout()
File "/home/swh/apib/irclib/irclib.py", line 194, in process_timeout
self.delayed_commands[0][1](*self.delayed_commands[0][2])
File "main.py", line 233, in m_privmsg
messages = messages()
File "./mods/feedreader/phpBBReader.py", line 185, in get_scheduled_output
messages = self.parse(url)
File "./mods/feedreader/phpBBReader.py", line 101, in parse
print ">>> (%s) %s" % (urlError.reason[0],urlError.reason[1])
AttributeError: 'SAXParseException' object has no attribute 'reason'
Resolution: use urlError.getMessage() instead.
If somebody write a lot of messages in a little time, the bot will then flood the channel.
A solution is to group the messages by author or threads like this :
Thread '$name' got $num new messages. ($linkToThread)
$name posted in $threadsName
Where :
$threadsName
is a list of the thread where the author posted.$name
is the nickname of the guy$num
is the number of messages$linkToThread
is a link to the thread first new messageThis is one major component since it end up to provide a valid combat behavior for users interacting with the bot. The basic idea is to provide random
sentences in case of aggression. But that's not fun since all sentences are
predetermined. Instead, the bot could generate sentences based on random
numbers. In a more advanced way, the bot could provide users a character
cheet with basics informations like streng, agility, intelligence, etc..
If the network fails, the bot crashes instead of trying to reconnect.
First thing to do is to correct the feedparser, which introduce the crash (the bozo error).
Here is a backtrace:
Warning: bozo error in effect!!! >>> (110) Connection timed out Traceback (most recent call last): File "main.py", line 339, in bot.our_start() File "main.py", line 120, in our_start self.start() File "/home/swh/apib/irclib/ircbot.py", line 247, in start SimpleIRCClient.start(self) File "/home/swh/apib/irclib/irclib.py", line 1139, in start self.ircobj.process_forever() File "/home/swh/apib/irclib/irclib.py", line 234, in process_forever self.process_once(timeout) File "/home/swh/apib/irclib/irclib.py", line 222, in process_once self.process_timeout() File "/home/swh/apib/irclib/irclib.py", line 194, in process_timeout self.delayed_commands[0][1](*self.delayed_commands[0][2]) File "main.py", line 234, in m_privmsg for msg in messages: TypeError: 'NoneType' object is not iterable
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.