Answer the question
In order to leave comments, you need to log in
How to fix error when launching discord bot?
I'm trying to make a custom status for the bot that he plays the game:
I managed to put it on my profile, but when I try to attach it to the bot, this error flies:
Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\ah0R\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "H:\Дискорд-Пайтон\wnn3.py", line 24, in on_ready
RPC.connect()
File "C:\Users\ah0R\AppData\Local\Programs\Python\Python39\lib\site-packages\pypresence\presence.py", line 45, in connect
self.loop.run_until_complete(self.handshake())
File "C:\Users\ah0R\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 618, in run_until_complete
self._check_running()
File "C:\Users\ah0R\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 578, in _check_running
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
C:\Users\ah0R\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py:350: RuntimeWarning: coroutine 'BaseClient.handshake' was never awaited
pass
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
@bot.event
async def on_ready():
RPC = Presence("885541244867055657")
bbb = [
{
"label": "BK",
"url": "https://vk.com/ah0rbird"
},
{
"label": "Steam",
"url": "https://steamcommunity.com/id/ah0Rbird"
}
]
RPC.connect()
RPC.update(
state="✨Печенька!✨",
details="Мы все переживём✍️",
start=time(),
buttons=bbb,
large_image="ah0r",
small_image="wn",
large_text="❤️Мы все переживём❤️",
small_text="❤️Weazel News❤️"
)
Answer the question
In order to leave comments, you need to log in
You can't use pypresence for bots.
Try it:
@bot.event
async def on_ready():
# 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"))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question