sockets irc bot not sending complete message
<p>I am trying to make an irc bot. It connects but doesn't send the complete message. If I want to send "hello world" it only sends "hello". It just sends everything until the first space. </p>

<p>In this program if you type hello in irc, the bot is supposed to send hello world. But it only sends hello.</p>

<pre><code>import socket

channel = "#bots"
server = "chat.freenode.org"
nickname = "my_bot"


class IRC:
    irc = socket.socket()

    def __init__(self):
        self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    def send(self, chan, msg):
        self.irc.send("PRIVMSG " + chan + " " + msg + "\n")

    def connect(self, server, channel, botnick):
        # defines the socket
        print("connecting to: " + server)
        self.irc.connect((server, 6667))  # connects to the server

        self.irc.send("NICK %s\n" % botnick)
        self.irc.send("USER %s %s Ibot :%s\n" % (botnick, botnick, botnick))
        self.irc.send("JOIN %s\n" % channel)
        self.irc.send("PRIVMSG %s :Hello Master\n" % channel)

    def get_text(self):
        text = self.irc.recv(2040)  # receive the text

        if text.find('PING') != -1:
            self.irc.send('PONG ' + text.split()[1] + 'rn')

        return text

irc = IRC()

irc.connect(server, channel, nickname)

while True:
    text = irc.get_text().strip()

    if "hello" in text.lower():
        irc.send(channel, "hello world")

    print text
</code></pre>

<p>You forgot a : before the message. This should work:</p>

<pre><code>def send(self, chan, msg):
    self.irc.send("PRIVMSG " + chan + " :" + msg + "\n")
</code></pre>

python sockets irc