Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mahedizaber51/looping-status-and-activity-task-discord.py
Create a looping status task for your discord.py or disnake or pycord bot. All types of status types included.
https://github.com/mahedizaber51/looping-status-and-activity-task-discord.py
discord discord-bot discord-py discordpy disnake disnake-bot disnake-bots disnake-template pycord pycord-bot
Last synced: 1 day ago
JSON representation
Create a looping status task for your discord.py or disnake or pycord bot. All types of status types included.
- Host: GitHub
- URL: https://github.com/mahedizaber51/looping-status-and-activity-task-discord.py
- Owner: MahediZaber51
- Created: 2022-02-11T15:56:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-04T14:00:22.000Z (about 1 year ago)
- Last Synced: 2023-11-05T14:36:11.005Z (about 1 year ago)
- Topics: discord, discord-bot, discord-py, discordpy, disnake, disnake-bot, disnake-bots, disnake-template, pycord, pycord-bot
- Language: Python
- Homepage: https://zealtyro.com
- Size: 24.4 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Looping-Status-Task-Discord.py
Create a looping status task for your discord.py or all other forks of discord.py such as disnake, pycord, etc bot. All types of status types included.
**[Click Here to Learn How you can host your Discord Bots 24/7 Online for free of cost](https://www.zealtyro.com/how-to-host-a-python-or-node-js-app-24-7-online-for-free/)****Monitor Uptime and Create Status Pages of your Websites, Bots, Domains status for free at:**
https://uptime.zealtyro.com/# Step 1 - Getting Started
First of all setup the basic bot. Additionally you can check the example.py [if you are using other forks of discord.py then just change the `discord` text from all the over the codes into that fork's name]Also make sure to import these:
```py
import discord
import asyncio
from discord.ext import tasks, commands
from discord.ext.commands import Bot
from discord.ext.commands import Context
```
# Step 2 - Setting Up The Task
First of all in bot event: `on_ready` include a new line ```status_task.start()```,
[if you noy added then add:
```py
@bot.event()
async def on_ready():
status_task.start() #to start the looping task
```
then we need to setup the task. now after that add this structure:
```py
@tasks.loop()
async def status_task() -> None:
#put the upcoming codes here
```
Now let's complete the code:
```py
await bot.change_presence(status=STATUS-HERE, activity=ACTIVITY-HERE)
await asyncio.sleep(TIME)
```
This is the main format and by adding this multiple times you will be able to create a looping task. We just need to change the `STATUS-HERE` and `ACTIVITY-HERE` text to set a status with custom activity.
Here's the list of all available Statuses:
```py
discord.Status.dnd #To set status to DND
discord.Status.idle #To set status to Idle
discord.Status.online #To set status to Online
```
Here's The List of all Available Activity Types:
```py
#streaming Activity.
discord.Streaming(name="stream name", url="stream url")# Gaming Activity.
discord.Game("Name of the Game")#listening Activity
discord.Activity(type=discord.ActivityType.listening, name="name of the music")#watching Activity
discord.Activity(type=discord.ActivityType.watching, name="name of the movie")
```
Check the `example.py` for understanding the codes better. Thanks# Useful Links
**[MY WEBSITE](https://zealtyro.com)****[YOUTUBE CHANNEL](https://youtube.com/ZealTyro)**