#development
1 messages · Page 818 of 1
https://hasteb.in/jewenobi.js bot.js
https://hasteb.in/dunifume.js index.js
aight
o
you're not even authenticating
what's bot.js for
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
and fucking learn
hey
why does he have 2 files
what
likely because he wants to switch things up
where has it been copied
and keep the old version
i thought he was sharding
not the issue right now
there's no way you wrote all of that and you don't know how it works
like
really
maybe he just forgot
yeah
which is kind of an issue
your commands won't work yet even if you fix the login
You just have a command class that's never used atm
oh
and those files have nothing to do with each other
like
what's the point of having those
if they don't interact with each other
ik
index.js and bot.js are nothing to do with each other
yes
he just still has the old index
uh
@digital ibex bc you're not being clear
how would i set up my cmd handler then
d o c s
i can use it with eris?
yes
okay
well
that's all right
@copper cradle commando is ass
maybe he loves ass
Help
discord js requires a peer of @Discordjs/uws@10.149.0 but none is installed you must install peer dependencies yourself
But it won't let me install sqlite
well install it then
I did but that comes
details please. what are you trying to do?

Ik
I tried thing online ok
Pls bal
@earnest phoenix ik why
#265156322012561408 @open aspen
@earnest phoenix install node-gyp
Hmmm
^^^
it is required
Rip it doesn't work
That is the newest version
it should work
ah yes
Look on top
new error
gyp always throws errors for me
install node-pre-gyp then
that's not going to work
believe it or not u cant do stuff without it
but tryitandsee
i'm guessing quickdb isn't native
K
why dont people try to read the error
Rip
I have node 13
Doesn't work
nope
Wait what is the new pre ver
Or rath nodegyp ver
0.14.0
Nah
show the new error
show ur package.json
i can't see shit
I could us my old js package
how about we fix the issue 1st before upgrading things
Install SQLite3 as well I recieved that error when installing SQLite without it
u forgot a gf
her u go
y not
figured it out?
what was that ohhhh for
if someone knows a solution please tell me
i kinda need gyp too
but can't seem to install it
use glitch;)
glitch stinky
i thought pinging doesn't work anymore? like the app still sleep even after 12 hours
Oh dam I found something
@pale vesselwdym
last time i used it, it didn't go well
use glitch;)
@finite bough hell no
rn I'm using heroku
i have to compile it my self
why not
reeeeeeee
uptime
true
without uptime robot orany http request
heroku is free
5 lines of code to make ur bot have an awesome uptime doesnt hurt
I got my vps for free
uptimerobot is free
lol
^
I use it yes
on my main bot project
I got permission from glitch
to make my bot 24/7
without http or robots
seems legit
they removed that feature coz
it was getting laggy
u can still see the feature on ur project
but u cant turn it on
in project status
or condition
what's it called?
good one
Oof
is there any js client.on('messageEdited', oldMessage, newMessage => { event on ds v12?
or smth similar
it's the same
lol
when using d.js sharding are you supposed to remove client#login from the bot file?
like this?
according to djs guide yes @zealous veldt
anyone here good at obj c
lol obj c
ok
Can anyone help me with making a ticket system that involved reactions
i know but it’s the only normaal code lang for macos 10.7
Can anyone help me with making a ticket system that involved reactions
@earnest phoenix language?
Bruh
Ehh
@modern sable
@plucky jewel wrong channel
I guess he meant "look, it worked!"
@golden condor uptimerobot
No
I know that
Just how it stop restarting
I use uptimerobot
They said it as if they didn't have restart
at what point in a bot's growth is a sqlite database not recommended anymore
never
ok
HOWEVER

if you rely a lot on db-side operations then you might want to use a more complete db
I use mysql as main db and sqlite as cache db
hm
mysql yuck
but if you're using only common datatypes (text, numbers, dates, etc) then you can stay with sqlite as long as you want, it's fast af
@earnest phoenix 
😳
because mysql is developed by oracle
How does one catch this exception in python?
and oracle is well... oracle, they're idiots
try {} catch{} 😎
postgres is superior
oh wait py
I meant except ____:
try: True catch: False finally: None
what's your code
yes im so cool
Who me?
discord.HTTPException
no, super mech
Ok
try catching wastes memory, do your best to fix the problem instead
@earnest phoenix mysql has no fault that oracle's being a dick, it's a quite good db
What if a user doesn't send a url
it's outdated and slow
slow?
Set a default value
outdated??
Well, I wanted to tell the user that it was not valid.
a number of benchmarks show mysql being outperformed by postgres
postgres is also opensource
could you show me your source?
what
you can litterally look it up
btw, #memes-and-media
its pretty well regarded that Mysql is lesser than Postgres
it's development related, it doesn't need to be in off topic
^
anyways, almost every stress test between mysql and postgres shows that postgres outperforms by a mile
it is related
indeed it is
????????????
the bot is in parentheses for a reason
this is on topic for development 
its pretty much better in every way tbh
^
i've tried both
my experience with postgres vs mysql is like heaven vs hell
lmao
I'll have to try it myself, every case is a case
you'll often see postgres being used in newer indie games
because of the sheer fact it outperforms mysql in big datasets
i either use Postgres or Datomic
how do I hide my api key from github?
Or just edit it I guess
Could forget to take it out when making a new commit though
So tbf you could but you probably shouldn't
and just make life easier with a gitignore™️
Hello I am using ytdl
and my bot keeps connecting and disconnecting
With the error "undefined"
I think we'll need a bit more than just that
That's all I have
lol
MY bot just restarted and keeps doing this now all of a sudden
nobody can help you if you don't provide more info about the error, and don't provide code
^^^^
lol
Ok
My bot has an error how do I fix it??
lol
lol
I am just giving what I had to work with
@golden condor give us the command code
and the error code
we will see
That's it
I meaned the command code :p
but its the same
So what is the command you need help with?
...
play
have you heard of debugging
I'm going with cry on this 
lol
Look
This is the error
[ { id: 'Hi7Rx3En7-k',
title: 'Angèle - Balance Ton Quoi [CLIP OFFICIEL]',
url: 'https://www.youtube.com/watch?v=Hi7Rx3En7-k' } ]
undefined
"Brol la suite", inclus 7 titres inédits, écoutez-les maintenant : https://lnk.to/BrolLaSuiteYD
Instagram : http://www.instagram.com/angele_vl
Facebook : http://www.facebook.com/angeleouenpoudre
Angèle en concert : https://lnk.to/AngeleConcertsYD
Brol Shop : https://lnk.to...
@golden condor why did you do this
There is the voice channel thing too if you dont do that const
By made i'm assuming copy paste 😳
lol
Wait
A YouTube vid
Do you use Visual Studio Code to code?
User not found
I don't get the problem I have
-bots Tonkku
User not found
Following a tutorial is basically advanced copy paste ngl
Lol
code it yourself
For my joinVC and leaveVC commands i coded it myself
i've seen a youtube video, but i wanted to make it myself
I did improvise most of it
I just need help fixing my error
coding its not improvising
I dont need a solding
Btw what do you use to code?
Glitch
hmmmm
considering you don't know what debugging is I think someone needs a lil bit of learning 
did you do const Discord = require('discord.js') [probably you did]
Yes
I agree
wat?
What do you wanna see?
Although you can learn from videos, I think it is best to understand what you want to do, then problem solve, which means going through the js docs and d.js docs
What you wanna see?
I think you need to ask to another person because i dont use Glitch
go on https://anidiots.guide/
i dont know on what channel
just look here
i hope you're aware that both glitch and heroku aren't powerful enough to run a music bot
Well @earnest phoenix I think you are wrong on that one
i'm really not
but it doesnt work :p
probably because your bot is unpopular lol
This is the one error Ive had
try having more than 10 concurrent guilds and your bot is going to crash
lol
For a private bot Glitch will work fine, but if you intend to make the bot public, good luck keeping it running
That thing gonna die 
i like how people here flex with public bots hosted on glitch & heroku when having 20 guilds and a single command usage per day
now let 10 guilds stream music and your bot is going to crash
you did the users wrong
i suggest Visual Studio Code
everyone does
👍
How many people actually use the bot
just because it's in 176 servers doesn't mean people are playing music or anything
lul
But the second people are like, aww cool lets listen to some music
that's exactly why i said concurrent lol

Sometimes you gotta use easy words for the wee ones

just checked my logs, 0 commands used in the last day, yay
and 20 guilds
so average
User not found
ik
yeah you should do that in testing
im just seeing what is his bot
what is the actual error?
Ooof
Discord bot that existed before Discord..... interesting
it would be too big for computers to handle with 32bit integers
What day on what year will computers reset?
on the day my firewall doesnt block the webserver as root
Yea
what happens when the time is higher than Long.MAX
32bit unix timestamps reset on 2038
like the earth exploding
Or use BigInt
I wouldn't think it would be
of Tim, could you explain how an api for a bot would work? or point me in a direction that I could learn about it? if not all good
what kind of api?
Im not sure, but people say that they have api's created for their bot
at least, I think thats what they say
they
well, an api is a server you run that gives you data
like a REST based api i imagine
wait nvm i suck at everything
actually the word api can be applied to many things, not necessarily online
yh ik
I used / still do use Websocket servers for the old backend until i switch to a REST api
i have a rest api as well, reworking my bot to actually use it
so how do rest api's work for a discord bot?
pretty much like any normal api
the same way any other rest api
run a webserver
using bot
send Get / post requests to api
get response from webserver
im sorry, I dont know about rest api's
i mean
first you need to know what you want to do
in my case, what i wanted to do
is have my bot's functions and calculations be usable in other projects
Anyone got a javascript .js for anti spam?
we are not giving u code
so i put on those functions in a webserver, behind urls such as mywebsite.com/calculate
and instead of having those functions inside my bot's code
@forest junco try GitHub
my bot just does a request to mywebsite.com/calculate
with parameters
and receives a response
in terms of scaleability aswell
so you gain the ability to use your bot's code with other applications such as a website?
if you run a webserver and have a decent chunk of the databases behind that it is very very easy to make a webdashboard with it aswell
how exactly do the api's work? http requests?
yup
lets say your bot has an image command, that randomly sends an image, and lets say you have 500 images stored in a folder in your bot's files
instead of having your bot open the images folder, chose a random image, and send
you make another project, make a webserver, and put a function on an endpoint
such as if you access yourwebsite.com/image your webserver will do what your bot did before, open the folder, pick a random image, and send it back to you
then instead of manking your bot do that, your bot just opens that link
and you can use that link in other projects
and you only need to maintain 1 folder of images
this makes sense
instead of having a folder for all projects that you want to do that with
and seems kind of efficient, but at the cost of delay?
yup
not really
but minimal
yh
depends on how youre hosting it etc..
like a local host based set of Rest endpoints keeps the latency down in the 1-10ms usually
and you would host this api on a web server? using node or what?
if the webserver is on the same machine as your other projects, it will be < 10ms
alot of languages support webservers
node is one option yes
what do you guys use?
an image dedi
i use node behind an nginx reverse proxy
i use python and django because its what im most competent with and then microthreading
same as tim but in golang
"nginx reverse proxy" - meaning?
yeetus that ipus
nginx is a traditional webserver, like apache
it receives connections, resolves domain names, and points them to files on your computer
node.js is a fairly new webserver, so there is a lot of things that it is not very good at yet
like SSL for example
if you were going to make your API external with a domain you would use some sort of apche based system normally
so using nginx as a traditional server is more efficient than directly exposing node to the web
but alot of languages and frameworks etc.... all have support for apache deployment
so my nginx receives connections, and internally redirects them to my node server
Is node good for backend/api ?
its as good as any other webserver
I assume that protects your code or the process?
a reverse proxy helps you handle stress on your internal webserver
it protects, and also makes some things like SSL more efficient
a reverse proxy can also act as a load balancer
for example you can run multiple node servers doing exactly the same thing
and have nginx distribute connections to them
node can only use one core, right?
usually yes
there is probably the ability to thread and multi processes
unless you use workers and child processes
^^
My webserver splits every request into a threadlet (micro thread) which allows it to scale upto how ever many logical cores you have x 600
👀
I would like to learn about this by trying it
xD
im gonna make a version 2 and completely redesign it
also need to move servers, its currently hosted on google gce
which has horrible disk speeds
just host mine on one of my local host machines with an NVME drive
altho is it worth the NVME drive, meh
yeah nvme is a must for my api
better than the big SSD which has like 50MB read and writes
i uses a lot of i/o
api's need the speed?
depends
REST based APIs tend to want to be moderately quick
if you are making your bot rely of the api in terms of storing data etc..
then it is a must
Where do I learn more about api's?
a public rest api needs to be very fast, as they can potentially have hundreds of people using them per second (unlikely but still)
also needs to have rate limits
in theory mine can potentially cope with 14,000 requests a second
however
the ram will of eaten shit by then
Datomic DB eats ram and cores for breakfast
mine uses 30 year-old C code that loads data from files on disk
OOF
10gb worth of files
even the people who use glitch felt that
xD
also @crimson vapor https://www.smashingmagazine.com/2018/01/understanding-using-rest-api/ Usefull link
nonetheless its actually still very efficient
but ssd makes a huge diff
i tested a function that scans 21k files and compiles data from them
on google it would take 2min on average
on galaxygate takes around 7 seconds
My bot does not receive votes using the webhook
Somebody please help
No wait....
Could I send a dm to anyone who votes
How would I make a warnings command?
Save a list of warned users with a database. When a mod runs the command (you decide what's classified as a mod), check the args and find the user they wanted to "warn". Do your magic in the background by adding it to the db and there you go.
Could someone help me with this error? I get it whenever I try to send an embed.
at Function.normalizeFields (C:\Users\_____\OneDrive\Documents\Coding\Node\Discord\Bot\node_modules\discord.js\src\structures\MessageEmbed.js:436:8)
at MessageEmbed.addFields (C:\Users\_____\OneDrive\Documents\Coding\Node\Discord\Bot\node_modules\discord.js\src\structures\MessageEmbed.js:252:42)
at MessageEmbed.addField (C:\Users\_____\OneDrive\Documents\Coding\Node\Discord\Bot\node_modules\discord.js\src\structures\MessageEmbed.js:243:17)
at Object.embed (C:\Users\_____\OneDrive\Documents\Coding\Node\Discord\Bot\commands\help.js:23:23)
at Object.run (C:\Users\_____\OneDrive\Documents\Coding\Node\Discord\Bot\commands\help.js:66:73)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:13316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:13316) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
send the code
@hollow granitediscord.js v12 requires node.js v12 or higher
I never realized that that could be an issue
yeah, array.flat() doesnt exist before node v11, and discord.js makes use of a lot of newer javascript functions which were added to node only recently
Thanks, it works now.
wait is that function in python, or is there something similar to it?
oh thats a framework nvm
found this in stackoverflow flat_list = [item for sublist in l for item in sublist] lol
Probably some new tut up that everyone is ripping code from
that's what I was thinking
module.exports = {
name: "getstatus",
desc: "Gets status from discord's status.",
usage: "",
execute: async (message, args) => {
message.delete();
fetch('https://srhpyqt94yxb.statuspage.io/api/v2/status.json')
.then(response => response.json())
.then(data => {
message.channel.send(data)
});
}};
(node:14) UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined
at Object.execute (/home/container/commands/Music/testget.js:8:5)
at Client.<anonymous> (/home/container/index.js:60:13)
at Client.emit (events.js:210:5)
at MessageCreateHandler.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/home/container/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:210:5)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:789:20)
(node:14) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Is fetch removed from JS?
you can use node-fetch, which is a package that simulates fetch
and makes it work the same as in browsers
When I try to shard using 3 shards, my bot runs my command twice. Does anyone know what might be the issue? I'm using discordjs
Is it because I'm using more shards than I need to?
multiple events maybe
check that first
eval client._events and see if message (and others) comes up as an array or an async function
if it comes as an array you're getting duplicate events
if it comes as an async function then you should be fine
I get this:
message: [AsyncFunction]
I have a function in my bot.js that runs commands,
client.on('message', async msg => {
...
commandfile.run(client, msg, args);
}
did you fully restart your bot when you changed your sharding?
restarted all processes and all shards?
Is there an issue with the API or something? It's almost like there are two instances of my bot in one server. Almost every command I run it does the action twice.
I checked the code and found nothing.
did you fully restart your bot when you changed your sharding?
@quartz kindle I'm trying to set up sharding for my bot rn, and yeah I fully restarted it
did you run the file in another terminal?
you can run any amount of instances of the same bot
my issue is mostly that when I try sharding it sends multiple messages when it should only send 1
😭
Almost every command I use (ping, eval, update) it sends the success message twice and does the action twice as well.
huh
hmm how to deloy dbl.js on heroku i try this way but i think it never work 😦
*deloy module
Hm, what code? I'm not sure what part is causing it and I have a few hundred lines of code.
all of it
Hm, I can't post it all here. Especially with multiple files.
Also, here is an example of what it's doing (the last two messages are from the eval command. They are an array of the bot latency from previous ping commands).
It doesn't do it for every command though.
then show the eval command
@quartz kindle anything seem off about the way I run commands?
It does duplicate actions for (so far) the ping, help, eval, update, and info command.
@wide ridgeyeah i dont see anything wrong there
o.O
Huh...
anyway, not much i can help with without seeing code
the problem could be anywhere
I have a similar command handler as Gopi and we seem to both be having the problem of the bot sending multiple messages (correct me if I'm wrong).
let commandFile = require(`./commands/${command}.js`);
commandFile.run(bot, message, args);
hmm how to deloy dbl.js on heroku i try this way but i think it never work 😦
@cerulean pebble .
help me
yeah I'm having the same issue @floral bloom 😭
lol no one help
@cerulean pebble deploy, not deloy
to deploy just do what you always would
to call that env var do process.DBL
nooo
process.env.DBL
I'm trying to run 5 shards but when I run my commands it shows 3 messages
@wide ridgecheck if there are no duplicate guilds
aighr
no
to call the var in your code
bruh
name it whatever you want
call it the same way you're calling 'token'
oke
hmm
@copper cradle hmmm you mean if use config var
so not need deploy DBL token to github right
you mean ?
i can't
heroku not have module DBL so when i upload code i must delete 2 lines that in picture
yup

hmmm
I just opened this channel and saw the message
i mean the heroku not have module dbl.js
lol
so that's error
Did not scroll up
send the error log
@copper cradle =))) i use the config var but i think it not work
did u run npm i dblapi.js
no how to run it in heroku
go to your bot's folder (on your machine) and in the console run npm i dblapi.js
then deploy your entire bot again
that's it
deploy it again
send the error log that you're getting from heroku's built in console
I have a djs bot...
This is one of my onEvent statements
client.on(`channelCreate`, channel => {
let myGuild = client.guilds.get(`${config.myGuild}`);
if (channel.guild.id === myGuild.id) {
let totalChannelCount = `${myGuild.channels.size}`;
let totalChannels = myGuild.channels.get(`${config.channelCount}`);
totalChannels.setName(`Channel Count: ` + totalChannelCount)
.catch(error => sendLog(error));
}
});
I get this error -> TypeError: Cannot read property 'id' of undefined in the if statement when i run a command
It only happens when i run the invite command of my bot
if (command === `invite`) { // Sends invite link for Client
const inviteEmbed = new Discord.RichEmbed()
.setColor(`${config.embed_color}`)
.setTitle(`${config.client_name}'s invite links`)
.addField(`Here is ${config.client_name}'s invite link with administrator permissions`, `${config.invite_link}`, true)
.addField(`Here is ${config.client_name}'s invite link without administrator permissions`, `${config.noAdmin_invite}`, true)
.setFooter(`Provided by: ${config.client_name}`);
message.author.send(inviteEmbed);
return;
}
^ the invite command doesn't even relate to the channelCreate
and the id error happens with the channel.guild.id
channel.guild is undefined
ofc.. i am not creating a new channel in my server
I am sending a command to send invite links of my bot
but it is triggering the channelCreate, and there is no new channel so it is undefined
@visual sandal console.log channel and see what you're getting
kk
prints nothing
cause it is undefined
works when creating a channel cause.. well.. a channel exists
but it shouldn't run for the invite command
wait
dude
like
you never defined channel
did you actually expect channel to be a global var?
channel is inside the function you're calling when the event channelCreate fires
and it's only available inside of that scope
JavaScript has two scopes – global and local. Any variable declared outside of a function belongs to the global scope, and is therefore accessible from anywhere in your code. Each function has its own scope, and any variable declared within that function is only accessible from that function and any nested functions
@visual sandal
you got to be kidding
ouef
zSnails gettin mad V2
@golden condor watch.json
@regal saddle 😳
@regal saddle 😳
Ill get every rage doe...be careful.
😳
@cerulean pebble this should do. (I'd suggest running it on a local environment and then deploying it)
npm i <module>
npm i dblapi.js
heroku just needs your package json and it installs all node packages for you
@lilac wharf how to make it on heroku
@cerulean pebble as Canarado said Heroku uses your Package.JSON to install modules for you, easiest way to get it to install the module is add it to the package manually 
or run the npm i dblapi.js command outside of Heroku Via your Terminal, Shell, Cmd Prompt or w.e you use and then re-deploy


hmm
?
Hello. I have an error.
This is the code where I get it.
```connection.query(SELECT * FROM account WHERE id = '${message.author.id}', function (err, rows) { //selecting user id
if (err) throw err;
if(rows.length < 1) { //if the user has no info in table | no id it inserts ID - XP - LEVEL
sql = `INSERT INTO account (id, xp, level) VALUES ('${message.author.id}', '${generateXp()}', ${lvl})`
} else {
let xp = rows[0].xp; //xp = the amount xp in database
sql = `UPDATE account SET xp = ${xp + generateXp()} WHERE id = '${message.author.id}'`; //update xp
let nxtLvl = rows[0].level * levelup; //how many +1 level per xp points
if(nxtLvl <= rows[0].xp){ //If level supass that amount it
connection.query(`UPDATE account SET level = ${rows[0].level + 1} WHERE id = '${message.author.id}'`) //updates level
}
//levelup message
if(nxtLvl <= rows[0].xp){
const lvlup = new RichEmbed()
.setDescription(`Hello, ${message.author.username} you leveled up to ${rows[0].level + 1}`)
.setColor(tutu)
message.channel.send(lvlup)
}
}
connection.query(sql)
})```
this is the error.
[2020-03-11 22:06:09]: [Log]: Got data from botconfig file!
[2020-03-11 22:06:09]: [Log]: Note: If you want to exit the bot, type exit into the console.
[2020-03-11 22:06:09]: [Log]: Successfully loaded other files.
[2020-03-11 22:06:09]: [Error]: ReferenceError: Cannot access 'config' before initialization
at Object.<anonymous> (C:\Users\Cools\dog1bot\src\index.js:44:43)
at Module._compile (internal/modules/cjs/loader.js:1128:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:983:32)
at Function.Module._load (internal/modules/cjs/loader.js:891:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fyre@1.0.0 start: `node src/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fyre@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Cools\AppData\Roaming\npm-cache\_logs\2020-03-12T05_06_09_456Z-debug.log
C:\Users\Cools\dog1bot>```
Can someone help?
ReferenceError: Cannot access 'config' before initialization
run_main_module.js:17:47 | index.js:44:43
initialize config, like var config = "a", thats basic js, so if you fall into this type of errors and can't fix them, go learn basic js.
would it work though if I put var config = "a"?
Of course it would but you can't try and use it in a variable or a arg prior to initializing it
Example
message.channel.send(config.helpMsg)
var config = require ('./config')
``` is wrong the variable should be intialized before being called
yeah cause higher i have
const config = require ("../../main-db.json");
I'm just gonna scrap the idea.
And get a new idea on what to do.
Or learn how to debug
and read error messages
Also when it says run_main_module.js:17:47 | index.js:44:43
It means the error is coming from that file on line 17 or 47 not sure what js formats it
all variables should if possible be at the beginning of the code or at the beginning of code brackets
Wasn't sure of the 47 column his code must be pretty messy
bet
and I bet that he used copy paste because who would ever make a mistake like that
but im not trying to judge
yeah okay buddys
Quick question about discord bots
Is it possible to make bots be able to interact with each other?
I set up a timer on a bot called mee6 to repeat a phrase every 12 hrs (which if a human said, would trigger another bot to complete an action) but the other bot doesn’t seem to see the timed message
You mean like bot respond to another bot?
Yes. Kinda
Is it possible
Hmm...
Have you used the
if (message.author.bot) return; code in your bot?
If you did... It won't respond to any bot
I haven’t, didn’t even know that existed
Hmm
For example what did you wanted your bot to say when mee6 responded?
@earnest phoenix
It’s a game stats server, so mee6 says $clanwar and another bot called deck shop responds with stats about a current war.
For example if you haven't used the code above and typed a code for example:
return message.channel.send("moment");
}```
And if a bot said bruh it would respond with moment
It responds back with the exact same thing
@earnest phoenix
The wot
@earnest phoenix wait are you trying to code inside the message respond method of mee6
?
[Visible CONFUSION]
@earnest phoenix have you made a bot?
Not exactly trying to code. I just want mee6 to be able to loop the charade $clanwar and have the other bot respond
@earnest phoenix have you made a bot?
No, Not really
- Mee6 can only do that like every 3 hours with an auto timer
- Most bots don't respond to other bots
- Mee6 does not load or run code you give it
Hmm... You want like for mee6 to say something and other bot respond to mee6?
Hmm... You want like for mee6 to say something and other bot respond to mee6?
@earnest phoenix yes
But which bot you want it to respond to mee6?
It’s called Deck Shop, it’s a Clash Royale game tracker
Hmm... I think it can't because the bot that you're talking about might have the
if (message.author.bot) return;
Code inside of it... So... It cannot respond to the mee6 or mee6 can't respond to it if it has that
I see, is there any others that may work? I also have yagpdb but I decided not to do that because it was way too complicated (at least for me)
I mean like none of them will work because some bots are aware of other bots telling them what to do just like the bot you're trying to rig or do something with it(Deck shop or whatever)...
Just with one single line of code sooo...
Rip
Oh, ok
Thanks @earnest phoenix really appreciate the help
Np
no bot will work
it just sends your code as a string
doesn't eval it
because that would be a security break and no bot would eval your message anyways
Some bots can respond to other bots if they doesn't have the code above...(scroll up)
if (message.author.bot) return
imagine this
both bots have the same prefix
for example !!
and when a user uses !!help
the other bot responds
then the other bot responds
then the other
it would be an infinite loop
Discord would even might break because of that Infinite loop
But would take a very long time
once this server didn't had bot with common prefixes unmuted
only one person was enough to make this server die
now imagine those bots would all respond to each other
which are probably more than a thousand
Yup... Every of one your actions have an unexpected consequential danger in it
One mistake can take down all
another reason would be you have something like economy
and a second bot just to farm for you
Unexpected just like a code not initializing and giving an error
Yup
That would be like unfair to every player of a currency including bot...
For example Dank memer...
Farm and farm and you rich if that would have happened
k
Wat happens here
anyways im off
Currency, I see
@tight plinth development being active
Nothing just code talking and stuff
an illegal activity
No
API breaking limit activity
The wot
Yes and no smh
im gonna go watch netflix bye
That's just the most unexpected thing i've seen in my life...
I wasn't expecting that tho
My life is complete... I can GAME END NOW
I mean he tried to execute codes from inside of a bot message method
Yup
The bot literally sends the lines of code without executing them
And mee6 isn't coded in us or whatever
A bot mounted on a pile of code, running on a code, would execute a code through a message method code? Lmao
It's coded in mee6
I wasn’t trying to code in mee6, just send a command (not code) though it for another bot to respond
Oh lmao i see...
You though it was going to work but nah... Good job tho giving it a shot even though it wasn't going to work
Well that’s debatable
They're just like brains but with no functions if it has no codes...
You command with codes... The bot follow it
@tight plinth and bots can be stupid if they aren't given correct codes or not even given codes to them...
Hmm
Hmm you code on PC or mobile?
I do it on mobile but what kind of program are you using?
Termux?
Termius
And then re-upload
Welp... That seems to be obvious to do that lol
U hit back, u'll be back on terminus with this prompt
Are you oh my god what an elite master
And u click upload back to derver




