qarkai / welcomebot Goto Github PK
View Code? Open in Web Editor NEWThis project forked from falconry/welcomebot
License: Other
This project forked from falconry/welcomebot
License: Other
Currently, if WelcomeBot is kicked out (by a Freenode mistake, for example) or disconnected in a netsplit, the python process keeps running and unfortunately starts taking 100% CPU.
I looked at other bots and it seems the sane thing to do is exit without trying to reconnect. Re-running the program should be handled separately with a daemon or a shell script.
Reference: https://github.com/ayust/kitnirc/issues/15#issuecomment-50968217
(formatted as code as I don't want to ping the issue..)
With the recent spamwave on freenode, I wanted Welcomebot to understand that kicked persons do not need to be welcomed :) Here is a solution that works for me:
if ircmsg.find("KICK " + bot.channel) != -1:
for person in bot.newcomers:
if ircmsg.find("KICK " + bot.channel + " " + person.clean_nick) != -1:
bot.newcomers.remove(person)
break
If you have an idea to make it more concise, feel free to change!
As you can imagine, the raw message contains the string
KICK #channel kickeduser
...while the actor is the one who did the kicking.
Edit: now I realised the solution only worked, if I did the kicking, but it failed if IZBot did the kicking. I don't understand why the message seemed to be ignored as bot.known_bots is only handled in case of PRIVMSG and JOIN.
It seems your changes to the block https://github.com/qarkai/WelcomeBot/blob/Py3/bot.py#L235 broke the "silence feature" of the bot.
Steps:
Bot will greet with a numeric ID.
Expected behaviour would be to skip the greeting in this case.
After registering my bot and trying out identification, I noticed two things.
Here are my changes
ircconn.send("PRIVMSG {} :{} {} {}".format("NickServ", "IDENTIFY", botnick, password))
time.sleep(10)
ircconn.send("JOIN {} \n".format(channel)) # Joins channel
The raw message for the freenode NickServ acknowledgement is
:NickServ!NickServ@services. NOTICE LibO_welcome :You are now identified for LibO_welcome.
Edit: probably a better way would be to start using SASL authentication.
Bot died after observing this quit message: Quit: Odch�z�m
This was the console output:
PING :orwell.freenode.net
Traceback (most recent call last):
File "bot.py", line 328, in <module>
sys.exit(main())
File "bot.py", line 318, in main
msg_recv = msg_handler(ircsock) # gets message from ircsock
File "bot.py", line 129, in msg_handler
new_msg = ircsock.recv(2048).decode('utf-8') # receive data from the server
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 55: invalid continuation byte
I ran into this case:
Maybe have a limit that if a welcome wait-time is triggered, only one extra welcome is allowed to be triggered during the original time window.
We have
nick = nick.rstrip('_1234567890')
It might be good to also ignore _away occurring at the end of nicknames. Sometimes people might join the channel with that in their nick.
Currently with 1 greeter the bot just says (like ).
This should be fixed with something like
if len(self.greeters) > 2:
greeters_string += ", and {}".format(self.greeters[-1])
elif len(self.greeters) == 2:
greeters_string += " and {}".format(self.greeters[-1])
else:
greeters_string = "{}".format(self.greeters[-1])
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.