#development
1 messages · Page 1602 of 1
If you changed those vars to let or const you'll see the problem
client.on("message", message => {
//if starts
if (message.content === `${prefix}clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES"))
var embedMessageError = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(embedMessageError)
.then(msg => {
msg.delete({ timeout: 5000 })
})
if (message.member.hasPermission("MANAGE_MESSAGES"))
var embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('a^clear', 'the messages got deleted!')
message.channel.send(embedMessagesuccesful)
.then(msg => {
msg.delete({ timeout: 5000 })
})
//if ends
}
})```
how can i update a field type with mongoose
There are more if statements
@amber quiver now it works but the error stays
I change for const and it said: const isn't a valid token
or something
it should delete the message
if (message.member.hasPermission("MANAGE_MESSAGES"))
var embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('a^clear', 'the messages got deleted!')
message.channel.send(embedMessagesuccesful)
.then(msg => {
msg.delete({ timeout: 5000 })
You need to wrap the code in a code block
after 5s
There's no code block there
you dont need
You need to if you want to execute multiple expressions
and that's what you are doing
it does that too
but the error still shows
🤦
and it still didnt delete the message
it deleted for me
lemme get my phone I'll get a screenshot
ok
okkkk
@cinder patio
you were right, the message was delete but still, for some reason It can delete the other messages
its just shows the message then deletes it
thats it
w8
and I still getting errors
ah yes off course it didnt work
I forgot the bulk delete
but still
if i'll add the bulk delete I still get an error
now its working without errors but it duplicates my messgaes wth
w8
brb in 5 minutes I need to solve this
stay here
i found another purge command
name: 'purge',
discription: 'discription',
execute(message, args) {
if (args[0] == 'help') {
const testembed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle('Purge command.')
.setDescription('')
.setThumbnail('')
.addFields(
{ name: 'Purge Command", "Usage: `*clear` <amount>' },
)
.setTimestamp();
message.author.send(testembed);
}
return;
}
message.delete();
if (!message.member.hasPermission('MANAGE_MESSAGES'))
{return message.reply('You don\'t have premssions to do that!');}
if (!args[0])
{return message.channel.send(
'Please enter a number of messages to clear! `Usage: .clear <amount>`',
);}
const deleteNum = parseInt(args[0]);
if (isNaN(deleteNum)) return message.reply('that is not a number');
message.channel.bulkDelete(deleteNum).then(() => {
message.channel
.send(`**__Cleared ${args[0]} messages.__**`)
.then(msg => msg.delete(2000));
});
},
};```
here
would maybe add some error handling to the bulk delete, incase the messages are older than 2 weeks, also iirc its limited to 100 messages
@amber quiver bro I fixed it
Completely
No errors no shit
The complete code
you there ?
im here
which IDE is this?
@near stratus
this is the exact code that I did rn but without the catch code
coz I didnt knew where to put it
coz when I put it it says error
i have an error handler in the index.js file
so I probably put the error in the wrong place
will probably not catch the error for this one thing properly
it does
@amber quiver
const Discord = require("discord.js");
const client = new Discord.Client()
client.on("message", message => {
if (message.content === `clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES")){
let emb = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(emb)
.then(msg => {
msg.delete({ timeout: 5000 })
}).catch(console.log)
}
if (message.member.hasPermission("MANAGE_MESSAGES")){
let emb = new Discord.MessageEmbed()
.setColor('#FF5800')
//.setDescription("poooooo")
.setTitle('succesful command')
.addField('a^clear', 'the messages got deleted!')
message.channel.send(emb)
.then(msg => {
msg.delete({ timeout: 5000 })
}).catch(console.log)
}
}
})
the one in the index.js is just for not killing the bot if something breaks, on the commands itself i would still add some handling to inform the user that it went wrong and why
ight
yeah thx, I wrote .catch(error.message) instead of console.log
that is the error probably that I got on catch
btw I sent you a friend req
IDK
My moto : ** if it just works then don't touch it**
I accepted
I can put the catch under the braces it doesnt matter. the error is on the command inside the catch code
ok thx
I also can put everything in try and then do catch
not everything
I told you IDK how it works but my code actually works without any error
Promise Rejection is not caught by try..catch
only from the hasPermission if statment
I didnt asked a question, I told you
oh
it doesnt matter actually
I can put it where I want under the end of the command but I must write console.log in the catch code
@near stratus now its just duplicates my embed message
when I delete
ohhhhhhhh
I know why its duplicating my embed message
now it should work perfectly
this is just my code but without the catch. I added the catch and now my code is exactly like this but without the.... //.setDescription('pooooooooooooooo')
btw I cleared my code and now its more readable
I thought codes were she
Assembly assignment
A question states that I need to list two identifiers "that will turn into a digit if I add a symbol/character to them"
Oh hold on... hexadecimal?
probably
But the question specifically states "if I add a symbol/character to them"
and hexadecimal 5 is still a number
How to resubmit your application
@slender thistle no I submitted the application but I want to delete it or edit it
https://top.gg/me, going to your bot page
Then what
Then see the available buttons on the bot's page and see if that helps you
what about ASCII value?
There is no editing button there
As in?
Could you explain how that connects to my case?
well if you add a ! to a indentifyer you could use the Binary code of it
010 0001 is the binary code for !
You'll have to resubmit it from scratch, Silent
or use the hex code
It says bot already exist
Then it seems to have been submitted by someone else
No I submitted it
Huh... like !my_indentifier?
or do you mean something like 010001b, my_identifier
well you wanted a way that makes a identifyer a number if you add a char
and if you take the hex or binary code of a char you can get a number from it
Why am I asking this, actually. TIAS time!
@slender thistle can't I verify from here
Does anyone know how I can pass a function or a required file to a broadcastEval function?
Like:
const embeds = require('../../../core/aesthetics/embeds')
... // code
const responses = await shardsManager.broadcastEval(`(${sendRegisteredVoteNotification}).call(this, '${userID}', '${coins}', '${botlist}', '${totalVotes}', '${totalCoins}', ${embeds})`)
async function sendRegisteredVoteNotification (userID, coins, botlist, totalVotes, totalCoins, embeds) {
// code
try {
await user.send(embeds.voteRegistered(user, coins, botlist, totalVotes, totalCoins))
return true
} catch (e) {
console.log(e)
return false
}
}
Right now embeds throws an unexpected identifier error when passed to that broadcastEval
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined i searched online and the most common result was that it was a require isxue but i checked all of my require funcs and they all correct
i would show code but the error doesnt say where the error is ;(
typo??
I dunno I think code is it its my typo
is tere any issue with vote count in website?
const client = new Discord.Client();
module.exports = {
name: 'purge',
discription: 'discription',
execute(message, args) {
if (args[0] == 'help') {
const testembed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle('Purge command.')
.setThumbnail('')
.addFields(
{ name: 'Purge Command", "Usage: `*clear` <amount>' },
)
.setTimestamp();
message.author.send(testembed);
}
message.delete();
if (!message.member.hasPermission('MANAGE_MESSAGES'))
{return message.reply('You don\'t have premssions to do that!');}
if (!args[0])
{return message.channel.send(
'Please enter a number of messages to clear! `Usage: .clear {amount}`',
);}
const deleteNum = parseInt(args[0]);
if (isNaN(deleteNum)) return message.reply('that is not a number');
message.channel.bulkDelete(deleteNum).then(() => {
const emb = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle('Purge successful!')
.addFields(
{ name: `${args[0]} messages where deleted!` },
);
message.channel.send(emb);
client.on('channelDelete', (channel) => {
console.log(channel);
});then(msg => msg.delete(1000));
});
},
};```
purge command
Told you When I write the code it works
but I wrote it by myself and it worked
Im kinda curious, when your bot wants to use the new slash command , it needs the application.commands scope, can i change somehow the scope, while the bot is already in guilds?
Re-invite is the only way I'm aware of
hello development friends i havent had a legitimate message in here since october 2020 but thats fine
i need nodejs help ok so i have base64 datafor an image and i want it to be a sendable image. any help would be $$$
Thanks
but damn how are the big bots doing it then
just leaving thousands of guilds 
Not sure which bots you may be referring to but they just may be using both bot scope and slash commands
or just straight up asking users to reinvite the bot
But i mean most of the big bots are existing longer than the slash commds / the scope i guess 
the kinda data thats built like data:image\/png;base64,iSH8fyefr80wqe9yhrf82qeyh89weurf9fru3r032r9weurieyhfrwkfwoiufrewjfhewfuqufddsajfdsahfiyfiuayfewyfaugfaufa
Yeah i mean in my case it shouldnt be the big of a deal, i guess he is in like 6 guilds or something 

why use binary though? hexadecimal gang
That's the last thing I want to worry about rn
did you tryed to use the buffer?
like take the data and create a new buffer with it?
i try new Buffer(data) and Buffer.from(data)
no workie
base64 = "your base64 string"
const buffer = Buffer.from(base64, "base64");
fs.writeFileSync("new-path.jpg", buffer);
o wtf
lol
You might need to remove the data:image\/png;base64, from the string
also yea GoogleFeud is right
Imagine using DIscord as your bot database lol
what
jk, but its possible
use a text channel as database 
@slender thistle i sent a request to the discord dev support, i can let you know about a answer if youre interested 
yes xD
Would be appreciated 
bro..... it workie........
and you said its a Tim level of issue
thank you @lusty quest and @cinder patio
u guys have been removed from my global hitlist
good luck with this im Armed
after 2 hrs i fixed the purge command
could be worse
yea
like writing a Scraper for 3 hours and then noticing that they got a API
XD
@near stratus for some reason my code just duplicates the embed message
have you done that before?
yes
bruh
the purge command?
And your code too (they are the same code so it doesnt really matter )
w8
i fixed it
I'll send
did you have 2 instances of the bot Running?
const client = new Discord.Client();
module.exports = {
name: 'purge',
discription: 'discription',
execute(message, args) {
if (args[0] == 'help') {
const testembed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle('Purge command.')
.setThumbnail('')
.addFields(
{ name: 'Purge Command", "Usage: `*clear` <amount>' },
)
.setTimestamp();
message.author.send(testembed);
}
message.delete();
if (!message.member.hasPermission('MANAGE_MESSAGES'))
{return message.reply('You don\'t have premssions to do that!');}
if (!args[0])
{return message.channel.send(
'Please enter a number of messages to clear! `Usage: .clear {amount}`',
);}
const deleteNum = parseInt(args[0]);
if (isNaN(deleteNum)) return message.reply('that is not a number');
message.channel.bulkDelete(deleteNum).then(() => {
if (message.member.hasPermission('MANAGE_MESSAGES')) {
const emb = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('**The messages got successfully deleted!**', `**__${args[0]}__** got deleted...`);
message.channel.send(emb)
.then(msg => {
msg.delete({ timeout: 5000 });
}).catch(console.log);
}
});
},
};```
this my code
client.on("message", message => {
if (message.content === `${prefix}clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES")) {
var embedMessageError = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(embedMessageError)
.then(msg => {
msg.delete({ timeout: 5000 })
}).catch(console.log)
}
if (message.member.hasPermission("MANAGE_MESSAGES")) {
message.channel.bulkDelete(20)
.then(message => {
var embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('Messages Cleared!', 'The messages got deleted!')
message.channel.send(embedMessagesuccesful)
.then(msg => {
msg.delete({ timeout: 5000 })
}).catch(console.log)
})
}
}
})```
kinda the same
but its weird and its not deleting the messages everytime
super weird
did you got 2 instances of the bot Running
no
are you sure? bcs its quite a common issue for this
do u use Git command line?
Does anybody know if it is possible to log in as a bot user on topgg (authenticate the oauth2 with a bot account)
idk
the bot is running normally
but this specific command is not
@lusty quest
also why 2 checks for permissions? i would just use an else if statement
if Permission is aviable execute otherwise throw error
I did too but it doesnt work
I can put else and then if
I tried
well then the issue is somewhere else
does the bot got permissions for it?
I need to check it
You could just return after your first check
yep
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = 'a^';
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
client.user.setActivity("some people", {
type: "WATCHING",
});
})
client.on("message", message => {
if (message.content === `${prefix}clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES")) {
var embedMessageError = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(embedMessageError)
.then(msg => {
msg.delete({ timeout: 5000 })
}).catch(console.log)
}
if (message.member.hasPermission("MANAGE_MESSAGES")) {
message.channel.bulkDelete(20)
.then(message => {
var embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('Messages Cleared!', 'The messages got deleted!')
message.channel.send(embedMessagesuccesful)
.then(msg => {
msg.delete({ timeout: 5000 })
}).catch(console.log)
})
}
}
})``` the whole code except of the client.login
did you get any error?
also DONT make a message event listener for every thing you do
why are you setting activity in the message listener
also you will spam the API with your code
your channel is not defined
by mistake
I just removed it
U knew something wrong with the message listener and the activity
it doesnt matter, its works with other commands
in this one command on this spezific position its not defined
also the way you do it wont work bcs the message is deleted so you cant reference it
await the delete stuff then send the message
w8 I'll fix that
ok
but dont use .then in this case
but I want the message to self delete
why tho
bcs you get not the message you want from the bulk delete
why this ```js
client.on('message', message => {
client.user.setActivity("some people", {
type: "WATCHING",
});
})
I removed thids
this*
lul
also did you make a client.on("message") event for each command?
Cannot read property 'setActivity' of null and this is whats happened
but I dont care
no
I just wanna know why my embeds got duplicated
did you have the snippet twice in your code?
??
try delete all of the second .then
message.channel.send(embedMessagesuccesful) should be the alst thing in the if case
i HAVE ONE
- bulkdelete.THEN 2) message.channel.send.THEN
if you do bulkDelete.then(message => {}) <--- this message is not a message, its a collection
or yeah or thats the problem
client.on("message", message => {
if (message.content === `${prefix}clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES")) {
var embedMessageError = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(embedMessageError)
.then(msg => {
msg.delete({ timeout: 5000 })
}).catch(console.log)
}
if (message.member.hasPermission("MANAGE_MESSAGES")) {
message.channel.bulkDelete(20)
var embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('Messages Cleared!', 'The messages got deleted!')
message.channel.send(embedMessagesuccesful)
.then(msg => {
msg.delete({ timeout: 5000 })
}).catch(console.log)
}
}
})
where
also did you get twice the same message or 2 different messages?
its duplicates the embed
what embed
embed message
Why are you using sendMessage?
which one
That's no longer a thing
whats your discord.js version?
You're using both send and sendMessage though
12
sendMessage was removed in 12
wait is the second permission check inside the message content check?
yes, its just the indentation thats bad
I deleted it. the VScode made it sendMessage instead of send
Its the IDE mistake
which is weird
coz Im using v12
update your linter and the other stuff
I do
yes
v12 completely removed sendMessage tho, the IDE should not be picking it up
But which embed is duplicated, error or success?
which version are you actually using?
but he do
full version
for some reason
do npm ls
or check your package.json
its possible that he uses some older version for discord.js snippets and auto completion that still uses V11
weird
the IDE fixed that to sendMessage
do you use sendMessage anywhere else? or only there?
¯_(ツ)_/¯
whats actually the problem right now?
Should I make another content check with the true permission check in it?
send is not defined and for some reason its makes my embed message to get duped
you can just do
if (contentCheck) {
if (!permissionCheck) {
errorEmbed
} else {
successEmbed
}
}
ok listen, I tried to put else but with if under else{
so thats why else didnt work
I DIDNT TRIED ELSE ALONE
i TRIED HIM WITH IF
SO THATS PROBABLY THE PROBLEM
wth
Im on caps
mmmm
client.on("message", message => {
if (message.content === `${prefix}clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES")) {
var embedMessageError = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(embedMessageError)
}
else {
message.channel.bulkDelete(20)
var embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('Messages Cleared!', 'The messages got deleted!')
message.channel.send(embedMessagesuccesful)
}
}
})
try this
thx I was about to do it by myself and you just wrote it for me
now its not duplicating but it also not deleting
Also you should use let / const instead of var
I used
and thats why it got duped
for the first time
Do you save your code?
does the bot has manage messages perms?
yep
yep
Are the messages older than 2 weeks?
if (message.content === `${prefix}clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES")) {
const embedMessageError = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(embedMessageError)
}
else {
message.channel.bulkDelete(20)
const embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('Messages Cleared!', 'The messages got deleted!')
message.channel.send(embedMessagesuccesful)
}
}
})
It can't be because of let/const lmao
not the duping
I mean
it wrote me
'const' is not a valid token
or something
so I replaced const
with let
and it wrote the same thing
Yeah, because you didn't have the code blocks {} at that time
so I switched to var
I did]
that was after you told me to
Then it cannot give you that error unless you screwed up in some way. Anyways, screenshot your task bar
I used {} in the if statment permission check before you told me but I saw that you can use it withou the {} so I removed them
?
but now Im using them
w8
@small tangle your code didnt worked for me so Im switching back to mine
Any errors?
lol somehow its delete the message with out the .then and the timeout
How old are the messages its trying to delete?
U made me building a js bot god damnit 
it works now
client.on("message", message => {
if (message.content === `${prefix}clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES")) {
var embedMessageError = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(embedMessageError)
}
else {
message.channel.bulkDelete(20)
.then(() => {
var embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('Messages Cleared!', 'The messages got deleted!')
message.channel.send(embedMessagesuccesful)
})
}
}
})
u have to do () => in the bulkdelete callback
not 100% sure, but i guess when youre doing message => {} youre not make a reference to the original message, therefore the program cant read the property channel
told him this a while ago
suggested to await the delete and then just send the message without using .then

but i mean it was 1 min googling for me... so you could do that yourself the next time 
are you all still on the purge command?
jep
I need to try this
I dont remember
it works i tried it by myself
ive already solved it
so much
but I dont wanna use the prge command
?
damn i saw your message now mythical, why are we still here 
when?
its exactly the same
ye XD
ok so I probably didnt see that. thank you too
you just could enter this to your own bot
and test it and then remove it
But my Bot is written in Java
ohh
Im programming in Java but I never programmed a java bot before
If you are programming in java, how did you know the write script for the bulk delete in JS
?
1 Min of googling / my first bot was in JS
like mine but without this embed shit. I searched so much for this and somehow you found it 1Min
literally the first entry
wth I searched the SAME THING and I couldn't find it.
And I entered to the "How does bulkDelete" work?
Im feeling stupid that I know how to code but I cant solve one stupid bulkDelete command
i mean if you dont find something that way, just look https://discord.js.org/#/docs/main/stable/general/welcome up
No youre fine
now youre smarter
and btw, I didnt use mythical's command coz I dont want to. I want my command but fixed. Dont ask me why, I just this type of person. I hate to look for help and if when Im looking for some help, Im getting mad if someone not helping me in the way I want to.
you think I didnt searched discord.js and discord.js guide? lol😅
https://discordjs.guide/ this link is the most searched link in my search history
but how, there is exactly one example at the bottom in the docs
https://discord.js.org/#/docs/main/stable/general/welcome and this is my third one after youtube
this is the code that I used before 3 days
but then I wanted to add embeds and then the fun began
but when you read closer, u see it returns a collection of the deleted messages
not the message of the message event
so many errors and rages about one stupid script
that was the problem, because of the compiler said u cant read send of undefined
yeah now I see it. I probably didnt look the code well
yeah, all this time that I lost is because I didnt read well the code. NICE
but for something so silly actually
someone have a script for welcome msg but in dm pls ??
of course! you think Im happy? I lost 2 days from my life to figure it out!
yes
I have one

its possible you send me pls ?
yes
but I need to eat
so
plz w8
yeah. It was verrrrrrrrrrrrrrrrrrryyyyyyyyyyyyyyy fun to lose two days from my life on a "ducking" script!
yep
🙏 thx
But now everything works, so good ending i guess
So the problem was basically what i said an hour ago lmao
happens xD
How can i get the id of a animated emoji without nitro?
you need to ctrl + shift + i and fetch the message content in the console
oops you mean codewise?
Im on mobile
are you talking codewise or in general?
Oh nvm got it i saw a method
general like i said with backslash
it's seems it can't be as devDep only
can someone tell me why this is again so annoying to do.
i have a object ```js
{
whitelisted_roles: [],
whitelisted_channels: [],
_id: 12,
guildID: '1',
prefix: '!',
kick_threshold: 5,
ban_threshold: 10,
threshold: 0.95,
__v: 10,
setup: true
}
got the object copy/paste above from console.logging the object to make sure it exist.
i mean if its works for ban it should works for kick too, typo?
whats the code snippet?
there is no much snipped its just console.log(Object.kick_threshold)
also i dont think its a typo, ive copy/pasted it also from the object into the console.log
so Object.ban... returns the correct int, but Object.kick.. throws an error?
kick returns undefined
and u define the object like you posted?
yes, this is what i get when i just console.log(object)
doesnt makes any sense 
so its say the object is undefined or the property?
exactly
it can be
@lusty quest w8 you can ban?
can u just post the 3 lines
just returns undefined
no thats not the case
oh
i have some weird issues with reading stuff from a object
it have nothing to do with the perms, its just accessing a property of an object
oh
Can you send the full script?
yes pls
console.log(object)-> returns the object like in the snippet
console.log(object. ban_threshold) -> returns 10
console.log(object. kick_threshold) -> returns undefined
yes
I have no idea
but i cant get the kick value
nope no idea, that shouldnt happen
are you manipulating somehow the object anywhere else?
open emote image in a new tab
you should check in google. believe me.... you wanna stuck with wrong code for 2 days?
the object is a const and read only
like me
the code worked 3 months ago, and i havent changed this part
you can also right click the emoji and then copy ID
w8 no
its only works with channels and bots
I think
undefined
whats surronded?
Someone loves to get help through teardrop information
stuff that doesnt interact with it directly
Why not just post your whole code so people can actually see
man it would be a lot easier if you just post the code
bcs its not really an issue with the code, its just an issue with reading a object
Post the code, bot a screenshot of the code.
If you knew what the issue was you wouldn't be here asking for help
it have to be a issue with the code ortherwise it would work
would be a pain in the ass to remove the confident stuff
@small tangle brw your code that U send me for the embed message didnt work. Its not deleting messages
bin and edit
and the messages are not 2 weeks old
If this is confidential then maybe you should ask for internal help then?
People be like "but I need this to get paid" and we're like "fine but we don't, kthxbai!"
it worked perfectly fine for me
I swear its not
TS7016: Could not find a declaration file for module 'node-schedule'. '/app/node_modules/node-schedule/lib/schedule.js' implicitly has an 'any' type. this error wasn't happening in local
perms?
@strong seal
is it double hosted ?
restart the pc
npm i --dev @types/node-schedule
not anymore
@lusty quest and u could think about an .env file for secrets
hm?
heroku doesn't read Dev
its not this type of stuff, more of what the code itself does
can't you use bash ?
can
and whats the problem to show it?
on prod never install dev deps, just compile it on ur pc and post it to heroku (dist + node_modules)
but I have everything working in local
u asked for help, i try to, but i cant, when you dont show me anything
like main.sh
npm i --dev @types/node-schedule
@small tangle me and the bot got all the perms
and is there an error?
ah man
no
pls no dev deps on prod
then in Procfile put bash main.sh
@amber quiver whats your current code?
yours
1 : 1?
yep
sends he the embed?
here is the pic
the bot have administrator so it should work and Im the owner
so...
ur bot should never have admin perms, but thats another topic
are there any messages left in the channel?
found the issue, for some reason it where Mongoose not any other part of the code.
yes
what? 
and no console error?
only have one message event listener?
yes
can u send the full script
yep
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = 'a^';
client.once('ready', () => {
console.log('Ready!');
});
client.user.setActivity("some people", {
type: "WATCHING",
});
client.on("message", message => {
if (message.content === `${prefix}clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES")) {
var embedMessageError = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(embedMessageError)
}
else {
message.channel.bulkDelete(20)
.then(() => {
var embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('Messages Cleared!', 'The messages got deleted!')
message.channel.send(embedMessagesuccesful)
})
}
}
})``` this all the things that you need to check
this is not all the bot's code...
does message.content === 'a!clear' works?
a^*
Two ways of getting help:
The Hard Way: Ask question with providing just 1-4 lines of code and get partial help.
The Easy Way: Provide the full program/class and get help to your specific problem.
UnhandledPromiseRejectionWarning: Error: 504 Gateway Time-out when posting to DBL my server count
so it's supposed to happen until they fix?
I showed him the specific code and then this
everyone is having that
??
i used exactly that code and it worked for me
should I remove that from the code? or leave this error like this? xD
can you check again what you sent to me??
the bot works with message.content === 'a^clear' ?
yes except the part of CLEAR
I cant clear but the message is shown
and then deletes itself
the embed is shown?
ok
or just ctrl r
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
or that
ctrl + F5
I know wdym
This error... Might be just crashing your bot, mate. Like it's not running.
All this time you just weren't restarting? Omg.
its happened to me with the bot status........ I knew something wrong
but
its not working at all
Remove that setActivity that's crashing your bot.
yes
ok
Or put it in the ready event where it belongs.
comment it out for now
maybe thats the problem
Probably.
or just do
client.on('ready' () => {
//set activity
}
You did it
its an error, what do u exspect xD
ok thank you too!
u should never ignore errors
Ready event doesn't provide a client that's wrong.
oh
I'll do it in the ready event
No
bot.on("ready", () => {
bot.user.setActivity("Type !help");
})
oke you dont pass any args in the callback
If you have a static status just use new Client({ presence: { activity: { name: "!help", type: "PLAYING" } } });
don't use .once()
@small tangle I just need to add .catch for the bot coz I dont want the bot to shut down when he gets errors and I need to add timeout for the message
I even didnt get the code wrong
its only because the setActivity
You need to learn how to catch errors, yes.
But that error was a syntax error that would be fixed by understanding the error itself. the code was wrong
I knew something here is off coz in my previous bot, I used this code (of the bulkDelete and the embeds) and it worked!
everything happened because the setActivity
Maybe you should read this: #development message
yes
I meant the code of the bulk
I'll start right now!
check the docs...
But everything works
code ?
we can do nothing with just this info 
I get this error and it doesn't start like that
we resolve this issue minutes ago, man, you should read the whole thread.
then provide more informations
why though? 🤔
.once only fires once
@umbral zealot I should learn again JS but now more properly....
What doesn't start? What are you doing, what language, what framework, what... what everything!
questions over questions
ok more ?
ah, but like for database connections .once() is fine? on ready
@amber quiver so youre good?
finally 
the event won't trigger ever again after triggering once, if your client gets disconnected and reconnects, it won't set the status back
lol
Ok but WHAT IS IT?
okay
does the file exist ?
what the hell is fontConfig? where does it come from?
and wtf bot does not start
check the path
what are you trying to do?
send code first
I'll blame the setActivity from now on
no, blame your inexperience at writing syntactically correct javascript.
I did another way, installed the ones I needed as a Dep and removed from DevDep
its a joke
I know that not everything is because of this
I was joking.... r/whoooosh moment lol
yeet
I have no idea where it comes from and the snout doesn't start, I also put a backup in advance and it's the same
show code @unborn venture

do you even know what you are coding ?
what code where
until now it suddenly stopped
what stopped ?
yes
? 
show code of the bot
index?
yes
const Discord = require('discord.js');
const config = require("./config.json");
const Enmap = require("enmap");
const get = require("get");
const client = new Discord.Client();
const db = require('quick.db');
const fs = require('fs');
client.config = config;
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});
client.commands = new Enmap();
fs.readdir("./commands/info/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/info/${file}`);
let commandName = file.split(".")[0];
console.log(`Attempting to load command ${commandName}`);
client.commands.set(commandName, props);
});
});
client.login(config.token);
enmap to store commands is a bit weird
^
you can just use Discord.Collection()
Enmap is a bit like a database if you think about it
and what exactly is now the error?
You don’t want to store commands on disk and on memory
@small tangle #development message
you cant really store commands on disk like that anyway
they will be serialized to strings, which will lose references and such
the fontconfig error is from canvas, do you use canvas?
are you sure you don't have a super old version of nodejs, also?
show your current line 3 in index.js
it's from an older version of a tutorial, people keep copying all over the place, so definitely old shoveled code if you see that.
yea I do remember seeing a tutorial like that
imagine a world where tutorials didnt exist :^)

I like to have a visual entry point, but im often modifying it overtime when my understanding is better
ik im just kidding, i also started like that
all code
and im definitly not a pro or exspect, maybe a better noob 
show your package.json
lol yea
i mean convas is a npm module
yes
wut
lmao
Can someone help me
"name": "kolax",
"version": "1.0.0",
"description": "kolax",
"main": "index.js",
"scripts": {
"test": "$"
},
"repository": {
"type": "git",
"url": "git"
},
"keywords": [
"$"
],
"author": "Blast & OlteanuAdv",
"license": "ISC",
"dependencies": {
"array-sort": "^1.0.0",
"axios": "^0.21.1",
"canvacord": "^5.0.8",
"chalk": "^4.1.0",
"convas": "^2.0.0",
"date-and-time": "^0.14.2",
"discord-akairo": "^8.1.0",
"discord-anti-spam": "^2.4.1",
"discord-giveaways": "^4.3.0",
"discord-image-generation": "^1.4.5",
"discord.js": "^12.5.1",
"discord.js-commando": "^0.10.0",
"emoji": "^0.3.2",
"emoji-regex": "^9.2.0",
"enmap": "^5.8.2",
"express": "^4.17.1",
"figlet": "^1.5.0",
"fivem": "^2.1.5",
"get": "^1.4.0",
"hastebin": "^0.2.1",
"imdb-api": "^4.4.1",
"index.js": "0.0.3",
"isgd": "^1.1.3",
"map": "^1.0.1",
"moment": "^2.29.1",
"node-emoji": "^1.10.0",
"node-opus": "^0.3.3",
"node-osu": "^2.2.0",
"node-superfetch": "^0.1.10",
"novelcovid": "^3.0.0",
"parse-ms": "^2.1.0",
"quick.db": "^7.1.3",
"quick.hook": "^1.5.1",
"random-puppy": "^1.1.0",
"relevant-urban": "^2.0.0",
"request": "^2.88.2",
"samp-query": "^0.1.5",
"simple-youtube-api": "^5.2.1",
"slot-machine": "^2.1.0",
"snekfetch": "^4.0.4",
"snowflake-api": "^2.0.0",
"table": "^6.0.4",
"to-zalgo": "^1.0.1",
"twemoji-parser": "^13.0.0",
"ytdl-core": "^4.4.1"
}
}
Need help adding Oreo to my server
I tried all night to fix it
Need help adding Oreo to my server
pachage
Ask in there support server
Oh ok
yes
that usually happens if there is a problem in a config file. does mongo have any command to test the config file like nginx does?
the message does not appear to start the bot and I did not change it, that is, it was working
@unborn venture that error likely happened because you tried to store commands in enmap
I don’t think so I looked around and couldn’t find anything
case 'leaderboard':
var allMoneys = message.guild.members.cache.map(m => {
var cdmoney = db.fetch(`cdmoney_${m.id}`)
var money = db.fetch(`money_${m.id}`)
return {money: (cdmoney + money) , id: m.id, username: m.user.username}
})
allMoneys.sort((a,b) => a.money- b.money);
var str = "";
var id = 1;
allMoneys.forEach(a => {
if(id <= 10){
str += (`${id}. ${a.username} : ${a.money}$\n`)
}
id++;
})
console.log(str)
const leaderBoardEmbed = new discord.MessageEmbed()
.setTitle(`${message.guild.name} Leaderboard`)
.setDescription(str)
.setColor("BLUE")
message.channel.send(leaderBoardEmbed)
break;
error:
DiscordAPIError: Invalid Form Body content: Must be 2000 or fewer in length.
it should show the top 10 users with the most money in the server that it was sent in.
Last time this happened I did ```
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
sudo service mongod restart
sa
what does console.log(str) show?
console.log(allMoneys)
console.log(message.guild.members.cache)
Do you have the guild member intents on? @tardy hornet
And make sure the ready event is before your doing this event
i did
where did you put the console?
convas, clivas or canvas?
isn't it canvos??
lol
Hello
Can someone help me to find a bot to create custom bets?
me
like music?
beats?
bot?
xD
case 'leaderboard':
var allMoneys = message.guild.members.cache.map(m => {
var cdmoney = db.fetch(`cdmoney_${m.id}`)
var money = db.fetch(`money_${m.id}`)
return {money: (cdmoney + money) , id: m.id, username: m.user.username}
})
allMoneys.sort((a,b) => a.money- b.money);
var str = "";
var id = 1;
allMoneys.forEach(a => {
if(id <= 10){
str += (`${id}. ${a.username} : ${a.money}$\n`)
}
id++;
})
console.log(str)
const leaderBoardEmbed = new discord.MessageEmbed()
.setTitle(`${message.guild.name} Leaderboard`)
.setDescription(str)
.setColor("BLUE")
message.channel.send(leaderBoardEmbed)
break;
before the embed const
i mean the console.log(message.guild.members.cache)
okay
in top of the embed's const
it just does not show it in the code i sent
dus any1 know how to make discord.py AI bot?
Learn discord.py and learn AI, then combine them :)
Hey to all bot devs, probably u know better than me where to host your bot? I mean, where is the best to take a VPS. Looking for a company with cheap prices but reliable with good latency.
all of what tim mentioned are good other than GG
ah yes, their support?
from a professional setup seems very naively setup

and the fact i had to argue the fact of why having to verify your email before you can pay an unlimited amount of money is a good idea vs just letting you sign up with an email that doesnt exist -_-
keep your emoji spam outta here please.
Hey, I am using webhooks to send a simple message to a channel. http://discord.com/api/webhooks/id/token" I'm sending a post request to this link with a JSON body where i have just set the content property to "Hello". When I send it returns status 200 but the message does not get sent?
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let mut embed = HashMap::new();
embed.insert("content", "This is the default content");
let client = reqwest::Client::new();
let res = client.post("http://discord.com/api/webhooks/8122430/WnrBxcDwLP4cDz6rbgvfX")
.json(&embed)
.send()
.await?;
println!("{:#?}", res);
Ok(())
}``` This is my code if it helps some of the ID and token are cut out.
anyone knows why my link preview won't show up on discord ? I've already put the correct meta tags on my index.html file and I've enabled https
<head>
<title>Free Bobux</title>
<meta property="og:url" content="https://files.cstef.dev/">
<meta property="og:video" content="https://get-mp4.xyz/videos/rick-astley-never-gonna-give-you-up_362329.mp4">
<meta property="og:video:secure_url" content="https://get-mp4.xyz/videos/rick-astley-never-gonna-give-you-up_362329.mp4">
<meta property="og:video:width" content="896">
<meta property="og:video:height" content="504">
<meta property="og:video:type" content="video/mp4">
<meta property="og:type" content="video.other">
<meta property="og:image" content="https://storage.googleapis.com/afs-prod/media/fc8c2237710cfe8824163e6bfa0fd493/695.jpeg">
<meta name="twitter:domain" content="googleapis.com">
<meta name="twitter:card" content="player">
<meta name="twitter:image" content="https://storage.googleapis.com/afs-prod/media/fc8c2237710cfe8824163e6bfa0fd493/695.jpeg">
<meta name="twitter:player" content="https://get-mp4.xyz/videos/rick-astley-never-gonna-give-you-up_362329.mp4">
<meta name="twitter:player:width" content="896">
<meta name="twitter:player:height" content="504">
<meta name="twitter:player:stream" content="https://get-mp4.xyz/videos/rick-astley-never-gonna-give-you-up_362329.mp4">
<meta name="twitter:player:stream:content_type" content="video/mp4">
<meta property="title" content="Free Bobux">
</head>
Probably cache
guess I'll wait then
Just do domain/?anythinghere
imma try
Why am I gettin this error?
https://i.callumdev.pw/q2kc9.png
nope, maybe is it because of my domain ? it doesnt work for the root domain either
@river thistle send it to me in dm
what do I have to send you
what are you trying to do?
Send a discord attachment through a post request
why are you creating a write stream?
do you want to save the attachment as a file?
well its what peole have been suggesting, its confusing the shit out of me lol
you dont need any of that
if request() returns a stream, you can pass it to formdata
data.append(bla, request(url))
is that the request library?
request is deprecated btw
Why are you using both request and axius
How can I know who is inviter and what is the invite code when a player joins a server?
ye im aware
streams on axios are different
oh right, how do I need to do it?
the stream is returned in response.data
so you have to ```js
let response = await axios({responseType:"stream"});
data.append(name, response.data)
discord requires form-data files to have a filename property
you can give it as a string in the 3rd parameter
.append("file", stream, "file.png")
?
oh wait thats not even discord lol
so idk, code 500 is server side error
but try the same thing, specify the file name in the 3rd parameter
you need to fetch all invites
and then?
then when a user joins, you need to fetch all invites again
and see which invite got its count increased
Thanks
ah yes
you need to set the form-data headers
i thought axios did this automatyticLLY
so would ...data.getHeaders() work
very enthusiastic YES
🤞
CSS is a scripting language that controls the design and styling of a website
you can use CSS in your bot's detailed description to change the colors and design of your bot page, and change many other things
the option to force which theme your bot page uses requires you to use custom CSS
so that developers who use CSS to design a custom bot page dont get their page all broken if people use the wrong theme
if you dont need custom CSS, then top.gg forces you to let people choose which theme they want
Css is a gift
code bots in css
you dont do that?
Loading
what does it do?
/usr/bin/mongod --config /etc/mongod.conf```
Lul
Hello, I'm trying to make a sound stats system, but in this section (attached) it doesn't save to db
pls tag me
ticket?
@rigid maple
I'm using translation :)
you're not running whatever voiceInit is
what I do ?
nice one
you learn javascript
bruh, does someone knows how to save a channel using quick.db or mega.db. its because i want to do a Welcomes system with a "set" command
you save the ID and assuming you are caching all channels, you can just get the channel from cache on the guildMemberAdd event
ok
thanks you bro
Hi, I have made a google site, and I want to connect it to https://didi-web.tk can any1 help me link the two?
define "made a google site"
I put the didi-web.tk and it said invalid
Thinking of creating a website? Google Sites is a free and easy way to create and share webpages.
that's because freenom domains aren't actually owned by u, you just "borrowed" it
idk, maybe
dont i need to proove i own it?
cloudflare would be an option if u had the ip, so it's a no
how can i?
well, when u buy a domain you get all the rights on it, I don't remember exactly how I've proved my domain's ownership
it's been ages since
about tokelau domains, doesn't freenom have its own redirection page?
like .co.uk and .us
idk
im new to websites
i thought i could put my url in and its tehre
ok thanks
so i just put my google sites url in the destination?
did you read this?
You can use your custom URL with a site on new Google Sites by creating a web address mapping.
Step 1: Check that you own your URL Go to google.com/webmasters/verificatio
yes
but I dont know how I can verify it
do note that freenom domains have the reputation of being...sketchy
ty


