get rid of the MessageDistributor module... & update discord, to work with API v10

Added discord commands (issue: as they're running over the event hub, they're processed on the same track as other events. => activity ingame triggers the next run; otherwise there's some delay for responses)
relay is a standard module now.
This commit is contained in:
2022-04-15 17:05:30 +02:00
parent fd84d82af2
commit a3a26f2ba4
32 changed files with 1036 additions and 729 deletions
+12 -3
View File
@@ -3,13 +3,14 @@ import time
from core.chat_blob import ChatBlob
from core.command_alias_service import CommandAliasService
from core.command_param_types import Any
from core.decorators import instance, command, event
from core.decorators import instance, command, event, setting
from core.dict_object import DictObject
from core.igncore import IgnCore
from core.job_scheduler import JobScheduler
from core.logger import Logger
from core.message_hub_service import MessageHubService
from core.setting_service import SettingService
from core.setting_types import BooleanSettingType
from core.setting_types import BooleanSettingType, TextSettingType
from core.text import Text
from core.util import Util
from modules.standard.datanet.ws_controller import WebsocketRelayController
@@ -35,8 +36,11 @@ class WorldBossController:
self.command_alias_service: CommandAliasService = registry.get_instance("command_alias_service")
self.job_scheduler: JobScheduler = registry.get_instance("job_scheduler")
self.setting_service: SettingService = registry.get_instance("setting_service")
self.relay_hub: MessageHubService = registry.get_instance("message_hub_service")
def pre_start(self):
self.relay_hub.register_message_source("timers")
self.setting_service.register(self.module_name, 'timer_spam', False, BooleanSettingType(),
"should timers be spammed")
self.command_alias_service.add_alias("tara", "wb tara")
@@ -120,7 +124,7 @@ class WorldBossController:
return DictObject({'spawn': last - immortal, 'mortal': last})
def send_warn(self, msg):
self.bot.send_private_channel_message(f"[<red>WB</red>] {msg}")
self.relay_hub.send_message("timers", None, f"[<red>WB</red>] {msg}", f"[<red>WB</red>] {msg}")
def get_next_alert(self, duration):
for alert in self.alerts:
@@ -190,3 +194,8 @@ class WorldBossController:
job['id'] = job_id
return
self.jobs.append({'name': timer.name, 'id': job_id})
# @setting('alert_times', '[480 * 60, 360 * 60, 240 * 60, 120 * 60, 60 * 60, 60 * 15, 60 * 5, 60 * 3, 60 * 2, 60, 30, 15, 5, 0]', 'Worldboss timer spam messages (ETA and actual)')
# def alert_times(self):
# return TextSettingType(['[480 * 60, 360 * 60, 240 * 60, 120 * 60, 60 * 60, 60 * 15, 60 * 5, 60 * 3, 60 * 2, 60, 30, 15, 5, 0]'])