GithubHelp home page GithubHelp logo

welcomebot's People

Contributors

aaparella avatar aaron1011 avatar bananaobserved avatar dcarrot2 avatar fboxwala avatar ilmari-lauhakangas avatar jbertino avatar kgriffs avatar kwurst avatar lkuper avatar ppegusii avatar qarkai avatar shaunagm avatar sunu avatar vr-clarissa avatar

Watchers

 avatar  avatar

welcomebot's Issues

Quit after disconnect (netsplit/k-line or any 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..)

Remove person from newcomers, if they are kicked (with proposed solution)

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.

NickServ identification syntax and a need to wait for identification acknowledgement

After registering my bot and trying out identification, I noticed two things.

  1. The PRIVMSG syntax was missing a : immediately before IDENTIFY (spaces in parameter are disallowed otherwise)
  2. I had to add a 10 second sleep after the NickServ identification message so it had time to be picked up (otherwise I was unable to join a channel that required users to be identified)

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.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 55: invalid continuation byte

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

Limit the number of queued welcomes inside the wait-time window

I ran into this case:

  1. Welcomebot joins a fresh channel
  2. One day, there is a netsplit (or Matrix bridge falls down) and many regulars from the channel re-join at once
  3. Welcomebot gives dozens of welcomes in a row!

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.

Strip _away from nicks

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.

Handle case where there is only 1 greeter

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])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.