Skip to main content

Encode json in custom_ids.

Project description

Persistence

PyPI - Downloads

An extension for interactions.py that dynamically places and returns objects in and from Discord's custom_ids so you don't have to. Check the wiki to learn how to use it!

How it works

The most popular interactions.py extension, Wait-For is an easy and effective way to simplify complex component chains by preserving the objects used during interaction. However, this means that any components created before the bot restarts become unresponsive. This could be solved by saving all previous needed interaction details to the disk, but that may not be an ideal solution for everyone. Luckily, there is another option.

The solution

The solution, originally conceived and executed by Toricane, was to place information in Discord's custom_ids. In the vanilla library, this requires some on_component or on_modal logic. Enhanced simplifies this by adding startswith and regex args to the bot.component and bot.modal decorators. However, even this is more complicated than necessary.

Further abstraction

Interactions-Persistence further simplifies placing objects in custom_ids using the json and allowing str, int, float, dict and list. The extension also encrypts custom_ids so it isn't obvious what they are doing. Using this ext is not only incredibly simple, but also reliable and lightweight. Taking a similar approach to Enhanced, Persistence uses on_component and on_modal listeners to identify and properly call persistent decorators.

Enjoy!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

interactions-persistence-2.2.3.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

interactions_persistence-2.2.3-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file interactions-persistence-2.2.3.tar.gz.

File metadata

  • Download URL: interactions-persistence-2.2.3.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for interactions-persistence-2.2.3.tar.gz
Algorithm Hash digest
SHA256 f8ab47de49fe5bc75cbf508853fad579f888c5011751bb51a4763c704a701f63
MD5 be93c2b2d57f3832dd4cdf17089539d8
BLAKE2b-256 24bc68a0c0f5634310c0085f20cb112b18ad92482a4e3fc4dcfd60aee3362251

See more details on using hashes here.

File details

Details for the file interactions_persistence-2.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for interactions_persistence-2.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3ae43d0dbd1bf1bd0a1bec4e72325f27a7989eb0ccfb1838f8f87cfc36919187
MD5 dd979b188649e130dd6e10bc315f92b6
BLAKE2b-256 c948cea54a259c57382339632d4f87dbd0dc068e1f0c93b542dfa6b631e72ed0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page