IRC – multitasking: listening & sending

This is the place for queries that don't fit in any of the other categories.

IRC – multitasking: listening & sending

Postby EscNor » Wed Oct 30, 2013 4:47 pm

Hey folks,

I've been playing around with Python for a little while now and finding it very enjoyable. But have run into a bit of a problem:

I am working on writing a very basic irc client (planning an irc based game with it's own server and clients at some point in the distant future). Being a lazy sob I have tried getting things to work using irclib or blackbox. All I am aiming for at the moment is sending and receiving a message. I can manage both but have to run two separate scripts in individual terminal windows (on Linux here).

So far I have found mention of subprocesses and just using os.system('python other_script.py &') but while that is all nice and dandy for running the script listening and displaying a message when ever someone messages me, I still haven't found a way to pass info to it – getting it to pass on a message to someone... So at the moment I need to log on with two nicknames in order to send and receive messages... which is hardly ideal. No doubt there is a perfectly logical way to do this with irclib or blackbox (have had a look with help()) but I am completely stumped - as I fear it is outside of my understanding for the time being.

So in short: How do I combine the listen and send script OR get one to pass info to the other?

Anyone got any pointers or tutorials that they know of that might make this all a bit clearer?

Thanks in advance.
Last edited by Mekire on Wed Oct 30, 2013 4:52 pm, edited 1 time in total.
Reason: First post lock.
EscNor
 
Posts: 2
Joined: Mon Oct 28, 2013 3:23 pm

Re: IRC – multitasking: listening & sending

Postby stranac » Wed Oct 30, 2013 9:48 pm

A general rule of thumb: doing something networking related - use twisted.

For an irc client, you will want to use twisted.words.protocol.irc.IRCClient.
There are plenty of examples(most of them bots) on the internet that should get you started.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1155
Joined: Thu Feb 07, 2013 3:42 pm

Re: IRC – multitasking: listening & sending

Postby EscNor » Thu Nov 28, 2013 4:26 pm

aaand years later, I return. Gosh darn work.
Thank you so much, seems like what I was looking for. :)
EscNor
 
Posts: 2
Joined: Mon Oct 28, 2013 3:23 pm


Return to General Coding Help

Who is online

Users browsing this forum: Baldyr and 6 guests