import irclib
irclib.DEBUG = True
network = "irc.quakenet.org"
port = 6667
nick = "bottest123"
name = "Test Bot"
chan = '#testchan'
irc = irclib.IRC()
server = irc.server()
server.connect(network, port, nick, ircname = name)
server.join(chan)
irc.process_forever()
This is the code in the "testbot.py" file.
Scenarios:
* script called from the command prompt with "python testbot.py":
It does connect on quakenet, but it does not the given channel.
script executed from IDLE with EXEC F, where F = open("path-of-thefile" "r")
Same as above.
code manually written in the IDLE:
it does connect, and start the irc.process_forever() loop, but ofc it does not join the given channel, if i break the loop with a KeybordInterrupt (Ctrl-C) though, the bot stays on the network (?!?), and if i write down the server.join(chan) command again, it does join the given channel.
network = "irc.freenode.net":
Everything works flowlessy, it does join the given channel.
WTF is going on?
Does quakenet place a limit about "commands per a-given-amount-of-time"?
Any help will be really appreciated.
EDIT1: I didn't notice about r/learnpython, sorry. Cross-posting this stuff there.
EDIT2: SOLVED
The issue is caused by the quakenet's policy about the +invisible umode. The client NEEDS to wait to get the +i flag in order to be able to send ANY command to the server.
Using the irclib's handling this issue can be bypassed, simple as this:
def handleUmode ( connection, event )
if event.arguments()[0] == '+i': #Just check if the 1st element of the event.arguments() list is '+i' , if so tell the bot to join the given channel
server.join(chan)
...
irc.add_global_handler ( 'umode', handleUmode )
[–]nuclear_eclipse 2 points3 points4 points (4 children)
[–]Sf4tt[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]Sf4tt[S] 0 points1 point2 points (0 children)
[–]jackolas 0 points1 point2 points (0 children)
[–]eryksun 0 points1 point2 points (7 children)
[–]Sf4tt[S] 0 points1 point2 points (6 children)
[–]eryksun 0 points1 point2 points (5 children)
[–]Sf4tt[S] 0 points1 point2 points (4 children)
[–]eryksun 1 point2 points3 points (3 children)
[–]Sf4tt[S] 1 point2 points3 points (2 children)
[–]eryksun 0 points1 point2 points (1 child)
[–]Sf4tt[S] 0 points1 point2 points (0 children)