diff --git a/README.md b/README.md index 9d8bc3c..1cab182 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ FEATURES INSTALL ------- -On Ubuntu/Debian you need `python-irclib` and `python-skype` as well as Skype itself to run the script. +On Ubuntu/Debian you need `python-irc` and `python-skype` as well as Skype itself to run the script. For `python-skype` I used the version 1.0.31.0 provided at `ppa:skype-wrapper/ppa`. Although newer version is packaged even for Ubuntu 11.04, this package didn't work out of the box on Ubuntu 12.04. Using latest source version from https://github.com/awahlig/skype4py works fine on Ubuntu 14.04. diff --git a/skype2irc.py b/skype2irc.py index 26c2b71..ce8309f 100755 --- a/skype2irc.py +++ b/skype2irc.py @@ -30,8 +30,8 @@ import time, datetime import string, textwrap -from ircbot import SingleServerIRCBot -from irclib import ServerNotConnectedError +from irc.bot import SingleServerIRCBot +from irc.client import ServerNotConnectedError from threading import Timer version = "0.3" @@ -274,7 +274,7 @@ class MirrorBot(SingleServerIRCBot): """Create IRC bot class""" def __init__(self): - SingleServerIRCBot.__init__(self, servers, nick, (botname + " " + topics).encode("UTF-8"), reconnect_interval) + SingleServerIRCBot.__init__(self, servers, nick, botname + " " + topics, reconnect_interval) def start(self): """Override default start function to avoid starting/stalling the bot with no connection""" @@ -311,12 +311,11 @@ def say(self, target, msg, do_say = True): """Send messages to channels/nicks""" target = target.lower() try: - lines = msg.encode("UTF-8").split("\n") + lines = msg.split("\n") cur = 0 for line in lines: for irc_msg in wrapper.wrap(line.strip("\r")): print target, irc_msg - irc_msg += "\r\n" if target not in lastsaid.keys(): lastsaid[target] = 0 while time.time()-lastsaid[target] < delay_btw_msgs: @@ -353,9 +352,9 @@ def on_welcome(self, connection, event): def on_pubmsg(self, connection, event): """React to channel messages""" - args = event.arguments() - source = event.source().split('!')[0] - target = event.target().lower() + args = event.arguments + source = event.source.split('!')[0] + target = event.target.lower() cmds = args[0].split() if cmds and cmds[0].rstrip(":,") == nick: if len(cmds)==2: @@ -377,9 +376,9 @@ def on_pubmsg(self, connection, event): def handle_ctcp(self, connection, event): """Handle CTCP events for emoting""" - args = event.arguments() - source = event.source().split('!')[0] - target = event.target().lower() + args = event.arguments + source = event.source.split('!')[0] + target = event.target.lower() if target in mirrors.keys(): if source in mutedl[target]: return @@ -391,8 +390,8 @@ def handle_ctcp(self, connection, event): def on_privmsg(self, connection, event): """React to ON, OF(F), ST(ATUS), IN(FO) etc for switching gateway (from IRC side only)""" - source = event.source().split('!')[0] - raw = event.arguments()[0].decode('utf-8', 'ignore') + source = event.source.split('!')[0] + raw = event.arguments[0].decode('utf-8', 'ignore') args = raw.split() if not args: return