fix for !track & !mrelay abbrv

This commit is contained in:
2021-08-28 21:24:52 +02:00
parent aa2aac94d9
commit a4acc5d162
3 changed files with 23 additions and 5 deletions
+17
View File
@@ -207,6 +207,23 @@ class AllianceRelay:
return f"Successfully changed the symbol for relaying messages to " \
f"<highlight>{self.character_service.get_char_name(int(bot))}</highlight>: <highlight>{prefix}</highlight>"
@command(command="mrelay",
params=[Const("abbrv"), Character("relaybot_name"), Any("Abbreviation")],
access_level="admin",
description="Change the abbreviation setting of the relays")
def mrelay_abbrv(self, request, _, bot, abbreviation):
bots: dict = self.relay_bots().get_value()
if not bot.char_id:
return f"The character <highlight>{bot.name}</highlight> does not exist."
if str(bot.char_id) not in bots.keys():
return f"There's no relay for <highlight>{bot.name}</highlight> registered. Please use <symbol>mrelay create {bot.name}"
bot = str(bot.char_id)
current = self.relay_guild_abbreviations().get_value()
current[bot] = abbreviation
self.relay_guild_abbreviations().set_value(current)
return f"Successfully changed the Abbreviation for relaying messages to " \
f"<highlight>{self.character_service.get_char_name(int(bot))}</highlight>: <highlight>{abbreviation}</highlight>"
@command(command="mrelay",
params=[Const("status"), Character("relaybot_name"), Options(["on", "off", "true", "false"])],
access_level="admin",
+5 -4
View File
@@ -83,10 +83,11 @@ class TrackController(BaseModule):
@event(event_type="buddy_logoff", description="Fire tracker events", is_hidden=True)
def track_fire_logoff(self, _1, event_data):
if "track" in self.buddy_service.get_buddy(event_data.char_id)["types"]:
self.event_service.fire_event("track_logoff", self.db.query_single("SELECT * from player where char_id=?",
[event_data.char_id]))
self.db.exec("DELETE FROM online where char_id=? and bot=?", [event_data.char_id, self.bot.get_char_id()])
if buddy := self.buddy_service.get_buddy(event_data.char_id):
if "track" in buddy["types"]:
self.event_service.fire_event("track_logoff", self.db.query_single("SELECT * from player where char_id=?",
[event_data.char_id]))
self.db.exec("DELETE FROM online where char_id=? and bot=?", [event_data.char_id, self.bot.get_char_id()])
@event(event_type="track_logon", description="Fire tracker events", is_hidden=True)
def track_logon(self, _1, user):