Allow updates to custom permissions
This commit is contained in:
parent
72998c8277
commit
16f91c3b47
|
@ -528,13 +528,20 @@ WHERE
|
||||||
await ctx.send("This command cannot have custom permissions setup!")
|
await ctx.send("This command cannot have custom permissions setup!")
|
||||||
return
|
return
|
||||||
|
|
||||||
await ctx.bot.db.execute(
|
try:
|
||||||
"INSERT INTO custom_permissions (guild, command, permission) VALUES ($1, $2, $3)",
|
await ctx.bot.db.execute(
|
||||||
ctx.guild.id,
|
"INSERT INTO custom_permissions (guild, command, permission) VALUES ($1, $2, $3)",
|
||||||
cmd.qualified_name,
|
ctx.guild.id,
|
||||||
perm_value
|
cmd.qualified_name,
|
||||||
)
|
perm_value
|
||||||
|
)
|
||||||
|
except UniqueViolationError:
|
||||||
|
await ctx.bot.db.execute(
|
||||||
|
"UPDATE custom_permissions SET permission = $1 WHERE guild = $2 AND command = $3",
|
||||||
|
perm_value,
|
||||||
|
ctx.guild.id,
|
||||||
|
cmd.qualified_name
|
||||||
|
)
|
||||||
ctx.bot.cache.update_custom_permission(ctx.guild, cmd, perm_value)
|
ctx.bot.cache.update_custom_permission(ctx.guild, cmd, perm_value)
|
||||||
|
|
||||||
await ctx.send("I have just added your custom permissions; "
|
await ctx.send("I have just added your custom permissions; "
|
||||||
|
|
Loading…
Reference in a new issue