#Hide Commands
1 messages · Page 1 of 1 (latest)
Hey! Once your issue is solved, press the button below to close this thread!
nope, discord limitation
the most you can do is set default_member_permissions
if you want developer commands, its best to sync those only to one guild that you own or just use prefixed commands
otherwise, you can tell owners/admins of servers to enable whatever commands they want normal people to use only in certain channels or whatever
@wispy niche On the topic of this, is it possible to limit commands to certain channels? so that they can only be used in that channel?
or does it require my own decorator/Check to be made?
Also When you use a slash command it shows you the options that you used meaning other people can see those options, anyway to also turn off?
as workaround you can do ctx.channel.send instead
yeah i used that, but then it says the application didnt response and still sends the embed after it? so wasnt sure if its bugged or not
use command > send status message > sends request to api > update status message based on request response.
thats the flow of my command if that helps, the origin message is being updated succesfully based on the status, however even when successful it says application didnt respond
because you have to ctx.send anyways
or else discord thinks the bot hasn't responded
and theres no way around that? I'd preferably just want to update the original message
you can send a private message only visible to the person that used the command
How do i do that?
ctx.send so discord knows the bot acknowledged the interaction, optionally with the ephemeral=True parameter, and then ctx.channel.send your message
I usually just put a checkmark in the ephemeral message
thanks, and you cant use the ephemeral arg in channel.send?
why would you need it?
and no because it's not responding to an interaction context (ctx)
status msg variable
on command:
ctx.send('working on it', ephemeral=True)
your code
ctx.channel.send OR status msg.edit(content='status update')
don't forget the awaits
like I did just now
I can show you an example if you need it @tulip verge
i didnt want to use ephemeral because im sure if the original/status message uses that, you can't edit ti?
i was getting this error: ERROR:root:An error occurred: HTTPException: 404|Not Found || Unknown Message
when trying to edit the status message, but because its ephemeral, the bot can't find it?
now that i think of it though, maybe thats a permission problem?
*component callback, not command
this is the initial value for the message variable
which is getting edited by the shown component callback
this is what im doing:
`embed = interactions.Embed(title=f'Doing Said Task', color=interactions.MaterialColors.BLUE)
progress_message = await ctx.send(embed=embed, ephemeral=True)
data = {'some_data': some_data}
try:
async with aiohttp.ClientSession() as session:
response = await session.delete(f'route', headers=headers, json=data)
if not response.ok:
data = await response.json()
embed_title = 'Failed to do task
fields = [
{'name': 'task1', 'value': data['task1']},
{'name': 'Reason', 'value': reason},
]
success = False
embed = create_embed_with_fields(embed_title, fields, success)
await progress_message.edit(embed=embed)
`
but when i use ephemeral i think the error is caused because the bot now doesnt have access to the status/progress message
and the bot does have admin perms
its not a permission problem
use ctx.edit(message, ...) whenever youre editing interaction stuff
still same problem, bot can't find the message when ephemeral is set to true
yeah
and i can see from the attempted request
the message its looking for is correct
the ID matches
gotcha
wait
nvm
i forgot slash content as the ctx
still doesnt work when i add it though
it works fine for me with a live test rn
i can send the full command if you want
i think full command code would be best
ive tried a number of things but i cant replicate it
sure
1 sec
`@check(interactions.has_any_role(manager_role_id, owner_role_id)) # type: ignore
@slash_command(name="commandname", description="do command", dm_permission=False, options=[interactions.SlashCommandOption(name='command_option', description='a', type=interactions.OptionType.INTEGER, required=True)])
async def commandname(ctx: SlashContext, arg_name: int):
embed = interactions.Embed(title=f'doing task', color=interactions.MaterialColors.BLUE)
progress_message = await ctx.send(embed=embed, ephemeral=True)
data = {'ping_id': ping_id}
try:
async with aiohttp.ClientSession() as session:
response = await session.delete(f'route', headers=headers, json=data)
if not response.ok:
data = await response.json()
embed_title = 'Failed to do task'
fields = [
{'name': 'Ping ID', 'value': data['ping_id']},
{'name': 'Reason', 'value': data['reason']},
]
success = False
embed = create_embed_with_fields(embed_title, fields, success)
if progress_message:
await progress_message.edit(embed=embed)
elif response.ok:
data = await response.json()
embed_title = 'task done'
fields = [
{'name': 'Ping ID', 'value': data['ping_id']},
]
success = True
embed = create_embed_with_fields(embed_title, fields, success)
await ctx.edit(progress_message, embed=embed)
except aiohttp.ClientError as error:
logging.error(f"An error occurred: {str(error)}")
await progress_message.edit(content="HTTP error occurred: An error occurred")
except Exception as error:
logging.error(f"An error occurred: {str(error)}")`
@wispy niche
this is sus
await ctx.edit(progress_message, embed=embed) and progress_message.edit both dont work
how so?
I mean that never got executed in the times ive tested it
slimed it down to this and it worked
theres a number of things wack with your current declaration of the command that are technically unrelated but still there
very importantly the difference in slash option and function parameter in yours should cause issues
but im guessing it doesnt, somehow?
i removed the whole try block and attempted to just send a message then edit it, same error, hence why i think its something to do with perms, but my bot has admin perms so im not sure
how so?
and no they dont cause issues for me, ive been using this format the past 5-6 commands
only this one which i want to be shown to user only, has caused an issue
you should be immediately be hit with an error like this due to the mismatch
oh i changed that stuff lol
right
the one i sent you is my function with diff variables and names
but yeah like i said i changed it to literally just send a message then edit it, and it doesnt work, but if i didnt have perms to edit the messages my other commands wouldnt work either, which they do
i legitimately cannot replicate this
my only theory is that your request is taking way too long
but that would have to be over 15 minutes long
i removed that block and literally had, send message, edit message
and it came back the same
which is weird, because this works flawlessly for me, and permissions dont affect it
im stumped lol
feel like pulling my hair out
this suggests somethings wrong with your setup, and im not sure what
i mean, im using embed in my example
hmm
your right
something is going wrong in my setup
i tried embed and now it works
but i dont understand then, because the response is returning okay, and within an appropriate time
and the error being logged is suggesting the message doesnt exist, 404
frankly whatevers going on i blame discord or something
ong
okay it seems to be the edit
could be my embed is bad
if i remove the edit lines in the code (still doing the request), everything works.
and progress message has the same message ID inside and outside the try block
if i change await progress_message.edit(embed=embed) to ctx.send('whatever)
it works
but editing just doesnt
well i can tell you you'll need to do ctx.edit(message) or message.edit(ctx=ctx) for it to work in the first place even in normal conditions
(they do the same thing)
okay
well
that works
so thank you veyr veyr much ily
however, how come progress_message.edit worked everywhere else but not with this command?
ephemeral messages arent normal messages, as you may assume
very strange indeed, but thank you nonetheless
they literally do not exist outside of the interaction - they dont appear to the channel at all
...and message.edit edits through the channel endpoint
ctx.edit (or passing in ctx) uses the interaction edit endpoint instead, and as said earlier, the message does exist within the interaction
for non-ephemeral messages, they also appear in the channel, so message.edit works (though has issues with some channels due to wacky slash permission stuff - ctx.edit works better then)
makes sense
(for anyone else curious: slash commands can run in channels the bot cant see. sending in that case is fine as that totally just interactions, but editing your own message using the channel endpoint means you run into a scenerio where you cant view the channel, so you have no message history, meaning you cant read the message to be edited in the first place. meanwhile the interaction path sidesteps all of that as interactions always can see and edit the messages it sends)
anyways, gonna close this unless theres anything else