Skip to main content

A plugin to help with saving variables for Discord bots

Project description

Discord Variables Plugin

A plugin to help with saving variables for bots

Instalation:

  • Windows: pip install discord_variables_plugins
  • Linux: pip3 install discord_variables_plugins

Documentation:

Server Specific Variables:

  • Import package, and create discord_variables_plugin.ServerVariables object:
import discord_variables_plugin
serverVars = discord_variables_plugin.ServerVariables()
  • To set a server specific variable
# Pass a discord.Guild object for guild
# Pass a string for varName
# Pass any object for value
serverVars.set(guild, varName, value)
  • To get a server specific variable
# Pass a discord.Guild object for guild
# Pass a string for varName
# Returns the object stored in varName of guild
varNameValue = serverVars.get(guild, varName)
  • To clear a saved server
# Pass a discord.Guild object for guild
serverVars.clearServer(guild)
  • To remove a variable of a server
# Pass a discord.Guild object for guild
# Pass a string for varName
serverVars.removeVar(guild, varName)
  • To save the server variables
# Pass a file path as fp
serverVars.save(fp)
  • To load the server variables
# Pass a file path as fp
serverVars.load(fp)

Global User Variables:

  • Import package, and create discord_variables_plugin.GlobalUserVariables object:
import discord_variables_plugin
userVars = discord_variables_plugin.GlobalUserVariables()
  • To set a global user variable
# Pass a discord.User object for user
# Pass a string for varName
# Pass any object for value
userVars.set(user, varName, value)
  • To get a global user variable
# Pass a discord.User object for user
# Pass a string for varName
# Returns the object stored in varName of user
varNameValue = userVars.get(user, varName)
  • To clear a saved user
# Pass a discord.User object for user
userVars.clearUser(user)
  • To remove a variable of a user
# Pass a discord.User object for user
# Pass a string for varName
userVars.removeVar(user, varName)
  • To save the global user variables
# Pass a file path as fp
userVars.save(fp)
  • To load the global user variables
# Pass a file path as fp
userVars.load(fp)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

discord_variables_plugin-1.2-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file discord_variables_plugin-1.2-py3-none-any.whl.

File metadata

  • Download URL: discord_variables_plugin-1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for discord_variables_plugin-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 77fca17b139139c7a968f2c79b4d5965afb932d39396e0d69c53471212bc39ad
MD5 78db73b99aef4ac22e2d635605f2ab6e
BLAKE2b-256 cdb02190819ed4ba5e0cd0bc890d27bea361ceb732721e61c9c73a6a7706a98a

See more details on using hashes here.

Supported by

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