Check attach_files permission inside send_interactive (#6552)

Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
Kreusada 2025-05-25 22:04:35 +01:00 committed by GitHub
parent 1daf56f3d8
commit 6603cd1a86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2477,23 +2477,34 @@ class Red(
msg = await channel.send(box(page, lang=box_lang)) msg = await channel.send(box(page, lang=box_lang))
ret.append(msg) ret.append(msg)
n_remaining = len(messages) - idx n_remaining = len(messages) - idx
files_perm = (
not channel.guild or channel.permissions_for(channel.guild.me).attach_files
)
options = ("more", "file") if files_perm else ("more",)
if n_remaining > 0: if n_remaining > 0:
if n_remaining == 1: if n_remaining == 1:
if files_perm:
prompt_text = _( prompt_text = _(
"There is still one message remaining. Type {command_1} to continue" "There is still one message remaining. Type {command_1} to continue or {command_2} to upload all contents as a file."
" or {command_2} to upload all contents as a file."
) )
else: else:
prompt_text = _( prompt_text = _(
"There are still {count} messages remaining. Type {command_1} to continue" "There is still one message remaining. Type {command_1} to continue."
" or {command_2} to upload all contents as a file."
) )
else:
if files_perm:
prompt_text = _(
"There are still {count} messages remaining. Type {command_1} to continue or {command_2} to upload all contents as a file."
)
else:
prompt_text = _(
"There are still {count} messages remaining. Type {command_1} to continue."
)
query = await channel.send( query = await channel.send(
prompt_text.format(count=n_remaining, command_1="`more`", command_2="`file`") prompt_text.format(count=n_remaining, command_1="`more`", command_2="`file`")
) )
pred = MessagePredicate.lower_contained_in( pred = MessagePredicate.lower_contained_in(options, channel=channel, user=user)
("more", "file"), channel=channel, user=user
)
try: try:
resp = await self.wait_for( resp = await self.wait_for(
"message", "message",