[Twisted-Python] how to access irc.IRCClient.* from other classes
Jonathan Lange
jml at mumak.net
Thu Sep 7 22:49:42 MDT 2006
On 9/5/06, Nick Rehm <speedy at nitroforce.eu> wrote:
> Hello,
> iam playing around with twisted.words.irc and come upon this what i dont
> understand right now
>
You have to pass a reference to 'mainirc' to either 'somestuff' or 'test'. e.g.
class somestuff:
def __init__(self, ircClient):
self.ircClient = ircClient
def test(self):
self.ircClient.msg('foo')
class mainirc(irc.IRCClient):
...
def connectionMade(self):
irc.IRCClient.connectionMade(self)
self.bot = somestuff(self)
Constructing a new instance of 'mainirc' won't work, because the new
instance won't be associated with a connection.
hope this helps,
jml
More information about the Twisted-Python
mailing list