enigma.core.database package

Submodules

enigma.core.database.public module

class enigma.core.database.public.MongoClient(config, logger, bot=None, *args, **kwargs)[source]

Bases: motor_asyncio.AsyncIOMotorClient

get(entity, state)[source]

Grabs the value stored for an entity’s state.

Parameters:
  • entity – Any discord object with an id attribute
  • state – An event passed as str
Returns:

Returns the state’s value if found or returns None

increment(entity, state, value)[source]

Increments an existing state’s value.

Parameters:
  • entity – Any discord object with an id attribute
  • state – A state of type int
  • value – The value to increment the state by
upsert(entity, **states)[source]

Updates an existing state’s value. Creates a state if it does not exist. Also creates a database collection for each entity type when needed.

Parameters:
  • entity – Any discord object with an id attribute
  • states – A dict of state and possible values

Module contents