Conversation
EmmmaTech
left a comment
There was a problem hiding this comment.
Looks good, here are some changes that you might wanna make
docs/Extensions/Tasks/tasks.mdx
Outdated
| With the tasks extension you can make background tasks without worrying about the asyncio hell and stuff like "what if my internet dies" and "how do I handle reconnecting" with the added benifit of alot of useful additions that are one line of code away! | ||
|
|
||
| ### Example Usage | ||
| ```py title="Example Usage" |
There was a problem hiding this comment.
I don't think the title field is needed
docs/Extensions/Tasks/tasks.mdx
Outdated
|
|
||
| If you do run this code in your terminal you should see something like this after about 15 seconds: | ||
|
|
||
| ```sh |
There was a problem hiding this comment.
The sh code block indicator is also not needed
docs/Extensions/Tasks/tasks.mdx
Outdated
| async def very_useful_task(): | ||
| print('doing very useful stuff.') | ||
|
|
||
| bot.run(your token) |
There was a problem hiding this comment.
Maybe replace the your token text with "TOKEN"
| # ... | ||
| ``` | ||
|
|
||
| ## [Tasks](https://docs.pycord.dev/en/master/ext/tasks/index.html) |
There was a problem hiding this comment.
Add an extra newline after this line.
There was a problem hiding this comment.
Will be fixed with formatting
|
|
||
| These attributes serve as a really powerful asset to get info about your loop. | ||
|
|
||
| ### Example |
There was a problem hiding this comment.
Add an extra newline after this line.
docs/Extensions/Tasks/tasks.mdx
Outdated
| ``` | ||
|
|
||
| For a more usful example here's a task in a cog context ripped straight from the [docs](https://docs.pycord.dev/en/master/ext/tasks/index.html#recepies): | ||
| ```py title="Cog Example" |
There was a problem hiding this comment.
I don't think the title field is needed
docs/Extensions/Tasks/tasks.mdx
Outdated
| Now let's create a cog that handles a leaderboard we have in our bot using Tasks then explain what we did after that and also provide a refresher of how slash commands groups work in cogs. | ||
|
|
||
| For the sake of this example let's pretend that we have a leaderboard module that does all the leaderboard handling for us and that computing the leaderboard is very expensive computationally wise so we want to store one version of it that gets regularly updated insetad of generating it every time someone calls the `/leaderboard view` command. | ||
| ```py title="Using Tasks" |
There was a problem hiding this comment.
I don't think the title field is needed
|
@emretech @BruceCodesGithub how's this |
No description provided.