user1008773
user1008773

Reputation: 13

Commands in Python IRC bot built with oyoyo

I have recently found the oyoyo Python IRC framework and as it looks decent from my newbie perspective, I have chosen to build an IRC bot with it (Twisted seems a bit daunting). I have looked at the example, but I am not sure how I would implement more commands. Would I just have a lot of if statements in the privmsg function? And how would trigger these if statements? While I am not a complete noob, I am still a newbie, so please don't judge me if this is a stupid question.

Upvotes: 1

Views: 313

Answers (1)

jfs
jfs

Reputation: 414645

IRC bot in twisted demonstrates how your bot can respond to several commands.

You define several command_*() methods and call them from privmsg() method.

getattr(self, 'command_'+command_name, None) retrieves appropriate method to call.

Upvotes: 1

Related Questions