From 158b729664014a409764f92b88b46e27aded903f Mon Sep 17 00:00:00 2001 From: Florian Strzelecki Date: Fri, 12 Apr 2019 11:00:35 +0200 Subject: [PATCH] bot: unregister plugin's URL callback with unregister_url_callback method --- sopel/bot.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sopel/bot.py b/sopel/bot.py index 25f499e91f..94d9f19123 100644 --- a/sopel/bot.py +++ b/sopel/bot.py @@ -279,10 +279,11 @@ def remove_plugin(self, plugin, callables, jobs, shutdowns, urls): self.unregister(func) # remove URL callback handlers - for func in urls: - regex = func.url_regex - if func == self.memory['url_callbacks'].get(regex): - del self.memory['url_callbacks'][regex] + if self.memory.contains('url_callbacks'): + for func in urls: + regex = func.url_regex + if func == self.memory['url_callbacks'].get(regex): + self.unregister_url_callback(regex) except: # noqa # TODO: consider logging? raise # re-raised