Changed the string formatter from % to f"",

Fixed a bug related to logging [log dir does not exist on master, and needs to get created on first startup]
Added !prefadmin <user> to view preferences of players, and change them
Orgrank & name will be hidden in !alts, if the character is not in an org
Page prefix & suffix are now being relayed [for example, it affects !online
Fixed !perks
Added comments regarding external API's.
This commit is contained in:
2021-08-14 02:36:20 +02:00
parent 80b5a4b577
commit 46d0ba3634
19 changed files with 104 additions and 86 deletions
+6 -7
View File
@@ -47,16 +47,15 @@ class MessageHubService:
invalid_sources = []
if len(inspect.signature(callback).parameters) != 1:
raise Exception(
"Incorrect number of arguments for handler '%s.%s()'" % (callback.__module__, callback.__name__))
f"Incorrect number of arguments for handler '{callback.__module__}.{callback.__name__}()'")
if destination in self.hub:
raise Exception("Message hub destination '%s' already subscribed" % destination)
raise Exception(f"Message hub destination '{destination}' already subscribed")
for source in default_sources:
if source not in self.sources:
self.logger.warning(
"Could not subscribe destination '%s' to source '%s' because source does not exist" % (
destination, source))
f"Could not subscribe destination '{destination}' to source '{source}' because source does not exist")
self.hub[destination] = (DictObject({"name": destination,
"callback": callback,
@@ -85,11 +84,11 @@ class MessageHubService:
def subscribe_to_source(self, destination, source):
if source not in self.sources:
raise Exception("Message hub source '%s' doeselecs not exist" % source)
raise Exception(f"Message hub source '{source}' does not exist")
obj = self.hub.get(destination, None)
if not obj:
raise Exception("Message hub destination '%s' does not exist" % destination)
raise Exception(f"Message hub destination '{destination}' does not exist")
if source not in obj.sources:
self.db.exec("DELETE FROM message_hub_subscriptions WHERE destination = ?", [destination])
@@ -105,7 +104,7 @@ class MessageHubService:
obj = self.hub.get(destination, None)
if not obj:
raise Exception("Message hub destination '%s' does not exist" % destination)
raise Exception(f"Message hub destination '{destination}' does not exist")
if source in obj.sources:
self.db.exec("DELETE FROM message_hub_subscriptions WHERE destination = ?", [destination])