From fc68950ade75ea5dbddfbe7027354746fb9318d5 Mon Sep 17 00:00:00 2001 From: Minidodo Date: Sun, 10 Oct 2021 00:47:34 +0200 Subject: [PATCH] Fix for mrelay, and blobs. (Spotted by Luckycharmmz/VA - ty for the fixing assistance!) Orgmembers will nolonger get invited into the priv channel of their orgbot.. (on reboot only) Added Nickname to !history (only useful for !history char_id>) --- core/igncore.py | 2 +- modules/core/discord/discord_controller.py | 2 +- .../core/private_channel/private_channel_controller.py | 6 ++++-- modules/orgbot/alliance/alliance_relay.py | 1 + modules/orgbot/org/org_roster_controller.py | 10 +++++++++- modules/raidbot/tower/tower_attack_controller.py | 7 ++++--- modules/standard/poll/poll_controller.py | 2 +- modules/standard/whois/character_history_controller.py | 4 ++-- 8 files changed, 23 insertions(+), 11 deletions(-) diff --git a/core/igncore.py b/core/igncore.py index f133896..72f4210 100644 --- a/core/igncore.py +++ b/core/igncore.py @@ -42,7 +42,7 @@ class IgnCore: self.last_timer_event = 0 self.start_time = int(time.time()) self.major_version = "IGNCore v2.6" - self.minor_version = "5" + self.minor_version = "6" self.incoming_queue = FifoQueue() self.mass_message_queue = None self.conns = DictObject() diff --git a/modules/core/discord/discord_controller.py b/modules/core/discord/discord_controller.py index 9c27735..99bd550 100644 --- a/modules/core/discord/discord_controller.py +++ b/modules/core/discord/discord_controller.py @@ -641,7 +641,7 @@ class DiscordController: self.setting_service.set_value(out, msg.channel.id) self.send_message(msg.channel.id, Embed(color=3066993, title="Channel Guard", description=f"This channel has been " - f"subscriped to the source {out}.")) + f"subscribed to the source {out}.")) def send_message(self, channel: int, message, delete=0): if self.client.is_ready(): diff --git a/modules/core/private_channel/private_channel_controller.py b/modules/core/private_channel/private_channel_controller.py index 49a916d..fe37962 100644 --- a/modules/core/private_channel/private_channel_controller.py +++ b/modules/core/private_channel/private_channel_controller.py @@ -83,8 +83,10 @@ class PrivateChannelController: if data.packet.char_id not in self.reinvite: account = data.account if account.disabled == 1: - pass - elif account.auto_invite == 1: + return + if account.member == self.bot.public_channel_service.org_id: + return + if account.auto_invite == 1: self.reinvite.append(data.packet.char_id) return if self.private_channel_service.in_private_channel(data.packet.char_id): diff --git a/modules/orgbot/alliance/alliance_relay.py b/modules/orgbot/alliance/alliance_relay.py index 53b59ee..f695a10 100644 --- a/modules/orgbot/alliance/alliance_relay.py +++ b/modules/orgbot/alliance/alliance_relay.py @@ -333,6 +333,7 @@ class AllianceRelay: self.logger.warning("##FIX ME## No relay command set!") if message[:len(rcmd)] != rcmd: return + message = message.replace("\n", "
") message = re.match(f"{rcmd} \[(.+?)\] (.+?): (.+)", message) if not message: return diff --git a/modules/orgbot/org/org_roster_controller.py b/modules/orgbot/org/org_roster_controller.py index 93d0fbb..b225f2a 100644 --- a/modules/orgbot/org/org_roster_controller.py +++ b/modules/orgbot/org/org_roster_controller.py @@ -190,22 +190,30 @@ class OrgRosterController: @event(PublicChannelService.ORG_MSG_EVENT, "Update org roster when characters join or leave", is_hidden=True) def org_msg_event(self, _, event_data): ext_msg = event_data.extended_message + log = False if [ext_msg.category_id, ext_msg.instance_id] == self.LEFT_ORG: + log = True self.process_org_msg(ext_msg.params[0], self.MODE_REM_MANUAL, ext_msg) elif [ext_msg.category_id, ext_msg.instance_id] == self.KICKED_FROM_ORG: + log = True self.process_org_msg(ext_msg.params[1], self.MODE_REM_MANUAL, ext_msg.params[0]) elif [ext_msg.category_id, ext_msg.instance_id] == self.INVITED_TO_ORG: + log = True self.process_org_msg(ext_msg.params[1], self.MODE_ADD_MANUAL, ext_msg.params[0]) elif [ext_msg.category_id, ext_msg.instance_id] == self.KICKED_INACTIVE_FROM_ORG: + log = True self.process_org_msg(ext_msg.params[1], self.MODE_REM_MANUAL, ext_msg.params[0]) elif [ext_msg.category_id, ext_msg.instance_id] == self.KICKED_ALIGNMENT_CHANGED: + log = True self.process_org_msg(ext_msg.params[0], self.MODE_REM_MANUAL) elif [ext_msg.category_id, ext_msg.instance_id] == self.JOINED_ORG: + log = True self.process_org_msg(ext_msg.params[0], self.MODE_ADD_MANUAL) # This just writes everything to the log.... also tower messages, and so on. mainly for debugging reasons, # may change in the future. # noinspection SqlInsertValues - self.db.exec("INSERT INTO org_activity (message, time) VALUES(?, ?)", [ext_msg.get_message(), time.time()]) + if log: + self.db.exec("INSERT INTO org_activity (message, time) VALUES(?, ?)", [ext_msg.get_message(), time.time()]) def process_org_msg(self, char_name, new_mode, actee=None): char_id = self.character_service.resolve_char_to_id(char_name) diff --git a/modules/raidbot/tower/tower_attack_controller.py b/modules/raidbot/tower/tower_attack_controller.py index b6d4964..952efd6 100644 --- a/modules/raidbot/tower/tower_attack_controller.py +++ b/modules/raidbot/tower/tower_attack_controller.py @@ -191,9 +191,10 @@ class TowerAttackController: self.tower.format_site_info(row)) attacker = self.text.format_char_info(event_data.attacker) add = "" - if account := self.account_service.get_account(event_data.attacker.char_id): - if self.account_service.simple_checks(account): - add = " :: He's a Raider!" + # Disable for now... + # if account := self.account_service.get_account(event_data.attacker.char_id) and event_data.defender.org_name in self.account_service.get_org_names(): + # if self.account_service.simple_checks(account): + # add = " :: He's a Raider!" self.bot.send_private_channel_message( f"[NW] " f"<{event_data.defender.faction.lower()}>" diff --git a/modules/standard/poll/poll_controller.py b/modules/standard/poll/poll_controller.py index 03769dc..8cee6b6 100644 --- a/modules/standard/poll/poll_controller.py +++ b/modules/standard/poll/poll_controller.py @@ -168,7 +168,7 @@ class PollController: "ORDER BY finished_at, id", [event_data.account.char_id]) if data: row = data[0] - self.bot.send_private_message(event_data.char_info.char_id, self.show_poll_details_blob(row)) + self.bot.send_private_message(event_data.packet.char_id, self.show_poll_details_blob(row)) def create_scheduled_jobs_for_polls(self): data = self.db.query("SELECT * FROM poll WHERE is_finished != 1") diff --git a/modules/standard/whois/character_history_controller.py b/modules/standard/whois/character_history_controller.py index f43fdb7..3fe67d0 100644 --- a/modules/standard/whois/character_history_controller.py +++ b/modules/standard/whois/character_history_controller.py @@ -36,7 +36,7 @@ class CharacterHistoryController: else: return f"Could not find history for {char.name} " \ f"on server {server_num}." - blob = " | ".join(["Date", "Lvl", "AI", "Side", "Breed", "CharId", "Guild (Rank)"]) + "\n" + blob = " | ".join(["Date", "Lvl", "AI", "Side", "Breed", "CharId", "Name", "Guild (Rank)"]) + "\n" blob += "__________________________________________________________\n" return self.text.format_pagination(data, offset, page, self.formatter, f'History of {char.name} (RK{server_num})', @@ -54,5 +54,5 @@ class CharacterHistoryController: return "DELETED\n" return f"{last_changed} | {self.text.zfill(int(row.level), 220)} | " \ f"{self.text.zfill(int(row.defender_rank or 0), 30)} | {row.faction:^7} | " \ - f"{row.breed:^10} | {self.text.zfill(int(row.char_id or 0), int(data[0].char_id or 0))} | " \ + f"{row.breed:^10} | {self.text.zfill(int(row.char_id or 0), int(data[0].char_id or 0))} | {row.nickname:^13} | " \ f"{org}\n"