diff --git a/src/bot/discord/commands/pathfinder_aon.py b/src/bot/discord/commands/aon.py similarity index 91% rename from src/bot/discord/commands/pathfinder_aon.py rename to src/bot/discord/commands/aon.py index 3e8cce7..575cdc8 100644 --- a/src/bot/discord/commands/pathfinder_aon.py +++ b/src/bot/discord/commands/aon.py @@ -1,10 +1,13 @@ +""" + Pathfinder Archive of Nethys (AON) commands. +""" import datetime import disnake import re from disnake.ext import commands -from src.knowledge.pathfinder_archive_of_nethys import PathfinderArchiveOfNethysClient +from src.knowledge.pathfinder.archive_of_nethys import ArchiveOfNethysClient async def pathfinder_aon_lookup_autocomplete( @@ -13,7 +16,7 @@ async def pathfinder_aon_lookup_autocomplete( """ Autocompletes pathfinder archive of nethys queries. """ - async with PathfinderArchiveOfNethysClient() as aon_client: + async with ArchiveOfNethysClient() as aon_client: if user_input == "": return [ "(archetype-182) Zombie", @@ -59,7 +62,7 @@ class PathfinderArchiveOfNethysCog(commands.Cog): """ Looks up a page on Archive of Nethys. """ - async with PathfinderArchiveOfNethysClient() as aon_client: + async with ArchiveOfNethysClient() as aon_client: match = re.match(self._id_regex, query) if match: data = await aon_client.search_page_by_id(document_id=match.groups()[0]) diff --git a/src/bot/discord/commands/dice.py b/src/bot/discord/commands/dice.py index 7422ac8..163cf6c 100644 --- a/src/bot/discord/commands/dice.py +++ b/src/bot/discord/commands/dice.py @@ -1,3 +1,6 @@ +""" + Dice commands. +""" import typing from datetime import datetime diff --git a/src/bot/discord/commands/pathfinder_wiki.py b/src/bot/discord/commands/pathfinder_wiki.py index 3fc1db8..1089316 100644 --- a/src/bot/discord/commands/pathfinder_wiki.py +++ b/src/bot/discord/commands/pathfinder_wiki.py @@ -1,7 +1,10 @@ +""" + Pathfinder Wiki commands. +""" import disnake from disnake.ext import commands -from src.knowledge.pathfinder_wiki import PathfinderWikiClient +from src.knowledge.pathfinder.wiki import PathfinderWikiClient async def pathfinder_wiki_lookup_autocomplete( diff --git a/src/knowledge/pathfinder/__init__.py b/src/knowledge/pathfinder/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/knowledge/pathfinder_archive_of_nethys.py b/src/knowledge/pathfinder/archive_of_nethys.py similarity index 91% rename from src/knowledge/pathfinder_archive_of_nethys.py rename to src/knowledge/pathfinder/archive_of_nethys.py index 8be0836..4156240 100644 --- a/src/knowledge/pathfinder_archive_of_nethys.py +++ b/src/knowledge/pathfinder/archive_of_nethys.py @@ -6,7 +6,7 @@ import aiohttp @dataclasses.dataclass -class PathfinderArchiveOfNethysDocument: +class ArchiveOfNethysDocument: """ Represents an essential document for Archive of Nethys. """ @@ -17,7 +17,7 @@ class PathfinderArchiveOfNethysDocument: url: str -class PathfinderArchiveOfNethysClient: +class ArchiveOfNethysClient: """ Simple PathfinderWikiClient """ @@ -38,7 +38,7 @@ class PathfinderArchiveOfNethysClient: async def search_page_by_id( self, document_id: str - ) -> typing.Optional[PathfinderArchiveOfNethysDocument]: + ) -> typing.Optional[ArchiveOfNethysDocument]: """ Searches the Archive of Nethys by an id. :param document_id: - The document id. @@ -66,7 +66,7 @@ class PathfinderArchiveOfNethysClient: ) as response: result = await response.json() for item in result.get("hits", {}).get("hits", []): - return PathfinderArchiveOfNethysDocument( + return ArchiveOfNethysDocument( id=item.get("_id"), name=item.get("fields", {}).get("name", ["Unknown"])[0], text=item.get("fields", {}).get("text", ["Unknown"])[0], @@ -75,7 +75,7 @@ class PathfinderArchiveOfNethysClient: async def search_pages( self, query: str, size: int = 10 - ) -> list[PathfinderArchiveOfNethysDocument]: + ) -> list[ArchiveOfNethysDocument]: """ Searches the Archive of Nethys pages :param query: The search query. @@ -103,7 +103,7 @@ class PathfinderArchiveOfNethysClient: result = await response.json() for item in result.get("hits", {}).get("hits", []): found_items.append( - PathfinderArchiveOfNethysDocument( + ArchiveOfNethysDocument( id=item.get("_id"), name=item.get("fields", {}).get("name", ["Unknown"])[0], text=item.get("fields", {}).get("text", ["Unknown"])[0], @@ -124,7 +124,7 @@ class PathfinderArchiveOfNethysClient: if __name__ == "__main__": - pf = PathfinderArchiveOfNethysClient() + pf = ArchiveOfNethysClient() result = asyncio.run(pf.search_pages("zom")) print(result) for item in result: diff --git a/src/knowledge/pathfinder_wiki.py b/src/knowledge/pathfinder/wiki.py similarity index 100% rename from src/knowledge/pathfinder_wiki.py rename to src/knowledge/pathfinder/wiki.py