#development
1 messages ยท Page 1000 of 1
What is your error
tk apperently is now paid
@lusty quest I just got one for free the day before yesterday so it was a good idea ๐
So there is no error in the console?
Wait lemme do it
getting an error with localhost mongo. I've tried a couple different things; localhost with and without port, localhost but the ip. All seems to give this error after the bot running for about a minute.
MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
mongoose.connect(`mongodb://localhost:27017/database`, {useNewUrlParser: true, useUnifiedTopology: true}).then(console.log(`Database Connected!`)).catch(err => console.log(err));
I am probably just stupid about this, but oh well.
the ip is not a leak, it's the localhost reserved ip
For those who are facing error on freedom I was also facing I have fixed it
DM me and I'll. You
You need to download Parallel Space
@summer acorn have you opened the mongodb service on your computer?
did you got some sort of authentification running?
no I have not.
That's why
I've just set up mongoose.
Yeah it's definitely broken
@golden condor It has issues with countries so I had to use a vpn and location in us in vpn to acces
oh ok then
You need the mongodb service running
Guess I was just stupid after all.
Or to use an external database
@earnest phoenix yeah the site seems to have stopped working recently
@golden condor I got one the day before yesterday
you can get a free mongo insance
^^ yep on the atlas website
the db will be local on the vps
native or docker?
super where do I check errors
I recently moved from a local db to a cluster because it makes it easier to go cross machine and having 200 servers only uses up about 50kb (each with like 15 lines of data in it) so 512mb of storage is tons more than needed.
@summer acorn is that on the same machine.
yes
windows
what's wrong ?
context?
{
"TOKEN":"",
"PREFIX":"-"
"default_prefix":"-"
}```
remove the " from the Keys
Add a comma after "-"
or that
ok
The first one
PREFIX
{
"TOKEN":"",
"PREFIX":"-",
"default_prefix":"-"
}
fixed
thx
how do I fix these?
alright
You just gotta find the thing that you missed and add on the end to it
Well then yes ig
so
if i cant get a tk domain
and i cant use my ip address
and there is no way to bypass the ssl on windows
const bot = new Discord.Client();
const token = 'no';
const cheerio = require('cheerio');
const request = require('request');
const PREFIX = ("b!")
bot.on('ready', () =>{
console.log('Im alive! woop woop!'); // do node . to run
bot.user.setActivity('**b!help**');
})
bot.on('message', message=>{
if (message.content.startsWith(PREFIX + "ping")) message.channel.send("Pong!");
if (message.content.startsWith(PREFIX + "youtube")) message.channel.send("Like and Subscribe \n https://www.youtube.com/channel/UCI3uMSDZzJ8T2X_r0PZEzWA?view_as=subscriber ");
if (message.content.startsWith("@silk moat")) message.channel.send(`Hi! My prefix here is **${PREFIX}**`);
if (message.content.startsWith(PREFIX + "image" )) image(message);
if (message.content.startsWith(PREFIX + "help")) {
const embed = new MessageEmbed()
// Set the title of the field
.setTitle('Help! :clipboard::banana:')
// Set the color of the embed
.setColor(0xff0000)
// Set the main content of the embed
.setDescription(':banana:About Banana!: \n Banana is a bot bases on having fun \n And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now thanks!');
// Send the embed to the same channel as the message
message.channel.send(embed);
}
});
}) // commands```
^
error is here
meaning i cant learn how to learn discord.py
What is your error
@golden condor
You used botChannel before you defined it
Oh
who
@spare mirage would you mind using hastebin
How to define Bot channel
@earnest phoenix if you can get a domain, cloudflare is a good choice since your IP is hidden
You used botChannel before you defined it
@golden condor how ?
is https://www.dot.tk just a fucking redirect to freenom
if (message.content.startsWith(PREFIX + "help")) message.channel.send```
how do I make this send a embed
https://discord.js.org/#/docs/main/stable/general/welcome dont rederect me to this I only get errors
wdym with messagehandler
if (message.content ===`${PREFIX}help`) {message.channel.send(embed)}
and the next one chains on it with else if
if (message.content.startsWith(PREFIX + "ping")) message.channel.send("Pong!");
if (message.content.startsWith(PREFIX + "youtube")) message.channel.send("Like and Subscribe \n https://www.youtube.com/channel/UCI3uMSDZzJ8T2X_r0PZEzWA?view_as=subscriber ");
if (message.content.startsWith("@silk moat")) message.channel.send(`Hi! My prefix here is **${PREFIX}**`);
if (message.content.startsWith(PREFIX + "image" )) image(message);
if (message.content.startsWith(PREFIX + "help")) message.channel.send(":banana:About Banana!: \n Banana is a bot based on having fun \n And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now")
}); // commands```
does the ping command work?
{
"embeds": [
{
"title": "Help! ๐๐",
"description": "๐About Banana!: \n Banana is a bot bases on having fun \n And eating bananas! ๐\n\nCommands:\n๐ b!image : shows u a random banana image (will be changed soon)\n๐ b!ping : Pong! (will show ms soon)\n๐ b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now",
"color": 7506394,
"author": {
"name": "Banana"
},
"footer": {
"text": "Justii#3473"
}
}
]
}
how did my problems go from not being able to install pip to being forced to pay
{
"embeds": [
{
"title": "Help! :clipboard::banana:",
"description": ":banana:About Banana!: \n Banana is a bot bases on having fun \n And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now",
"color": 7506394,
"author": {
"name": "Banana"
},
"footer": {
"text": "Justii#3473"
}
}
]
}
all you did was put it in a json code block
Is there a way to sort MongoDB arrays alphabetically? Or do I need to do it myself using for loops?
that makes it easier to see @earnest phoenix
i fuckign made it readable
try to use the embed constructor @spare mirage its usually easyer
wich one xD there are thousands
with d.js i could help you
fine
@lusty quest so I convert it
use the constructor instead of whatever that was what you sended
ok
the code you sended a few hours ago was also using it but i guess the issue was that the constructor was all over the file
.setColor('#0099ff')
.setTitle('Help :banana:')
.setAuthor('Banana')
.setDescription('\n Banana is a bot bases on having fun \n And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now'
.addField('Inline field title', 'Some value here', true)
.setTimestamp()
.setFooter('Justii :3')
channel.send(exampleEmbed);```
so this will work?
looks good
how do I add this iside my command
message.channel.send(exampleEmbed)
how to add ' ?
?
like Don't
add a \ infront
\ not /
this ?
where do I add this part const exampleEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Help ๐')
.setAuthor('Banana')
.setDescription('\n Banana is a bot bases on having fun \n And eating bananas! ๐\n\nCommands:\n๐ b!image : shows u a random banana image (will be changed soon)\n๐ b!ping : Pong! (will show ms soon)\n๐ b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now'
.addField('Inline field title', 'Some value here', true)
.setTimestamp()
.setFooter('Justii :3')
`this is a exampe don\ยดt you see`
@spare mirage above the part where you handle your messages
yes but handle the errors before starting
return message.channel.send("You Don\`t")
yes
bruh this is dum
message.channel.send("You Don't")
b
oh its this same shit
they go from installation and then give me an example of code
they never told me these three tthings that i might need to know
@spare mirage you probably got somewhere a missing ) or ,
- what is the file named
- where does the file go
- where do you go after installing
bcs most bot tutorials requrire you to know the coding language
@lusty quest I dont miss anything
you do otherwise there would not be the error
client.on("message", async message => {
if(!message.guild) return;
let prefix = db.get(`prefix_${message.guild.id}`)
if(prefix === null) prefix = default_prefix;
if(!message.content.startsWith(prefix)) return;
//the codes
})
why it's not working ?
there's no error show in console
There is no actual code
so what to do ?
Put in.. code...?
i need to change every command to ```js
if (msg.startsWith(prefix + "prefix")) {
bcs most bot tutorials requrire you to know the coding language
@lusty quest but in this case, i dont
do i need to learn javascript, and then node.js, and then discord.js
node.js is javascript
and discord.js is just a package for node.js
@lusty quest can u see a problem?
nope, its possible that the error is somewhere above
it says its on line 25 and 31
i did id but it's only with prefix command any1 can help?
@spare mirage what happens in line 25
@viral iris did you dont have a idea what your bot should do?
@viral iris what theme do you use cuz im sorry but i dont like the way the messages look like that
did you opened somewhere earlyer a field with (?
i just like everything else about it
@viral iris did you dont have a idea what your bot should do?
@lusty quest change the prefix but not changing only-prefixcommand
i dont get what you want to do
@lusty quest no
there has to
thats weird
otherwise there would not be this error
can you show the code above the embed
@viral iris so your bot doesnt save the new prefix properly?
i mean yes
yes will do
@viral iris so your bot doesnt save the new prefix properly?
@lusty quest what should i do now ?
oops token
@viral iris debug your code and see why it fails
@lusty quest
looks like an error from the package you get from your host
remove the ; in line 31 and see if it helps
@spare mirage
:/
@lusty quest can u come dm ?
not really
@viral iris i dont to DMs anymore
@lusty quest can u come dm ?
@viral iris is that a web server? And Did you forget the โhttp://โ part of the link or is it just not showing it.
@spare mirage looks like you have there some errors with your command handling.
i guess this makes the errors
keep the first command but set the execution in {} the next command then starts with else If and the execution again in {}. repeat this for every command
if(message.content == `${PREFIX}ping`){ message.chanel.send("Pong")
}else if(message.content == `${PREFIX}hi`){ message.chanel.send("HI")
}
as example
So it will be
if(message.content == ${PREFIX}ping){ message.chanel.send("Pong")
}else if(message.content == ${PREFIX}hi){ message.chanel.send("HI")
}else if(messgae.content ==
}else if
why?
yes

just remove them
but a switch case would be better i guess
true but you don't need to use brackets for that
wait what
keep your code
ok
else if is only needed if you need an invalid command message at the end
I ctrl z'ed it
otherwise, keeping them would be pointless unless it's somehow faster
other part of your code caused that error
then there is somewhere a mistake in the code
but the top looks alright
maybe somewhere in your Embed Constructor
but remove the token this time
you didn't close the long setDescription() of that embed
}): look
this was wrong
if (message.content.startsWith(PREFIX + "ping")) message.channel.send("Pong!");
else if (message.content.startsWith(PREFIX + "youtube")) message.channel.send("Like and Subscribe \n https://ww");
if (message.content.startsWith("@Banana#2028")) message.channel.send(`Hi! My prefix here is **${PREFIX}**`);
if (message.content.startsWith(PREFIX + "image" )) image(message);
if (message.content.startsWith(PREFIX + "help")) channel.send(embedhelp);
}): // commands```
can you add it to a codeblock
last line should be a ; not :
fixed
lul
did you changed something?
Hmm
doesnt work :/
you need to have either every command with if or else if (if elseif only the first is only if)
keep the old
the green one?
red
yes but at the end you need now a event that returns a invalid command message
-> else {message.channel.send("invalid Command")}
uhh
add it after your last command
its always at the end incase someone try to run a invalid command
ohh wait. it will return on every message
just make else return
just else if (content.startsWith(prefix)) send("invalid command");
at the end
i guess you're not planning to add the bot here
can I?
really
isnt that weird
people can make a nuke bot and add it
https://hastebin.com/mapecepuju.js like this?
@pale vessel
yes but with the actual send method lul
can someone help me?
you had channel.send and send, both won't work
server = client.guilds.keys().next().value;``` how do i make this v12?
guilds is a manager that holds the cache
what
so what would need changing?
@long yew i gave you a clue
@spare mirage change channel.send and send to something that you've been doing before
hmm
channel.send(embedhelp); else if (content.startsWith(PREFIX)) message.
channel.send("invalid command");```
I would do It like that
so is it right?
only one way to find out mate
it didn't work?
||not||
/**/(["manchester",["Manchester","Manchester United F.C.","Manchester City F.C.","Manchester Airport","Manchester Arena bombing","Manchester, New Hampshire","Manchester by the Sea (film)","Manchester Piccadilly station","Manchester Metrolink","Manchester derby"],["","","","","","","","","",""],["https://en.wikipedia.org/wiki/Manchester","https://en.wikipedia.org/wiki/Manchester_United_F.C.","https://en.wikipedia.org/wiki/Manchester_City_F.C.","https://en.wikipedia.org/wiki/Manchester_Airport","https://en.wikipedia.org/wiki/Manchester_Arena_bombing","https://en.wikipedia.org/wiki/Manchester,_New_Hampshire","https://en.wikipedia.org/wiki/Manchester_by_the_Sea_(film)","https://en.wikipedia.org/wiki/Manchester_Piccadilly_station","https://en.wikipedia.org/wiki/Manchester_Metrolink","https://en.wikipedia.org/wiki/Manchester_derby"]])
How i can transfer this to json
nani
you have two invalid command
how can i send custom emojis with discord.js?
the first one was in the middle of the code, and the second one is on the last
first one needs to be removed
how did it even manage to get up there lol
huh
all?
you only need one at the last part
delete the whole else if until ;
yes
ye
i would suggest learning javascript first 
Im doing that by doing this xD
so can u help me ?
i don't know that code
what are u trying to make
what is RepounceBody? @earnest phoenix
repounce.body = repunceBody
Hey. If I want to send a dm to a user with my bot, is there a difference between using guild.members.cache.get() and client.users.cache.get() regarding whether the user is cached or not? Or do I have to use .fetch() for that?
as long as I'm not using guild.owner it's fine? (It's about a dm to the owner)
you only need to fetch if the user isn't cached/is a partial
yes but idk if it's fetched if the dm is sent
if guild.owner isn't cached then you need to fetch it
erm cached*
so like await guild.owner.fetch()?
trainers[message.author.id].mons.forEach(function (mon) {``` is this out dated?
function removeElement(elementId) {
// Removes an element from the document
var element = document.getElementById(elementId);
element.parentNode.removeChild(element);
}
function closePI() {
let element = document.getElementById("popup-input")
let div0 = document.getElementById("div0")
let div1 = document.getElementById("div1")
removeElement("div0")
removeElement("div1")
return element.value;
}
``` doesnt seem to work
no
@spare mirage get it approved
@spare mirage go to the developers portal
3 pings, nice.
:/
he wants to add it to his server
all with descending answers
ohhhhhhhhhhhh
get outplayed
lol
function removeElement(elementId) {
// Removes an element from the document
var element = document.getElementById(elementId);
element.parentNode.removeChild(element);
}
function closePI() {
let element = document.getElementById("popup-input")
let div0 = document.getElementById("div0")
let div1 = document.getElementById("div1")
removeElement("div0")
removeElement("div1")
return element.value;
}
``` doesnt seem to work
@surreal sage The property parentNode doesnt exist
well, it doesn't exist
Can u put all ur embed messages in another document and use that document to list all youre embeds?
what
.setColor('#0099ff')
.setTitle('Help :banana:')
.setAuthor('Banana')
.setDescription('\n Banana is a bot based on having fun \n And eating bananas! :banana:\n\nCommands:\n:banana: b!image : shows u a random banana image (will be changed soon)\n:banana: b!ping : Pong! (will show ms soon)\n:banana: b!youtube : Subcribe to me (will be changed to setting your own youtube soon)\n\nThats it for now')
.addField('ur dinner today', 'bananas', true)
.setTimestamp()
.setFooter('Justii :3')```
can I put this in another document
yes
and still use it from index.js?
no
@spare mirage You can put every command in external files, tho.
so I can put the commands in there
wdym
but not the embeds
@spare mirage ^^
thnx
oh yeah thanks
if (command === "slap") {
if (!args[1])
return msg.channel.send(
"**Who You need to slap boi?**"
);
msg.reply("just Slapped butt of" + msg.mentions.users.first());
};```
Here
What happens is
There is no space between name of person and butt of
And second it tells name
Instead of pinging
object should be fine in discord.js
But he wants the mention not the string of it
it converts it to mention iirc
Literally add a space after butt of in the string
@pale vessel oh it's different to discord.py then ;-;
msg.reply("just Slapped butt of " + msg.mentions[0].mention);```
Would that be correct in js
if (command === "slap") {
if (!args[1])
return msg.channel.send(
"**Who You need to slap boi?**"
);
msg.reply(`just slapped ${msg.mentions.users.first()}`);
};```
See why does that happens ?
What js it supposed to do
@delicate shore try what I sent
if (command === "slap") {
if (!args[1])
return msg.channel.send(
"**Who You need to slap boi?**"
);
msg.reply(`just slapped ${msg.mentions.users.first()}`);
};```
@delicate shore this way of making commands is kinda bad...
if u type "hdfsoiafhuoewhoh slap" it will still reply
it did for me
using if (message.content.startsWith(PREFIX + "commandname")) COMMAND
works way better
Eewww
@delicate shore this way of making commands is kinda bad...
if u type "hdfsoiafhuoewhoh slap" it will still reply
@spare mirage
No I have command holder
Why not just use the bot syntax for it and events
didnt know :/
@spare mirage yeah it depends on how he's doing it
@placid iron d.js is different
nah keep this
@delicate shore try getting the users id and creating a mention
yeah but do that urself
:(
so do .users.first().id
and then do
<@id>
or if u want you can use the regex expression to get the user mentions in order so u can pick out the first one
if u want the bot to reply to a mention in a server use
wait actually
if (message.content.startsWith(@BOTID)) message.channel.send("message");
so do
.users.first().id
@rustic ridge what
@placid iron discord.js has on message events
F
@delicate shore wait theres a better way give me a ec
ok
@delicate shore .users.first().toString()
then???
what
@delicate shore if your bot can't mentions users with <@id> you probably have enabled disableMentions: "all" in your client settings
me not gettig it
@placid iron but discord.js has this thing called commando which handles commands in events
@delicate shore if your bot can't mentions users with <@id> you probably have enabled disableMentions: "all" in your client settings
@tight plinth indeed i have
why
Because that's how it works
Erm no
What the fuck
They can't lol
YouTube links / ever I'd on earth can only contain numbers & letters
There is a 1 chance out of a billion that a id can mention someone
How can i show all flags of a user? (V12)
<user>.flags
I want with name
you can set per-message mention options
@tight plinth you mean this right
U can't
Sad
Yes
the disableMentions option is for sending messages, not for receiving
are you sending messages that contain possible mentions?
@quartz kindle yeah he be tryna ping someone
you can set per-message disableMentions if you want
for example .send("bla",{disableMentions:"none"})
the message option should override the global option set in the client, so you can use any combination you want
you can make mentions enabled for specific commands only
there is also the allowedMentions option for further control, for example to mention only a specific user but disable mentions for other users
can I make commands for a bot
that only work for me
?
not only admin
but only ME
as in @spare mirage
Use owner ID
if(message.author.id != โyour discord id)return
idk Iโm on mobile
Smthng like that
if(<user>.id != "Your id") return;
message.channel.startsWith("banana") message.channel.send(" ๐ ")
<message> refers to the message define
uhh
.nex
next? What
do i remove next?
what did you want to archive?
why is my code not getting colors
user isnโt literally that
bcs copy/paste doesnt work
@spare mirage are you new to js?
Itโs the user object
yes
oh that explains it
message.author, not <user>, read the docs.
all that code needs fixing and cleaning
I fixed it
dont create a new event listener for every command you make. maybe try to find a tutorial for creating a message handler
but now it works for everyone
dont create a new event listener for every command you make. maybe try to find a tutorial for creating a message handler
I dont
you have already 2 for the same event
too much can cause a memory leak
but then how do I make it me only?
learn how to debug your code. we are not here to do it for you
justii, you just put another if statement
can anyone help me?
?
@long yew i already asked you yesterday what is spawns and you didn't replied. So I'll ask again: what is spawns
it is a variable
#memes-and-media for other languages
var spawns = require("./spawns.json");
Console.log it and show what it returns
(diฤer diller iรงin #memes-and-media gel yoksa mute yersin)
@earnest phoenix ingilizcem yok aqi
#memes-and-media gel
Turkish in development aaaaa
@tight plinth how?
You don't know how to console.log something?
Yes
ok
would this work @misty sigil
@spare mirage no
how will it?
You can't start developing discord bots with discord.js if you don't know how to use Javascript
i will change later
No, change now
i will later
No,now.
How do i make this command author only
if (message.content.startsWith("hi!")) message.channel.send("Hi");
How do i make this command author only
if (message.content.startsWith("hi!") && message.author.id = โIDhereโ)message.channel.send("Hi");
there
thanks! I lowkey didnt know && was a thing
yep i'm here
getting weird errors
just learn js.
||best way to learn is by asking||
you will learn nothing by asking others. They'll just give you the answer, and they won't explain why and how
function popupInput(title, placeholder) {
let divOverylay = document.createElement("div")
let div = document.createElement("div")
divOverylay.style.cssText = "position: absolute; top: 0%; left: 0%; background: rgba(0,0,0,0.6); z-index: 4; width: 100%; height: 100%;"
div.style.cssText = 'position: absolute; margin: auto; left: 0; top: 0; right: 0; bottom: 0; background-color: #303030; z-index: 5; width: 45%; height: 25%; border-radius: 25px; text-align: center;'
div.innerHTML = `<br><span style="padding-top: 100px;font-size:30px;color: white;font-family: 'Source Code Pro'">${title}</span><br><br><input id="popup-input" class="creatPr-input" placeholder="${placeholder}"><br><br><button onclick="closePI()" class="submit-proj">Next</button>`
document.body.appendChild(divOverylay);
document.body.appendChild(div);
}
function closeIt() {
let element = document.getElementById("popup-input")
divOverylay.style.display = 'none'
div.style.display = 'none'
div.innerHTML = ''
return element.value;
}
```i have this script but the button when pressed wont change these elements
i tried some stuff but all not found
is the button have closeit function on clicked ?
but look topic
It was just me being dumb
simon, this is open for all kinds of development help
I forgot my !
@earnest phoenix can you help me with profile badges?
yep
:D
i believe i just need images of all of the badges and then draw them in?
or is there something else
yep
Can anyone help me with web scraping ? Dm please
Whatโs a range error
an error that suggests a given value is out of range
ie a number that is too big or too small
I'm trying to translate my Discord bot to eris.js (because it's faster) but I just want to be lazy and work quickly I tried this:
console.log({ embed: embed})
But it shows something like
{
embed: MessageEmbed {
(stuff here)
}
}
I want embed: MessageEmbed { to be embed: { instead
how is this possible'
eris doesnt have embed builders
unless you're using some extra package
how did you build that embed?
but... why
you're trying to use discord.js and eris at the same time?
like using discord.js's embed builder on eris?
yep
in that case you can do embed.toJSON()
... ok
im surprised this actually works
but .toJSON() is a bit slower than.. JSON.parse(JSON.stringify()) but i dont really care
(I do really care)
function image(message){
var options = {
url: "http://results.dogpile.com/serp?qc=images&q=" + "bananas",
method: "GET",
headers: {
"Accept": "text/html",
"User-Agent": "Chrome"
}
};
^ this belong to my search function is there any way I can change what I search "bananas" with a command: !image WhatUwantToSearch
example:
if I do "!image Cheese"
"bananas"
will become "Cheese"
and run image(message)
is there a way to make a bot reply the same message to several different words rather than doing this:
msg.channel.send('deus vault');
}
if (msg.content === 'lord') {
msg.channel.send('deus vault');
}
if (msg.content === 'God') {
msg.channel.send('deus vault');
}
if (msg.content === 'Lord') {
msg.channel.send('deus vault');
}
if (msg.content === 'Jesus christ') {
msg.channel.send('deus vault');
}
if (msg.content === 'Jesus') {
msg.channel.send('deus vault');
}
```
lemme try smtng
if (msg.content === 'Lord', 'god') msg.channel.send('deus vault');
```
@earnest phoenix is this posible too?
no
would make sense though
['a', 'b'].includes(msg.content)
u can just use js' or
well yeh, but i do that when theres loads so it goes down and looks nice
Preferences
How do i store variables in files so i can access them later even if my bot goes down
I use discord.js
Dm me
Imma go sleeep
Look up a tutorial on JSON I guess
i domt know json
can you link me a tutorial
ok
but is there any database thingy i can use on glitch.com
How can I pass a variable from a forEach function outside of the function?
anyone here can tell me why my sleepdelay isnt working?
https://hasteb.in/koyuyeta.js
The thing is that the limit for requests exceeds. I thought of putting the delay inbetween asking pages.
I know I can pass it to an array or a DB, but won't it repeat itself? (because of the forEach function)

Did you get the question?
I have 4 users on the server and I use forEach for example, won't pushing it into an array happen 4 times?
Just don't use for each?
But I have to?
But the variable is in the forEach
what r u trying to do, theres most likely an easier way to do it
Get a variable outside of the forEach function
message.guild.members.cache.forEach(member => {
let variableIneed = something inside the foreach function
})
then i want it here
anyone have a muted role create code?
We don't just spoonfeed code
Then ask it
Itay, that variable gets created for every member, you cannot do that
Depending on what you want, you could use map
What are you trying to do?
Get that variable outside the function too
what are you doing on the outside specifically?
Something that is supposed to happen once and not a few times
is there any way I can not cache users
Then why are you using a loop?
discord.js btw
Let me explain:
First time I check for some stuff on each user, and then I want the result of it outside the function for a one time use
Then map would be ideal
hey guys i seem to keep getting this error after trying loads of things and just wondered if anyone knew why its making this error thanks in advance
Error [SyntaxError]: missing ) after argument list
Can map get the function result?
yes
users.map(user => user.someFn());
That returns an array with the result for each user
Though, why not do that one time thing inside the forEach loop? When you use map, you'll still have to loop through the results
ok hi its me again i tryed this but now it replys to every message sent: ``` if (msg.content === 'Lord', 'god'){
msg.channel.send('deus vault');
}
Because then it will do it a few times and I really don't need it to repeat
Can i store variables in a database file on glitch? (and i dont even know how databases work)
firenado that's not how it works
idk
im not to sure on why it is giving me this error, broadcastEval is a bit odd https://discordapp.com/channels/264445053596991498/272764566411149314/726797737424715836
I started js yesterday
|| meaning or?
Yes
oh ok
|| means or
&& means and
oh didnt know
nice thx again
as I said I started with js yesterday
uhh, lumap, I didnโt do that
lol
Two works: f*ck u
works
Can i store variables in a database file on glitch? (and i dont even know how databases work)
can someone help (not spoonfeed)
Well "variables" not exactly, but data
Variables contains data
seems like alot of people trying to make bot for getting the badge ._.
Lol it is
If you're here only to get the badge, then get the fuck out of here except if you already know how to program
exactly xd
This message should be sent to everyone talking here for a simple problem like "how to put bot online" or things like that
I got custom prefix code but where can I put my bot command?
const db = require('quick.db')
client.on('message', async message => {
if (message.author.bot) return; // Ignore if the user is a bot.
let pref = db.get(`prefix.${message.guild.id}`);
let prefix;
if (!pref) {
prefix = ";"; // If the server doesn't have any custom prefix, return default.
} else {
prefix = pref;
}
if (!message.content.startsWith(prefix)) return; // use this. so your bot will be only executed with prefix.
let args = message.content.slice(prefix.length).trim().split(/ +/g);
let msg = message.content.toLowerCase();
let cmd = args.shift().toLowerCase();
message.flags = [];
while (args[0] && args[0][0] === "-") {
message.flags.push(args.shift().slice(1)); // Message Flags: -default, -ban, -parameter
}
if (msg.startsWith(prefix + "prefix")) {
if (!message.member.hasPermission("MANAGE_GUILD")) return message.channel.send("You don't have any permissions to do this!");
let data = db.get(`prefix.${message.guild.id}`);
if (message.flags[0] === "default") {
await db.delete(`prefix.${message.guild.id}`);
return message.channel.send("The server prefix has been changed into default.");
}
let symbol = args.join(" ");
if (!symbol) return message.channel.send("Please input the prefix.");
db.set(`prefix.${message.guild.id}`, symbol);
return message.channel.send(`The server prefix has been changed to **${symbol}**`);
}
});
To get the badge you must :-
1). Learn basics of JS
2). Get pretty more well with JS
3). Read documentation of discord.js
4). Try watching tutorials of discord.js
5). Finally you can now make ur own bot without any problem i suppose...
@earnest phoenix you're not forced to use js lol
ik but many ppl use it xd
@viral iris learn fucking js
True
not just js and discord.js for the badge smh
Some people use py too
the largest part use JS or py. a few Go but i havent seen one using c or rust in a while
But people using other programming languages knows how to program and read docs, they don't need to ask here tips on "how to do x"
poobis
true Lumap
Does anyone know how to avoid the ratelimits of Youtube ? Because due to that my bot can't play music anymore when i got ratelimited ๐ฆ
proxies
How do i make a variable named yolo, assign it the value ["yolo1","yolo2"] and save it to a file through quick.db?
Basically create an array and save it to quick.db so i can access it later
the way u would store anything in a db? i've never used quick.db but i believe its something like db.set
so can i put db.set(variablename)
A variable stores data in RAM. You want to store the data, not the variable.
Judging from the examples,
// Pushing an element to an array (that doesn't exist yet) in an object:
db.push('userInfo.items', 'Sword')
And does .push store it in RAM
no
No?
no, it doesn't store it in RAM
the back of ur documents are not seen
like
if(command === "MemberCount") {
}
What comes in between that
have you checked the docs
@misty sigil nope
Pls send me link
https://discord.js.org for djs
oliy, the owner
Thanks for telling me about this cool quickdb thingy, now i can get economy system off my NTBF list (Never To Be Finished list)
like
if(command === "MemberCount") {}
@delicate shore i think its
<message>.guild.memberCount
maybe
Oh ok
why incase message in <>
<message> is the message object
so it could be msg
or message
or mssg
or whatever it's defined as
i define it as m
ooh, thats new
https://discordjs.guide <<<<<<<<< head there for starting guide
short and easy to use
i wonder should i rewrite my old bot, or start fresh bot?
okay then i guess
hello,
i have a express server (node.js) on my raspberry pi 3. how can i make it public and not only localhost?
Port forward the port
i did it
At that point it should be public then.
If you need a domain, get a domain
ok thx
how do i check if "userBalance" array (or whatever you call it) in quickdb contains a key with the ID of the user? and how do i set keys with the name as the member's ID anyways? first step towards dank memer ripoff ๐คฃ
hello
any one there?
function popupInput(title, placeholder) {
let divOverylay = document.createElement("div")
let div = document.createElement("div")
divOverylay.style.cssText = "position: absolute; top: 0%; left: 0%; background: rgba(0,0,0,0.6); z-index: 4; width: 100%; height: 100%;"
div.style.cssText = 'position: absolute; margin: auto; left: 0; top: 0; right: 0; bottom: 0; background-color: #303030; z-index: 5; width: 45%; height: 25%; border-radius: 25px; text-align: center;'
div.innerHTML = `<br><span style="padding-top: 100px;font-size:30px;color: white;font-family: 'Source Code Pro'">${title}</span><br><br><input id="popup-input" class="creatPr-input" placeholder="${placeholder}"><br><br><button onclick="closePI()" class="submit-proj">Next</button>`
document.body.appendChild(divOverylay);
document.body.appendChild(div);
}
function closeIt() {
let element = document.getElementById("popup-input")
divOverylay.style.display = 'none'
div.style.display = 'none'
div.innerHTML = ''
return element.value;
}
``` I cant set the id's from div and divOverlay, so i have to use javascript to call them, but when the button is clicked, how do i include it in the event?
Maybe learn how do use a database first instead of trying to go straight for a dank memer ripoff lol
Use a db properly
@earnest phoenix
Maybe learn how do use a database first instead of trying to go straight for a dank memer ripoff lol
@prime cliff thats literally what i asked help with a database
quick.db
@surreal sage newly created elements do not have any events attached to them
onclick event in the innerHTML
the closePI() function doesnt work?
can someone help me with my problemo
wait
scroll up
also, you cant access the div and divOverlay variables across functions like that
you need to find and declare them again
i use RichEmbed() not MessageEmbed()
and discord.guide doesn't have a guide on rich ones
@surreal sage also, you can set ids like this
@earnest phoenix RichEmbed is the same as MessageEmbed
@solemn latch doesn't work :/
the only difference is that RichEmbed is in discord.js v11, which is the old version
why does quick.db not keep stuff when i restart my bot
i typed refresh in the terminal
my bots sourcecode is at glitch.com/~codecodiscordbot
@quartz kindle p i n g
@quartz kindle ```js
function closePI() {
let element = document.getElementById("popup-input");document.getElementById("div0").style.display = 'none';document.getElementById("div1").style.display = 'none';document.getElementById("div1").innerHTML = '';return element.value;
}
function popupInput(title, placeholder) {
let divOverylay = document.createElement("div")
let div = document.createElement("div")
divOverylay.style.cssText = "position: absolute; top: 0%; left: 0%; background: rgba(0,0,0,0.6); z-index: 4; width: 100%; height: 100%;"
div.style.cssText = 'position: absolute; margin: auto; left: 0; top: 0; right: 0; bottom: 0; background-color: #303030; z-index: 5; width: 45%; height: 25%; border-radius: 25px; text-align: center;'
div.innerHTML = <br><span style="padding-top: 100px;font-size:30px;color: white;font-family: 'Source Code Pro'">${title}</span><br><br><input id="popup-input" class="creatPr-input" placeholder="${placeholder}"><br><br><button onclick="closePI()" class="submit-proj">Next</button>
document.body.appendChild(divOverylay);
document.body.appendChild(div);
div.id = "div1"
divOverylay.id = 'div0'
}
i ran it in the console and it worked
returned at hid it
you looking at my source code nasty lol
who
@surreal sage try this then: div.querySelector("#popup-input").addEventListener("click",closePI)
tim
thanks il try in a mind
@earnest phoenix all i can see is that you're using some very outdated stuff
What should my bot have in a bot info command? I don't need codes rn
@earnest phoenix all i can see is that you're using some very outdated stuff
@quartz kindle i dont care

