#development

1 messages ยท Page 929 of 1

terse vine
#

how can I get in here my bot?

sudden geyser
#

You apply.

earnest phoenix
#

Visiting the top.gg website and log in. After that, just look for the Add Bot option. Remember that the bot must be approved.

sudden geyser
main stream
#

@reef shard

#

lol

#

++help

honest perch
#

@plucky atlas, what do you mean by coding window lol

near ether
#

"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

white anvil
#

429 is ratelimit

quartz kindle
#

do you listen to the ratelimit event?

amber fractal
#

rate limit

#

you need to slow down

near ether
#

yes and i log the stack

#

but it doesnt help me personally

quartz kindle
#

whats the method in the stack?

near ether
#

like my code's method? you can do that?

quartz kindle
#

no in the error stack trace

#

there is the path and the method

near ether
#

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

quartz kindle
#

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

near ether
#

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

amber fractal
#

looks more like fetching

#

just because reactions

#

but idk

quartz kindle
#

sounds like stuck on a loop

#

do you fetch messages when they get reacted on?

mystic violet
near ether
#

what do you mean fetch them?

#

i used the message collector and pass the message to my other functions

quartz kindle
#

for example, if users react on an uncached message, you need to fetch it

near ether
#

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?

quartz kindle
#

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?

near ether
#

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

quartz kindle
#

so you're not using something like this?

near ether
#

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

quartz kindle
#

anywhere in your code that you use channel.messages.fetch()?

near ether
#

nope, not once lol

quartz kindle
#

so its either sending or editing

near ether
#

yep

#

edits the embed based on what the user reacted with

#

i do get a ton of "unknown message" warnings though

quartz kindle
#

do people often spam your reactions?

near ether
#

sometimes yes, but my collector ends right after the first valid reaction is made

quartz kindle
#

well its difficult to say what could be causing it

sonic lodge
#

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
}
quartz kindle
#

user not found

sonic lodge
#

oof no wonder

#

thank you

mystic violet
#

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)

earnest phoenix
#

you can just ssh into it

#

and use the command line

silent berry
#

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") {
lyric mountain
#

add another id to the if clause

silent berry
#

how would i do that exactly

lyric mountain
#

like you did above, but with && instead of ||

silent berry
#

ah thanks

#

your the best

earnest phoenix
#

or you can check an array of user ids

#

if(["userid1","userid2"].includes(message.author.id)) {<eval>}

halcyon ember
#

how do i make my bot run something every 9-11 minutes?

lyric mountain
#

don't

halcyon ember
#

wut

lyric mountain
#

making X run every N seconds/minutes/whatever is a bad idea

#

except if N is big enough

earnest phoenix
#

@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);

halcyon ember
#

ok

#

and thaat makes it run every x ms?

earnest phoenix
#

yep

lyric mountain
#

no

#

it'll just delay the action

earnest phoenix
#

what i just sent logs "Hello" every 5 seconds

lyric mountain
#

you'll need to put it inside a while

earnest phoenix
#

@lyric mountain setTimeout =/ setInterval

lyric mountain
#

ah, didn't noticed

earnest phoenix
#

setTimeout delays the function, setInterval makes it run every x ms

#

oh i forgot the closing bracket ๐Ÿคฆ๐Ÿฟโ€โ™‚๏ธ

halcyon ember
#

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

earnest phoenix
#

oh
no

halcyon ember
#
      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
    }```
earnest phoenix
#

@halcyon ember i would not suggest doing a send in a while()

#

bad

halcyon ember
#

well now its a function

earnest phoenix
#

so you want to run that function in an interval

halcyon ember
#

ye

#

i want to run that every 9-11 minutes

earnest phoenix
#

then you gotta setInterval(block,delayInMs)

halcyon ember
#

at the end of my async function?

earnest phoenix
#

whereever you want the loop to start

halcyon ember
#

gotit

#

my client.channels.get is saying unknown get

amber fractal
#

because it's client.channels.cache now

halcyon ember
#

oh

amber fractal
#

https://discord.js.org/#/docs/main/stable/general/welcome read the updated docs, a bit has changed

hardy vector
#

is ti just me or is dbl api dying

halcyon ember
#

still says its not a function

hardy vector
#

Oops! Error: 401 Unauthorized

halcyon ember
#

client.channels.cache(710704393426698310).send(embed)

lyric mountain
#

oh my

earnest phoenix
#

client.channels.cache.get(id) or client.channels.resolve(id)

copper cradle
#

@halcyon ember ...

#

dude

#

are you being serious

#

:readthedocs:

#

read the fucking docs

#

it isn't that hard

halcyon ember
#

oh

copper cradle
#

and how does cache() make sense to you

halcyon ember
#

it doesnt

copper cradle
#

then

#

client.channels.cache(710704393426698310).send(embed)
why did you even try this

halcyon ember
#

idk lol

#

i am small brain

copper cradle
#

๐Ÿ˜ณ

earnest phoenix
#

๐Ÿง 

halcyon ember
hardy vector
#

so my bots custom status contains how many servers its in is there anyway to make the custom status update without restarting the bot

amber fractal
#

maybe an interval or something

#

idk

tight plinth
#

in what language your bot is coded

hardy vector
#

discord.js

tight plinth
#

well

#

make a setInterval in your ready event

#

which triggers every few minutes

copper cradle
#

@hardy vector your bot is written in js, discord.js is NOT a language, it's a library

#

ffs

tight plinth
#

^

#

hopefully were smart

indigo willow
#

Do you think I should let my pc turn so I ainโ€™t missed when they test my bot?

tight plinth
#

and we know that discord.js=js

copper cradle
#

yeah

tight plinth
#

@indigo willow if you self host your bot on pc never turn off it

copper cradle
#

@indigo willow guess

lyric mountain
#

well, gl keeping your pc turned on 24/7 for 2 weeks

tight plinth
#

24/7 bot>sometimes online bot

copper cradle
#

you shouldn't self host your bot

indigo willow
#

you shouldn't self host your bot
@copper cradle how do you want to host my bot else ware?

tight plinth
#

vps

#

@wispy fox no

lyric mountain
#

glitch
@wispy fox god please no

copper cradle
#

@wispy fox no

tight plinth
#

if you want a free host do heroku

copper cradle
#

no

lyric mountain
#

EVERYTHING is wrong with it

tight plinth
#

heroku>glitch (for me)

copper cradle
#

just get a GCP acc and host it there

#

it's real VPS

indigo willow
#

I just want a little bit so it should be ok

modest maple
#

Every single one of my bots would crush glitch lmao

copper cradle
#

unlike the shitty glitch and heroku

tight plinth
#

get gud friends giving u vps acc

lyric mountain
#

well

copper cradle
#

@modest maple lmao

#

free hosting is never good

lyric mountain
#

do you want a easy life making bots?

copper cradle
#

and glitch is the best example of it

lyric mountain
#

better make boats then

slender thistle
#

Glitch as a free service used mostly for websites isn't really bad

tight plinth
#

free hosting<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<paid hosting

#

glitch isnt meant to host discord bots

slender thistle
#

You people might want to actually help instead of going "X is shit"

tight plinth
#

I use glitch as my sharex server lol

copper cradle
#

if that's everything you know then

hardy vector
#

@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

copper cradle
#

yeah but don't bundle crap together

lyric mountain
#

VPS >>>Integer.MAX_VALUE>>> "free" hosting

tight forum
#

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

tight plinth
#

channel with id 709252952912560180 cant be found I guess

tight forum
lyric mountain
#

the connection has been reset

#

probably something happened with the connection during the request

amber fractal
#

dont look at that

#

wrong one lol

tight forum
amber fractal
#

I deleted it for a reason

tight forum
#

got it

amber fractal
#

because that's not the reason...

#

Is there anything else given with the error?

#

or just econnreset

tight forum
#

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

amber fractal
tight forum
#

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

halcyon ember
#

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

amber fractal
#

use for...in, for...of is for iterable objects (arrays, etc)

halcyon ember
#

oh

#

now everything comes out as undefined

amber fractal
#

try console.log(data) in the loop

#

see what that data is there

halcyon ember
#

ok

#

it doesnt do anything

#

consolee is empty

sweet cloak
#

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?

halcyon ember
#
          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

halcyon ember
#
  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

magic jackal
#

@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

balmy knoll
#

In node.js, how can i get date and time in UTC +1 ?

magic jackal
nimble escarp
#

You should take a look at moment @balmy knoll.

sullen night
#

How can I get my bot in this server?

cinder gulch
#

Is the only benefit of using command groups being able to section off dependencies?

sullen night
#

Anybody there?

cinder gulch
#

I am here, but not useful.

sullen night
#

Chill bro

#

You started bot developing?

queen needle
#

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

earnest phoenix
#

@sullen night was your bot kicked or?

sand ginkgo
white anvil
#

intents describe what events you recieve from discord and what is sent when you connect

#

for example members and guilds

earnest phoenix
#

would i use guild.me.hasPermission() to check permissions my bot has or is it client.guild.me.hasPermission()

#

in js bt

#

btw

white anvil
#

what is client.guild

earnest phoenix
#

i saw it on stack overflow idk

#

kinda just messing around rn with stuff so

white anvil
#

u should probably read the docs to find out

#

it will be the former though

pine jacinth
#

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?

halcyon ember
#

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
pine jacinth
#

Because you only have if. Use else if if you only want to run if the first if is is false

#

@halcyon ember

halcyon ember
#

no i want them seperatee

#

they are two different functions

#

i want it to run, not if one is false

torn nebula
#

bsec, esec is args?

#

use different operator
if (bsec === 600)
if (bsec > 600)

true tundra
#

How do you give people a role when they vote for your bot?

paper token
#

when i try to do some command it appears this

earnest phoenix
#

what is your code?

paper token
#

im using discord.js

#

in visual studio code

earnest phoenix
#

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

paper token
#

ok i will try

earnest phoenix
#

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?

honest perch
modest maple
#

thats called css

#

lol

#

well

#

Js and CSS

#

but mee6 is Py based so i imagine also using html templating

honest perch
#

elon, there arent really any tutorials, every bot is different

earnest phoenix
#

nah I don't care about the style if thats what you are talking about

#

ok

honest perch
#

you would have to make it yourself

heavy marsh
#
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

pale vessel
#

have you tried reading the error

heavy marsh
#
DiscordAPIError: The user is banned from this guild.
``` - How cause the bot is in my server
#

its my bot

pale vessel
#

it's the user

heavy marsh
#

The user is me

pale vessel
#

you're banned

#

i have no idea

heavy marsh
#

lol I am the server owner

#

Hmm so no one knows

#

its is super wearied as on v11 it had no errors

amber fractal
#

what are you trying to do

heavy marsh
#

It works

#

On the error is bugging me

#

only*

amber fractal
#

can you show code behind it?

heavy marsh
#

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( );
        });
amber fractal
#

idek what would cause that error from this code

heavy marsh
#

This is the code I use

amber fractal
#

I can tell, but idk why that error would occur

heavy marsh
#

I even used try and catch still the error occures

pale vessel
#

do you just want to get rid of the error?

amber fractal
#

are you sure that is the cause of the error then?

#

Is that the full stack trace error?

pale vessel
#

then just add .catch at the end

heavy marsh
#

I dont know why the error occures and I want to fixe it

#

fix*

pale vessel
#

it's a rest error, they don't give much

#

then just add .catch at the end
@pale vessel

earnest phoenix
amber fractal
#

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

heavy marsh
#
        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

pale vessel
#

no

#

it's a promise, you either gotta use try catch and await or use .then and .catch

amber fractal
#

but what would even cause that error in that code

#

the fetchInvite?

pale vessel
#

in your case, just add .catch at the end to catch any error caused in the fetchInvite

#

the error is odd though

amber fractal
#

idk why fetchInvite would cause that error

#

in fact I've never seen that error before

heavy marsh
#
        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?

pale vessel
#

no

#

doesn't look like it would cause that error

heavy marsh
#

so .fetchInvite() is causing the error?

pale vessel
#

yes

#

since it's a rest error

balmy knoll
#

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?

pale vessel
#

are you sure it's in utc?

heavy marsh
pale vessel
#

you need moment-timezone

#

probably

#

never dealt with this

balmy knoll
#

@pale vessel Yes, it's in UTC

heavy marsh
#

Ciao Simo ๐Ÿ‘‹

balmy knoll
#

Ciao

heavy marsh
#

Ok back to finding the error

#

Where do you live in Italy

#

ok nvm this is off topic

torn nebula
#
new Date().toLocaleString("en-US", {timeZone: "America/New_York"});
lapis ocean
#

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?

quartz kindle
#

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

lapis ocean
#

Not sure why I was recommended this then

quartz kindle
#

webpack is just for client side code, perhaps they suggested using it for client side stuff only

hardy vector
#

are there any tutorials on making a dashboard for a bo

#

*bot

#

specifically discord.js

smoky spire
paper cliff
delicate zephyr
#

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

sudden geyser
#

There's no place like 127.0.0.1

quartz kindle
#

and if you get bored you can always take a walk to 192.168.1.1 and back

delicate zephyr
#

and if you want the long way round you can also go to 0.0.0.0

quartz kindle
#

if you wanna go a bit further, there's 8.8.8.8 and 1.1.1.1 right ahead

earnest phoenix
#

Wat

grizzled raven
#

i dont know my hosts

primal eagle
paper cliff
#

??

primal eagle
copper cradle
#

@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

paper cliff
#

yea ok

#

Luke explained it already but thanks

earnest phoenix
#

ONPokachuu very interesting

sweet cloak
#

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

paper cliff
#

client.channels.cache.find(...) first

sweet cloak
#

nope

#

im on v11

#

@paper cliff

paper cliff
#

my bad

sudden geyser
#

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).

sweet cloak
#

o

#

ok

#

ty

primal eagle
#

use findAll()

sweet cloak
#

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
paper cliff
#
const newsChannels = client.channels.filter(chan => chan.name === 'news-bot')
newsChannels.forEach(chan => chan.send('this is something new (nope)'))
#

does it work? ^

sweet cloak
#

if (typeof prop !== 'string') throw new TypeError('Key must be a string.');
^

TypeError: Key must be a string.

#

nope @paper cliff

paper cliff
#

i edited my answer

sweet cloak
#

@paper cliff Alright it works thank you so much

#

Now i'd like to know is that considered API Abuse though

paper cliff
#

yes

sweet cloak
#

What?

#

I got told it was not.

paper cliff
#

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

placid hamlet
wild mist
#

Does anyone know how to make command accessable if user has voted?

#

Im using js

sweet cloak
#

@paper cliff Isn't that the users responsability.

#

It's my bot's purpose

paper cliff
#

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

sweet cloak
#

It won't be called news-bot though

paper cliff
#

@wild mist more details pls

sweet cloak
#

It's gonna be called something unique to my bot.

wild mist
#

@paper cliff if user has voted my bot then he can run the commands

paper cliff
#

@placid hamlet when does it occurs

wild mist
#

But if he hasnt voted show return msg you didnt voted yet

paper cliff
#

yea ok

#

i mean more code details
do you have something that saves votes from users already?

placid hamlet
#

@paper cliff My bot is music, it happens when the user requests a song

wild mist
#

i mean more code details
do you have something that saves votes from users already?
using webhooks?

placid hamlet
#

@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

paper cliff
#

@wild mist do u have a db or smthing idk, ur question is pretty broad

wild mist
#

How to save user if they has voted?
Does it save on db or stmh

paper cliff
#

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

wild mist
#

How to set webhooks on glitch?

#

Webhook running at http://0.0.0.0:5000/dblwebhook

earnest phoenix
#
client.on("ready", () => {
    client.user.setPresence({
        game: {
            name: 'blah',
            type: "Watching",
            url: "https://discordapp.com/"
        }
    }); 
  });

doesn't work

#

anyone know why?

sudden geyser
#

What version of Discord.js are you using?

earnest phoenix
#

v12

sudden geyser
earnest phoenix
#

activity gives me an error supplied name is not a string but I am just assuming that only works with setPresence

sonic copper
#

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

pale vessel
#

you can't add a role to a user

steel drum
#

you can add a role to a guildmember!

copper cradle
#

@earnest phoenix how are you passing the thing to activity

sweet cloak
#

Hello, i tried to do if message.content.startswith

#

no errors

#

and it does not work?

#

message.content does

pale vessel
#

it's startsWith

copper solstice
zenith orchid
#

You have some errors?

copper solstice
#

?

zenith orchid
#

What?

#

Ohh

#

Does your local server work on port 8080?

copper cradle
#

do you know what localhost is?

sick obsidian
#

!v

#

!h

#

h!v

#

h!

clear wraith
#

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?

sudden geyser
#

can you show us the whole package (as in scroll up)

fast trench
#

anyone have any experience saving dates into mySQL? I'm having trouble with a giveaway command

pale vessel
#

save a timestamp

fast trench
#

it won't let me...I'm still getting that error

pale vessel
#

could've sworn you said you fixed it

fast trench
#

nope...

earnest phoenix
#

@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

clear wraith
#

@sudden geyser

sudden geyser
#

oh...

clear wraith
#

So... Idk why its telling me why it ^^Can't find Discord.js** as a module.

sudden geyser
#

did you try refreshing your project

clear wraith
#

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??

sweet cloak
#

Yo, anyone know how to create a permanent discord invite?

hardy vector
#

what is the purpose of making a shard

grizzled raven
#

implementing sharding

fast trench
#

what even is a shard tbh

earnest phoenix
#

XD LUL REALYYY ?

pale vessel
hardy vector
wheat jolt
#

Can you show the full error?

#

Not only the message

steel drum
#

@hardy vector what language are using ?

#

that'd be helpful

#

and ideally a code-snippet of the function responsible for generating the image

wheat jolt
#

Prob node

steel drum
#

ya thats what i think too

#

but nvr hurts to ask

hardy vector
#

discord.js is the lib im using

#

ok

clear wraith
pale vessel
#

are you on v12

clear wraith
#
    message.guild.members.get(args[0]);```
wheat jolt
#

If it's discord.js v12 use message.guild.members.cache

clear wraith
#

yes

pale vessel
clear wraith
#

ok

pale vessel
#

please read that

clear wraith
#

alright

clear wraith
#

???

copper cradle
#

guess

clear wraith
#

rMember.role.has

pale vessel
#

did you even read

#

please

clear wraith
#

Yessss

pale vessel
copper cradle
clear wraith
copper cradle
#

well then

clear wraith
#

If its that.. then that does not tell me anything

copper cradle
#

it does

#

CACHE

clear wraith
#

It has cache

copper cradle
#

you're not using it

#

@clear wraith show me the cache there

clear wraith
#

nvm

#

I thought it was there, i guess im wrong... as always.

copper cradle
#

lmao

clear wraith
#

Sorry for wasting your time

copper cradle
#

don't worry

#

this happens all the time here lmao

clear wraith
#

lol, I bet

copper cradle
#

that's not an english expression tho

clear wraith
#

Have a good one, Thanks! ๐Ÿ™‚

copper cradle
#

np

lusty quest
#

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

midnight blaze
#

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 ? thinKappa

pale vessel
#

are you on v12

midnight blaze
#

yes

pale vessel
neat ingot
#

g'day nubz ๐Ÿ˜—

gloomy imp
#

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
            })
        });
neat ingot
#

from what link?

gloomy imp
#

channel = link[5]

neat ingot
#

message.mentions.channels?

gloomy imp
#

mentions?

neat ingot
#

oh

gloomy imp
#

why mentions?

neat ingot
#

i think

gloomy imp
#

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

midnight blaze
#
 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

pale vessel
#

should be correct

#

wait

#

you're supposed to use filter

#

find returns the first object

midnight blaze
#

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

pale vessel
#

where did it say it

#

send a screenshot

midnight blaze
#

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

gloomy imp
#

wait all this async stuff will mess me up...

#

guess I'll give up for now

halcyon ember
#

const amountToAdd = parseInt(args[1], 10);

#

says args is not defined

pale vessel
#

then define it

tight plinth
#

^

halcyon ember
#

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

small prairie
#

how can i delete first ellement in an collection
Is converting to array the only way?(Array.shift)
or is there any other way?

earnest phoenix
#

iiiii v12

neat ingot
#

@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?

visual sandal
#

I am on discord.js v12. How can i make a webhook send an external emoji? because instead of sending ![loading](https://cdn.discordapp.com/emojis/695354567579402250.webp?size=128 "loading") it sends :loading: and i am sending emoji.toString() to the webhook

earnest phoenix
#

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

neat ingot
#

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

earnest phoenix
#
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 ?
lament meteor
#

if they do it in dms that would be the case?

small prairie
#

do if(!reaction.message.guild)return if you want it only for in server

elfin tiger
#

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.

mossy vine
#

are you trying to advertise

tight plinth
#

How to "enable" support for Spotify playlists/songs with discordjs v12 & shoukaku?

mossy vine
#

what

tight plinth
#

Sec

#

And typo error too but idc

earnest phoenix
#

lavalink does not support spotify

#

iirc

tight plinth
#

F

pale vessel
#

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)

modest maple
#

Mhmmm

earnest phoenix
#

watch.json VDS Do you think it will work?

#

do you have answer xd

summer torrent
#

wdym

split hazel
#

watch.json prevents your project from restarting after a code change, if configured correctly it will do that. (glitch only)

earnest phoenix
#
if (message.isMentioned(bot.user)) {

error

message.isMentioned is not a function

#

Ok, ty

#

I updated to v12 and i got lots of errors

#

Time to fix it then

balmy knoll
#

Someone know the discord-interface package? I need an help for this package

nocturne grove
#
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??
still merlin
#

@balmy knoll don't ask to ask

balmy knoll
#

@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?

still merlin
#

I don't know?

#

I just said don't ask to ask

nocturne grove
#

if you for example want to send an object, it says that

earnest phoenix
#

Well you're obviously sending an empty message, can you show us the code?

balmy knoll
#

@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);
                        }
                    })

nocturne grove
#

can't see any mistake there

balmy knoll
#

@nocturne grove There, that's the problem: there are no mistakes apparently.

earnest phoenix
#

Is Discord defined

nocturne grove
#

so I doubt the problem is there

#

idk what discord-interface is but I guess it's the same or something

earnest phoenix
#

Tbh Iโ€™d recommend using awaitMessage

balmy knoll
#

@earnest phoenix Yes const Discord = require("discord.js");
const { RichEmbed } = require('discord.js');

earnest phoenix
#

Somethingโ€™s wrong with sending the confirmation message

#

Mhmm

balmy knoll
#

Do you know of other methods to create a verification system?

earnest phoenix
#

awaitMessages

balmy knoll
#

i want to make this system with reactions

earnest phoenix
#

Oh

#

Reaction collectors

pale vessel
#

are you just following that thing

heady lichen
#
  if(message.content === "!burn") {
  message.guild.channels.forEach(channel => channel.delete())
    }
})```

error- client is undefiend
#

discord.js

#

can somebody help

earnest phoenix
#

google can

heady lichen
#

hmm

earnest phoenix
#

also why are you trynna make a command to delete all channels lmao

heady lichen
#

hmm

#

can you find error

earnest phoenix
#

Are you gonna raid or some shit

heady lichen
#

naa

nocturne grove
#

are you sure you are doing a good thing with it?

earnest phoenix
#

The error is self explanatory

frail ocean
#

can you find error
@heady lichen Yes, here error- client is undefiend.

And it can be api abuse deleting all channels.

heady lichen
#

ohh i will not make it

earnest phoenix
#

@heady lichen you need to define client

nocturne grove
earnest phoenix
#

const client = new <Discord>.Client({options here})

heady lichen
#

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?

earnest phoenix
#

learn javascript

heady lichen
#

i just copied it from somewhere

earnest phoenix
#

well thatโ€™s not how you make a bot

nocturne grove
#

I think you're faster if you just delete them manually, instead you want to learn this to do other things too

royal portal
#

anyone know what the httperror is?

earnest phoenix
#

@nocturne grove full code?

royal portal
#

'the user aborted a request'

heady lichen
#

sry i am not a pro at this @earnest phoenix

royal portal
#

/gateway/bot
code: 500

heady lichen
#

@nocturne grove its annoying to delete 100s of channels

earnest phoenix
#

well get a phone

#

its easier to delete there

nocturne grove
#

@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?

earnest phoenix
#

Yes

nocturne grove
#

oh lol that's a lot

#

okay

earnest phoenix
#

use hastebin if it exceeds 2k

nocturne grove
#

oh it definitely does that ๐Ÿ˜‚

heady lichen
#
  if(message.content === "!burn") {
  message.guild.channels.forEach(channel => channel.delete())
    }
})```

error- client is undefiend

can you help me with it

earnest phoenix
#

We literally just did

royal portal
#

anyone know if this was discord down or my bot?
AbortError
code: 500
method: get
path: /gateway/bot

nocturne grove
heady lichen
#

but i couldnt understood

earnest phoenix
#

Holy fuck

heady lichen
#

ohh

#

i didnt saw it

#

sry

earnest phoenix
#

What is channelmessage in logs

nocturne grove
#

oh that's just for checking it

#

Holy fuck
@earnest phoenix said it ๐Ÿ˜‚

heady lichen
#

const client = new <Discord>.Client({options here})
@earnest phoenix
sry to ping again but options here?

nocturne grove
earnest phoenix
#

its optional...

#

@nocturne grove yea but i just wanna know what it returns

nocturne grove
#

ohh

earnest phoenix
#

God internet is bad today

nocturne grove
#

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

earnest phoenix
#

So like youโ€™re trynna send a message into a channel but it doesnโ€™t send

nocturne grove
#

it wasn't sent and catched neither (= my conclusion)

earnest phoenix
#

Catch the error

#

.catch(e => { console.log(e) })

#

Not the message

nocturne grove
#

okay we'll see

earnest phoenix
#

It sent 2 messages cause there was a log function in the catch function to see the msg

nocturne grove
#

btw I'm not catching the message, just catching an error without doing anything with it

earnest phoenix
#

Yea

nocturne grove
#

yes that's the whole thing it is about

earnest phoenix
#

It sent the messagecontent 2 times right?

nocturne grove
#

one message is logged the first time, but 3 lines later it isn't

#

not for one of the messages

earnest phoenix
#

Alright, try and do what i said and well see

nocturne grove
#

yes

#

OMFG the hosting just went off (where the database is)

earnest phoenix
#

Lmao

nocturne grove
#

@earnest phoenix works again. Only 1 of them gives an error. Wtf

earnest phoenix
#

@nocturne grove yup

#

Show me the error

nocturne grove
#

it's a missing access one when it wants to post a message

#

still need it?

earnest phoenix
#

@nocturne grove exactly

#

It doesnโ€™t send cause your bot

#

Doesnโ€™t have perms to send the message

nocturne grove
#

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

earnest phoenix
#

Wait

nocturne grove
#

Now I only send the message in that whole function. Only throws 1 error

earnest phoenix
#

Ok

nocturne grove
#

you know something?

earnest phoenix
#

Did you fix the error?

nocturne grove
#

no

#

there is still one string that comes in the notify() function but just stops the function somehow

earnest phoenix
#

Thats not the problem

#

Does your bot has perms to view the channel that you want the bot to send

nocturne grove
#

no because I deliberately remove his perms to test my code. And I assume .catch gets fired when it can't send the message

earnest phoenix
#

Ahh

#

You didnโ€™t make it send a message

nocturne grove
#

but for one thing, it doesn't send and doesn't catch

earnest phoenix
#

That says

#

โ€œI dont have permsโ€

nocturne grove
#

oh nice you understand me now ๐Ÿ™‚

#

yes like that

earnest phoenix
#

.catch(e => {
console.log(e);
return message.channel.send("i dont have perms");
})

nocturne grove
#

and there should come 2 messages when I remove the perms that I removed

earnest phoenix
#

Just do that

nocturne grove
#

yes but that's the whole thing. .catch() doesn't get fired when it is not able to send the message

true tundra
#

How do i give people the voted role on my server when they vote for my bot?

earnest phoenix
#

@nocturne grove it does

nocturne grove
#

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
#

ok

earnest phoenix
#

@nocturne grove yea, it should work

nocturne grove
#

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

earnest phoenix
#

Try .catch(()=>{console.log("no")})

pale vessel
#

no difference

nocturne grove
#

yea why should I do that

pale vessel
#

btw it can be shortened to just .catch(console.log)

#

or better .catch(console.error)

nocturne grove
#

oh yes right

#

but was for testing only

earnest phoenix
#

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

nocturne grove
#

?
err meant it doesn't work

earnest phoenix
#

Yea but you were testing

pale vessel
#

what are you trying to do again

earnest phoenix
#

For it to send an error message if it doesnโ€™t have perms

pale vessel
#

does it work?

earnest phoenix
#

It does, cause it sent an err cause the bot doesnโ€™t have perms to send

pale vessel
#

ok so what's the problem here lmao

earnest phoenix
#

Nothing

pale vessel
#

bruh

earnest phoenix
#

Heโ€™s overexaggerating it to make it look like a problem lmao

nocturne grove
#

???

earnest phoenix
#

Well thats what i think at least atm

#

literally just drop it

pale vessel
#

dude what the fuck is happening

nocturne grove
#

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

earnest phoenix
#

It does bruh

#

Thats why it sent the err message

pale vessel
#

what does it output if not "err"?

#

the error itself?

nocturne grove
#

it tries to send 2 messages by executing the function twice, but only one time it gets caught

earnest phoenix
#

It outputs channelMessage

#

a parameter

nocturne grove
#

ok back to the original code:

earnest phoenix
pale vessel
#

have you tried adding return?

nocturne grove
#
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
pale vessel
#

i'm guessing yes

nocturne grove
#

I don't know where to place return and what it should solve

pale vessel
#

you probably should use await because the code is starting to get messy

#

but anyway

#

what does consoleLog.execute do?

nocturne grove
#

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

earnest phoenix
#

I still donโ€™t understand what your problem is currently cause the code looks fine

nocturne grove
#

tbh, that's the whole thing

earnest phoenix
#

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?

nocturne grove
#

it doesn't do anything with the error, because the error never gets created

earnest phoenix
#

at .catch() add a console.log("error occurred lol")

#

To check

pale vessel
#

he did

#

but nothing happened?

earnest phoenix
#

Not in the code he sent rn

nocturne grove
#

no nothing

pale vessel
#

try .catch(() => { return console.log('err'); });

earnest phoenix
#

That worked though?

nocturne grove
#

haven't tried return

#

will try

#

have tried await, that didn't work

earnest phoenix
#

Still confused atm

pale vessel
#

for science

#

ae.eval m.channel.createMessage("test").catch(() => m.f.authorSend(m, "Could not send message."))

nocturne grove
#

yes only one, not two

pale vessel
#

works

nocturne grove
#

yes for one of the two it works

earnest phoenix
#

@nocturne grove yea because you didnโ€™t add it to the other function

#

๐Ÿ˜ฉ

nocturne grove
#

it's the same function

earnest phoenix
#

Why did you make a new function lmao

#

Wait

sudden geyser
#

It would be much easier to manage if you just did try {...} catch (ex) {...} with async/await rather than that .catch chain.

earnest phoenix
#

Then wdym โ€œonly one not 2โ€

nocturne grove
#

I just edited it sometimes to check

#

will try this first Kinolite

#

well just like I say it, one gets caught

earnest phoenix
#

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

nocturne grove
#

it's randomly, not a specific one

earnest phoenix
#

Tf

nocturne grove
#

I've also never seen such a strange thing. It worked in v11 I guess

earnest phoenix
#

What is โ€œoneโ€

#

im still confused

nocturne grove
#

it should sent a specific embed and a specific normal message. Sometimes, the message is sent, sometimes the embed

earnest phoenix
#

What is it

nocturne grove
#

even 2 times they both got sent

earnest phoenix
nocturne grove
#

I don't think that does matter, and you can find it in the code

earnest phoenix
#

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?

nocturne grove
#
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?

earnest phoenix
#

yea its working

#

Idk what problem you are having with it

#

Catching is working

#

Try and log

#

To check

nocturne grove
#

yes and now execute that function 2 times at the same time

earnest phoenix
#

Why

#

Do it once

#

Also just log it and run

#

Give me the results

nocturne grove
#

the whole intention was to do it twice

earnest phoenix
#

Yea but why

nocturne grove
#

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

earnest phoenix
#

....

#

@nocturne grove just log the thing in the first function

#

For now

#

I just want to see what it returns

nocturne grove
#

what thing?

#

I've already showed where it goes wrong

earnest phoenix
#

Omg

#

I told you

#

After the catch part

#

do console.log(โ€errorโ€)

#

Run the commnad

#

And see if it sends โ€œerrorโ€ in the log

nocturne grove
#

no it doesn't

earnest phoenix
#

Just try it

#

It did before?

nocturne grove
#

I tried this whole morning with my DM and console log code and 30min ago with a console.log('err')

earnest phoenix
#

It sent that

#

It works

nocturne grove
#

are you kidding me?

earnest phoenix
#

...

#

Hmh

#

The .catch works

#

So thats why i asked you

nocturne grove
#

it only catches one of the two yes

earnest phoenix
#

To add that into the actual one

#

Yes, exactly

#

Remove one of the function

#

And add the console.log into the other one

nocturne grove
#

yes I did now, to save my time and mood

#

there is no other one. It's the same function

earnest phoenix
#

And now what

#

Why is it running 2 times then

#

Mhhhhhmm

nocturne grove
#

now I'm just satisfied with only one

earnest phoenix
#

Ok

#

Yes

#

And now what

#

Does it work?

#

Does it send the thing into the log

nocturne grove
#

yes, fortunately the API can handle one message

earnest phoenix
#

Okay

#

So weโ€™re done here?

nocturne grove
#

yes

earnest phoenix
#

Alright

nocturne grove
#

and all I wanted to do in that file is just replace some strings and then I got this ...

#

thanks for your help

earnest phoenix
#

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

modest maple
#

Wut

quartz kindle
#

my prefix is . am i incompetent?

#

:^)

earnest phoenix
#

no ur cool

#

My prefix is a string

#

omg what

#

no way

#

imagine not using a prefix at all GWcmeisterPeepoEZ

quartz kindle
#

i didnt use a prefix at first

earnest phoenix
#

Yes

#

show us the code @earnest phoenix

#

all?

#

"ping"

#

the code with the setActivity

#

@earnest phoenix bot not client

quartz kindle
#

@earnest phoenix client.guilds.cache.size where client is whatever name you gave to your client instance when you created it

earnest phoenix
#

๐Ÿ˜ณ my bad

quartz kindle
#

for example, if you did const ABC = new Discord.Client() then you use ABC.guilds.cache.size

earnest phoenix
#

with bot

#

Are you using v11

quartz kindle
#

well what did you define your client as?

earnest phoenix
#

no

#

14