#How To Make Bot Display Typing Analog?

1 messages · Page 1 of 1 (latest)

tender ledge
#
@commands.slash_command(
    name = "hello",
    description = "Returns a random hello message to the user",
    guild_ids = [JsonService().get_guild_id(),]
)
@commands.has_any_role("member")
async def hello(self, inter):
    await inter.response.defer(ephemeral=True)
    
    async with inter.typing():
        await asyncio.sleep(random.randint(1,5))

    random_greeting = random.choice(self.json_service.get_greetings())
    rand_greet = random_greeting.replace("{username}", "{inter.author.name}")

    return await inter.edit_original_message(f"{rand_greet}")
```I'm trying to make it look like the bot is typing when a user uses the command above, however, `inter.typing()` is what I changed `ctx.typing()` to which came from [this stackoverflow](https://stackoverflow.com/questions/51252714/how-can-i-make-discord-bots-display-the-bot-is-typing-status#:~:text=%40bot.command()%0Aasync%20def%20mycommand(ctx)%3A%0A%20%20%20%20async%20with%20ctx.typing()%3A%0A%20%20%20%20%20%20%20%20%23%20do%20expensive%20stuff%20here%0A%20%20%20%20%20%20%20%20await%20asyncio.sleep(10)%0A%20%20%20%20await%20ctx.send(%27done!%27)). My problem is that this throws an error
```console
Ignoring exception in slash command 'hello':
Traceback (most recent call last):
  File "/home/mek/Documents/GitHub/MeksHub/env/lib/python3.10/site-packages/disnake/ext/commands/slash_core.py", line 728, in invoke
    await call_param_func(self.callback, inter, self.cog, **kwargs)
  File "/home/mek/Documents/GitHub/MeksHub/env/lib/python3.10/site-packages/disnake/ext/commands/params.py", line 1083, in call_param_func
    return await maybe_coroutine(safe_call, function, **kwargs)
  File "/home/mek/Documents/GitHub/MeksHub/env/lib/python3.10/site-packages/disnake/utils.py", line 567, in maybe_coroutine
    return await value
  File "/home/mek/Documents/GitHub/MeksHub/commands/gen_commands.py", line 85, in hello
    async with inter.typing():
AttributeError: 'ApplicationCommandInteraction' object has no attribute 'typing'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/mek/Documents/GitHub/MeksHub/env/lib/python3.10/site-packages/disnake/ext/commands/interaction_bot_base.py", line 1378, in process_application_commands
    await app_command.invoke(interaction)
  File "/home/mek/Documents/GitHub/MeksHub/env/lib/python3.10/site-packages/disnake/ext/commands/slash_core.py", line 737, in invoke
    raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'ApplicationCommandInteraction' object has no attribute 'typing'
```I wasn't sure if the docs had something like this, and even if it did, I'm not sure what to search to find it. Thanks in advance.
#

nvm figured it out