#development
1 messages ยท Page 929 of 1
You apply.
Visiting the top.gg website and log in. After that, just look for the Add Bot option. Remember that the bot must be approved.
aka if you want to add it to the server go to https://top.gg/bot/new
@plucky atlas, what do you mean by coding window lol
"429 hit on route /channels/706876497268441149/messages"
what actions could cause this error? would it be failing to send a message or something?
too many requests, according to google
429 is ratelimit
do you listen to the ratelimit event?
whats the method in the stack?
like my code's method? you can do that?
oh i only just started having this issue so i dont have proper logging
when my bot gets un-tempbanned ill push the logging changes to live
if you can see the method, you can see what was the action
for example POST to /channels/:id/messages = sending a message
PATCH = edit a message
GET = fetch a message
its pretty much always POST
so i made a few observations after getting temp-banned for the umpteenth time
for some reason my bot just starts spiking in bytes sent
and then i get temp banned
when i check my logs
i see a whole bunch of these
nobody is even using commands
there are hundreds of 429's in a row with no commands used
https://support.parsecgaming.com/hc/en-us/articles/115002624051-Error-Codes-22006-and-15000-Unable-To-Initialize-Encoder-On-Your-Server- (How would I fix this in a virtual machine)?
what do you mean fetch them?
i used the message collector and pass the message to my other functions
for example, if users react on an uncached message, you need to fetch it
makes sense, because i am also getting a lot of unknown message errors
but is not enough just to pass the actual message to my code? isnt that technically cached?
i dont know what your code is doing so i cant say
but a couple things would be, if you fetch messages that get reacted on, what is the criteira they need to pass? you dont fetch all messages on all reactions right?
also, are you passing messages among shards using broadcastEval?
this is basically how my code works when involving messages
the only criteria is that the reaction was made by the user and is one of the reactions my bot has placed on the message
so usually its like
message embed with instructions
so you're not using something like this?
no, i dont check for all message reacts
bot creates a message, sends it, reacts to it, and awaits user reaction on that message only
i use a message reaction collector to get the reactions
anywhere in your code that you use channel.messages.fetch()?
so its either sending or editing
yep
edits the embed based on what the user reacted with
i do get a ton of "unknown message" warnings though
do people often spam your reactions?
sometimes yes, but my collector ends right after the first valid reaction is made
well its difficult to say what could be causing it
does anyone know what this error means? it occurs when i use bot.users.fetch() in discord.js:
DiscordAPIError: 404: Not Found
at RequestHandler.execute (C:\...\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
name: 'DiscordAPIError',
message: '404: Not Found',
method: 'get',
path: '/users/',
code: 0,
httpStatus: 404
}
user not found
Anyone know how I can download full teamviewer on my raspberry pi?
(not host)
I wanna connect to a PC from my pi
(cause the PI is portable)
Im attemping to add another user to my eval, how would this work. discord.js v11.5.1
helium.on('message', async message => {
try {
if (message.content.startsWith(`${prefix[0]}eval`)|| message.content.startsWith(`${prefix[1]}eval`)) {
if (message.author.id !== "user_id") {
add another id to the if clause
how would i do that exactly
like you did above, but with && instead of ||
or you can check an array of user ids
if(["userid1","userid2"].includes(message.author.id)) {<eval>}
how do i make my bot run something every 9-11 minutes?
don't
wut
making X run every N seconds/minutes/whatever is a bad idea
except if N is big enough
@halcyon ember there is a function called setInterval(<function to run>,<delay in ms>)
for example, logging "hello" every 5 seconds: ```js
setInterval(function() {console.log("Hello")},5000);
yep
what i just sent logs "Hello" every 5 seconds
you'll need to put it inside a while
@lyric mountain setTimeout =/ setInterval
ah, didn't noticed
setTimeout delays the function, setInterval makes it run every x ms
oh i forgot the closing bracket ๐คฆ๐ฟโโ๏ธ
oh
so say i have this function
const embed = new Discord.MessageEmbed()
.setColor('#FF9900')
.setTitle("Bitcoin block #"+btcblock+" was mined")
.setAuthor('Block mined', 'https://cdn.discordapp.com/emojis/710590499991322714.png?v=1')
client.channels.get(`710704393426698310`).send(embed)
btcblock = btcblock+1
}```
i change it to a function like
oh
no
const embed = new Discord.MessageEmbed()
.setColor('#FF9900')
.setTitle("Bitcoin block #"+btcblock+" was mined")
.setAuthor('Block mined', 'https://cdn.discordapp.com/emojis/710590499991322714.png?v=1')
client.channels.get(`710704393426698310`).send(embed)
btcblock = btcblock+1
}```
well now its a function
so you want to run that function in an interval
then you gotta setInterval(block,delayInMs)
at the end of my async function?
whereever you want the loop to start
because it's client.channels.cache now
oh
https://discord.js.org/#/docs/main/stable/general/welcome read the updated docs, a bit has changed
is ti just me or is dbl api dying
still says its not a function
Oops! Error: 401 Unauthorized
client.channels.cache(710704393426698310).send(embed)
oh my
client.channels.cache.get(id) or client.channels.resolve(id)
@halcyon ember ...
dude
are you being serious
:readthedocs:
read the fucking docs
it isn't that hard
oh
and how does cache() make sense to you
it doesnt
then
client.channels.cache(
710704393426698310).send(embed)
why did you even try this
๐ณ
๐ง

so my bots custom status contains how many servers its in is there anyway to make the custom status update without restarting the bot
in what language your bot is coded
discord.js
@hardy vector your bot is written in js, discord.js is NOT a language, it's a library
ffs
Do you think I should let my pc turn so I ainโt missed when they test my bot?
and we know that discord.js=js
yeah
@indigo willow if you self host your bot on pc never turn off it
@indigo willow guess
well, gl keeping your pc turned on 24/7 for 2 weeks
24/7 bot>sometimes online bot
you shouldn't self host your bot
you shouldn't self host your bot
@copper cradle how do you want to host my bot else ware?
glitch
@wispy fox god please no
@wispy fox no
if you want a free host do heroku
no
EVERYTHING is wrong with it
heroku>glitch (for me)
I just want a little bit so it should be ok
Every single one of my bots would crush glitch lmao
unlike the shitty glitch and heroku
get gud friends giving u vps acc
well
do you want a easy life making bots?
and glitch is the best example of it
better make boats then
Glitch as a free service used mostly for websites isn't really bad
free hosting<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<paid hosting
glitch isnt meant to host discord bots
You people might want to actually help instead of going "X is shit"
I use glitch as my sharex server lol
if that's everything you know then
@hardy vector your bot is written in js, discord.js is NOT a language, it's a library
@copper cradle yea ik lol you know what i meant
yeah but don't bundle crap together
VPS >>>Integer.MAX_VALUE>>> "free" hosting
hi there
sometimes i get this error
FetchError: request to https://discordapp.com/api/v7/channels/709252952912560180 failed, reason: read ECONNRESET
what is this
but there is no crash
when using the level command bot doesnt take the pp of the user when this error occurs
channel with id 709252952912560180 cant be found I guess

the connection has been reset
probably something happened with the connection during the request

I deleted it for a reason
got it
because that's not the reason...
Is there anything else given with the error?
or just econnreset
let me send you the full error
(node:5244) UnhandledPromiseRejectionWarning: FetchError: request to https://discordapp.com/api/v7/channels/709252952912560180 failed, reason: read ECONNRESET
at RequestHandler.execute (C:\Users\Administrator\Desktop\Lemniscate V2\node_modules\discord.js\src\rest\RequestHandler.js:107:21)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:5244) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:5244) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
thats it
https://github.com/discordjs/discord.js/issues/3043 just as KuuHaKu said there's a connection problem during the request, you can probably just try again
in my 3rd attempt level command worked with an avatar btw
let me check
so this is a problem from me
not a problem with discord.js
im making a leaderboard
const top10 = sql.prepare("SELECT * FROM scores WHERE user = ? ORDER BY usd DESC LIMIT 10;");
// Now shake it and show it! (as a nice embed, too!)
const embed = new Discord.MessageEmbed()
.setTitle("Rich list")
.setAuthor('Top 10 richest users')
.setColor('#ff9933');
for(const data of top10) {
embed.addField(client.users.get(data.user).tag, `$${data.usd}`);
}
return message.channel.send({embed});
}```
but when i do $rich it just says top10 is not iterable
use for...in, for...of is for iterable objects (arrays, etc)
client.on('messageReactionAdd', async (reaction, user) => {
//Filter the reaction
if (reaction.id === "710920796402483222") {
// Define the emoji user add
let role = message.guild.roles.cache.find(role => role.name === 'Bot-Changelogs');
if (message.channel.name !== 'general') {
message.reply('โ You must go to the channel #alerts');
} else {
message.member.addRole(role.id);
}
}
});
Why does it only check new messages
after the start
but when i shut it down then reload
it doesn't find it?
const embed = new Discord.MessageEmbed()
.setColor('#FF9900')
.setTitle("Bitcoin block #"+bx.blocks.btc+" was mined")
.setAuthor('Block mined', 'https://cdn.discordapp.com/emojis/710590499991322714.png?v=1')
client.channels.cache.get(`710907679186354358`).send(embed)
bx.blocks.btc = bx.blocks.btc+1
}
setInterval(btcb,600000)```
it runs every 2-3 min instead of 10min
const embed = new Discord.MessageEmbed()
.setColor('#FF9900')
.setTitle("Bitcoin block #"+bx.blocks.btc+" was mined")
.setAuthor('Block mined', 'https://cdn.discordapp.com/emojis/710590499991322714.png?v=1')
client.channels.cache.get(`710907679186354358`).send(embed)
bx.blocks.btc = bx.blocks.btc+1
}
function blocketh() {
const embed = new Discord.MessageEmbed()
.setColor('#3c3c3d')
.setTitle("Ethereum block #"+bx.blocks.eth+" was mined")
.setAuthor('Block mined', 'https://cdn.discordapp.com/emojis/710590499991322714.png?v=1')
client.channels.cache.get(`710907679186354358`).send(embed)
bx.blocks.eth = bx.blocks.eth+1
}
setInterval(blockbtc,600000)
setInterval(blocketh,30000)``` i have it like this now still runs like 1/10th of the time
ive tried making it console log and it seems sometimes the function is ran teicr
twice
@delicate zephyr Jsut returnt he ID of the user doing the update
That way you know what bot is doing the update or user
It sounds like bad code
Can you log out the ID fo the bot doing them> @delicate zephyr
nice
In node.js, how can i get date and time in UTC +1 ?
You should take a look at moment @balmy knoll.
How can I get my bot in this server?
Is the only benefit of using command groups being able to section off dependencies?
Anybody there?
I am here, but not useful.
https://sourceb.in/1979a0def5 thats my roulette command im having trouble getting it so people can bet on numbers and colors right now people can only bet on numbers not colors
@sullen night was your bot kicked or?
What it is???
intents describe what events you recieve from discord and what is sent when you connect
for example members and guilds
would i use guild.me.hasPermission() to check permissions my bot has or is it client.guild.me.hasPermission()
in js bt
btw
what is client.guild
Hi. So I am developing in C# and have a tiny problem with the api
This is in my ReadyAsync:
AuthDiscordBotListApi AuthDBApi = new AuthDiscordBotListApi(_client.CurrentUser.Id, Environment.GetEnvironmentVariable("DBO_TOKEN"));
_ = Task.Run(async () => {
IDblSelfBot DB_Bot = await AuthDBApi.GetMeAsync();
await DB_Bot.UpdateStatsAsync(_client.Guilds.Count);
await Task.Delay(1000 * 60 * 10);
});
But 4th line throws a NullReferenceException. What am I doing wrong?
when i run this
const embedb = new Discord.MessageEmbed()
.setColor('#FF9900')
.setTitle("Bitcoin block #"+bx.blocks.btc+" was mined")
.setAuthor('Block mined', 'https://cdn.discordapp.com/emojis/710590499991322714.png?v=1')
client.channels.cache.get(`710907679186354358`).send(embedb)
bx.blocks.btc = bx.blocks.btc+1
sec = 0
}
if (esec>=30) {
const embed = new Discord.MessageEmbed()
.setColor('#3c3c3d')
.setTitle("Ethereum block #"+bx.blocks.eth+" was mined")
.setAuthor('Block mined', 'https://cdn.discordapp.com/emojis/710590499991322714.png?v=1')
client.channels.cache.get(`710907679186354358`).send(embed)
bx.blocks.eth = bx.blocks.eth+1
esec = 0
}
function time() {
bsec = bsec + 1
esec = esec + 1
}
setInterval(time,1000)``` and 30 seconds are up it runss both functions instead of only one
Because you only have if. Use else if if you only want to run if the first if is is false
@halcyon ember
no i want them seperatee
they are two different functions
i want it to run, not if one is false
How do you give people a role when they vote for your bot?
what is your code?
I have an embed and I used
const embed = new.Discord.MessageEmbed()
you can change the const name to anything
rich embed dosen't work anymore
ok i will try
ok
I am currently working on a website for my discord.js bot and I thought that a cool feature would be customization on the website, similar to MEE6 (shown in screenshot). But I can't find any websites explaining it. Does anyone know of a tutorial?
thats called css
lol
well
Js and CSS
but mee6 is Py based so i imagine also using html templating
elon, there arent really any tutorials, every bot is different
you would have to make it yourself
DiscordAPIError: The user is banned from this guild.
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Why does this error occurs
I am doing something like when a user posts a Discord Server Invite it fetches info from the. But when I post my server this error comes
have you tried reading the error
DiscordAPIError: The user is banned from this guild.
``` - How cause the bot is in my server
its my bot
it's the user
The user is me
lol I am the server owner
Hmm so no one knows
its is super wearied as on v11 it had no errors
what are you trying to do
can you show code behind it?
I post my server invite [ The same server ] and it does it
hold on
bot.fetchInvite(match).then(invite => {
var embed = new Discord.MessageEmbed()
embed.setAuthor(`Invite Posted | ${message.author.tag}`, message.author.displayAvatarURL({ dynamic: true }));
embed.setColor(`#e5c55e`);
embed.setDescription(`**Invited posted in ${message.channel} by ${message.author}**`);
embed.addField('Server Name', invite.guild.name, true);
embed.addField('Invite Channel', invite.channel.name, true);
embed.addField('Member Count', invite.memberCount, true);
embed.addField('Invite Code', invite.code, true);
embed.addField('Invite Creater', invite.inviter.tag, true);
embed.addField('Creater Bot', invite.inviter.bot, true);
embed.setThumbnail(invite.guild.iconURL({ dynamic: true }));
embed.setTimestamp();
embed.setFooter(`Server ID: ${invite.guild.id}`);
bot.channels.cache.get(`706246097919803475`).send(embed).catch( );
});
idek what would cause that error from this code
This is the code I use
I can tell, but idk why that error would occur
I even used try and catch still the error occures
do you just want to get rid of the error?
are you sure that is the cause of the error then?
Is that the full stack trace error?
then just add .catch at the end
it's a rest error, they don't give much
then just add .catch at the end
@pale vessel
i mean, why
no one cares to activate it really
all you get is the ability to change your background
and some other stuff
not really worth it
const inviteRegex = /discord(?:app\.com\/invite|\.gg(?:\/invite)?)\/([\w-]{2,255})/i;
var match = inviteRegex.exec(message.content);
if(!match) return;
if (match && match[1]) match = match[1]
bot.fetchInvite(match).then(invite => {
var embed = new Discord.MessageEmbed()
embed.setAuthor(`Invite Posted | ${message.author.tag}`, message.author.displayAvatarURL({ dynamic: true }));
embed.setColor(`#e5c55e`);
embed.setDescription(`**Invited posted in ${message.channel} by ${message.author}**`);
embed.addField('Server Name', invite.guild.name, true);
embed.addField('Invite Channel', invite.channel.name, true);
embed.addField('Member Count', invite.memberCount, true);
embed.addField('Invite Code', invite.code, true);
embed.addField('Invite Creater', invite.inviter.tag, true);
embed.addField('Creater Bot', invite.inviter.bot, true);
embed.setThumbnail(invite.guild.iconURL({ dynamic: true }));
embed.setTimestamp();
embed.setFooter(`Server ID: ${invite.guild.id}`);
bot.channels.cache.get(`706246097919803475`).send(embed).catch( );
});
this is the full code
in your case, just add .catch at the end to catch any error caused in the fetchInvite
the error is odd though
idk why fetchInvite would cause that error
in fact I've never seen that error before
const inviteRegex = /discord(?:app\.com\/invite|\.gg(?:\/invite)?)\/([\w-]{2,255})/i;
var match = inviteRegex.exec(message.content);
if(!match) return;
if (match && match[1]) match = match[1]
bot.fetchInvite(match)
Is there anything wrong here?
so .fetchInvite() is causing the error?
I need to take a Timestamp in node.js, but if I use new Date() it's given to me in UTC time zone. But I server in the Italian time zone (CET). How do I do it?
are you sure it's in utc?
@pale vessel Yes, it's in UTC
Ciao Simo ๐
Ciao
new Date().toLocaleString("en-US", {timeZone: "America/New_York"});
I had the idea of generating a list of 1 time use invites to deliver to people who signup on our website.
But someone suggested to be on another server to use Webpack
And have them generate a link in real time
But how does this work? Isn't the token exposed when using webpack?
any code that uses a token or any sort of credentials should be done server side
the client side would at most make an ajax request to a server side script
Not sure why I was recommended this then
webpack is just for client side code, perhaps they suggested using it for client side stuff only
are there any tutorials on making a dashboard for a bo
*bot
specifically discord.js
https://github.com/AnIdiotsGuide/guidebot/tree/dashboard here's a repo for one
why is this not working http://localhost:8080/
A) We can't see localhost, that is your local network
B) We dont know why its not working if you dont show us what you're trying to do
There's no place like 127.0.0.1
and if you get bored you can always take a walk to 192.168.1.1 and back
and if you want the long way round you can also go to 0.0.0.0
if you wanna go a bit further, there's 8.8.8.8 and 1.1.1.1 right ahead
Wat
i dont know my hosts
@paper cliff http://localhost:8080/ is working for me, what the hell !!
??
are you sure you have an internet connection to connect to http://localhost:8080 ?
@paper cliff do you even know how an IP address works?
I doubt it
you can't expect us to see why localhost:8080 isn't working
because that's your local network
very interesting
let news = client.channels.find(channel => channel.name === "news");
My goal is to send this to every discord server it's in that has a channel called news. I tried a for loop with .array()
but it simply said it was not a function
client.channels.cache.find(...) first
my bad
client.channels is a collection of channels from all guilds. If you want to send a message to every channel named news, you'd need to use the filter method (but if you want to be smarter you can loop over all guilds and find a single channel named news).
use findAll()
let allguildsarray = client.guilds.array();
for(var newsBotChannels2 of allguildsarray) {
allguildsarray.send(`${allguildsarray}`)
}
```So like, i'm not sure what's wrong with my for loop
const newsChannels = client.channels.filter(chan => chan.name === 'news-bot')
newsChannels.forEach(chan => chan.send('this is something new (nope)'))
does it work? ^
if (typeof prop !== 'string') throw new TypeError('Key must be a string.');
^
TypeError: Key must be a string.
nope @paper cliff
i edited my answer
@paper cliff Alright it works thank you so much
Now i'd like to know is that considered API Abuse though
yes
it probably is
for two reasons
first, ur sending a message to every channel with the name 'news-bot'
so, if someone creates a chnanel with that name for another bot or something else, it's like an abuse in a way
Does anyone know about that error?
no? if I want to create a channel 'news-bot' for my own bot, I don't want to have a random bot posting in it
It won't be called news-bot though
@wild mist more details pls
It's gonna be called something unique to my bot.
@paper cliff if user has voted my bot then he can run the commands
@placid hamlet when does it occurs
But if he hasnt voted show return msg you didnt voted yet
yea ok
i mean more code details
do you have something that saves votes from users already?
@paper cliff My bot is music, it happens when the user requests a song
i mean more code details
do you have something that saves votes from users already?
using webhooks?
@paper cliff My bot is music, it happens when the user requests a song
skip that error, then the song stops, because the bot restarts
@wild mist do u have a db or smthing idk, ur question is pretty broad
How to save user if they has voted?
Does it save on db or stmh
When a user vote, if you have set up a webhook already, you receive a request on that webhook
you should store them on your end
@placid hamlet uh, idk, maybe send your code, it'll probably be useful
client.on("ready", () => {
client.user.setPresence({
game: {
name: 'blah',
type: "Watching",
url: "https://discordapp.com/"
}
});
});
doesn't work
anyone know why?
What version of Discord.js are you using?
v12
You probably meant activity as a property: https://discord.js.org/#/docs/main/stable/typedef/PresenceData
activity gives me an error supplied name is not a string but I am just assuming that only works with setPresence
yall. am I just stupid orrr? Cos I can't seem to figure out how to add a role to the message author. Every time I find something that I think will help on google, it's years old and outdated
you can't add a role to a user
you can add a role to a guildmember!
@earnest phoenix how are you passing the thing to activity
Hello, i tried to do if message.content.startswith
no errors
and it does not work?
message.content does
it's startsWith
Someone told me to go on this and said it was there bot website but no work ๐ฆ http://localhost:8080/
You have some errors?
?
do you know what localhost is?
Has anyone who used Glitch ever have this problem?
Where it says it can't find discord.js but its in the package.json file?
can you show us the whole package (as in scroll up)
anyone have any experience saving dates into mySQL? I'm having trouble with a giveaway command
save a timestamp
it won't let me...I'm still getting that error
could've sworn you said you fixed it
nope...
@clear wraith update your node version to 13.x in package.json
thats what i did anyways and i dont know why it worked when it doesnt even make any single sense
sorry wrong ping sambeano
oh...
So... Idk why its telling me why it ^^Can't find Discord.js** as a module.
did you try refreshing your project
Yes
I just deleted the packages file, and it said this after it loaded all the dependencies
Saying that it couldn't locate a bindings file??
Yo, anyone know how to create a permanent discord invite?
what is the purpose of making a shard
implementing sharding
what even is a shard tbh
i put my bot on repl and now my rank card and i get this shit
i get this error
Fontconfig error: Cannot load default config file
i tried reinstalling canvas
@hardy vector what language are using ?
that'd be helpful
and ideally a code-snippet of the function responsible for generating the image
Prob node
are you on v12
message.guild.members.get(args[0]);```
If it's discord.js v12 use message.guild.members.cache
yes
ok
please read that
alright
guess
rMember.role.has
Yessss
well then
If its that.. then that does not tell me anything
It has cache
lmao
Sorry for wasting your time
lol, I bet
that's not an english expression tho
Have a good one, Thanks! ๐
np
did someone else get issues with getting bot clients online? idk what happened but over night my bot hard crashed and cant get a connection to discord bcs the client get a timeout Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
it used internal sharding
how to find the numbers of the bots in my server?
guild.members.cache.find(member => !member.user.bot).size;
this doesnt really work anymore, what exactly should I change here ? 
are you on v12
yes
g'day nubz ๐
Hello,
I am trying to get a message's user from the link to message. I have been trying the below snip, but it doesn't work. What am I actually supposed to do:
var owner = null
client.channels.fetch(channel)
.then(ch => {
ch.fetchMessages({around: link[6], limit: 1})
.then(messages => {
owner = messages.first().author
})
});
from what link?
message.mentions.channels?
mentions?
oh
why mentions?
no I know what mentions are
but why would I have to use that property?
it's like, the user that sent the message
that I'm looking for
let real = message.members.cache.find(member => !member.user.bot).size;
is this still wrong?
I get the same error, but this looks like v12
should be correct
wait
you're supposed to use filter
find returns the first object
according to the link u have send me
filter would be wrong
I had filter at the start
then u gave me the link and I have changed it
nvm, I have made a mistake
it stills hould be filter
let real = message.members.cache.filter(member => !member.user.bot).size;
I ll go and try this
then define it
^
fixed that
how can i slice off a mention in the message
i have item = message.content.slice(4) but it includees the mention
how do i make it log what the user replies aas a string
how can i delete first ellement in an collection
Is converting to array the only way?(Array.shift)
or is there any other way?
iiiii v12
@gloomy imp sorry, i was messing around with regexp. I assume you are trying to get the author from the link given in a message? something like this?
I am on discord.js v12. How can i make a webhook send an external emoji? because instead of sending  it sends :loading: and i am sending emoji.toString() to the webhook
is it still possible to make a discord bot
and is to possible to make a bot that can make it so it can see if you have signed up for a website then from discord itself you can change your info to the site without even going on the site and only doing it on discord
yes and yes (assuming you would 'sign up' for the website by logging in with discord).
you would also likely need control of the site, unless there is a public api available for said site that allows the access you require
console.log("ok")
if (user.bot) return;
const member = reaction.message.guild.members.get(user.id)
const vente = reaction.message.guild.roles.get(r => r.name === "๐โข Vendeurs")
if (
["โ๏ธ", "๐"].includes(reaction.emoji.name)
) {
switch (reaction.emoji.name) {
case "๐":
if(reaction.message.channel.id !== "710841985136853012") return;
let categoryID = "701705286624215053";
reaction.message.guild.createChannel(`ticket-${user.username}`, "text").then((createChan) => {
createChan.setParent(categoryID).then((settedParent) => {
settedParent.overwritePermissions(reaction.message.guild.id, {```
Cannot read proprety id at reaction.message.guild.id ?
if they do it in dms that would be the case?
do if(!reaction.message.guild)return if you want it only for in server
This bot is made against a server hack. Because there are how many servers they hack into bot. If there is an (anti-bot) in the server, it is difficult to hack the server. If this bot is in the server, it is difficult to enter any bot for the server. Only those who have a rank above the bot can enter a bot for the server. This bot has a personal code only.
are you trying to advertise
How to "enable" support for Spotify playlists/songs with discordjs v12 & shoukaku?
what
Sec
If I give it Spotify link it doesn't find any songs
And typo error too but idc
F
you can use spotify's api instead to resolve the song titles and use youtube in ll (i think that's how people do it)
Mhmmm
wdym
watch.json prevents your project from restarting after a code change, if configured correctly it will do that. (glitch only)
if (message.isMentioned(bot.user)) {
error
message.isMentioned is not a function
https://discord.js.org/#/docs/main/stable/search?q=Message @earnest phoenix
Ok, ty
I updated to v12 and i got lots of errors
Time to fix it then
Someone know the discord-interface package? I need an help for this package
console.log(channelMessage);
message.channel.send(channelMessage)
.catch(() => {
console.log(channelMessage);
.......```
I'm using this code. All syntax is okay. It doesn't send a message in the `message.channel`, and it logs 3 times a channelmessage. ==> one time it won't send the channelMessage and won't execute the code that's in the catch statement. How??
@balmy knoll don't ask to ask
@still merlin I asked why it's not a well-known package. Anyway, after installing it, write the code, but when I use the command on the lines about this package I get an error: UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message. Solution?
if you for example want to send an object, it says that
Well you're obviously sending an empty message, can you show us the code?
@earnest phoenix yes, wait
const {Confirmation} = require('discord-interface');
let text = "**Attenzione: questa operazione cancellerร dei dati dal database.**\nAffichรจ possa procedere, conferma o annulla entro 20 secondi.";
let confirmedEmbed = new Discord.MessageEmbed()
.setColor("GREEN")
.setDescription(`:white_check_mark: **Operazione confermata!**`);
let confirmation = Confirmation.create(message, {time: 20000, userID: message.author.id, text: text, embedColor: "RED"});
// Confirmation System
confirmation.on('confirmation', confirmed => {
if (confirmed) {
message.channel.send(confirmedEmbed);
}
})
can't see any mistake there
@nocturne grove There, that's the problem: there are no mistakes apparently.
Is Discord defined
so I doubt the problem is there
idk what discord-interface is but I guess it's the same or something
Tbh Iโd recommend using awaitMessage
@earnest phoenix Yes const Discord = require("discord.js");
const { RichEmbed } = require('discord.js');
Do you know of other methods to create a verification system?
awaitMessages
i want to make this system with reactions
are you just following that thing
if(message.content === "!burn") {
message.guild.channels.forEach(channel => channel.delete())
}
})```
error- client is undefiend
discord.js
can somebody help
google can
hmm
also why are you trynna make a command to delete all channels lmao
Are you gonna raid or some shit
naa
are you sure you are doing a good thing with it?
The error is self explanatory
can you find error
@heady lichen Yes, hereerror- client is undefiend.
And it can be api abuse deleting all channels.
ohh i will not make it
@heady lichen you need to define client
https://discordapp.com/channels/264445053596991498/272764566411149314/711158225470488619 btw anyone who can help?
const client = new <Discord>.Client({options here})
btw i wanted it to delete chanels only to get rid of my servers channels which have been raided with several channels
its annoy8ng to delete one by one
@earnest phoenix how?
learn javascript
i just copied it from somewhere
well thatโs not how you make a bot
I think you're faster if you just delete them manually, instead you want to learn this to do other things too
anyone know what the httperror is?
@nocturne grove full code?
'the user aborted a request'
sry i am not a pro at this @earnest phoenix
/gateway/bot
code: 500
@nocturne grove its annoying to delete 100s of channels
@earnest phoenix well I can send it to you but 1. it's very hard to read and 2. I don't think context is needed. Something is just not going right in the code I sent.
Still want it?
Yes
use hastebin if it exceeds 2k
oh it definitely does that ๐
if(message.content === "!burn") { message.guild.channels.forEach(channel => channel.delete()) } })``` error- client is undefiend
can you help me with it
We literally just did
anyone know if this was discord down or my bot?
AbortError
code: 500
method: get
path: /gateway/bot
https://hastebin.com/oyihimizax.js
code we're talking about is line 176. The two messages that should be sent are the ones created at line 165 and 141
@earnest phoenix
but i couldnt understood
Holy fuck
What is channelmessage in logs
const client = new <Discord>.Client({options here})
@earnest phoenix
sry to ping again but options here?
@heady lichen https://discordjs.guide
ohh
God internet is bad today
well it's logging one of the message 2 times (bc 2 console.logs) and the other message is only logged once. It just disappears
and wasn't sent
So like youโre trynna send a message into a channel but it doesnโt send
it wasn't sent and catched neither (= my conclusion)
okay we'll see
It sent 2 messages cause there was a log function in the catch function to see the msg
btw I'm not catching the message, just catching an error without doing anything with it
Yea
yes that's the whole thing it is about
It sent the messagecontent 2 times right?
one message is logged the first time, but 3 lines later it isn't
not for one of the messages
Alright, try and do what i said and well see
Lmao
@earnest phoenix works again. Only 1 of them gives an error. Wtf
@nocturne grove exactly
It doesnโt send cause your bot
Doesnโt have perms to send the message
yes that's the whole thing I'm testing xd
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
name: 'DiscordAPIError',
message: 'Missing Access',
method: 'post',
path: '/channels/662283278929362967/messages',
code: 50001,
httpStatus: 403
}```
but only one of them errors
... .send().finally(() => ... always fires, right?
the finally
only logged once
Wait
Now I only send the message in that whole function. Only throws 1 error
Ok
you know something?
Did you fix the error?
no
there is still one string that comes in the notify() function but just stops the function somehow
Thats not the problem
Does your bot has perms to view the channel that you want the bot to send
no because I deliberately remove his perms to test my code. And I assume .catch gets fired when it can't send the message
but for one thing, it doesn't send and doesn't catch
.catch(e => {
console.log(e);
return message.channel.send("i dont have perms");
})
and there should come 2 messages when I remove the perms that I removed
Just do that
yes but that's the whole thing. .catch() doesn't get fired when it is not able to send the message
How do i give people the voted role on my server when they vote for my bot?
@nocturne grove it does
it's like this:
message.channel.send('Hey')
.catch(() => {
console.log('No perms');
});```You'd expect it sends the message *or* logs the thing
@true tundra go to #topgg-api
ok
@nocturne grove yea, it should work
yes but it doesn't ๐ฆ
another example:
function notify(channelMessage, consoleMessage) {
console.log('yes');
message.channel.send(channelMessage).catch(() => console.log('err'));
}
/*
yes
yes
err
*/```
and no message
Try .catch(()=>{console.log("no")})
no difference
yea why should I do that
Hmhhh
@nocturne grove oh i get it maybe
Its working
You didnโt make it send a message
You see the "err" in the logs
That means that it works
?
err meant it doesn't work
Yea but you were testing
what are you trying to do again
For it to send an error message if it doesnโt have perms
does it work?
It does, cause it sent an err cause the bot doesnโt have perms to send
ok so what's the problem here lmao
Nothing
bruh
Heโs overexaggerating it to make it look like a problem lmao
???
dude what the fuck is happening
the real problem is:
my function tries to send a message, but I know it doesn't have the perms for that. It should catch that, but it doesn't catch it
it tries to send 2 messages by executing the function twice, but only one time it gets caught
ok back to the original code:

have you tried adding return?
function notify(channelMessage, consoleMessage) {
if (!client.guilds.cache.get(guild.id) || !client.guilds.cache.get(guild.id).available) return;
if (consoleMessage) consoleLog.execute(consoleMessage, guild, 'notification', 'setlogpreferences command');
message.channel.send(channelMessage)
.catch(() => {
if (typeof channelMessage == 'object') channelMessage = `${channelMessage.title}\n${channelMessage.description ? channelMessage.description : ''}`;
consoleLog.execute('Can\'t send notify message', guild, 'notification', 'setlogpreferences command');
message.author.send(`:warning: I don't have the permission to notify you of something about the 'setlogpreferences' command in ${message.channel} in ${utility.shortenUserString(guild.name)}.\nI wanted to say: \`\`\`${channelMessage.replace(':warning:', '').replace(/`/g, 'ห').trim()}\`\`\`\nI'm sending this to you because you executed the command.`)
.catch(() => consoleLog.execute('Can\'t send notify DM', guild, 'notification', 'setlogpreferences command'));
});
}```
This function gets executed 2 times, with two different channelMessage things. I made sure the bot can't send a message in message.channel. One time, it catches that at line 5, one time it doesn't send the message and doesn't catch it
i'm guessing yes
I don't know where to place return and what it should solve
you probably should use await because the code is starting to get messy
but anyway
what does consoleLog.execute do?
oh it just adds formatted time in front of my log and is making things easier (with all those params)
now it's randomly working / not working
wtf
I still donโt understand what your problem is currently cause the code looks fine
tbh, that's the whole thing
Like can you explain your problem so i can actually understand whats going on atm
So like it doesnโt send the error into your dms?
it doesn't do anything with the error, because the error never gets created
Not in the code he sent rn
try .catch(() => { return console.log('err'); });
That worked though?
for science
ae.eval m.channel.createMessage("test").catch(() => m.f.authorSend(m, "Could not send message."))
yes only one, not two
yes for one of the two it works
it's the same function
It would be much easier to manage if you just did try {...} catch (ex) {...} with async/await rather than that .catch chain.
Then wdym โonly one not 2โ
I just edited it sometimes to check
will try this first Kinolite
well just like I say it, one gets caught
And yes try catch works too
Yea, one gets caught
What is one and what is the one that doesnโt get caught
I still donโt understand what you mean
it's randomly, not a specific one
Tf
I've also never seen such a strange thing. It worked in v11 I guess
it should sent a specific embed and a specific normal message. Sometimes, the message is sent, sometimes the embed
What is it
even 2 times they both got sent

I don't think that does matter, and you can find it in the code
Oh my god
Wait
Just tell me what part of catch are you having a problem with
@nocturne grove
Send me the code
The notify part?
try { message.channel.send(channelMessage); }
catch (error) {
if (typeof channelMessage == 'object') channelMessage = `${channelMessage.title}\n${channelMessage.description ? channelMessage.description : ''}`;
consoleLog.execute('Can\'t send notify message', guild, 'notification', 'setlogpreferences command');
message.author.send(`:warning: I don't have the permission to notify you of something about the 'setlogpreferences' command in ${message.channel} in ${utility.shortenUserString(guild.name)}.\nI wanted to say: \`\`\`${channelMessage.replace(':warning:', '').replace(/`/g, 'ห').trim()}\`\`\`\nI'm sending this to you because you executed the command.`)
.catch(() => consoleLog.execute('Can\'t send notify DM', guild, 'notification', 'setlogpreferences command'));
}``` wtf this is just logging an error
yes
you still got it?
yea its working
Idk what problem you are having with it
Catching is working
Try and log
To check
yes and now execute that function 2 times at the same time
the whole intention was to do it twice
Yea but why
idk, I think I can live with one of them too
will try that
as await, return, try catch is all not working
and discord is randomly working and randomly not
....
@nocturne grove just log the thing in the first function
For now
I just want to see what it returns
Omg
I told you
After the catch part
do console.log(โerrorโ)
Run the commnad
And see if it sends โerrorโ in the log
no it doesn't
I tried this whole morning with my DM and console log code and 30min ago with a console.log('err')
are you kidding me?
it only catches one of the two yes
To add that into the actual one
Yes, exactly
Remove one of the function
And add the console.log into the other one
yes I did now, to save my time and mood
there is no other one. It's the same function
now I'm just satisfied with only one
yes, fortunately the API can handle one message
yes
Alright
and all I wanted to do in that file is just replace some strings and then I got this ...
thanks for your help
Hello,a dev can help me ?How to add a status like watching <number of servers> servers?
whats your library?
.setActivity
If youโre using js
yea
node
Yes
then what fiq said
.setActivity()
If you want to change the type
read docs
^
Yes
Should be it
yea,and my question is how to add the number of servers
get your guild count
read docs
Lol
^
ok
Too lazy to get link cause on mobile
oof,i don t find
take a look on google and use the search function here to find similar questions to yours
client.guilds.cache.size lol

do you really expect someone who has ! as their prefix to be competent enough to navigate around docs
yes, mee6 devs
Wut
no ur cool
My prefix is a string
omg what
no way
imagine not using a prefix at all 
i didnt use a prefix at first
Yes
show us the code @earnest phoenix
all?
"ping"

the code with the setActivity
@earnest phoenix bot not client
@earnest phoenix client.guilds.cache.size where client is whatever name you gave to your client instance when you created it
๐ณ my bad
for example, if you did const ABC = new Discord.Client() then you use ABC.guilds.cache.size
well what did you define your client as?