Hot Summer Deals are Here!
Celebrate with up to 99% off on 17,300 resources
03
Days
00
Hours
19
Mins
24
Secs

Discord Bot Help

Status
This thread has been locked.

Swift.

Experienced Manager | Developer
Banned
Feedback score
38
Posts
1,448
Reactions
255
Resources
0
So i put a panel online and tried to upload my discord bot and I got this error

Using custom discord bot egg

Code:
[Pterodactyl Daemon] Server marked as ON
/home/container/ac.js:11
client.on("ready", async () => {
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
[Pterodactyl Daemon] Server marked as OFF
[Pterodactyl Daemon] ---------- Detected server process in a crashed state! ----------
[Pterodactyl Daemon] Exit Code: 1
[Pterodactyl Daemon] Out of Memory: false
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Swift.

Experienced Manager | Developer
Banned
Feedback score
38
Posts
1,448
Reactions
255
Resources
0
Banned forever. Reason: Scamming (https://builtbybit.com/threads/swift-scam-report.441763/)

Medi

Bot Developer
Premium
Feedback score
27
Posts
393
Reactions
171
Resources
1
That’s the entire thing
Hes referring to the ready event in the bots' code.[DOUBLEPOST=1538991187][/DOUBLEPOST]
Hes referring to the ready event in the bots' code.
If you open the index.js or the main js file for the bot and look for the onReady event, Just copy or screenshot the snipet of code and paste it back here.
 

Swift.

Experienced Manager | Developer
Banned
Feedback score
38
Posts
1,448
Reactions
255
Resources
0
Hes referring to the ready event in the bots' code.[DOUBLEPOST=1538991187][/DOUBLEPOST]
If you open the index.js or the main js file for the bot and look for the onReady event, Just copy or screenshot the snipet of code and paste it back here.
I don't mean the stack-trace I mean the "ready" event code from /home/container/ac.js which should be around line 11 or so.
Oh here sorry,

const Discord = require('discord.js')
const client = new Discord.Client()
const chalk = require('chalk')
const fs = require('fs')

const config = require('./config.json')
const package = require('./package.json')

const bot = new Discord.Client({disableEveryone: true})

client.on("ready", async () => {
console.log(chalk.blue('Connecting to Discord API.'))
console.log(chalk.green(''))
console.log(chalk.blue('Succesfully Connected to Discord API.'))
console.log(chalk.green(''))
console.log(chalk.blue('Getting Bot Token .'))
console.log(chalk.green(''))
console.log(chalk.blue('Succesfully Recivied Token.'))
console.log(chalk.green(''))
console.log(chalk.blue('Bot is starting.'))
console.log(chalk.green(''))
console.log(chalk.blue('Loading Commands.'))
console.log(chalk.green(''))
console.log(chalk.blue('Loading Tickets.'))
console.log(chalk.green(''))
console.log(chalk.blue('Loading Modules.'))
console.log(chalk.green(''))
console.log(chalk.blue('Loading Defaults.'))
console.log(chalk.green(''))
console.log(chalk.blue('Bot has succesfully started!'))
console.log(chalk.green(''))
console.log(chalk.red('Info: \nName: ' + client.user.username + '#' + client.user.discriminator + '\nGuilds: ' + client.guilds.size + '\nMembers: ' + client.users.size))

client.config = config;
client.fs = fs;
client.package = package;
client.user.setActivity("Made by Swift#1293")
});
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/swift-scam-report.441763/)

tiehm

Developer
Supreme
Feedback score
7
Posts
688
Reactions
455
Resources
0
I re-formatted your code and changed a few things as-well fixed your original issue (you forgot to put the }); in the right place)
https://hastebin.com/tominumuhi.js
You introduced another issue, you can not set the activity before the ready event.
So i put a panel online and tried to upload my discord bot and I got this error

Using custom discord bot egg

Code:
[Pterodactyl Daemon] Server marked as ON
/home/container/ac.js:11
client.on("ready", async () => {
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
[Pterodactyl Daemon] Server marked as OFF
[Pterodactyl Daemon] ---------- Detected server process in a crashed state! ----------
[Pterodactyl Daemon] Exit Code: 1
[Pterodactyl Daemon] Out of Memory: false
May I ask for your NodeJS version?
 

tiehm

Developer
Supreme
Feedback score
7
Posts
688
Reactions
455
Resources
0
I fixed the error *he* was getting, Sure it would produce another error but I mean it isn't hard to move a bit of code. He also never even called a Client#login() so it wouldn't work either way.
I would guess that they excluded the login due to the token. Why would you ever want to help someone and introduce another bug which wasn't there before? I also actually think that your solution will not work and that this is an issue due to the "async" keyword (as the user might be using a Node version below 7.x).
 

para

Premium
Feedback score
8
Posts
102
Reactions
97
Resources
0
I would guess that they excluded the login due to the token. Why would you ever want to help someone and introduce another bug which wasn't there before? I also actually think that your solution will not work and that this is an issue due to the "async" keyword (as the user might be using a Node version below 7.x).
He fixed the error that OP asked for, not give him a lesson on basic JavaScript. OP can place the ClientUser#setActivity() code in the ready event to fix the issue either way.
 

tiehm

Developer
Supreme
Feedback score
7
Posts
688
Reactions
455
Resources
0
He fixed the error that OP asked for, not give him a lesson on basic JavaScript. OP can place the ClientUser#setActivity() code in the ready event to fix the issue either way.
As I said, the error is likely related to the Node JS version installed AND NOT the code the user posted (oh well, it is related to it, but the "solution" would not fix this particular error)
 

tiehm

Developer
Supreme
Feedback score
7
Posts
688
Reactions
455
Resources
0
Read the damn stack-trace and MAYBE you would actually know what the issue was? I use async there all the time and it works fine for me so don't tell me that, The stack-trace specifically said "SyntaxError: Unexpected token (" and my Visual Studio Code showed me that problem right away when I pasted the code into a JS file. Also ty para glad some people can realize what I was trying to do.
I've pasted the exact the same code into my IDE and I do not get any error. The error is the async keyword.
 

para

Premium
Feedback score
8
Posts
102
Reactions
97
Resources
0
I've pasted the exact the same code into my IDE and I do not get any error. The error is the async keyword.
How hard is it to understand basic english jfc

the issue that was displayed IN THE ERROR was a typo, in this case missing brackets. roob sent a fix for the issue that WAS PROVIDED. no need to come with maybe-scenarios, he did what OP asked him for. If OP responds with their node version, feel free to help them if you want.
 

tiehm

Developer
Supreme
Feedback score
7
Posts
688
Reactions
455
Resources
0
How hard is it to understand basic english jfc

the issue that was displayed IN THE ERROR was a typo, in this case missing brackets. roob sent a fix for the issue that WAS PROVIDED. no need to come with maybe-scenarios, he did what OP asked him for. If OP responds with their node version, feel free to help them if you want.
Copied the exact code of the OP and ran it. Without any issue. Why? Because my system is on Node version 10.x
8cd14052-9164-42b5-ae4a-112cb0faae51.png


A syntax error is not always connected to missing brackets or similar.
 

imagamer

Feedback score
0
Posts
65
Reactions
17
Resources
0
Copied the exact code of the OP and ran it. Without any issue. Why? Because my system is on Node version 10.x
8cd14052-9164-42b5-ae4a-112cb0faae51.png


A syntax error is not always connected to missing brackets or similar.

Off topic but that's a beautiful IDE. What is it?
 

AegisBlue

Python Developer
Supreme
Feedback score
10
Posts
427
Reactions
151
Resources
0
Status
This thread has been locked.
Top