From 84cdfc849644144c0fbf2a1ceace020120b381c4 Mon Sep 17 00:00:00 2001 From: Gordon Shumway <39967334+oddluck@users.noreply.github.com> Date: Tue, 19 Feb 2019 03:17:59 -0500 Subject: [PATCH] Update plugin.py --- MUD/plugin.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/MUD/plugin.py b/MUD/plugin.py index cdf4e35..dbaba35 100644 --- a/MUD/plugin.py +++ b/MUD/plugin.py @@ -40,11 +40,21 @@ class MUD(callbacks.Plugin): """ channel = msg.args[0] nick = msg.nick - self.tn[nick] = Telnet(self.registryValue('server'), self.registryValue('port')) - response = self.output(self.tn[nick]) - for line in response: - if line.strip(): - irc.reply(line, prefixNick=False) + def join(self, irc, msg, args): + """ + Join the MUD + """ + channel = msg.args[0] + nick = msg.nick + try: + if self.tn[nick]: + irc.reply("You already have an open connection. Please stop that connection first.") + except: + self.tn[nick] = Telnet(self.registryValue('server'), self.registryValue('port')) + response = self.output(self.tn[nick]) + for line in response: + if line.strip(): + irc.reply(line, prefixNick=False) join = wrap(join) def m(self, irc, msg, args, input):