[Discord Bot Deployed Fail] Promote fail

Question:
I’m trying to deploy my Discord bot to be online 24/7. However, it keeps failing without any error message. I’m wondering if the issue could be ‘domain not found.’(See Picture 1)

Deploy Setting
Deployment Type: Reverse VM(0.5 vCPU / 2 GiB RAM)

Repl link:
https://replit.com/@timochien/LineRangersBot
(I have already hidden my Discord bot token. So you will only see the code like below)

try:
    client.run()
except KeyError:
    print("Bot is not running")

Screenshots:

Hi @timochien , welcome to the forums!
The website isn’t showing because the app failed to promote. Moreover, even if you deployed successfully, there would be nothing on the website since your repl is a bot, not a site.
Could you also share the logs of the program?

1 Like

Hi. Thank for your reply. Here is the log. It’s show nothing…
截圖 2024-01-19 下午7.08.57

Are you using Background worker or Web server for the Reserved VM?

I am using Background worker

Hi @timochien !
I see what the problem is. You should deploy your bot as Autoscale since you do have a Flask server running.
Autoscale turns the repl on when there are incoming requests and off when not receiving any requests.
Hope this helps!

It said check the log. But Logs Tab says “no log yet…”
Setting:
Autoscale(1 vCPU / 2 GiB RAM / 3 Max)

That is indeed odd. Maybe @SuzyAtReplit can help and take a look (sorry to ping you).

1 Like

No worries at all @NateDhaliwal.
It’s actually on my radar for next week. I did do some initial investigation but nothing stands out. I have my own simpler yet similar version of @timochien’s bot which deploys fine as Reserved VM Background Worker so I need to take a closer look next week at what’s different. It is quite odd that we get no logs from this (and I didn’t either when I tested).
I’ll let you guys know what we find out!

2 Likes

So what I need to do now is just waiting?

@timochien I will need to engage my team to assist in troubleshooting, but I wouldn’t mind your help in testing as well.

If you make a simple Discord bot, like this one here, does it deploy without issue?
https://docs.replit.com/tutorials/nodejs/build-basic-discord-bot-nodejs
Note you may need to update the “intents” section as the template is a little outdated.

If this simple bot deploys fine with Reserved VM - Background Worker, then you can move on to testing your own code to see what the differences are. You can make a copy of your code and gradually remove the differences. This would help us isolate which piece of your code may be causing the deployment error.

In the meantime, I’ll let you know what I’m able to find out with the team, but it may take some time and I wanted to give you some actionable troubleshooting ideas.

1 Like

I’ve made a simple bot. Code below:

import discord
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)

@client.event
async def on_ready():
    print('Login:', client.user)

@client.event
async def on_message(message): #a command that can repeat message.
    if message.content.startswith("[echo") and len(message.content.split())>=2:
        x = ""
        for i in range(1,len(message.content.split())):
            x += message.content.split()[i]+" "
        f = open("echo.txt","a") #Write the echo message into a txt file
        f.write(x+"\n")
        f.close()
        await message.delete()
        await message.channel.send(x)

client.run(TOKEN)
"#WarmyCatBot"

It deployed successfully. And work fine in Discord Server. But it can not write the text into the file echo.txt. Is there any solutions to slove this problem?

Not right now. Deployments don’t have persistent filesystems.

Staff have said that they are working on a solution, though.

2 Likes