mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 03:38:53 -05:00
Allow sending the file in follow-up message in ACL upload commands (#5685)
Added follow up message when uploading acl file in permissions cog.
This commit is contained in:
parent
1fd9324171
commit
5522f909bd
@ -632,11 +632,23 @@ class Permissions(commands.Cog):
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Set rules from a YAML file and handle response to users too."""
|
"""Set rules from a YAML file and handle response to users too."""
|
||||||
if not ctx.message.attachments:
|
if not ctx.message.attachments:
|
||||||
await ctx.send(_("You must upload a file."))
|
await ctx.send(_("Supply a file with next message or type anything to cancel."))
|
||||||
return
|
try:
|
||||||
|
message = await ctx.bot.wait_for(
|
||||||
|
"message", check=MessagePredicate.same_context(ctx), timeout=30
|
||||||
|
)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
await ctx.send(_("You took too long to upload a file."))
|
||||||
|
return
|
||||||
|
if not message.attachments:
|
||||||
|
await ctx.send(_("You have cancelled the upload process."))
|
||||||
|
return
|
||||||
|
parsedfile = message.attachments[0]
|
||||||
|
else:
|
||||||
|
parsedfile = ctx.message.attachments[0]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self._yaml_set_acl(ctx.message.attachments[0], guild_id=guild_id, update=update)
|
await self._yaml_set_acl(parsedfile, guild_id=guild_id, update=update)
|
||||||
except yaml.MarkedYAMLError as e:
|
except yaml.MarkedYAMLError as e:
|
||||||
await ctx.send(_("Invalid syntax: ") + str(e))
|
await ctx.send(_("Invalid syntax: ") + str(e))
|
||||||
except SchemaError as e:
|
except SchemaError as e:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user