#development
1 messages · Page 1209 of 1
that's still valid
oh
hover over the red circle
Hi, i have a problem..
I create a mysql connection when it is needed. I listen for the "PROTOCOL_CONNECTION_LOST" event, to catch terminating idle connections. Code here: https://hastebin.com/yidozaguwa.js
At first it seems to work.. After the connection is idle it gets terminated, the event is fired and i remove the connection. when i make an action that needs the connection, it is also successfully recreated again.
However, when an idle connection is already terminated and i dont need and recreate it again within about 5 to 10 minutes, then i get another PROTOCOL_CONNECTION_LOST event that is not handled by my code.
I dont understand where that second similar (unhandled) event a few minutes after the first (handled) event comes from, any ideas?
Which scripting language you're using?? OwO
@earnest phoenix
Yo
Heyo
Which scripting language you're using?? OwO
@earnest phoenix there is a difference between a programming language and scripting language
OwO
they're using a programming language
wtf am i even trying to say
A scripting language is a programming language
OwO what is the difference between Scripting language and Programming language
Dêv
there isnt,
i see the difference don't you
have you read all of it?
scripting languages are translated into another language and then converted into binary
someone call a doctor i am losing my mind and might die
example: python is written in C first python gets converted into c and then gets run
someone call a doctor i am losing my mind and might die
@earnest phoenix If u die then I'll get your Golden Apple
JS is translated into CPP, right
@earnest phoenix If u die then I'll get your Golden Apple
@earnest phoenix 🤣🤣🤣🤣🤣🤣🤣
Hello! does anyone here know how i can override the default help command? I'm using eris
someone call a doctor i am losing my mind and might die
@earnest phoenix If u die then I'll get your Golden Apple
@earnest phoenix haha i have keepInventory on
1 Golden Apple= Death of Ender Dragon
Hey, my permissions don't apply to the new ticket channel but it working before
the code https://hasteb.in/egeganej.js
v8 is written in cpp
please explain your problem better
Me ?
idk about nodejs
Hello! does anyone here know how i can override the default help command? I'm using eris
v8 is written in cpp
@digital ibex who in their right mind would saycppinstead ofC++
ur mom
Hello! does anyone here know how i can override the default help command? I'm using eris
@elder loom don't send the same question twice
wait for someone to help
Me ?
@potent ferry yes
alright
Hello! does anyone here know how i can override the default help command? I'm using eris
@elder loom just a sec I'll send you docs
do the overriden permissions not work in new ticket channels?
yeah this grammar is totally correct
lol
When i use my command, the channel is create but the permissions don't apply
sorry for my english I'm french
lemme see your code
the code https://hasteb.in/egeganej.js
r u-
that's discord.py
i said i was using eris
let membre = message.guild.member(message.author);
membre???
lol
is eris a programming language i thought it was your name
yes ?
eris is a library mate
oh
is eris a programming language i thought it was your name
@wanton anvil eris is a library
ok
wait that's french
what is french
what is?
yes code913
well umm
me doesn't know french
so i can't figure out if membre is a typo or a French word
french word
wut
many people did
wait i think i found the answer to my question.
Who
?

eh
so is there anyone that can help me how i can override the default help command using eris?
Eh what?
hey guys can you help me cuz i need a
reddit meme code with the prefix 7meme pls
BTW dm me da code
or here
Asking to be spoonfed
stfu
chill bruh
i am
You not
Nah, do commands yourself
We won't spoonfeed code here since it's not allowed
and it is dumb*
ok
(Rule 8a I think)
np
We only help with helping to understand how to do X or Y
ok
@viral spade i have no idea, but something you could try is ensure the connection is property killed after the error happens
for example, add a conns[dbHost].destroy() before deleting it
We only help with helping to understand how to do X or Y
@slender thistle or Z
Z doesnt deserve help
thats Z'cist
can this type of thing be converted into a discord.User object
a string into a discord.User object
i mean you could just fetch api info and manually map it
but i dont know if d.js has a reverse method for that
basically the opposite of toString()
fromString() ?
ye
what string?
Can anyone help me
same thing
nvm
Pls
its automatically converted to a mention, so you can use message.mentions
but you can still parse it from text
My bot wont stay online
Hi I am using discord.js/discord.js-light and i listened for the debug event because my bot would come online and function properly but then after a couple minutes, went offline, every single time and then I used the debug event, and this happened and I have no idea why this keeps happening:
Discord.js
and this is continually spammed in the console
Lol
and this never seemed to happen before so I am very confused
It seems like it always sends one heartbeat, which is acknowledged and then it sends another which isn't and then the bot comes offline but it doesn't exit the process
i've seen people complaining about that in discord.js
not sure what can cause it since it never happened to me
do you use client.ws anywhere in your code?
Hey Tim, I'm using discord.js-light, and there's this really weird problem. Every time I try to send a message, I get the error "Cannot send empy messages". The error doesn't occur when I am using discord.js, and strangely, when I am testing the script with a bot which is only in a few servers @quartz kindle
I am assuming it's from dicord.js-light since I don't get any errors when I'm using the normal discord.js
tims overthrowing discord.js with discord.js-light
@cinder patio are you sending an embed?
try doing .send({embed: variablename });
i keep getting that error on discord.js on there latest version
and that seemed to fix it
Does anybody remember when i was trying to get my bot to send messages every 10 minutes? well.....my whole server is now filled with "depression has entered the chat"
That fixed it. So it's a problem from discord.js, sorry Tim
yeah it seems to be a discord.js problem lmao
does it happen in normal discord.js as well?
yep
yea
after updating it... it kinda broke lmao
kept saying it couldnt send an empty message when it was an embed
have fun haha
@golden condor how many shards do you have
1
and are you killing your shards in your code?
Well I don't have any
or killing the bot
No I don't
both latest version?
Yes
I literally have got one place where I destory the client which is the reconnect command but I log back in
the easier way to fix worrying about sql injections is by using ?
is it possible to define your parameters like this? sql.get(`SELECT * FROM accounts WHERE id = ?`, [message.author.id])
What does ?` do?
That should work
well in nodejs when using mysql it creates it into a parameter so you can define the variable externally
What library are you using?
it helps prevent sql injections
Oh I see nevermind
Ah I see, okay. Thank you 🙂
np
doesnt SQL use VALUES() syntax or only for insertion?
only for insertion
'SELECT * FROM table WHERE id = VALUES($1)
to insert data you do "INSERT INTO table (column, column2) VALUES(value1, value2)"
interesting
for selecting you dont need to say that its a value
i see
Oh I see, okay. 😮
even though .get itself should protect from doing stuff like cat"; DROP TABLE table;
its always a good idea to practice security with queries
It's still good to get into the habit even from parameters you're certain won't be forged like guild ids
fat oof lmao

@split hazel Yeah true. Alright, thanks guys 
that all in 5 h
gg
Pfff that's what databases are for 
How do i make my bot send an image?
what library are you using?
huh
there is multiple different librarys to talk to the discord api
wdym
if you are using discord.js you can do .send({ files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048'] })
thats it?
that is a URL
according to the discord.js docs haha
https:// means URL, u dum?
that may work @earnest phoenix
not sure if it would be considered safe as its just a variable and not a statement
what package are you using for sql queries?
Codes snow, and foam ur code is now in my bag :3
(I suck at rhyming)
ive never actually worked with sqlite
Me neither
I mean, ehh, i'm new to coding discord bots, so im new to everything follwoing: json/Javascript or Node.js or VS code
use prepared statements
in that screenshot i just posted shows how you use a prepared statement
would make it much more secure
yep
use ? if you want to use variables
then define those variables outside of the SQL
should be easy enough to setup what you want to do working with that
@remote ivy btw what exactly is the issue with djs, does .send(embed) not work when embed is an instance of MessageEmbed?
yep that is what the issue is @quartz kindle
.send(embed) works fine for me
i uploaded my bot to a VPS and updated to the latest discordjs version and it decided to just break and wouldnt send any embeds
As well as .send({embed:embed})
until i did .send({embed: varname })
someone added my bot server then my bot crashed when it trys to start
here is the server id : 532753259740266506
@earnest phoenix if the embed variable is called embed you can just use .send({embed})
@earnest phoenix the problem is your bot not the server, check your bot's code and look for errors
how did you code your bot?
what you mean
alright, did you check your console?
how does one get certified developer 😉
client.on('ready', e => {
client.guilds.get("532753259740266506").leave().catch(err => {
console.log(`there was an error leaving the guild: \n ${err.message}`);
})
})
does any error appear in the console?
i added this command for leave that server but
bot doesn't get ready
nothing in console
sometimes it says someting take too long to do
add this: client.on("debug",console.log)
Alright, thanks buddy! ❤️
Why is DSL bot offline
how can i make the bot chose from 2 diffrent answers?
Put both choices in an array and math.random it from 0 to array length then just index the choice with the number that the math.random returns
We know no need to bump just ask don't ask to ask
You forgot the colon after 'purge'
Also instead of a billion IFS at the top just use a switch much easier
also wtf why not toLowerCase()?
Also unnecessary space after (PREFIX.length)
How Are You,
how Are You,
How Are you,
How are you,
How are You, @earnest phoenix
you can solve all that by just toLowerCase() it
Heck I didn't even realize all the IFS pretty much do the same thing I would of mentioned it lmao 😂
lemme do some math rq just out of curiosity
9^2
512
512 possible combinations that you can solve with a simple toLowerCase()
just used math to see the combination
imagine writing 512 if's to match every single case
That'd be painful
what u trying to do again?
I created an application. if you enter an incorrect information, it throws it on the error page, but it gives this error in console log and the website closes.
specify the roles that are able to purge or check if the user have the permission to manage messages
I'm getting a error with this ```js
await message.channel.messages.fetch({ limit: amount }).then(message => {
message.channel.bulkDelete(amount, true).then(message => {
message.channel.send(SuccessfullyDone);
});
});``` trying to purge messages, 'bulkDelete isnt defined', I've logged message as well https://hastebin.com/xetebozafe
@remote ivy Will it work for sql.all too and sql.run? Example: sql.all(`SELECT id FROM servers ORDER BY id DESC LIMIT 5`) & sql.run(`DELETE FROM warnings WHERE guildId = "${message.guild.id}" AND userId = "${user.id}"`) etc.
yep
sorry xd fixed
@still merlin messages.fetch() returns a collection of messages, not a single message
so .then(message <- this message is a collection, not a message
therefore there is no message.channel
you dont need to fetch them, just bulkdelete them directly
message.channel.bulkDelete(amount)
oki thanks
if you want to bulkdelete specific messages, then fetch them, and use the fetch result in the delete
.fetch().then(result => message.channel.bulkDelete(result))
@remote ivy But should I worry if it's just sql.all(`SELECT id FROM servers ORDER BY id DESC LIMIT 5`)?
yeah
^I'd say no
You can't do an SQL injection when you can't give it any arguments 
even .get should be using prepared statements as it can return data that its not supposed to
^ i have a feeling that hes talking about using sql.all and sql.run and not the actual query itself
if hes talking about the query then absolutely no need
should be fine to use
the only attack vector in an sql statement is user input. if a query has user input, you have to protect it. if it doesnt have any user input, it doesnt matter
@quartz kindle Ah I see
nope
Yeah I'll protect it anyways
yes, its good practice to use prepared statements in all queries
Thanks
it also helps with code consistency and styling
@remote ivy top.gg had a certified program thing, but its in hiatus atm afaik
Hey
hi
not the place for that
is mongoose the best way to go for mongodb in nodejs?
function botVotes(){
dbl.getVotes().then(votes => {
votes.length
});
}
message.channel.send('I have ' + botVotes() + ' votes!')
Should this work?
I always have problems with promises
mongoose is an option, not necessarily the best nor the worst
dnt really understand how they work
@ionic dawn no that wont work
then you use .then(), the result will be given in a new context, long after the old context ends
the .then() never returns to the original context
its like spawning a separate process to run it
hmm.. but I have to use the .then to be able to have the number of votes on screen
right?
ive been reading and I have to use the .then to resolve the promise, again I still reading about promises, dnt really get them
should I use await in async fnct?
yes
you have to await it
async function botVotes(){
let votes = await dbl.getVotes();
return votes.length
}
message.channel.send('I have ' + await botVotes() + ' votes!')
mongoose is an option, not necessarily the best nor the worst
@quartz kindle do you have any other better options?
@gritty bolt i dont use mongo
sql is another option (sqlite, mysql, mariadb, postgres)
i use sqlite
r u on 14.8 or newer?
if not, you need to add (async() => {})(); iirc
^ lower than 14.8.x
thats why promises are better, cause no callback hell
let add = client.channels.get("740591444963885129")
const eklendim = new Discord.RichEmbed()
.setTitle(`:inbox_tray: Sunucuya Eklendim`)
.setTimestamp()
.setColor("GREEN")
.setThumbnail(guild.iconURL)
.addField(`:clipboard: Server İsmi`,guild.name)
.addField(`:id: Sunucu ID`, guild.id)
.addField(`:crown: Server Sahibi`,guild.owner.user.tag)
.addField(`:id: Server Sahibi ID`,guild.owner.user.id)
.addField(`:busts_in_silhouette: Üye Sayısı`,guild.memberCount)
add.send(eklendim)
});
client.on("guildDelete", guild => { // sunucuya eklendim ve atıldım
let add = client.channels.get("740591444963885129")
const eklendim = new Discord.RichEmbed()
.setTitle(`:outbox_tray: Sunucudan Atıldım`)
.setTimestamp()
.setColor("RED")
.setThumbnail(guild.iconURL)
.addField(`:clipboard: Server İsmi`,guild.name)
.addField(`:id: Sunucu ID`, guild.id)
.addField(`:crown: Server Sahibi`,guild.owner.user.tag)
.addField(`:id: Server Sahibi ID`,guild.owner.user.id)
.addField(`:busts_in_silhouette: Üye Sayısı`,guild.memberCount)
add.send(eklendim)```
@quartz kindle
try (await botVotes())
and im using 12.16.3 @restive furnace
is it bot.cache.guilds.get or bot.guilds.cache.get for guild IDs
@quartz kindle still saying Unecpected identifier
cause im pretty sure starting my index file im going to get lots of errors
@ionic dawn is the place where you're using it also an async function?
it has to be async as well
kk let me try something
cause my embed is outside the func
but.. should be outside the funct right?
Almost all my commands work fine other than my mute command, 'execute is undefined'
Can someone help please?
that means the command was not found
the file where command is or the command location isnt founded
@quartz kindle can I send you the whole thing at dm? mayb im missing somethin idk
Almost all my commands work fine other than my mute command, 'execute is undefined'
@still merlin use a command handler plz
like
I'm using a command handler
try client.commands.get(command).execute(...) catch errors
here no
also your mute command does not have an execute function to execute
wait no
the command "mute" was not found
hey
const Discord = require('discord.js');
const fs = require("fs");
const canvacord = require("canvacord");
module.exports = {
name: "delete",
category: "image",
description: "Delete Meme",
run: async (client, message, args) => {
const text = args.join(" ");
let avatar = message.mentions.displayAvatarURL || message.author.displayAvatarURL({ dynamic: false, format: 'png' });
let image = await canvacord.delete(avatar);
let attachment = new Discord.MessageAttachment(image, "deleted.png");
return message.channel.send(attachment);
}
}```
even if i m mentioning someone
Hello
does anyone know how i can overwrite the default help command? (i'm using eris)
if there's no option, don't use the commandclient, use client instead.
@remote ivy For this SELECT * FROM table WHERE col = "${message.guild.id} AND row ="${test}", should I do WHERE col = ?, "${message.guild.id} AND row = ?`, [test] or something.
alright thanks
@earnest phoenix do WHERE col = ? AND row = ?", [message.guild.id, test]
Thank you
@ionic dawn you cant use .then
Thanks for everyone's help! but i just found out there's something called bot.unregisterCommand so i just did that with the default help command and my problem is solved now.
I have a question is message.guild.name names of channels/guilds put in cache?
or can I keep my code simply as reply(message.guild.name) as an example
client.channels.cache is a thing, if thats what u asking
no i meant what I said "channel.cache.send" in order to send messages

@weak rain okay... what am i looking at?

Somebody knows how to post a message using Discord webhook with Node.js http lib ?
Na sorry @solemn merlin
i mean it should be simple
the url is the webhook
then just add the headers/payload
im familiar with axios, but any http library should handle the request is a similar fashion
url => headers => body
Yes but http lib need a port
What iss the webhook port ?
const Discord = require('discord.js'); const fs = require("fs"); const canvacord = require("canvacord"); module.exports = { name: "delete", category: "image", description: "Delete Meme", run: async (client, message, args) => { const text = args.join(" "); let avatar = message.mentions.displayAvatarURL || message.author.displayAvatarURL({ dynamic: false, format: 'png' }); let image = await canvacord.delete(avatar); let attachment = new Discord.MessageAttachment(image, "deleted.png"); return message.channel.send(attachment); } }```
heres the code
why does it need a port?
its a POST request
you dont need any ports on your end for a webhook @solemn merlin
@weak rain and i explained to you that you havent described any error
i explained
@quartz kindle isnt working without the .then, cant display it at the embed
if the embed is outside the thing wont workt 
first()
Ok, I'll manage to do it in another way, ty ^^

error is
The webhook that top.gg send, does the header have something like "user_id" with the id of the discord account that vote ?
message.mentions?
@opal plank yes
@solemn merlin user
@solemn merlin OH you mean THAT webhook
i thought you meant discord's webhook
not top.gg webhook
No @opal plank I was first speaking of the discord webhook x)
But now of the top.gg
@ionic dawn show code
oh i see
Ok ty, the TEST request send an user ?

@solemn merlin you mean "Test button" ? It triggers webhook with your ID
@weak rain mentions.users
kk
Ok ty
?
I got "undefined" for the user headers
fs.appendFile('console.txt',request.headers['user'],function (err){if(err){throw err;}});
lemme check the types rq
@solemn merlin
same error
im assuming this is body
?
i need codes
This is barely my codes
@mellow marlin we dont spoonfeed here
var fs = require('fs');
http.createServer(function(request, response) {
if(request.headers['authorization']==process.env.apiKey){
fs.appendFile('console.txt','==Requête de Top.gg===\n',function (err){if(err){throw err;}});
fs.appendFile('console.txt',request.headers['user'],function (err){if(err){throw err;}});
fs.appendFile('console.txt','\n==Fin requête===\n',function (err){if(err){throw err;}});
response.writeHead(200, {'Content-Type': 'text/html'});
response.end('<p>ok)</p>');
}else{
response.writeHead(200, {'Content-Type': 'text/html','connected':false});
response.end('<p>no.</p>');
f//s.appendFile('console.txt','',function (err){if(err){throw err;}});
}
}).listen(8443);```
@solemn merlin what i sent above is the response
Yep but you have "user"
@mellow marlin we dont spoonfeed here
@opal plank arab ?
Imagine not supporting queries in your webhook
im not sure tbh
That I didn't got
@mellow marlin no, english
Bruh idk how to get the payload, only the header
@mellow marlin no, english
@opal plank ok
should be in Body
Parse the body as JSON, get user key
^^
So request.body ?
i was about to check if there was a header saying if it was json
request.json might be a thing
im not too sure either, most of the stuff i use is express(which is similar) and axios
Ok ty (I'm really not web dev, I just need to make a thinks with webhook lmao)
And the worst is that with Plesk I can't add modules
Ye but I can't add modules
oh i see
why you can't
Plesk$

I have a vps but fully use for my bot
So I have this:
{member.user.displayAvatarURL({ format: png })
``` and for any reason ``png`` is not defined. anyone knows why?
Oh, okay!
What
saying invalid syntax
What are you trying to do?
when will i know my bot it approved?
check to see if bot is alone in vc
k
How well do you know JavaScript? (@drifting wedge)
its python
yikes
I was putting that into js
len(voice_channel.members) == 1
Does py use .s to access obje-
Shiv is py wizard
if the bot is in a vc alone then the length of voice channel members will be 1
What is len 
So len('Hey') == 3
So, I want to make something like wfakequote Username | Text hwo can I do the text split? (discord.js v12)
What language Vale?
discord.js v12. Sorry, forgot that
let cum = message.content.split("|")
NodeJS.. use .split('|')
i lowkey wish this server could make multiple development channels and specify a channel for languages
Wait
i lowkey wish this server could make multiple development channels and specify a channel for languages
This is brilliant
How can I do it with args?
Add .trim() after
Okay
when the bot is approved on the top.gg website will they put it on that server? like to do tests on the bot and etc.
How do I get a role?
I get this error
Uncaught Promise Rejection TypeError: message.guild.roles.find is not a function```
when i tried this
```js
let muterole = message.guild.roles.find(role => role.name === "muted");```
And with args?
@fringe axle I named it cum because it's an array like args
@still merlin discord.js V12?
Hmmm
yes
when the bot is approved on the top.gg website will they put it on that server? like to do tests on the bot and etc.
Sorry
But yes they will
let muterole = message.guild.roles.cache.find(role => role.name === "muted"); @still merlin
Don't spoonfeed
thankyou very much
Did it
The what
Regex time!!!!
let text = message.content.split("|").trim();
Do message.content.trim().split("|")
Okay
replace(/\s/g, "") to remove whitespace
And with args.join?
Just use .trim
How?
/\|| | /g 😄
Regex is not fun
Okay
Does that remove all spaces
No
You want to see the code?
Spice the shit
Because you split the message content?
Split the args
Make sence
Hello all, I had to go earlier and didn't have a chance to finish so could I have some help with this:
#development message
async run(message) {
let argsC = message.content.split(" ").slice(1);
let text = argsC.join(0).trim().split("|");
if(!text) {
message.say(`Please provide a text!`)
}
let member = message.guild.members.cache.find(m => m.user.username.toLowerCase() === argsC.join(1).toLowerCase()) || message.member;
const userFlagsA = await member.user.fetchFlags();
const userFlags = userFlagsA.toArray();
var image = await canvas.quote({
username: `${member.user.username}`,
message: `${text}`,
color: `#ffffff`,
image: `${member.user.displayAvatarURL({ format: 'png' })}`,
});
return message.channel.send(new Discord.MessageAttachment(image, 'fakequote.png'))
}
}
``` Whole code.
I define args manually with argsC, don't ask.
Do slice(1) on cum
lol
@golden condor are you destroying your shards? it might be d.js-light related issue if you're not doing anything wrong.
I don't have cum
Hi I am using discord.js/discord.js-light and i listened for the debug event because my bot would come online and function properly but then after a couple minutes, went offline, every single time and then I used the debug event, and this happened and I have no idea why this keeps happening:
Just gonna bring this down
At the end?
@golden condor are you destroying your shards? it might be d.js-light related issue if you're not doing anything wrong.
@restive furnace no I'm not
Okay xD
Haven't told him about it
return await msg.voice_client.disconnect(), await msg.send(f":lp: Disconnected from Voice Channel because it had no users")
else:
return```
this is giving me error
return error
But it only seemed to happen this morning
I changed nothing
Da actually fuq
Unless fetchAllMember could have an affect
@fringe axle console.log the Argy boyes
But I enabled it yesterday and it worked fine
@golden condor doesn't discord.js-light show you when you're ratelimited?
Uhh
Try disabling the fetchall
And I am not declaring intents
Can someone help? :0
Okay
My brain slow
Sec done
Try disabling the fetchall
@pure lion it worked yesterday tho, could it be to do with my WiFi?
Are you hosting on your net
Yes atm
Because I'm just testing out code and stuff
I test on my webserver 8)
I'm still coding it so there is no point putting it into the vps but I can try
Yeah try that and if it works then 😄
Alright
Someone now? ;_;
async run(message) {
let argsC = message.content.split(" ").slice(1);
let text = argsC.join(0).trim().split("|").slice(0);
if(!text) {
message.say(`Please provide a text!`)
}
let member = message.guild.members.cache.find(m => m.user.username.toLowerCase() === argsC.join(1).toLowerCase()) || message.member;
const userFlagsA = await member.user.fetchFlags();
const userFlags = userFlagsA.toArray();
var image = await canvas.quote({
username: `${member.user.username}`,
message: `${text}`,
color: `#ffffff`,
image: `${member.user.displayAvatarURL({ format: 'png' })}`,
});
return message.channel.send(new Discord.MessageAttachment(image, 'fakequote.png'))
}
}
someone? ;__;
?
wfakequote Hi! | Tim
Hello I am in need of assistance :/
if (oldMember.user.avatar != newMember.user.avatar){ await embed.setThumbnail(newMember.user.displayAvatarURL({ dynamic:true }).replace('.webp', '.png') + '?size=2048'), embed.setTitle(`Profile Picture Update`) } else {}```
so I coded this to work whenever a user changes something about themselves
it goes through a list of if then statements in a way
but for some reason
this avatar thing doesnt work at all
it sends the basic embed that i created. but doesnt add anything in for this avatar change.
all the other ones I made do work, help?
@fringe axle you're adding 0,0 to it because you're joining with a 0
@fringe axle first remove the command: .split(" ").slice(1).join(" ")
then split the delimiter: .split("|").map(t => t.trim())
then the result is [0] the text, [1] the user
is there a way to have my bot only respond to a message if its sent by me?
check if the author of the message has the same id as you
under your message event
do ```js
if (message.author.id === (YOUR DISCORD ID HERE) {
} else {}```
^ or that;
if(message.author.id != yourID) return;
either way works tbh
tru tru
Can anyone help me with this https://discordapp.com/channels/264445053596991498/272764566411149314/750746714058784780
ok thanks
uh yeah what version of discord.js are you using Creepa
12
make sure to use cache to get required information
well it gets my information
so like oldMember.user.cache.avatar;
hmm
you see what im using gets me the guild member object
@quartz kindle you there?
client.on('guildMemberUpdate', async (oldMember, newMember) => {
if (oldMember.guild.id === '700847999076663566') {
const patroncheck = client.guilds.cache.get('700847999076663566');
const patronrole = patroncheck.channels.cache.get('746276368785997844');
if (oldMember.nickname === null) oldMember.nickname = oldMember.user.username;
if (newMember.nickname === null) newMember.nickname = newMember.user.username;
let embed = new Discord.MessageEmbed()
.setColor('ORANGE')
.setAuthor(`${newMember.user.tag}`, `${newMember.user.displayAvatarURL({ dynamic:true }).replace('.webp', '.png') + '?size=2048'}`)
.setTimestamp()
.setFooter(`User ID: ${newMember.user.id}`);
// Roles
if (oldMember.roles.cache.size != newMember.roles.cache.size) { await embed.addField('Old', `${oldMember.roles.cache.filter(r => r.id !== oldMember.guild.id).map(roles => `<@&${roles.id}>`).join(" ") || " No Roles."}`, true), embed.addField(`New`, `${newMember.roles.cache.filter(r => r.id !== newMember.guild.id).map(roles => `<@&${roles.id}>`).join(" ") || " No Roles."}`, true), embed.setTitle(`Role Update`)} else {}
// Nick / User
if (oldMember.nickname != newMember.nickname) { await embed.setTitle(`Nick / Username Update`), embed.addField('Old', `${oldMember.nickname}`, true), embed.addField('New', `${newMember.nickname}`, true) } else {}
// AvatarURL```
if (oldMember.user != newMember.user){ await embed.setThumbnail(newMember.user.displayAvatarURL({ dynamic:true }).replace('.webp', '.png') + '?size=2048'), embed.setTitle(`Profile Picture Update`) } else {}
// Username
if (oldMember.user.username != newMember.user.username){ await embed.setTitle(`Username Update`), embed.addField(`Old`, `${oldMember.user.username}`, true), embed.addField(`New`, `${newMember.user.username}`, true) } else {}
// Discrim
if (oldMember.user.discriminator != newMember.user.discriminator){ await embed.setTitle(`Discriminator Update`), embed.addField(`Old`, `${oldMember.user.discriminator}`, true), embed.addField(`New`, `${newMember.user.discriminator}`, true) } else {}
await patronrole.send(embed)
} else {
}
});```
yeah.. you lost my on that
question though; does definedembed.addField; also work for like definedembed.setAuthor? or definedembed.setColor?
or is it definedembed.addField only for adding fields
its the whole line that isnt working
which means that it cannot realize the starting code that compares the two things
when I use it it returns ReferenceError: message is not defined
also this is the full code if (msg.content === "creator") { if(message.author.id != 666378959184855042) return; msg.channel.send("hey look its my creator insert username here"); }
Hu
don't spam here, aka ask ur question thx
Hi Izzy foreign gÇ
?
it worked thanks!
Does anyone know how to have multiple instances of code running at the same time linked to one user
Why tho?
but they all are bad.
noice
💩
heroku/glitch/repl doesn't keep your bot 24/7 online
^
sometimes they might keep ur bot up 95% of the time - but only if you're lucky.
repl restarts every 10 minutes, glitch restarts everyday, heroku resets when dyno ends it's worker time
heroku += aka everyday
return await msg.voice_client.disconnect(), await msg.send(f":lp: Disconnected from Voice Channel because it had no users")
else:
return``` giving me syntax error
sometimes they might keep ur bot up 95% of the time - but only if you're lucky.
@restive furnace heroku for me works 24/7
no card, hosting like 6 bots
Relating to this:
#development message
I've tried logging in on another bot, I've tried removing the fetchAllMembers option and I get the exact same result
I've tried putting it on my vps and recieve the same issue
try to remove all your code except require and login, and debug
Ok
Am doing that
huh
it works with that
and I'm using the same client options
That's really weird
they are pretty good
@sweet kestrel if those are good then a vps is the best fucking shit to ever exist
noice
hmm
then the second one isn't acknowledged
and it starts spamming that error again
even with just basic code?
where could it be happening then
i have no idea
try gradually adding more and more code?
Show us your custom client
buckle up bois
HASTEBIN
ok
You arent editing any heartbeats or anything weird
it always happens after like 5 mins
Can u comment out the custom events section
I have a suspicion that might be the issue
what
that might fix it
just checking
yeah it fixed it
i had a setInterval for presence
and i forgot to put in the time value
lol
@slender thistle 
return await msg.voice_client.disconnect(), await msg.send(f":lp: Disconnected from Voice Channel because it had no users") else: return``` giving me syntax error
@drifting wedge what error
@fervent goblet its looking for cairo, which is a graphics processing library
check if they have specific instructions for installing on windows
usually windows builds require something like GTK which includes cairo
oh god
How do i make my bot send a message with out any commands from a player?
i think it downloaded the entire library
nvm, i already know, lmaooo
what kind of library is fucking 33 gigs
i have no idea
afaik github's limit is 100mb
also its terabyte
So if i install GTK it will work potentially?
do you even have 33tb disk space?
its not my pic xD
it's photoshopped
but i heard the guy installed like 2000 fucking modules
fr tho
@fervent goblet check their website/github for windows installation instructions
i'd doubt 2000 would be that much
apple devices don't come with 33TB of storage
lol
imma bet some sqlite file is in one of them that increased heavily
there is nothing as far as i can see
apple devices don't come with 33TB of storage
@earnest phoenix pretty sure thats linux, not apple's shit
oh?
it looks so much like sierra
with linux, anything's copyable
xD
pretty sure windows themes exist to turn linux's desktop into windows 10
@quartz kindle reading the error further i noticed something
so i guess i need to install GTK
yes
my guess is that its made mainly for browsers
but for node it uses node-canvas, which requires GTK and cairo
How do i make my bot send messages to people?
<user>.send
that ez?
<user>.send('message')?
yup
Aight
Wait, does the user have to be the name and number? or sumthin
yes, i assume
dumb question ;-;
Hey
hi
Wait, does the user have to be the name and number? or sumthin
@earnest phoenix no
it has to be the user object
lol
Just started my RainzSecurity Bot a couple weeks ago and everything is already going good
pretty sure thats linux, not apple's shit
@earnest phoenix even so, 33 TB?
Who is going to need that
it has to be the user object
@misty sigil
huh?-
Wtf is a user object
can someone explain how a user object works?
which library are you using?









