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
+1 -1
View File
@@ -42,7 +42,7 @@ class Tyrbot:
self.last_timer_event = 0 self.last_timer_event = 0
self.start_time = int(time.time()) self.start_time = int(time.time())
self.major_version = "IGNCore v2.6" self.major_version = "IGNCore v2.6"
self.minor_version = "1" self.minor_version = "2"
self.incoming_queue = FifoQueue() self.incoming_queue = FifoQueue()
self.mass_message_queue = None self.mass_message_queue = None
self.conns = DictObject() self.conns = DictObject()
+17
View File
@@ -207,6 +207,23 @@ class AllianceRelay:
return f"Successfully changed the symbol for relaying messages to " \ return f"Successfully changed the symbol for relaying messages to " \
f"<highlight>{self.character_service.get_char_name(int(bot))}</highlight>: <highlight>{prefix}</highlight>" 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", @command(command="mrelay",
params=[Const("status"), Character("relaybot_name"), Options(["on", "off", "true", "false"])], params=[Const("status"), Character("relaybot_name"), Options(["on", "off", "true", "false"])],
access_level="admin", access_level="admin",
+2 -1
View File
@@ -83,7 +83,8 @@ class TrackController(BaseModule):
@event(event_type="buddy_logoff", description="Fire tracker events", is_hidden=True) @event(event_type="buddy_logoff", description="Fire tracker events", is_hidden=True)
def track_fire_logoff(self, _1, event_data): def track_fire_logoff(self, _1, event_data):
if "track" in self.buddy_service.get_buddy(event_data.char_id)["types"]: 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=?", self.event_service.fire_event("track_logoff", self.db.query_single("SELECT * from player where char_id=?",
[event_data.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()]) self.db.exec("DELETE FROM online where char_id=? and bot=?", [event_data.char_id, self.bot.get_char_id()])