Nexus
Nexus

Reputation: 23

Is it possible to create a constantly updating progress bar for commands? [Discord.py]

I have a particularly large and resource-intensive command that takes a while to actually output anything. I was wondering if it were possible to create an ASCII progress bar that is constantly edited by the bot to indicate progress, perhaps similar to this:enter image description here

Could this be possible, and how?

Upvotes: 1

Views: 597

Answers (1)

AX-11
AX-11

Reputation: 51

You can call .edit() on a message to change its contents.

progress_bar = await some_channel.send('=>..')
# after some things finish
await progress_bar.edit(content = '==>.')
# after some more things finish
await progress_bar.edit(content = '===>')

Calling .send() will return a message object that can be manipulated with any of the message methods.

relevant stack overflow post about editing message.

Upvotes: 1

Related Questions