Skip to content

Restructuring database.py #23

@Ooglely

Description

@Ooglely

While restructuring the way the pug categories were stored I also made a class for interacting with the bot's database, without needing the 20+ functions that were specific to one purpose in database.py. Having every feature that uses the database use the BotCollection class instead would look and work much better

from database import BotCollection

category_db = BotCollection("guilds", "categories")

# Get a list of pug categories
try:
  result = await category_db.find_item({"_id": interaction.guild.id})
except LookupError:
  await interaction.send(
    "There are no pug categories setup for this server.\nPlease run /pug category add to add a pug category."
  )
  return

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions