Browse Source

fixed error in script convert that broke converting due to change

tags/v2.2.0^2
Roxie Gibson 5 years ago
parent
commit
248476ce52
2 changed files with 2 additions and 4 deletions
  1. +1
    -2
      roxbot/cogs/customcommands.py
  2. +1
    -2
      roxbot/scripts/JSONtoDB.py

+ 1
- 2
roxbot/cogs/customcommands.py View File

@@ -33,12 +33,11 @@ from roxbot.db import *


class CCCommands(db.Entity):
# Sadly no way to add a custom constraint to this while we either use pony or sqlite/
name = Required(str)
output = Required(Json)
type = Required(int, py_check=lambda val: 0 <= val <= 2)
guild_id = Required(int, size=64)
composite_key(name, guild_id)
composite_key(name, guild_id, type)


class CustomCommands(commands.Cog):

+ 1
- 2
roxbot/scripts/JSONtoDB.py View File

@@ -57,13 +57,12 @@ def custom_commands_convert(guild_id, settings):
for com_type, commands in settings.items():
if com_type != "convert":
for name, command in commands.items():
com_hash = hashlib.md5(name.encode() + str(guild_id).encode() + str(com_type).encode()).hexdigest()
if isinstance(command, str):
com = [command]
else:
com = command
try:
CCCommands(name=name, hash=com_hash, output=com, type=int(com_type), guild_id=guild_id)
CCCommands(name=name, output=com, type=int(com_type), guild_id=guild_id)
db.commit()
except (TransactionIntegrityError, CacheIndexError, IntegrityError):
pass

Loading…
Cancel
Save