5
votes

comment changer l'activité du bot discord.py

cela peut être difficile pour moi, mais je crois à la puissance de stackoverflow,

Je veux changer le statut du bot de lecture à regarder. J'essaye ceci mais il joue toujours le statut.

code:

import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio

PREFIX = ("$")
bot = commands.Bot(command_prefix=PREFIX, description='Hi')

@bot.event
async def on_ready():
    activity = discord.Game(name="Netflix", type=3)
    await bot.change_presence(status=discord.Status.idle, activity=activity)
    print("Bot is ready!")

bot.run('TOKEN')


0 commentaires

4 Réponses :


0
votes

Selon ce problème , l'argument de mot-clé de jeu dans Client.change_presence a été renommé activité afin que votre code ressemble à

activity = discord.Game(name="Just")
await client.change_presence(status=discord.Status.idle, activity=activity)


0 commentaires

1
votes

Le bot peut toujours Playing X ou à Streaming Y , mais PAS un statut personnalisé

https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.change_presence


0 commentaires

28
votes

Vous pouvez utiliser ce Ezz!
# Setting `Playing ` status
await bot.change_presence(activity=discord.Game(name="a game"))

# Setting `Streaming ` status
await bot.change_presence(activity=discord.Streaming(name="My Stream", url=my_twitch_url))

# Setting `Listening ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))

# Setting `Watching ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))


0 commentaires

0
votes
import discord
from discord.ext import commands
import datetime

from urllib import parse, request
import re

bot = commands.Bot(command_prefix='prefix here', description="desc here")

@bot.event
async def on_ready():
    await bot.change_presence(activity=discord.Streaming(name="to keep it a secret", url="http://www.twitch.tv/dheeran2010"))
    print('Im Ready')


bot.run('Token here')

1 commentaires

veuillez corriger le formatage et expliquer comment cela répond à la question