# Copyright 2026 Logan Fick # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Quotes module for Owlbot. Allows moderators to store quotes and anyone to recall random quotes. """ from owlbot.api import ModuleContext, on_setup, on_teardown # Re-export decorated handlers so the module loader discovers them. from .commands import ( addquote_command, deletequote_command, listquotes_command, quote_command, ) from .manager import QuoteManager from .repository import QuoteRepository from .routes import quotes_list_page __all__ = [ "addquote_command", "deletequote_command", "listquotes_command", "quote_command", "quotes_list_page", "setup", "teardown", ] @on_setup async def setup(ctx: ModuleContext) -> None: """Initialize the quotes module. Creates the database schema and instantiates the QuoteManager. :param ctx: Module context with config, storage, and other services. """ repo = QuoteRepository(ctx.storage) await repo.setup() manager = QuoteManager(ctx, repo) ctx.state["manager"] = manager @on_teardown async def teardown(ctx: ModuleContext) -> None: """Clean up the quotes module. :param ctx: Module context. """ ctx.state["manager"] = None