Is there a differece between Replit and PyCharm when running a Discord Bot

Viewed 34

I am currently starting to ptogramm my discord bot. Yesterday it worked fine but today I runned into an error and started from scrap again, I used PyCharm. Now on PyCharm the code works fine, but if I run it on Replit I run into the following error:


    in using static token
    Traceback (most recent call last):
      File "main.py", line 20, in <module>
        client.run(token)
      File "/home/runner/ighfiiev/venv/lib/python3.8/site-packages/discord/client.py", line 828, in run
        asyncio.run(runner())
      File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/runners.py", line 44, in run
        return loop.run_until_complete(main)
      File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
        return future.result()
      File "/home/runner/ighfiiev/venv/lib/python3.8/site-packages/discord/client.py", line 817, in runner
        await self.start(token, reconnect=reconnect)
      File "/home/runner/ighfiiev/venv/lib/python3.8/site-packages/discord/client.py", line 745, in start
        await self.login(token)
      File "/home/runner/ighfiiev/venv/lib/python3.8/site-packages/discord/client.py", line 580, in login
        data = await self.http.static_login(token)
      File "/home/runner/ighfiiev/venv/lib/python3.8/site-packages/discord/http.py", line 801, in static_login
        data = await self.request(Route('GET', '/users/@me'))
      File "/home/runner/ighfiiev/venv/lib/python3.8/site-packages/discord/http.py", line 680, in reques

This is my code, I used it in PyCharm first, then copied it to Replit, after running the code the error appeared. I can't really figure out why it isn't working (on PyCharm it still does) :


    import discord
    
    token = 'here.is.my.token'
    
    intents = discord.Intents.default() 
    intents.members = True # If you ticked the SERVER MEMBERS INTENT
    client = discord.Client(intents=intents)
    
    @client.event
    async def on_ready():
        print(f'bot has logged in as {client.user}')
    
    @client.event
    async def on_message(msg):
        if msg.author == client.user:
            return
        if msg.content.startswith('$hello'):
            await msg.channel.send('Hello!')
    
    client.run(token)

0 Answers
Related