From f35b5e203820a03ac204803c3ffb6d9f6f89c921 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 15 Sep 2014 23:37:35 +0200 Subject: [PATCH] Fixed so CmdIRC2chan correctly handles deletion by botname and not just by dbref. Resolves #572. --- src/commands/default/comms.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/commands/default/comms.py b/src/commands/default/comms.py index b4c5979db..a507d236f 100644 --- a/src/commands/default/comms.py +++ b/src/commands/default/comms.py @@ -758,12 +758,13 @@ class CmdIRC2Chan(MuxCommand): Usage: @irc2chan[/switches] = <#irchannel> @irc2chan/list - @irc2chan/delete botname|dbid + @irc2chan/delete botname|#dbid Switches: - /disconnect - this will delete the bot and remove the irc connection + /delete - this will delete the bot and remove the irc connection to the channel. - /remove - " + /remove - " + /disconnect - " /list - show all irc<->evennia mappings Example: @@ -807,10 +808,11 @@ class CmdIRC2Chan(MuxCommand): if('disconnect' in self.switches or 'remove' in self.switches or 'delete' in self.switches): botname = "ircbot-%s" % self.lhs - matches = PlayerDB.objects.filter(db_is_bot=True, db_key=botname) - if not matches: + matches = PlayerDB.objects.filter(db_is_bot=True, username=botname) + dbref = utils.dbref(self.lhs) + if not matches and dbref: # try dbref match - matches = PlayerDB.objects.filter(db_is_bot=True, id=self.args.lstrip("#")) + matches = PlayerDB.objects.filter(db_is_bot=True, id=dbref) if matches: matches[0].delete() self.msg("IRC connection destroyed.")