I set the status to idle, but it doesn't show up.
Summary
First, the status is Live (Twitch).Then try to change the status to idle using a slash command.However, it doesn't change easily.That's why I gave you a serious report that it might be a bug.
Reproduction Steps
- Start with Twitch status 2.Try to change status to idle using slash command
Minimal Reproducible Code
@client.event
async def on_ready():
await client.change_presence(activity = discord.Streaming(name=f"{Server_name}を覗いています...👀", url="https://www.twitch.tv/Nooooooo_0328"))
@tree.command(name="maintenance",description=f"{Bot_name}をメンテナンスモードに切り替えます (関係者専用)")
async def maintenance(interaction: discord.Interaction):
if interaction.user.id in adimn_User:
guild = client.get_guild(Server_id)
member = guild.get_member(Bot_id)
if member.status == discord.Status.idle:
embed=discord.Embed(
title="メンテナンスモードに切り替えが出来ませんでした。",
color=Bot_color_warning,
timestamp=interaction.created_at
)
embed.add_field(
name="エラーの原因",
value="メンテナンスモード中のため"
)
embed.set_author(name="❗ エラー")
await interaction.response.send_message(embed=embed, ephemeral=True)
return
await client.change_presence(status = discord.Status.idle, activity = discord.Activity(name="メンテナンス中...", type=discord.ActivityType.playing))
Expected Results
I thought I could do it, but I couldn't
Actual Results
There were no errors and it didn't take effect no matter how long I waited
Intents
intents = discord.Intents.default() intents.message_content = True intents.moderation = True intents.members = True intents.guilds = True intents.typing = True intents.presences = True intents.voice_states = True
System Information
- Python v3.11.1-final
- discord.py v2.2.3-final
- aiohttp v3.8.4
- system info: Windows 10 10.0.19045
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
I corrected it because it was written in Japanese.
First of all, you shouldn't be using client.change_presence() in on_ready(), because it triggers multiple times as per the docs.
Instead set the activity and status kwargs in the constructor of your client like so:
client = commands.Bot(command_prefix="!", activity=..., status=...)
You may then try to change your presence using change_presence() on your command.
Note It may take a few minutes to update the presence.
First of all, you shouldn't be using
client.change_presence(), because it triggers multiple times as per the docs.
on_ready may trigger multiple times, not client.change_presence(). If you're calling client.change_presence() in on_ready, it may trigger more than once though.
I would recommend you change the presence once the on_connect() event is triggered on the first time the bot is alive. @Nooooooo-0328
I would recommend you change the presence once the
on_connect()event is triggered on the first time the bot is alive. @Nooooooo-0328
on_connect suffers from the exact same issue as on_ready @Iqrar99