Click here to Skip to main content
15,844,498 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello. I'm creating a GUI for Discord Bots and I want to know why is my program crashing when the instance of Node.JS is running. What I mean by this is that when you press the button on the form to execute the server/bot, the app hangs up.

I'm using the "Process()" way to open an app/exe, and there's a property that it's called ".CreateNoWindow". So yeah. When you put this property to "False", a console window from where the server is running is shown up. And when I closed it, I managed to see the message that I programmed to show up when the bot logs in to the Discord API, which was a great message to me. But the bot wasn't online on my private server, so I decided to mess around with the configuration of the "ProcessStartInfo". But no success.

Anyways, I'll let you in the "What have you tried?" a download to the ZIP that contains my Visual Studio 2019 Solution and the files needed to start the bot so somebody on this platform can help me with this.

The contents on the folder "nodejs" should go in the "nodejs" folder located at %ProgramFiles%\nodejs\
the file "token.tkn" is really a renamed .txt file that I coded to create and modify.

Please DON'T touch the "SECRET TOKEN (CLICK ME)" button. If you do, please do Alt + F4 and nothing should happen. I just want to make the program respond when the bot is on.

What I have tried:

Solution+Bot stuff[^] <--- I'll still let it there.

VB.NET
Public Class Form1
    Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click
        Form2.Show()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        statusLabel.Text = "OK"
        statusLabel.ForeColor = Color.Lime
        Dim bot = New Process With {
 .StartInfo = New ProcessStartInfo With {
 .FileName = "node.exe", 'location of node.js exe
 .Arguments = "bot\main.js", 'location of the js file 
 .UseShellExecute = False,
 .RedirectStandardOutput = True,
 .CreateNoWindow = True
}
}
        bot.Start()

        While Not bot.StandardOutput.EndOfStream
            Dim botOutput As String = bot.StandardOutput.ReadLine()
            TextBox1.Text = botOutput
        End While
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        MsgBox("Make sure that you have Node.js installed in the default route. If not, please re-install.")
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        MsgBox("Made by joveaaron in 2021. Due to the importance of the Tokens, I'm just gonna give the source code to people with good reputation. In order to stop the token stealing. This is a completely free program. If you paid for this, contact me inmediately at joveaaron.yt@gmail.com.")
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        statusLabel.Text = "Stopped"
        statusLabel.ForeColor = Color.Red
        Dim stopbot = New Process With {
            .StartInfo = New ProcessStartInfo With {
            .FileName = "taskkill.exe",
            .Arguments = "/IM node.exe"}}
    End Sub
End Class
Posted
Updated 9-Jan-21 1:27am
v2

1 solution

Nobody is going to download a random executable and run it on their machine.

Show the code, and someone can try to answer/suggest an answer for the problem.
 
Share this answer
 
Comments
Member 15040038 9-Jan-21 6:20am    
Sir, it's not a random executable. Inside there's my solution to the program (VS2019 Solution)
Member 15040038 9-Jan-21 6:21am    
Well, nobody no, because Mediafire reports 2 downloads.
Richard MacCutchan 9-Jan-21 8:03am    
So you have made two people's lives easier by letting them have all your code. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900