#development
1 messages · Page 970 of 1
const command = message.content.toLowerCase();
if(command === Prefix + 'meme') {
let msg = await message.channel.send("Fetching");
fetch('https://meme-api.herokuapp.com/gimme')
.then(res => res.json())
.then(json => {
let embed = new Discord.RichEmbed()
.setTitle(json.title)
.setImage(json.url)
.setFooter(`Link: ${json.postLink} | Subreddit: ${json.subreddit}`)
msg.edit(embed)
}) //this is for ending the .then code
} //this is for ending the if(command.... code
}); //this is for ending the client.on code...```
do i paste this?
yep
k , amma test
also thanks for the notes
u were missing }
and ) previously xd
Can i put a class inside a class?
when I domodule.exports = class { constructor(apikey) { this.apikey = apikey } //functions class OtherClass { } ``` returns unexpected token
@empty owl
@earnest phoenix there seem to be something wrong can i inv you to see it ?
You're missing a } there
it is editing the message and also adding [Object] [object] i suppose @earnest phoenix
??
nvm
what is the problem?
u can send ss
it just sends "fetching" and then does nothing 🤣
should i change the API?
ohk
got any errors in console?
no
the console is clean
o wait
hmm?
(node:3740) UnhandledPromiseRejectionWarning: TypeError: Discord.RichEmbed is not a constructor
after i send the command
ohk
which discord.js version you are using?
12
it should be
Discord.MessageEmbed()
not RichEmbed()
ohh
sorry
they changed it in v12...
and now i am lazy to edit like thousands of code in my bot to convert it to v12 xd
therefore, i am using v11 rn xd
OMG OMG I LUV U SO MUCH ITS WORKING !!!!!
TY
TY
TY
np xD
U ARE AMAZING
lol
lmao
that was me over reacting 🤣
yep xD
now i gtg... if u have any other probe, u can ping me tho i will come in like within 30min
LMAO
I AM SOOO HAPPY
okeeee
i want to hug u rn for making this work 😊
uhh
if i have code liek this
module.exports = class {
constructor(apikey) {
this.apikey = apikey
}
//functions
}``` and I want to make a new class that you dont have to tell the apikey to again, how would I do that
something like
let api = new API("key")
api.otherapi.getSomething("something")
how would I make this "otherapi" thing
NVMmMm
i am not sure about it cuz i never tried doing so but u can create a new class outside of previous one i think. @empty owl
i might be wrong bout it for sure tho xd
@earnest phoenix fyi you'll need to convert to v12 eventually
@astral raven buy a vps or server and run your bot on it
@empty owl 1, give your class a name pls
class MyThing { ...
as for that, pretty simple, in the constructor:
constructor(apikey) {
this.apikey = apikey
// add this:
this.otherapi = {
getSomething: (something) => {
return somethingElse;
}
}
}```
@earnest phoenix fyi you'll need to convert to v12 eventually
@sick cloud no one said it is necessary to convert. What it says is that no support will be provided nor bugs will be fixed in v11 anymore...
as much as i remember . . .
it's necessary
in october your bot simply won't start
discord's making intents mandatory then and v11 won't get intents
is the verified bot tag a public flag?
are you using winston? @dusky yoke
yes
hmm
can you try this one?
client.logger.log("error", err.stack)
if it still shows error, send me your codee once
code*
ok
lemme see it
may i see where u have defined client.logger?
just send the code written here... dont send complete file xd
you never defined client.logger
as well?

lemme send you code u must write in ur main file
const winston = require("winston");
const logger = winston.createLogger({
transports: [
new winston.transports.Console(),
],
format: winston.format.printf(log => `[${log.level.toUpperCase()}] - ${log.message}`),
});
client.logger = logger
@dusky yoke
write this code in you main file (say, index.js)
ok
Has anyone ever run into this for their bot? I'm hosting it on EC2 instance
fatal error: ineffective mark-compacts near heap limit allocation failed - javascript heap out of memory
I use mongoose for mongoDB connection, seems to be a memory leak or something occuring?
yeah that's a memory leak
i have no fuckin clue if your db is at fault here; check to see that it doesnt forget to close/reconnect
new to nodejs but when exactly would I close the DB? as I need it for almost all of my commands
i too use mongoose but i never ever faced this problem 
I've added .lean() to some of my selects and seems to have fixed memory rising fast
but the error only occurs after a couple of hours of running so ill keep an eye on it
@earnest phoenix do you close your connection at any point?? My memory usage has only started rising on the server since breaking about 1k servrs
nope i dont close anywhere...
and my bot is also in 1k+ servers xD
how much memory does your server have?
my bot uses mongo at 40k servers and i don't close the conn
but i don't use mongoose so maybe it's a break in their lib
try straight mongodb? /s
i just use it like this:
const Money = require("../models/coins.js") //Schema
Money.findOne({
userID: message.author.id
}, async(err, user) => {
CODE_GOES_HERE
})
@earnest phoenix Let me know if u have any of this api(s)
Dog , PNG - gif
Cat , PNG - gif
Hug , PNG -gif
Cookie , PNG - gif
Hello how to disable everyone to discord.js
i am used {disableEveryone: true} not working
what version
V12
I am making a website with html and css and i made buttons with css, the problem is when I click the button a square outline appears but my button is rounded
This is only for bot development.
oh oops
Not really
It is lol
Hello how to disable everyone to discord.js
i am used {disableEveryone: true} not working
It's mainly for bot development
It's only for bot development.
General development is still allowed
you can ask about general development here, but yeah because this is a bot list server. most discussions are bot related
@earnest phoenix Provide more info.
@placid hazel i am using lastest version v12.2.0
const Discord = require('discord.js');
const client = new Discord.Client({disableEveryone: true})
const fs = require('fs');
const db = require('quick.db');
const moment = require('moment');
client.ayar = db;
const ayarlar = require('./ayarlar.json')
const snekfetch = require("snekfetch")
//require('./util/eventLoader')(client);
const DBL = require("dblapi.js");
const dbl = new DBL(ayarlar.dbltoken, client);
const ms = require("parse-ms")
require('events').EventEmitter.defaultMaxListeners = 70;
require('events').defaultMaxListeners = 70;
require("ms")```
My bot.js
@placid hazel js
Ok
ok so first try
disableEveryone doesn't exist in v12
it does not
I have the solution.
https://discord.js.org/#/docs/main/stable/typedef/ClientOptions see the disableMentions property
const Client = require("discord.js");
const client = new Client({
disableEveryone: true
});
you're using v11
it can't work if it doesn't exist
Bruh??
I made disableEveryone possible in v12.
Because you say it's "impossible".
well
disableEveryone - does - exist - in - v12
nbuther check your d.js version
it literally does not are you blind
click on the link above and you'll see no occurance of disableEveryone
And which one is actually used
🤦♂️
Smh.
imagine
every - single - version
Also, why
probably 13
I'm genuinely curious in the backstory behind such decision
You guys are just low IQ's right now. Let's just end this convo before drama is made.
yeah he's trolling
go to your main file
and do the following
console.log(require('discord. js').version)
I have a host.
and?
It cannot log things. Just errors.
you can
console.error
they're trolling, zsnails lol
Ik
@earnest phoenix How tf?
I'm just bored lmao
Send a message in a channel then
Trolling is when you're pretending to be dumb or pranking someone, when you're actually smart or know it etc.
@earnest phoenix ```
rbd/pnpm-volume/3672d489-bc81-431f-946e-a054c7dc3828/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/client/Client.js:4239:35 AM
throw new TypeError('CLIENT_INVALID_OPTION', 'disableMentions', 'a string');9:35 AM
^9:35 AM
9:35 AM
what's your code
That's not the full traceback, is it
const Discord = require('discord.js');
const client = new Discord.Client({disableMentions: true})
const fs = require('fs');
const db = require('quick.db');
const moment = require('moment');
client.ayar = db;
const ayarlar = require('./ayarlar.json')
const snekfetch = require("snekfetch")
//require('./util/eventLoader')(client);
const DBL = require("dblapi.js");
const dbl = new DBL(ayarlar.dbltoken, client);
const ms = require("parse-ms")
require('events').EventEmitter.defaultMaxListeners = 70;
require('events').defaultMaxListeners = 70;
require("ms")```
you're using the wrong type
disableMentions? wtf
We do not spoonfeed in this server
You have the "bot developer" role
Who uses disableMentions? I mean ??
🙄
I just noticed shivæ is one of the mods.
image generator api
@earnest phoenix #topgg-api
Nooo
bruv
Cant even read channel descriptions
#topgg-api is for top.gg API stuff
well
uh
what
nvm
ping?
i got a ping here
@earnest phoenix Let me know if u have any of this api(s)
Dog , PNG - gif
Cat , PNG - gif
Hug , PNG -gif
Cookie , PNG - gif
@earnest phoenix u got the answer or want it?
i still need it
ok gimme 2min i will send ya
ok ,tysm ✨
idk of cookie...
its ok
just send the ones u know
for others :
lemme copy them from my code xd me bad in remembering these stuffs xD
Cat: https://aws.random.cat/meow
Dog: https://dog.ceo/api/breeds/image/random
Hug, Kiss, Slap, and many other actions : https://nekos.life/api/v2/endpoints (go to this link for endpoints)
@earnest phoenix
oh
nice
amma try them
ty
np
is this right?
client.on("message", async(message) => {
const command = message.content.toLowerCase();
if(command === Prefix + 'cat') {
let msg = await message.channel.send("Fetching");
fetch('https://aws.random.cat/meow')
.then(res => res.json())
.then(json => {
let embed = new Discord.MessageEmbed()
.setTitle(json.title)
.setImage(json.url)
msg.edit(embed)
})
}
});
for some reason it sends fetching then it sends a embed with undefined
@earnest phoenix ?
just a sec
u need to edit it a bit
it is not having same json.title and json.url
replace json.title with some text
and replace json.url with json.file for cat image & json.message for dog image API
mhmmmm
oh ok
every API is not same...
i didint know
Woah ... right as I clicked your profile @earnest phoenix you started VSC.
lol i am in VSC for more than 3 hours xD
making a custom bot for a client...
btw, no chatting here xD
As I clicked. ohh yeah lol
meme command is the easiest
Imgur API?
idk
she sent me a random api idk 🤣
https://nekos.life/api/v2/img/slap
oh
she
..

ok..
wait
r u a male?
yes
well shit
lmao
i didnt even know 🤣
sry
for hug cmd:
https://nekos.life/api/v2/img/hug
lol i dont really mind it xD
for this is it .setImage(json.file)?
imagine using client mods
just a sec... lemme check its api
@earnest phoenix don't use nekos.life
- your bot will get denied here
- it has nsfw images of younger chars (afaik)
lol we are not using nsfw tho xd
but i didn't know that
i dont want nsfw
although i used it in my custom bot xD
i am just making someone hug
also slap
idc if i dont use it 🤣
applied for weeb.sh about 3 months ago and yet no reply xd
¯_(ツ)_/¯
on a side note, is there any easy way in css to make an element opaque but not it's content
i am just a NOOB in website development... i just know basics for it so, idk about it xd
nvm got it
Happy b-day @bitter sundial
nice
why in #development
@commands.has_permissions(manage_channels=True)
Why this decorator makes other commands stop?
When I add this code, The whole commands are affected
@commands.command(name="name", usage="usage")
@commands.has_permissions(manage_channels=True)
async def _command_name(self, ctx: commands.Context):
pass
- discord.py 1.3.3
@sick cloud background: rgba(0,0,0,.5)
Oh shit, you already got it
Didnt read it
My bad
Let's just not (no matter if it's a lyric or not)
Also not the right channel to talk random bs in the first place
so er when i try scrolling my background dies
how do i fix that lol
i want the background to stay full screen and not move but let the content move fine
err that stretches it
@earnest phoenix my bot is finally done , thanks for every single character u wrote , it helped me a lot , and if my bot gets famous i will give u credit , u are such an amazing coder ✨
and i think we should be friends!
(if u want)
✨ ⭐
yeah that looks wrong
basically i want the image to fill the page fine but not scroll or move
Wait, you want that one pic to cover the whole body?
@earnest phoenix my bot is finally done , thanks for every single character u wrote , it helped me a lot , and if my bot gets famous i will give u credit , u are such an amazing coder ✨
and i think we should be friends!
(if u want)✨ ⭐
@earnest phoenix np it was great to help ya
wanna be friends?
So why are there 2 pics? Or is that the one pic?
ok i dont mind and also, no chatting here 
i want the bg to stay like this fixed but let the content divs scroll fine
So, it still moves even after background-repeat: no-repeat
yeah
Aight wait a sec
it does
works perfectly, cheers
No worries
one more question, is there an easy enough way to make a navbar that's fixed at the top of the page, disappears when you scroll down but appears when scrolling back up
currently my nav just stays at the top which is fine but you have to scroll up to change pages
So, you want it to be always visible?
pretty much, but only disappear when you scroll down
if you've used chrome on android it does that with its header bar
So, you want it visible the moment you scroll up?
yep
so while scrolling down and reading it hides, but when you scroll up at all it comes back
mmkay
Np
And yes, you can use costum ttf font files with @font-face iirc
how come i get crazy memory leaks whenever discord's api starts acting up?
is it something bc of djs and caching?
is there any way to make a border on a <p> extend the full content length
Like in the pic above? @sick cloud
yeah
the small border already there is only on the first line
but i drew how long it should be
already using it but it only puts a border on the first line
on what element did you use the border-left: 1px solid black;?
the p
Is all the text in the <p> tag?
hmmm, tbh i dont see why it doesnt work, only if you have an other <p> tag with <p>"to keep you"</p>
Could you send me the html code block?
This is probably gonna sound really dumb but how can I connect the vps IP to run my dashboard on a domain url
So instead of it saying "localhost:8080/dashboard" it says www.example.com/dashboard
put the code on the vps and set an A record of the domain name to the server ip
hmmm, maybe try this .quote{ border-left: 2px solid #140560; }
p.quote should have worked tho
put the code on the vps and set an A record of the domain name to the server ip
@sick cloud oh it's just an A Record
I know but we don't download modüle its get error
You need to install the module
We try but it always gets error
What error
Modüle don't download
Yes but what error
@short idol https://stackoverflow.com/questions/58965713/cannot-find-module-m3u8stream-lib-parse-time check here
How to check if a member has a specific word in name ? ( not nickname )
in what language and library
discord.js v12
Ok, thank you
dbl auto post stats and vote event doesnt work
@short idol update ytdl
Hey how to do phone number verification in lbc
.. please
lbc?
I made myself a custom version of the Client instance, can that be the issue?
Lbry
@short idol update ytdl
@summer torrent ytdl works fine for me
Please someone
@earnest phoenix which library
I have lbry account...and I can't able to phone number verification in my region.....so tell me additional method
I mean is this code/development related? Javascript, python, etc.
yeah youre definitely in the wrong place
Because this channel is for chatting about development
Where is the right place... suggest me please
Where I have to go for my problems
You are not using lbry...tell me as personally
what is lbry? Website?
https://lbry.com/
this? ^
Yes
I directed to this page
White theme
Please help me to solve my blunder problem
Hi, not sure if this is relevant, but I am having issues with Vs code live share and it asks me to sign in every time
So I'm trying to point my dashboard to my vps ip I have set the proxy but it says the website is down, now I made a, A record with the word guard as that is the beginning of the sub domain I want and pointed it to my vps ip with the port 80 open what have I done wrong here?
Its saying address already in use
Damn
like its not a network issue as my other bot works fine
i dont have any error logs
nvm its a network error
just wondering if someone can help me
im getting require(...) is not a constructor
var http = require('http'),
httpProxy = require('http-proxy')
const http = require('http');
const httpProxy = require('http-proxy');
const http = require('http');
const httpProxy = require('http-proxy');
@honest perch i tried that before and it said the same thing
did you installed http-proxy module
do you exporting that file :blobthinking:
@summer torrent yes it exports the whole command folder
did you installed http-proxy module
@tight plinth i did yes
What even is http-proxy
a proxy
Anyone know why my bot isnt logging anything? my friend keeps leaving and joinng my server hoping it will work but it dosnt. the logging thing is
client.on("guildMemberAdd", (member) => {
const channel = member.guild.channels.cache.find(
(ch) => ch === serverlogchannel
);
if (!channel) return;
let serverembed = new Discord.MessageEmbed()
.setTitle("New Member")
.setColor("#3f48cc")
.addField(`User`, `${message.member}`)
.addField(`Joined At``${message.member.joinedAt}`)
.addField(`Total Members Now`, `${message.guild.memberCount}`)
.setFooter(`👋 🤯`);
return channel.send(serverembed);
});
``` set log command
client.on("message", (message) => {
let args = message.content.substring(prefix.length).split(" ");
switch (args[0]) {
case "setlogchannel":
if (!message.member.hasPermission(["ADMINISTRATOR", "MANAGE_CHANNELS"]))
return message.channel.send(
"**error** You need the manage channels or administrator permission to do this!"
);
if (!message.guild.me.hasPermission(["ADMINISTRATOR", "MANAGE_CHANNELS"]))
return message.channel.send(
"**error** I don't have the correct permission to do this, Please give me the manage channel's permission"
);
serverlogchannel = message.channel.id;
const channel =
message.channel.id +
message.channel.send(`I have set this channel to the log channel!`);
break;
}
});```
ok thanks!
.find would loop through the collection. treat it as an individual channel for the function
channels have the id property that you can compare
flaze are you any good with DNS Records at all
probably not but I have set an a record for my vps
im trying to forward my dashboard to a subdomain
ive set the a record name guard and the target is my vps ip
what webserver is your dashboard using?
didn't work
well, did you define serverlogchannel in the event?
im using my localhost on the vps
how did you set up the dashboard?
@pale vessel i think i know why its saying the port is already in use
but it says that with any port i open in ubuntu
What is the best database host to use
localhost
I dont understand why when I run my dashboard its saying port 80 already in use but when I run s netstat port 80 isnt even on there
@winter yacht advantage: rust, runtime safety, possibly extra runtime speed
disadvantage: compile times, serenity doesnt fully cover the api, memory bullshit
Apache/NGINX/other already using Port 80
also from my experience, serenity doesnt scale at all
couldnt get a bot with 600 servers running
dropped events, api requests not going through, etc.
@mossy vine lifetimes are actually super useful
rust memory management makes memory leaks nearly impossible
If it's already known that port 80 is in use, why keep trying to use it?
@white anvil im not arguing that, im just saying that serenity often overcomplicates things
I save my Data with setting[message.guild.id + message.author.id] i want to get the array of the guild with all members. How could i do that ?
I know. But i dont want to change this now xd
I have a command to set this option for a user. Its easier with JSON and i restart my bot alot times.
var levell = JSON.parse(fs.readFileSync("./rqs/level.json", "utf8"))
var xp3 = levell[message.guild.id + message.author.id]
const jsonAsArray = Object.keys(xp3).map(function (key) {
return xp3[key];
})
.sort(function (a, b) {
return b.xp - a.xp;
});
return console.log(jsonAsArray);
This is my Code.
It isn't recommended to use a JSON db
@golden condor Heard that, but still using it xD
uh-oh, better do something soon
@clever tree try use forEach
Well, it depends. It isn't on some cases the worst, some cases it might be the best option.
Depends what data you save and fetch.
i want to get the array of the guild with all members. How could i do that ?
Do you mean you want to get a list of users from said guild?
@golden condor Could u give me an example for the forEacghh function i have to use to get every memberstats of that guild ? Im new to coding 😅
Ok
dont use forEach, use for in or for of, if you cant understand them
@sudden geyser I mean. I have my lvl in Json for every user+guild. Now I want to get all users from the guild and their lvl sorted from high to low for a leaderboard.
How is it stored
doesn't sound so good with json (if)
xp[message.guild.id + message.author.id] = { xp: 0, level: 1 }
If the object is every user and you want to filter it by the guild, you can use .filter and check if the key starts with the guild ID, then do the rest of what you were doing. Although, you should reasonably be using something other than JSON, it's not going to be my issue if you have issues down the line.
Anyone here uses code-server able to help me with something?
code-server?
yes
@sudden geyser Json is better for me. I restart my bot allot of times. When i change that i will go to db or sth. But i cant figure out how to get all memberxp for the guild.id
I mean. I store everything as guild.id + user.id
So idk how to get only the guild id for the array. :/
ah, it's a web vs code
yes
If i run it on older version, it works well but I have memory leaks (4gb memory almost). If I try a newer version, it won't work.
So I need help :c
I need someone who uses it so I can speak privately with him in DMs
Json is better for me. I restart my bot allot of times. When i change that i will go to db or sth.
Restarting your bot does not make any difference between JSON and a database like SQLite assuming you save it.
But i cant figure out how to get all memberxp for the guild.id
Like how you already havejsonAsArray, you got all the keys of the object. After that, you need to use.filterto check ifkey.startsWith(guildID). You'll then have an array ofguildID + userIDwhere allguildIDwill be a single guild.
idk if there'll be someone, most people use actual IDEs
this is an actual ide.
@sudden geyser Oh ok. To both. Thanks. I will try it out. Maybe I will get more into databases. But ... Its allot i gues xd
@sudden geyser I get an error when trying this : key.startsWith is not a function
var levell = JSON.parse(fs.readFileSync("./rqs/level.json", "utf8"))
const jsonAsArray = Object.keys(levell).map(function (key) {
return levell[key];
})
.filter(function(key) {
return key.startsWith(message.guild.id);
})
.sort(function (a, b) {
return b.xp - a.xp;
});
return console.log(jsonAsArray);
You should be filtering before you map.
@sudden geyser Thank you <3 :)
maybe the port is in use?
open task manager, resource monitor, click on network tab and see if any process is using port 8080
Would it not say something like EADDRINUSE if it were already being used.
is port 8080 allowed in firewall?
maybe try one of those port checker websites, to see if that port is open or being blocked
How could I map my function only from 1 to 10 ?
let rankindex = 0;
let embed2 = new Discord.RichEmbed()
.setColor("BLUE")
.setTitle(`${earthemoji} | **Top Global XP** | ${earthemoji}`)
.setDescription(`${jsonAsArray.map(rank => `**[${++rankindex}] -** **${rank.user}**: Level: ${rank.level} | XP: ${rank.xp}`).join('\n')}`);
What do u mean @earnest phoenix
i meant exactly what i said
...a for loop
Yeah. But how does it work
Thanks. I will try it out. xd
Sry for my stupidity
dbl auto post stats and vote event doesnt work, I made myself a custom version of the Client instance, can that be the issue, and how do I resolve it?
const { MessageEmbed } = require("discord.js");
const db = require("quick.db");
const ms = require("ms");
module.exports = {
name: "setup",
run: async (bot, message, args) => {
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("**Nu ai permisia necesara sa faci asta!**");
const filter = m => m.author.id === message.author.id;
let tag;
let role;
message.channel.send("Specifica un tag! Ai timp 30 de secunde pentru a raspunde!")
message.channel.awaitMessages(filter, {max: 1, time: 30000}).then(m1 => {
if(m1.first()) {
tag = m1.first().content;
db.set(`ServerTag_${message.guild.id}`, tag)
message.channel.send(`Tagul a fost setat la ${tag}`)
message.channel.send("Ce rol vrei sa atribui membrilor care au acest rol ?");
message.channel.awaitMessages(filter, {max: 1, time: 30000}).then(m2 => {
if(m2.first()) {
role = message.mentions.roles.first();
if(!role) message.channel.send("Specifica un rol valid!")
db.set(`ServerRole_${message.guild.id}`, role.id); //here
message.channel.send(`Rolul a fost setat la ${role}`)
message.channel.send("Setupul a fost finalizat cu succes !")
}
})
}
})
}
}
(node:4864) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
help ?
debug your code
its showing that theres too many connections on my database. So what does it mean? does that mean i need a better host?
it means you literally spam your database with connections and data
basically dossing it
That's a broad term, it may be the fact that his database only has one user limits, or two. Which are perfectly reasonable.
Damian, based on your SQL hosting provider, you may need a different host or to host the SQL environment on a Server elsewhere. Google should be able to assist further with that
how to react to message after the bot has sent it?
mymsg = sendmessage("eeee")
mymsg.react
^ but await sending the message
thanks
thanks for the info, anyone else have some experience with rust compared to nodejs for a discord bot?
@winter yacht compared in what terms?
there's a huge difference between those two, that's for sure
well, do you know rust?
rust is much better for performance, if you're looking for good performance then i'd use rust as node.js is not a thing you'd be using if you're looking for performance
yes, but it's not necessarily suited for everything either, at least not if you don't have very good knowledge of it
So I wouldn't recommend "defaulting" or switching to Rust if you have little or no prior experience
but you can certainly use rust for discord bots, there's one bigger library for it, too
serenity it's called i think
Bumping my question:
Anyone using code-server 3.4.1 or 3.2.0+? I need some help with it.
ur gonna get ratelimited if you don't put a cooldown on that btw
but just iterate through the member list
.forEach
@indigo flax have you figured out how to grab/create a invite to another server the bot is in?
what version of djs u use
sometimes it would
11.5.1
i could modify that
do u know how to kick or ban every member
i do not, i am new to js
just use forEach.
But I don't feel like you would ever need this for any reason (except harm). Also ratelimit is a thing.
make 2 second delay lel
just use forEach.
nonono... or actially yes or for in or for of oorrr for(func)
what sites would u guys recommend for sql database hosting
hosts rather considering i have multiple user requests at the same time
Can't you host it on the same server as your bot?
the last part of the post is irrelevant
huh?
since i asked for best? sure
current host is showing too many connections on my database
Is it a public database or what
how would I convert a map to a valid array so that paginaton can use it
serverQueue.songs.map(song => ++index + " - **" + song.title + "**" that's how I call for my queue list
${message.guild.owner.user.tag}(${message.guild.ownerID})```
TypeError: Cannot read property 'user' of null
my serverinfo command works in other servers except dbl
owner isn't cached so you have to fetch it first
you have to cache owner now?
well
just add a line of code if owner is not defined
you don't have to fetch it every time
yh I was gonna do that
okchamp
yessir
const db = require("../../db");
const config = require("../../botconfig.json");
const prefix = config.prefix;
let newPrefix = await db.get(`Prefix_${message.guild.id}`) ? await db.get(`Prefix_${message.guild.id}`) : prefix
help ?
@earnest phoenix
the message is in a dm
cannot read property id
Go to line 41. Are you missing a semicolon/color/etc.?
i am not too good in glitch but i think is missing a , on line 40
or dont use glitch
how do you create a role in discord.js
what version
@quaint hornet same problem with line 40 when i put ,
Remember that JSON is strict. There should be no trailing/dangling comma.
Hello, I receive a lot of PROTOCOL_PACKETS_OUT_OF_ORDER errors with my mysql database. I asked the host to change max_allowed_packet to 500M, they said they changed it but I still receive a lot of those errors. I'm using mysql.createConnection() and am closing that connection after I did the query.
I want to send content of the last 100 messages of a channel. My code work, but it send 100 times the content of the lastest message (only one). What's wrong?
channel.messages.fetch({ limit: 100 }).then(messages => {
for (var i=0;i<100;i++) {
var m = messages.first()
var msg_embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setAuthor(m.author.tag, m.author.avatarURL())
.setDescription(m.content)
.setTimestamp(m.createdTimestamp)
msg.channel.send(msg_embed)
}
})```
And, I don't know why, but my bot isn't offline:
```js
bot.on('ready', () => {
bot.user.setStatus("invisible")
})```
You're only getting the first message? messages.first()
@rose spire you are just getting messages.first() every time
Also why do you want to do that in the first place. That's quite spammy.
you can use an easier for loop like for (const m of messages.array())
Yeah, thanks!
no problem
Doesn't work...
channel.messages.fetch({ limit: 100 }).then(messages => {
for (const m of messages.array()) {
var msg_embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setAuthor(messages.author.tag, messages.author.avatarURL())
.setDescription(messages.content)
.setTimestamp(messages.createdTimestamp)
msg.channel.send(msg_embed)
}
})```
There's no messages.forEach?
... why do you want to fetch 100 messages and then re-send them all?
For archive them
thats not a very good idea, but oh well. You should use a for loop with async/await
@ancient sand see the all file and verify than only the last element of each value have no , example : ```json
{
"name": "name",
"version": "0.0.1",
"dependencies": {
"express": "^4.17.1",
"discord.js": "^12.2.0"
},
"engines": {
"node": "12.x"
},
"license": "MIT"
}
there is messages.forEach but dont use it
.then(async messages => {
for(let [id,message] of messages) {
let embed = bla
await msg.channel.send(embed)
}
})
But, how do I have a variable that changes with each message?
wdym
help
channel.messages.fetch({ limit: 100 }).then(async messages => {
for(let [id,message] of messages) {
var msg_embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setAuthor(messages.author.tag, messages.author.avatarURL())
.setDescription(messages.content)
.setTimestamp(messages.createdTimestamp)
msg.channel.send(msg_embed)
}
})
``````diff
- TypeError: Cannot read property 'tag' of undefined```
javascript out of memory
But, how do I have a variable that changes with each message?
@rose spire for each interation of the loop, the m gets another value
Luffy the keyword is: JavaScript heap out of memory
@rose spire message not messages
Oh, yeah, I see
Hello, I receive a lot of
PROTOCOL_PACKETS_OUT_OF_ORDERerrors with my mysql database. I asked the host to changemax_allowed_packetto 500M, they said they changed it but I still receive a lot of those errors. I'm using mysql.createConnection() and am closing that connection after I did the query.
@quartz kindle do you know anything about this?
your bot is trying to do some heavy stuff
its crashing on 2gb ram
is that 12mb or 12gb
gn
your vps have 12 ram
oh i see lol
lol
but how many you is putting to the javascript
@storm bluff try node --max-old-space-size=4096 yourFile.js
yourFile.js == server.js
??
yeah
yes, or whatever you use
oke
your bot is trying to do some heavy stuff
@quaint hornet
its crashing on 2gb ram
@quartz kindle
Is that about my question?
One last thing, if there is a image with a message, how can I get the link?
sorry for all those mentions but I want to keep things clear 🙂
message.attachments is a collection of attachments
each attachment has an url property
@rose spire
@nocturne grove it was for luffy
idk about that error, havent seen it before
ohh I'm sorry didn't see that
@quartz kindle not work
hmm okay
@storm bluff ?
do you use pm2?
do you track cpu/memory usage ?
pm2 is best lmaooooooooooo
you never did anything to check how much cpu/ram your bot is using?
like task manager? or vps admin panel?
oh it is a windows vps
interesting
this shit pissing me
imagine making a bot from mobile with "mobile ssh"
oke
its like you bot is making something than he dont have a permission
in a server
like delete a message
@earnest phoenix i have pc and i using pc for coding but
When im not home then i see if bot is ok or no
logic
1GB
Ok, i understood sorry.
@storm bluff ram?
yup
??
3
lol
this bot is a testing bot
what
wtf
your bot is on 3 servers?
how
then you have a severe memory leak
3 servers are using 2 GB of ram
LOlo
you are render videos or 8k images? for all at same time?
your testing bot has a problem
servers
you need to fix it
how
i dont know, look in your code
i can show the problem
undefined when there is an attachement?
if(message.attachments) {
msg_embed.setThumbnail(message.attachments.url)
}```
someArray.url?
What's wrong? 👀
You're trying to access a url property of something that doesn't have such property
@quartz kindle tim how i can show the err
idk how
use progrem or what???
?
But what is that?
https://discord.js.org/#/docs/main/stable/class/MessageAttachment
how can i fix this problem @quartz kindle
the problem is your code
i cant help you
you have a memory leak or an infinite loop somewhere
a bot on 3 servers cannot possible use 1.4gb ram
unless its on a server with like 500k members
so your code is doing something bad, you have to find it, you coded it
hello: Is there a way I can send a join message and have an icon reaction in the middle of that message: example "Click the bell for access: 🛎️"
Where do you want to send the join message?
when a new user joins the server, I want to send that message to a welcome channel. "welcome... blah blah.. click here for access: 🛎"
Oh, that's not possible with bot accounts. You can use reactions and tell the user to react with X emote, though
i mean, if it was an embed and the bell was a link
I cant believe nobody has come up with a fix for that. Inline reactions. 😄
you could use a embed
A hyperlink in an embed sounds appropriate, yeah
i'd just go with reactions personally though
I have new users that keep getting confused by the reactions on the bottom of the message. (keywords: New users) they don't get it, no matter how you word the message. I thought it might be simpler to inline the reaction.
Understandable then
ah i see
i guess what you could do is generate a url that has a special code for that specific user in it
you;d need to have a webserver that could get that code and send a webhook or something similar to your bot
Flower Image API ?
GET
discord.js
PNG - JPEG
v12
how do i know how many guild(s) my bot is in?
Discord.js v12
@rapid plaza "development"
oh sorry
You forgot []. [@earnest phoenix]
Is it possible to send notifications to everyone in the sever when a youtube vid goes live or any other socials?
yes
how would I turn a map into an array
message.lower() that is how you lower case the msg right? in py
assuming message is the content, yes
cog = bot.get_cog("PrefixStore")
message.lower()```
thats my code
so yeah?
@pale vessel that doesnt work
wait nvm no its not a string
how did that not throw any error
message has no attribute lower()
wait may i ask how do you handle commands if user types em uppercased
make them lowercased lul
that what i wanna do lol
check for the content attribute in message
i'm not sure how to in dpy
or python in general
wait i got this now
commands.Context = commands.Context.lower()
self, message: discord.Message, *, cls=commands.Context
) -> commands.Context:
```
it gives me error with context on second line
what u trying to do?
how would I turn a map into an array so that I can use it in an array embed
my song queue is a map but I would like to make it an embed with pages
but to do this I need to make it an array
@torn ravine a map has both keys and values, which dont translate to a 1 dimensional array
is there a way I can use an array instead of a map?
i have no idea why its a map in the first place
Can't you just be like .map(e=>e.DesiredProperty) or am I missing something here?
i don't think you can map a map lol
looping fishy on me until my bot reaches 20 users
been going for 3 hrs by now
i need 5 more guilds to add it
bruh this song
is
earrape
ok but does this have to do with development though
wrong channel
if6, you can try iterate through the map
go to #memes-and-media
when I started programming I used maps
refactor your code
yea there is alot of stuff I gotta clean up now that I think about it
.setThumbnail(user.avatarURL) why does this not work? user is message.author
first off, what's your discord.js version
How do Isee that again?
12.2.0
avatarURL should be a function in v12
So?
try making it a function
Alright ty
-wrongserver
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
It said to come here ;-;
Where
How do I add a blank field
use the unicode character
?
Is it possible to send notifications to everyone in the sever when a youtube vid goes live or any other socials?
How do you do this?
idk, ifttt?
you utilize the youtube api to get a websocket connection to youtube and a ws message whenever a selected streamer goes online
and combine that with a @everyone and there you go
Is there a code for it?
oh god
there are several but i wont spoonfeed
Will there be some on github?
maybe
How do you do this?
Add a command rha mention everione in a server when called and put the link tha has been requested in comand like
!newvideo url
Alright
Try it and see
@quaint hornet where do I put the url?
On the argument of comand
You can get the server notification channel to send the message of url or just ask on comand
Wdym?
Do you have an example of the code?
When te bot receives a message you cant split it by spaces
When te bot receives a message you cant split it by spaces
@quaint hornet you can't? wdym
why can u not
When te bot receives a message you cant split it by spaces
@quaint hornet you clearly don't know what you're talking about
@earnest phoenix Depends when you run the command. if ALL the command file does is delete one message, it would delete your command you typed..
If your command replies, THEN deletes, it will delete its own reply... etc etc
Delete again in your command file
Run another message.delete() or whatever you are using
Best to add a delay also. So the user has a time to read the reply before its deleted.
await message.channel.send(message.author+' This is the reply!!.').then(d_msg => { d_msg.delete(5000); }).catch(error => console.log(`Error: ${error}`));
@earnest phoenix
How would I put total members in my bot's status like this:
Playing c! | (servers) servers | (amount of users across all servers) (users)
@jade jungle guild.memberCount ??
@jade jungle bot.guilds.cache.size = guild count
bot.users.cache.size = user count of all guilds
^ If you want the total user count, you're going to want to iterate through each guild and add up .memberCount
how i do a exec with child_process? (js)
And is very much a cleaner way to do it @earnest phoenix . Cheers 🙂
@quaint hornet you clearly don't know what you're talking about
i know what i am talking just dont know how to speak it correctly in english (my country dont have english as main language)
I made a pay command and there is no errors but when I try to pay someone it doesnt respond the only time it says anything is when i do c!pay but not when mentioning or saying a users name
Anyone have any idea how to fix?
This is the code: https://sourceb.in/58b834a696
how would i make it so that my bot dosent join a server
so its kinda like
"blocked"
from the server
so if they try to invite him he just leaves
message.delete() shold resolve it
I made a pay command and there is no errors but when I try to pay someone it doesnt respond the only time it says anything is when i do c!pay but not when mentioning or saying a users name
Anyone have any idea how to fix?
This is the code: https://sourceb.in/58b834a696
Can anyone help?
how would i make it so that my bot dosent join a server
@astral yoke:
function guildCreate( guild ) {
if( disallowedGuilds.includes( guild.id ) )
guild.leave( );
}
tysm







