#development

1 messages · Page 890 of 1

summer torrent
#

wdym

earnest phoenix
#

like

#

you work like ${job}

#

youtuber, doctor, police

quartz kindle
#

you want to say a random job every time?

nimble escarp
#
const jobs = ["Youtuber", "Doctor", "Police"];
const job = jobs[Math.floor(Math.random() * (jobs.length - 0) + 0)];
console.log(job);
summer torrent
earnest phoenix
#

🥣

nimble escarp
#

might not work, haven't tested pepeshrug

earnest phoenix
quartz kindle
#

lmao

summer torrent
nimble escarp
#

I just remember the formula to make a random function

#

with min and max parameters

summer torrent
#

random() is enough

nimble escarp
#

cbb appropriating it

quartz kindle
#

you can only use random() if you make a collection of it

nimble escarp
#

I'm still struggling with the TS error pepecry

#
import { Client } from "discord.js";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1101:16)
    at Module._compile (internal/modules/cjs/loader.js:1149:27)
    at Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
    at Object.nodeDevHook [as .js] (/Users/Nick/Development/Numen/node_modules/ts-node-dev/lib/hook.js:61:7)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.Module._load (internal/modules/cjs/loader.js:923:14)
    at Module.require (internal/modules/cjs/loader.js:1074:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/Nick/Development/Numen/node_modules/ts-node-dev/lib/wrap.js:80:1)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)

Only happens in the file passed over to the ShardingManager

const manager = new ShardingManager("src/bot/index.ts", {
    token: process.env.BOT_TOKEN,
});
static trench
#

How many servers does my bot need to be in to have a active server count on top.gg?

sonic lodge
#

it doesn't matter

tight plinth
#

How many servers does my bot need to be in to have a active server count on top.gg?
@static trench 0, you just need to post your server count to dbl

sonic lodge
#

you manually post the amount to top.gg

hasty sparrow
#

You need to provide top.gg with the server count

static trench
#

How?

#

It isnt automatic?

sonic lodge
#

check out the dbl api

static trench
#

Ok

#

I am .py though

sonic lodge
#

here's the one for python

static trench
#

Ok ty’

slender thistle
static trench
#

I host on repl.it ill put in in there

earnest phoenix
#

my bot goes offline every 2 minutes

#

i get that even though its literally never happened when i was using it before

nimble escarp
#

A free dyno can't run nonstop

#

had the same problem

earnest phoenix
#

how long do i need to let it rest for

nimble escarp
quartz kindle
#

quota for unverified accounts is 550 hours per month

#

if you pass that quota, it will only work again next month lol

#

550 hours is about 21 days

earnest phoenix
#

does that mean i can just duplicate the node and it works

#

the dyno i mean

nimble escarp
#

The best solution is paying for the dyno

#

Costs me about $1 per month

earnest phoenix
#

hlep

quartz kindle
#

you can only have 1 dyno on free account lol

#

you'd need to create another account

#

or simply verify it

slender thistle
#

Don't be lazy and properly censor your tokens please...

static trench
blissful scaffold
#

I doubt that is good enough to hide your token

nimble escarp
#

uhh, I guarantee you can get the token from that screenshot

slender thistle
#

Why wouldn't you be able to?

earnest phoenix
#

ok

nimble escarp
#

it's poorly censored

earnest phoenix
nimble escarp
#

Also, it looked like your index.js was in node_modules.

quartz kindle
#

^

#

why is your index there lol

earnest phoenix
#

where would you suggest me take it

nimble escarp
#

to the root folder

#

next to package.json

earnest phoenix
opaque seal
#

Do you guys think it will be a problem to have a mongoDB database on a linux server if, I wanna make a web dashboard for my bot?

nimble escarp
#

Why would it be a problem?

earnest phoenix
nimble escarp
#

Yeah.

opaque seal
#

Why would it be a problem?
@nimble escarp idk, never got into this stuff

earnest phoenix
#

i try

nimble escarp
#

Depends on what you'd want to do with it. I'm hosting the web dashboard with Heroku as well

#

I'm running it in the same process (with express)

opaque seal
#

I'm not on hiroku

earnest phoenix
opaque seal
#

Heroku*

quartz kindle
#

@earnest phoenix that means your index.js is wrong

opaque seal
earnest phoenix
#

i dont see the porblem

nimble escarp
#

It looks like you didnt save the file on your screenshot

#

Check if the contents are actually inside

inner glen
#

How i can mention a role in embed?

earnest phoenix
#
  • im not eng
inner glen
#

cuz @... not working

#

in embed

opaque seal
#

How i can mention a role in embed?
@inner glen <@&12321312312311312>

#

Like that

nimble escarp
opaque seal
#

you need the & sign

inner glen
#

@opaque seal aight

nimble escarp
#

@white fable - User
[#12321312312311312](/guild/264445053596991498/channel/12321312312311312/) - Channel
<@&12321312312311312> - Role

earnest phoenix
nimble escarp
#

The same problem as before.

quartz kindle
#

??

#

why did you put it back?

nimble escarp
#

You moved it back to node_modules

amber fractal
#

Wait is your index.js in node_modules?

earnest phoenix
#

yea

#

here

nimble escarp
#

I'd suggest learning node.js properly before making a bot.

quartz kindle
#

but why

#

thats wrong we told you before

earnest phoenix
#

im new js

nimble escarp
#

node_modules is only for modules installed with npm or yarn

#

You shouldn't really touch node_modules

earnest phoenix
#

I did not touch

#

setup is automatic like this

restive furnace
#

learn basic js, then learn basic node.js, then make a bot, then verify the bot

earnest phoenix
#

its soo hard

quartz kindle
#

setup is not like that

maiden mauve
#
bot.on('messageReactionAdd', async (reaction, user) => {
    if((reaction.message.guild !== null) || user.bot)
        return; //ignore reactions unless its in a dm and not made by bot

    if (reaction.message.partial) {
        try {
            await reaction.message.fetch();
        } catch (e) {
            console.log('Something went wrong when fetching the message: ', e);
            return;
        }
    }
}
static trench
#

What is a DBL token?

#

What is a DBL token?

maiden mauve
#

still getting "reaction.message.fetch is not a function"

quartz kindle
restive furnace
static trench
#

How do i find it?

maiden mauve
#

with Partials enabled on client

quartz kindle
static trench
#

Ok

#

It’s my client I’d?

earnest phoenix
nimble escarp
#

I'm still crying over my typescript bot pepecry

static trench
#

ID?

sudden geyser
#

its soo hard
@earnest phoenix if you aren't willing to learn, you won't be able to program in js correctly.

quartz kindle
#

@maiden mauve message.channel.messages.fetch(message.id)

maiden mauve
#

that's a lot longer than the example

#

ill give it a whirl

static trench
#

How do I find my dbl token?

earnest phoenix
#
  if(command === "myinvites") {
    let userinvites = await message.guild.fetchInvites(message.author.id)
    if(!userinvites) userinvites = 0
    let invitesembed = new Discord.RichEmbed()
    .setDescription(`The user ${message.author} has ${userinvites} invites.`)
    .setColor(config.Green)
    message.channel.send(invitesembed)
  }```
#

How do i fetch invites of a user properly?

#

The user @earnest phoenix has [object Map] invites.

static trench
#

I found it

earnest phoenix
#

found it too

quartz kindle
#

@earnest phoenix did you actually save the file?

earnest phoenix
#

but its saying 0 invites every time

#

oof

#
  if(command === "myinvites") {
    let userinvites = await message.guild.fetchInvites().then(invites => {
      invites.find(invite => invite.inviter.id === message.author.id)
    })
    if(!userinvites) userinvites = 0
    let invitesembed = new Discord.RichEmbed()
    .setDescription(`The user ${message.author} has ${userinvites} invites.`)
    .setColor(config.Green)
    message.channel.send(invitesembed)
  }```
quartz kindle
nimble escarp
#

^

sonic lodge
#

@earnest phoenix i'm not sure but i think richembed was removed in favor of MessageEmbed

nimble escarp
#

^

earnest phoenix
#

im v11

sonic lodge
#

ohh

earnest phoenix
#

lmao

  if(command === "myinvites") {
    let userinvites = await message.guild.fetchInvites().then(invites => {
      invites.find(invite => invite.inviter.id === message.author.id)
    })
    if(!userinvites) userinvites = 0
    let invitesembed = new Discord.RichEmbed()
    .setDescription(`The user ${message.author} has ${userinvites} invites.`)
    .setColor(config.Green)
    message.channel.send(invitesembed)
  }```

@earnest phoenix

sonic lodge
#

sorry xd

earnest phoenix
#

how can i fetch the users invites properly?

#

Hello! I'm trying to run my JDA bot on a Google Compute Engine VM, and I can't seem to find out how. I uploaded the executable JAR file to the VM, but it says it doesn't have access to the jar when I try to run it.

#

It's a SpringBoot app

nimble escarp
earnest phoenix
#
  if(command === "myinvites") {
    let userinvites = await message.guild.fetchInvites().then(invites => {
      invites.find(invite => invite.inviter.id === message.author.id)
    })
    if(!userinvites) userinvites = 0
    let invitesembed = new Discord.RichEmbed()
    .setDescription(`The user ${message.author} has ${userinvites} invites.`)
    .setColor(config.Green)
    message.channel.send(invitesembed)
  }```

its saying 0 invites (sry for posting again but people are messaging)

#

even tho i have more invites btw

#

save,

#

ok

#

saved

quartz kindle
#

you saved it in the wrong place

#

you saved it inside node_modules again

earnest phoenix
#

drop node modules ?

nimble escarp
#

no

quartz kindle
#

delete index.js

#

move index.js from node_modules there

earnest phoenix
quartz kindle
#

delete index.js from node_modules

earnest phoenix
#

all ?

quartz kindle
#

close the file in your editor (dont save)

#

open the file again in your editor, from your bot folder, not from node_modules

earnest phoenix
#

like starting from scratch

#

oh

#

ok

#

but

#

im deleted index.js

#

oh

#

new files!

maiden mauve
#

Tim, we're going deeper into problems. Sorry to pester you but what does this mean?

reaction.message.partial undefined

earnest phoenix
#

im restarted

nimble escarp
earnest phoenix
#

selected old folder

#

what

quartz kindle
#

its still wrong lol

earnest phoenix
#

im using translate

#

im turkish

quartz kindle
#

i told you to close the file in your editor

#

needs to be

#

your bot folder name

#

VISUALBOT

pale vessel
#

outside node_modules

earnest phoenix
quartz kindle
pale vessel
#

2 configs

#

hmmmm

earnest phoenix
quartz kindle
#

yes

#

now open that file

earnest phoenix
#

wich?

quartz kindle
#

index.js

earnest phoenix
quartz kindle
#

yes

#

now its correct

earnest phoenix
#

i try ?

quartz kindle
#

yes

earnest phoenix
#

OH

#

FIRST TİME

#

ACTİVATED

#

BOT

#

THANKS BOİİİ

quartz kindle
#

@maiden mauve can you show the full error?

maiden mauve
#

@quartz kindle would using djs 11.5 be a suspect?

quartz kindle
#

v11 doesnt support partials

earnest phoenix
#

translate trash

maiden mauve
#

the undefined was a giveaway on that

#

lets start there then 😄

quartz kindle
#

:^)

earnest phoenix
#

thanks

nimble escarp
#

sigh can't figure out the problem

earnest phoenix
#
  if(command === "myinvites") {
    let userinvites = await message.guild.fetchInvites().then(invites => {
      invites.find(invite => invite.inviter.id === message.author.id)
    })
    if(!userinvites) userinvites = 0
    let invitesembed = new Discord.RichEmbed()
    .setDescription(`The user ${message.author} has ${userinvites} invites.`)
    .setColor(config.Green)
    message.channel.send(invitesembed)
  }
#

saying 0 invites even tho i have 40

pale vessel
#

console log invites

nimble escarp
#

You might need to first return the promise

#

in .then

pale vessel
#

no

mystic hemlock
#

I've been asked to verify my bot because of the new privileged intents. I'm not sure what things are considered as privileged, is there a list of that?

nimble escarp
#

He's using await

earnest phoenix
#

its undefined

#

if i use the 0 its 0

pale vessel
#

why are you using await and .then again

earnest phoenix
#

no idea

pale vessel
#

well I am done

earnest phoenix
#

like
to fetch them

nimble escarp
earnest phoenix
#

and i saw this method

#

soi thought

pale vessel
#

it's one of them only

#

smh

sonic lodge
mystic hemlock
#

Yeah

earnest phoenix
#
let userinvites = await message.guild.fetchInvites(message.author.id)```
#

will this be it ?

sonic lodge
#

that's the only two

pale vessel
#

yes

earnest phoenix
#

oh

nimble escarp
#

Learn about Promises.
Promises are either handled through .then/.catch or async/await (try/catch)

mystic hemlock
#

What exactly does GUILD_PRESENCES mean?

earnest phoenix
#

The user @earnest phoenix has [object Map] invites.

#
  if(command === "myinvites") {
    let userinvites = await message.guild.fetchInvites(message.author.id)
    if(!userinvites) userinvites = 0
    let invitesembed = new Discord.RichEmbed()
    .setDescription(`The user ${message.author} has ${userinvites} invites.`)
    .setColor(config.Green)
    message.channel.send(invitesembed)
  }```
sonic lodge
#

i don't know actually

nimble escarp
#

Now you can do .find on the userinvites variable

pale vessel
#

fetchInvites doesn't have any parameter

earnest phoenix
pale vessel
#

no

#

console log it first

grizzled raven
#

@pale vessel no its not

#

you can await and .then and/or .catch

nimble escarp
#

but you have to return a promise first

earnest phoenix
#

it returns a collection

nimble escarp
#

in then

grizzled raven
#

.then returns a promise itself

pale vessel
#

you can do that if it's a chain of promises

grizzled raven
#

thats why you can do .then(...).catch(...)

pale vessel
#

so await

nimble escarp
#

only if you're not using { }

earnest phoenix
#

...

#

so what is it?

pale vessel
#

can we see the invites structure?

earnest phoenix
#
let userinvites = await message.guild.fetchInvites()``` currently it
nimble escarp
#

The docs have a good example imo.

pale vessel
#

well the output

#

yes the docs too

nimble escarp
#
// Fetch invite creator by their id
guild.fetchInvites()
 .then(invites => console.log(invites.find(invite => invite.inviter.id === '84484653687267328')))
 .catch(console.error);
earnest phoenix
#

thats how i got my first example?

#

but still didnt work?

pale vessel
#

because you put await

earnest phoenix
#
let userinvites = message.guild.fetchInvites().then(invites => invites.find(invite => invite.inviter.id === message.author.id))```
this was my first try
grizzled raven
#
let val = await promise().then(x => true) // val is true
let val2= await promise() // val2 is whatever promise returns
let val3= await throwError().then(x => 3).catch(e => 2) // val3 is 2
#

just wanter to put that out

nimble escarp
#

Yeah but he needs to return a promise in .then to await the value if he uses {}

pale vessel
#

i get that

earnest phoenix
#

wait so am i right with this code?

let userinvites = message.guild.fetchInvites().then(invites => invites.find(invite => invite.inviter.id === message.author.id))```
nimble escarp
#

like

let val = await promise().then(x=> {})
earnest phoenix
#

why doesnt it wotrk

#

work

pale vessel
#

add return

earnest phoenix
#

wdym
like where

grizzled raven
#

what?

#

well no he does

#

await will return undefined

nimble escarp
#
let userinvites = (await message.guild.fetchInvites()).find(invite=>invite.inviter.id===message.author.id);
#

something like this should work

pale vessel
#

add () at the end

#

wait nm

#

it's not a function

earnest phoenix
#

it gave me the link

#

the invite link

pale vessel
#

well?

grizzled raven
#

thats probably you concatenating the object into a string

#

which i think returns the url

nimble escarp
#

wait

#

shouldn't it be .filter instead of .find?

#

I used .find only because he used it in his example.

earnest phoenix
#

im looking for it to return the number of people joined from the users invite

grizzled raven
#

depends

pale vessel
#

filter

#

find returns the first element

#

filter returns an array

earnest phoenix
#
let userinvites = await message.guild.fetchInvites().then(invites => invites.find(invite => invite.inviter.id === message.author.id))``` current code
grizzled raven
#

no its find

pale vessel
#

why find?

#

they're invites

nimble escarp
#

The find() method returns the value of the first element in the provided array that satisfies the provided testing function.

grizzled raven
#

then in the embed do js userinvites.uses

nimble escarp
#

oh yeah

#

what if a user makes more invites?

earnest phoenix
#

here

#

so it will get them aswell ?

nimble escarp
#

Well, it'd depend on his usage.

pale vessel
#

it's best to use filter because a member can create multiple invites

#

or am I wrong

earnest phoenix
#

how do i use the filter then

nimble escarp
pale vessel
#

change find to filter lol

earnest phoenix
#

oh is that it

#

lmao

pale vessel
#

after that you can map the filter

earnest phoenix
#

returns undefined

nimble escarp
#

userinvites will then be an array (sorry, Map)

grizzled raven
#

huh?

earnest phoenix
#

and how do i get it to show number instead of undefined?

grizzled raven
#

userInvites will return an array, then you can reduce it

pale vessel
#

i don't know the structure of the invites so yeah

earnest phoenix
#
let userinvites = await message.guild.fetchInvites().then(invites => invites.filter(invite => invite.inviter.id === message.author.id))```
#

current btw

pale vessel
#

i meant what fetchInvites return

earnest phoenix
#

ik

nimble escarp
#

Returns: Promise<Collection<string, Invite>>

grizzled raven
#
userinvites.reduce((prev, val) => val.uses + prev, 0)
nimble escarp
earnest phoenix
#

i want to know what it means tho

#

not be spoon fed

nimble escarp
#

ehh...

#

then you should learn about promises

earnest phoenix
#

userinvites.reduce((prev, val) => val.uses + prev, 0)
what is perv and val

grizzled raven
#

it iterated through the array and adds every invite's uses

#

prev is just the total number at the time

nimble escarp
#

prev = sum of the previous val.uses
val = the current object

earnest phoenix
#

oh

#

previous and value

#

?

grizzled raven
#

yes

nimble escarp
#

yep

#

Damn, getting redux flashbacks.

earnest phoenix
#

and then current value uses + previous

#

what is the ,0 ?

nimble escarp
#

initial value

#

arr.reduce(callback( accumulator, currentValue[, index[, array]] )[, initialValue])

earnest phoenix
#

ending value ?

nimble escarp
#

initial (starting) value

earnest phoenix
#

is initial the ending value tho ?

#

like the ending number?

nimble escarp
#

starting value

#

the default value

earnest phoenix
#

oh

nimble escarp
#

before it begins adding up

earnest phoenix
#

if no invites then = 0 ?

nimble escarp
#

yup

earnest phoenix
#

oh

nimble escarp
#
initialValue Optional
A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first element in the array will be used as the initial accumulator value and skipped as currentValue. Calling reduce() on an empty array without an initialValue will throw a TypeError.
earnest phoenix
#

oh

#

got it

maiden mauve
#

@quartz kindle console.log(currentEmbed.embeds[0].footer.text);

DJS 12 made all the difference! 😄 😄 Thanks for your time

earnest phoenix
#

thank you so much!

nimble escarp
#

so could anyone help me now? pepecry

quartz kindle
#

sure

#

dont use TS

#

:^)

hasty sparrow
#

What's the issue?

nimble escarp
#
import { Client } from "discord.js";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1101:16)
    at Module._compile (internal/modules/cjs/loader.js:1149:27)
    at Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
    at Object.nodeDevHook [as .js] (/Users/Nick/Development/Numen/node_modules/ts-node-dev/lib/hook.js:61:7)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.Module._load (internal/modules/cjs/loader.js:923:14)
    at Module.require (internal/modules/cjs/loader.js:1074:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/Nick/Development/Numen/node_modules/ts-node-dev/lib/wrap.js:80:1)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)
#
const manager = new ShardingManager("src/bot/index.ts", {
    token: process.env.BOT_TOKEN,
});
earnest phoenix
#

const {Client} = require("discord.js")

#

replace your import statement with that

nimble escarp
#

Well, I am using ES6 modules.

earnest phoenix
#

just try it

nimble escarp
#

I know it'll work :c

quartz kindle
#

have you tried import { Client } from "discord.js/esm"?

nimble escarp
#

/esm?

quartz kindle
#

was added on v12.2

nimble escarp
#

Oh, it's an esmodule

#

One second!

#

Uhh, still the same problem. Guess I'll have to do with const/require.

quartz kindle
#

you could ask in the d.js server

#

they should know

nimble escarp
#

Guess I'll have to. Still tried at least 😄

#

Thanks guys!

#

Well that was quick.

quartz kindle
#

glad you got it solved

#

most of my questions there go unanswered lmao

nimble escarp
#

Well I kinda got it answered

knotty steeple
#

d.js server best for support

#

i wish i wasnt joking

nimble escarp
#

in the end

#

didn't get it answered

#

Was told to use tsc --watch instead of ts-node
Somehow fixed it myself pepeshrug

quartz kindle
#

it makes sense tho

#

because the sharding manager spawns child processes

earnest phoenix
#

it explains everything very good

#

omm

quartz kindle
#

so the manager will be doing node shard.ts for you basically

earnest phoenix
#

oky

quartz kindle
#

and node doesnt understand ts files

nimble escarp
#

Yeah, I fixed it like this

{
    "dev": "nodemon -e ts --exec \"yarn build\"",
    "build": "tsc && node -r dotenv/config dist/index.js",
}
restive furnace
#

or use node.ts :)

earnest phoenix
#

ı need help

nimble escarp
#

@restive furnace WeSmart

earnest phoenix
#

ı need help

#

webhook help

slender thistle
#

-ask2ask

gilded plankBOT
#

Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.

Please read https://dontasktoask.com/ for an explanation on why this is an issue.

earnest phoenix
#

webhook help

pale vessel
#

well tell us the issue

earnest phoenix
pale vessel
#

simple

earnest phoenix
nimble escarp
#

now I wonder how I can get the bot developer role

earnest phoenix
pale vessel
#

you don't

hasty sparrow
#

Develop a bot

earnest phoenix
#

@earnest phoenix don't you have this Turkish link

#

No

#

:C

#

Because dbl is based on English

pale vessel
#

more like the internet

earnest phoenix
#

^ exactly

#

available in turkish developers

pale vessel
#

we have around 2

#

lol

earnest phoenix
#

:C ı use translate

#

well good luck then

#

basic english knowledge is recommended for coding GWossuKannaSip

#

or just using the internet omegalul

#

yeah

#

english is a universally taught language you can't complain about having to speak it 🤷‍♂️

#

@earnest phoenix you dont have role

pale vessel
#

he does

earnest phoenix
#

yes and?

pale vessel
#

you just don't know

earnest phoenix
#

exactly

pale vessel
#

role doesn't mean anything

nimble escarp
pale vessel
#

still miss gaby tho

earnest phoenix
#

ive been thinking of making a jackbox bot, people are bored during quarantine and getting money is a bit harder right now, so id really love to boost people's moods by bringing them a paid game to discord for free

pale vessel
earnest phoenix
#

probably not

#

disqord/dsp

#

discord.net is prone to breaking due to the lib not catching on with recent api changes

hasty sparrow
#

Tried DSharpPlus?

pale vessel
#

he said

nimble escarp
#

libdiscord
#c++

turbid bough
royal portal
#

how do I set intents in my client options?

hasty sparrow
#

Always sometimes?

cinder patio
#

In which library Hamburger

royal portal
#

discord.js

cinder patio
#
{
  ws: {
    intents: [...]
} 
}
pale vessel
#

you don't?

earnest phoenix
#

uh

royal portal
#

how does that work

earnest phoenix
#

intents are enabled on your app page

royal portal
#

because I need them for bot verification

cinder patio
#

I think only a few are (those regarding privacy)

earnest phoenix
#

oh i forgot you have to pass them through the gateway

royal portal
#
bot.on('ready', () => {
  console.log("Ready to Protect.")
  bot.user.setActivity(`s!help | ${bot.guilds.cache.size} guilds`, { type: 'LISTENING' });
  setInterval(() => {
  bot.user.setActivity(`s!help | ${bot.guilds.cache.size} guilds`, { type: 'LISTENING' });
  }, 1800000)
});

bot.on("guildCreate", guild => {
  guild.owner.send("**thank you for adding bot**").then().catch(console.error);
});


bot.on('guildMemberAdd', member =>{

    const channel = member.guild.channels.cache.find(channel => channel.name === "safety-logs");
    if(!channel) return;
   
    channel.send(`**${member} has joined the server.**`).then().catch(console.error);
});

bot.on('message', msg => {
  if (msg.content === 'test') {
    msg.reply(`test`).then().catch(console.error);
}
});
#

thats my code

#

and ppl said it will stop working

earnest phoenix
#

don't do event subscriptions in ready because ready can fire multiple times

#

or have a bool check

#

.then().catch(console.error) :D?

royal portal
earnest phoenix
#

if ready had occured

royal portal
#

so do I need intents or not

cinder patio
#

or use .once

#

Well intents.. afaik they are used to receive updates about certain things, so it depends what your bot does

royal portal
#

do I need this box checked for my code I sent?

cinder patio
#

yes

royal portal
#

will my code stop working though

cinder patio
#

guildMemberAdd is part of the members intent

#

not right now but in the future probably

royal portal
#

like once discord verification

#

oh

#

also is server members intent to do with if owner adds bot then bot dms owner saying thank you for adding bot and also welcome messages?

#

and how many guilds the bot is in on its status?

cinder patio
#

If you don't have it you won't receive the GUILD_MEMBER_ADD, GUILD_MEMBER_UPDATE and GUILD_MEMBER_REMOVE events

royal portal
#

but my code is fine?

cinder patio
#

If you have the guild member intent disabled: If a member changes their nickname (and not only nickname, roles, permissions and other things as well) and they are cached the bot won't update the cached member with the new nickname, you won't know when a guild member leaves a guild or when someone joins a guild

#

So welcome messages won't work

royal portal
#

but nicknames get removed once you leave the server

#

I only have a welcome message

nimble escarp
#

But you won't receive the guildMemberAdd event.

#

Meaning you wouldn't be able to detect when someone has joins.

royal portal
#

for just that person?

quartz kindle
#

if you enable intents using new Client({ws:{intents:INTENTSHERE}})

#

and dont enable GUILD MEMEBRS priviledge

#

this code block will never run

royal portal
#

it works though

quartz kindle
#

because you're not using intents

royal portal
#

so that means my bot doesnt have intents?

true tundra
#

Is there a way to make the bots status go back and forth from streaming and playing?

nimble escarp
#

@true tundra Yeah, you can change it anytime, however there is rate-limiting.

quartz kindle
#

yes, your bot doesnt have intents, unless you enable them using what i said above

royal portal
#

so I disable this box

quartz kindle
#

that box doesnt matter if you dont use intents

royal portal
#

oh

#

what about in the application

quartz kindle
#

intents are disabled by default

#

(for now)

royal portal
#

in the application I wrote I use server member intents for welcome message and to dm owner when the owner invites the bot

quartz kindle
#

did you configure it to enable intents?

#

in your client options?

royal portal
#

on the bots code?

quartz kindle
#

yes

royal portal
#

nope

quartz kindle
#

so then intents are disabled

true tundra
#

@nimble escarp I want the bot status to change from streaming to playing by it self without me switching the status...

quartz kindle
#

what do you mean you use "server member intents"?

royal portal
#

in application

#

i checked that

quartz kindle
#

where is that even?

royal portal
#

bottom of application

#

bot verification

nimble escarp
#

Yeah, you can do that. @true tundra

true tundra
#

How do you do it

royal portal
#

@quartz kindle I wasn't meant to tick it?

quartz kindle
#

oh you mean the verification process

royal portal
#

yea

quartz kindle
#

you need that yes, for the future

nimble escarp
#

Well, the same way you'd change the bot's activity to streaming/playing.
Just add timers or anything else you want.

quartz kindle
#

but you are not using it now

royal portal
#

but then

#

it said what it uses

#

something like that

#

I wrote it welcomes users

earnest phoenix
#

i have a command to see my invites
how can i get the invites but for only people that are still in the server?

#
  if(command === "myinvites") {
    let userinvites = await message.guild.fetchInvites().then(invites => invites.filter(invite => invite.inviter.id === message.author.id))
    let legitinvites = userinvites.reduce((prev, val) => val.uses + prev, 0)
    let invitesembed = new Discord.RichEmbed()
    .setDescription(`The user ${message.author} has ${legitinvites} invites.`)
    .setColor(config.Green)
    message.channel.send(invitesembed)
  }```
pale vessel
#

check the inviter id

quartz kindle
#

intents are disabled by default, but will be mandatory in the future, so there will come a time that your bot will stop working if you dont use intents, and when that time comes, you will need the server member intents to be able to welcome users if your bot is in more than 100 guilds

true tundra
#

@nimble escarp I dont know how to put timers

quartz kindle
#

for now you dont need it, unless you use intents, but in the future you might need it

royal portal
#

so its fine what I wrote?

nimble escarp
#

He probably wants to count the number of uses (based on if the person who used it is still in the server) @pale vessel

quartz kindle
#

yes its fine what your wrote

earnest phoenix
#

i want to get the invite amount BUT to people that are still in the server

#

not people who left

nimble escarp
#

@true tundra setInterval pepeshrug

quartz kindle
#

@earnest phoenix thats not possible

#

there is no list of users who used the invite, so you cant know which ones left and which ones are still in the server

nimble escarp
#

In theory it could be done, but it'd be nowhere close to an elegant solution.

earnest phoenix
#

so how is invitemanager working?

quartz kindle
#

they count it in a different way

earnest phoenix
#

can i get help with doing it the same way ?

nimble escarp
quartz kindle
#

when a user joins -> fetch the invites, see which invite was increased by 1 -> assign that invite to the user

#

and you need to track all of this in a database

earnest phoenix
#

i have no idea on how to do it or what you mean

quartz kindle
#

then you will have a hard time trying to accomplish it

#

you can start by reading the link posted above by our asian friend

earnest phoenix
#

lmao

nimble escarp
#

I'd change my nickname to something easily "ping-able" but can't do that

quartz kindle
#

you need to ask a mod to do it

nimble escarp
#

Is there a channel for that? Don't want to ping mods.

turbid bough
#

You must ping mods

#

or actually just change your username

#

lol dont do that

earnest phoenix
#

@quartz kindle look at dms please

turbid bough
#

just ping one moderator, not the whole staff

slender thistle
#

There was no need to delete the mention, also 👀

nimble escarp
#

Uhh, sorry.

#

Well, I'd need my nickname changed

proper mist
#

how do you make a discord.js economy system

nimble escarp
#

To something easily pingable.
I'd change it to "ovxrfl0w" myself if I could.

earnest phoenix
#

how can i get the invite that the user joined from ?

quartz kindle
#

the link posted says how

nimble escarp
#

I already sent a link for that.

quartz kindle
#

lmao

nimble escarp
#

well, not exactly what I'd choose but sure lmfao

split hazel
#

@true tundra 2 things

#

1 you leaked your token
2 dont send the invite

true tundra
#

What invite

split hazel
#

I'll send it in DMs

proper mist
#

how do you make a discord.js economy system in 2020

turbid bough
#

user.money = 0

nimble escarp
#

@split hazel could you change my nickname to "ovxrfl0w" instead? pepeTeeth

proper mist
#

what

#

how do u make economy

turbid bough
#

you need virtual money

nimble escarp
#

You're basically asking "how to build a house".

#

There are many approaches.

#

Depends on what you want exactly.

quartz kindle
#

use a database, store the amount of money each user has

turbid bough
#

how are we supposed to tell what things are going to increase money, and what its going to be used

proper mist
#

k

turbid bough
#

and then you would have to make a money-sink so there wont be much money flowing trough

earnest phoenix
#
  client.on("guildMemberAdd", async (member) => {
    let userinvitelink = member.fetchInvites()
    let userinvited =
    })```
i have this code
i need to somehow get the user who sent the link by the member who joined
quartz kindle
#

go over that link again

proper mist
#

ok so i saw this online for economy

#
  
const db = require('quick.db')
const ms = require('parse-ms')
const Discord = require('discord.js')

exports.run = async (client, message, args, config) => {


    let timeout = 86400000 // 24 hours in milliseconds, change if you'd like.
    let amount = 500
    // random amount: Math.floor(Math.random() * 1000) + 1;


    let daily = await db.fetch(`daily_${message.author.id}`);

    if (daily !== null && timeout - (Date.now() - daily) > 0) {
        let time = ms(timeout - (Date.now() - daily));

        message.channel.send(`You already collected ur daily reward, you can come back and collect it in **${time.hours}h ${time.minutes}m ${time.seconds}s**!`)
    } else {
    let embed = new Discord.RichEmbed()
    .setAuthor(`Daily`, message.author.displayAvatarURL)
    .setColor("GREEN")
    .setDescription(`**Daily Reward**`)
    .addField(`Collected`, amount)

    message.channel.send(embed)
    db.add(`money_${message.author.id}`, amount)
    db.set(`daily_${message.author.id}`, Date.now())
        
    }

}
#

But this has rich embeds

#

and when i changed it to message embed

#

it didn't work

true tundra
#
const client = new Discord.Client();

client.on("ready", () => {
    console.log(`Logged in as ${client.user.tag}!`);
    console.log("Streamstatus by DayZoonHD");

    client.user
        .setActivity(``, {
            type: "STREAMING",
            url: ""
        })
        .then(presence =>
            console.log(
                `Your Status has been set to  ${
          presence.game ? presence.game.none : "none"
        }`
            )
        )
        .catch(console.error);
});

client.login("");```
earnest phoenix
#

i dont get that link

quartz kindle
#

@earnest phoenix you need to fetch all guild invites BEFORE the user joins, then when a user joins, you need to fetch invites AGAIN, and check which invite was changed

earnest phoenix
#
  client.on("guildMemberAdd", async (member) => {
    let userinvitelink = member.fetchInvites()
    let userinvited =
    })```
i have this code
i need to somehow get the user who sent the link by the member who joined

@earnest phoenix

quartz kindle
#

the link does explain it

earnest phoenix
#

i created a db called invites and i want to add 1 to the user that invited

#

so i just need the user who invited

#

to get him from the user who joined

#

and i dont get it with that link

true tundra
#

I need help making a timer so the bot switches status from streaming to playing

quartz kindle
#

@earnest phoenix the answer is still the same

nimble escarp
#

You need to have the number of uses for all invites before the event happens, then when a user joins you have to find which invite's uses increased by one.

earnest phoenix
#

i dont get anything with that link

quartz kindle
#

you need to have the number of uses from before, and compare them with the number of uses from after

earnest phoenix
#

but whyyy

quartz kindle
#

because thats how discord works

nimble escarp
#

Because there's no other way.

earnest phoenix
#

cant i just add to the user who invited?

#

invites.add(theuser blalal, 1)

nimble escarp
#

You can't associate the invited user with the user who created the link unless you do it similar to how it was done on the link I sent.

earnest phoenix
#

sigh

nimble escarp
#

You need to associate the invite link with the invited user when he joins (which is what we're telling you to do).

quartz kindle
#

blame discord

earnest phoenix
#

i will

quartz kindle
#

discord doesnt tell you where a member comes from, which invite they used to join

nimble escarp
earnest phoenix
#

they do?
i checked it before but forgot how

#

i got the inv link

#

i think

nimble escarp
#

They don't.

earnest phoenix
#

no idea then

#

thanks

nimble escarp
#

You can only check who created the invite and how many uses the invite has (how many people used it to join).

earnest phoenix
#

i wanna do it but i dont understand anything from that link

#

i wanna add 1 every time someone joins from his link (using quickdb)

nimble escarp
#

It's described pretty well.

earnest phoenix
#

can u send it again ?

nimble escarp
#

Then you can check https://discord.js.org/#/docs/main/stable/class/Invite to see which properties are available.

earnest phoenix
#

ok so i have that part
but how do i get it into quick db

#

oh actually wait i think i might do it

true tundra
#

Can someone help me with this:

const client = new Discord.Client();

client.on("ready", () => {
    console.log(`Logged in as ${client.user.tag}!`);
    console.log("Streamstatus by DayZoonHD");

    client.user
        .setActivity(``, {
            type: "STREAMING",
            url: ""
        })
        .then(presence =>
            console.log(
                `Your Status has been set to  ${
          presence.game ? presence.game.none : "none"
        }`
            )
        )
        .catch(console.error);
});

client.login("");```
earnest phoenix
#
const invitedb = new db.table("invitedb")
client.on('guildMemberAdd', member => {
  member.guild.fetchInvites().then(guildInvites => {
    const ei = invites[member.guild.id];
    invites[member.guild.id] = guildInvites;
    const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
    const inviter = client.users.get(invite.inviter.id);
    invitedb.add(`${member.guild.id}.${inviter.id}`, 1)
  })})```
#

@quartz kindle

#

i got this so far

#

lmao

#

what is wrong with the code?

true tundra
#

Im trying to add a timer so the status can switch from streaming to playing

#

?

mossy vine
#

how could i place gradients at the edges of a website Thonk

earnest phoenix
#

wym edges

mossy vine
#

those edges

#

ignore my professional art skills

knotty steeple
#

graphics design is my passion

mossy vine
#

kinda like a vignette i guess?

#

but for the entire page

earnest phoenix
#

oh

#

i thought you meant like an actual square border

#

with a gradient

mossy vine
#

wait i can just do it with a box-shadow cant i

knotty steeple
#

yes

#

probably

earnest phoenix
#

yes

knotty steeple
#

definitely

mossy vine
#

aight thanks

earnest phoenix
#

set the position of a div element to aboslute, width and height to 100% and box-shadow

mossy vine
#

(surprised noone tryitands.ee-d me)

knotty steeple
earnest phoenix
#

absolute*

mossy vine
#

instead of a div element i could just do body cant i?

knotty steeple
earnest phoenix
#

it's not suggested to make the body absolute but whatever floats your boat

#

oh

#

yeah you could place box shadow on the body

#

im dum

mossy vine
#

okay thanks

true ravine
#

If some funky business happens in my code and ends up storing the result of an equation as NaN, is that stored as a string or some other type?

knotty steeple
#

NaN is NaN

#

its just NaN

true ravine
#

Hmmm

#

Alright thanks

#

Another stupid question, but does let behave the same with arrays or objects as it does with strings or numbers?

knotty steeple
#

yes

true ravine
#

Ah nice thank you

earnest phoenix
#
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```hello   yourDBLTokenHere in part (') we will put
knotty steeple
#

pls

#

proper english

#

u put ur dbl api token there

#

@earnest phoenix

inner glen
#

yo
so i have every command in a file
like
commands/music/play.js
right
but when i add a new command like meme.js in file like commands/other/meme.js
when i start the bot
and go to test it i type b!meme and the bot keep telling me Unknown command
why?

#

any help please

quartz kindle
#

you will need to show code

#

did you make the command loader yourself?

inner glen
#
const randomPuppy = require("random-puppy");


module.exports = {
    name: "meme",
    category: "other",
    description: "Sends an epic meme",
    run: async (client, message, args) => {
        // In this array, 
        // you can put the subreddits you want to grab memes from
        const subReddits = ["dankmeme", "meme", "me_irl"];
        // Grab a random property from the array
        const random = subReddits[Math.floor(Math.random() * subReddits.length)];

        // Get a random image from the subreddit page
        const img = await randomPuppy(random);
        const embed = new RichEmbed()
            .setColor("RANDOM")
            .setImage(img)
            .setTitle(`From /r/${random}`)
            .setURL(`https://reddit.com/r/${random}`);

        message.channel.send(embed);
    }
}```
#

no

maiden mauve
#

const {embedR0, embedR1, embedR2, embedR3, embedR4} = require('./commands/menus.js');

Am I doing this a cave man way assuming these could greatly expand? (Didn't want to flood index with datablocks)

quartz kindle
#

then who did the command loader?

#

@maiden mauve why not just require menus.js?

#

and use menus.embedR0?

maiden mauve
#

menus or m

#

hmm

#

that's probably the more long term solution

#

was a bit rusty on the syntax

quartz kindle
#

and if you're writing R0 in your embed footer, you can also do menus[embeds[0].footer.text]

#

or require("menus.js")["embed"+embeds[0].footer.text]

#

or something like that

maiden mauve
#

I did this

#
    const currentEmbed = await reaction.message.fetch();
    if(!currentEmbed || !currentEmbed.embeds[0].footer)
        return console.log("invalid reaction");

    const currentPage = currentEmbed.embeds[0].footer.text;


    switch(currentPage) {
        case "R0":
            if(reaction.emoji.name === '▶️') 
              await reaction.message.edit(embedR1);    
            else if(reaction.emoji.name === '◀️')
              await reaction.message.edit(embedR2);
            break;
#

grrr spacing

#

it's working nicely just gotta organize it and maybe double check the validation against problem users

earnest phoenix
#

help me pls
i would have a question about how can i get the maximum value from the lvl queue CODE ```php
<?php
session_start();
require_once 'connect.php';

$sql = mysqli_query($con, "SELECT max(lvl) FROM globalxp");
$ertek = mysqli_fetch_array($sql);
?>
<h1><?php echo $ertek['accountid']; ?></h1>```

maiden mauve
#

staring at the repeated conditionals in switch case is getting my brain spinning

#

but I'll shelf that for another code cleanup

earnest phoenix
#

@earnest phoenix

glad charm
#

@earnest phoenix that adds nothing to chat. This is for development stuff only.

inner glen
#

yo
so i have every command in a file
like
commands/music/play.js
right
but when i add a new command like meme.js in file like commands/other/meme.js
when i start the bot
and go to test i type b!meme and the bot keep telling me Unknown command
why?
im using CommandoClient btw

pale vessel
#

make your own command handler and don't use commando

glad charm
#

^ Agreed, making your own isn't hard either.

maiden mauve
#

was gonna say if your using a thing refer to it's help files

#

I haven't had any issues using a textbook basic command handler

earnest phoenix
#

hello how can I get guild channel list like this? on a web dashboard

#

there are a ton of ways to go about it

#

it depends on how your infrastructure is set up

#

do you depend on a websocket to exchange data or is it just requests to your backend API

#

api

#

just started making a dashboard for discord bot

#

any text tutorials or video anything will help me a lot

#

they won't

#

expose an endpoint in your api that returns data for the said guild

#

then on your frontend hit the endpoint and process the data

#

ok thanks

turbid bough
earnest phoenix
#
  client.on('guildMemberAdd', member => {
  member.guild.fetchInvites().then(guildInvites => {
    const ei = invites[member.guild.id];
    invites[member.guild.id] = guildInvites;
    const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses);
    const inviter = client.users.get(invite.inviter.id); 
    invitesdb.add(`${member.guild.id}.${inviter.id}`, 1)
  })})```
```js
const invite = guildInvites.find(i => ei.get(i.code).uses < i.uses); this is the error```
#

(node:16129) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined

#

the invite you got from your invites array is undefined

#

yeah

#

but

#

how do i fix it, thats the question

#

you tell me

#

i don't know how you structured your code

#

i can send it

#

Anyone know how I can prevent some variables from being accessed from eval without changing the value of them?

nimble escarp
#

don't wanna sound toxic, but are we making your bot for you? pepeThinkingHmmmm

turbid bough
#

what does guildInvites variable have?

#

what is it defined

earnest phoenix
#
const wait = require('util').promisify(setTimeout);

client.on('ready', () => {
  wait(1000);
  client.guilds.forEach(g => {
    g.fetchInvites().then(guildInvites => {
      invites[g.id] = guildInvites;
    });
  });
});```
#

Anyone know how I can prevent some variables from being accessed from eval without changing the value of them?
simply don't give eval access to people who you do not trust

#
const invites = {};```
#

it's extremely hard to make a (properly) sandboxed eval

#

@earnest phoenix you realize that wait is a promise and will do nothing if you're calling it in a non await/async method?

#

oh

nimble escarp
#

it's extremely hard to make a sandboxed eval
@earnest phoenix even multimilion dollar companies struggle with it lmfao

earnest phoenix
#

im new to it

turbid bough
#

why would multimillion dollar companies use eval lol

nimble escarp
#

There are real uses for eval lmao.

earnest phoenix
#

i got it from a website and just coded it a bit with someones help lmao

#

idk what to do

#

its undefined

#

stop copypasting code without knowing what it, or you, does

#

you should maybe review some djs documentation and some basic javascript and then try making a bot

nimble escarp
earnest phoenix
#

Bruh

#

:thistho:

#

i want that emoji hand it over

nimble escarp
#

This way you won't learn in the end pepeshrug

earnest phoenix
#

ik how to make a bot, but for this specific thing, someone in this server legit told me to read it
I TOLD HIM I DONT UNDERSTAND

#

but still

pale vessel
#

download the emoji and put it in your server

earnest phoenix
#

ok ctrl shift i time

pale vessel
#

right click is enough

earnest phoenix
#

wait what

#

whoa

nimble escarp
pale vessel
#

i do

earnest phoenix
#

if you don't understand instructions it's more than likely a sign that you do not actually know how to code in the language you're working with. anyone can pick up a programming language and claim to "know how to do x" because they've repetitively done x, however when you give them something they have to figure out on their own, they struggle with it a lot simply because they don't know what they're doing and didn't get themselves experienced with the language - this is called a help vampire

#

It's like an actual language, you can only work well with it if you can speak it

#

let alone understand it being spoken

nimble escarp
#

if you don't understand instructions it's more than likely a sign that you do not actually know how to code in the language you're working with. anyone can pick up a programming language and claim to "know how to do x" because they've repetitively done x, however when you give them something they have to figure out on their own, they struggle with it a lot simply because they don't know what they're doing and didn't get themselves experienced with the language - this is called a help vampire
@earnest phoenix thistho I was searching for that expression.

turbid bough
#

actually, if you know how to code in just one single language, you can pretty much transfer that knowledge to any other language

regal jacinth
#

how do i change the font colour in pillow ?

turbid bough
#

not the same as trying to learn french when you know dutch

slender thistle
#

almost

#

Unless we're talking C++ and Python :p

nimble escarp
#

Programming vampires bite code, bit by bit. LaughPepe

pale vessel
#

what the

slender thistle
#

True

nimble escarp
#

you dont speak of cpp, thats illegal pepeStab

regal jacinth
#

....

turbid bough
#

its probably easier to learn python when you know c++, but not backwards

pale vessel
#

@regal jacinth what pillow?

nimble escarp
#

Also, someone cleared my nickname pepeshrug

regal jacinth
#

;-;

slender thistle
#

probably being the keyword

regal jacinth
#

hmmm

slender thistle
#

Pillow, that's Python

regal jacinth
#

it's a module to edit in a pic

turbid bough
#

@nimble escarp back to square one

regal jacinth
#

using python

earnest phoenix
#

how to make an infinite loop that will repeat and write a command

nimble escarp
#

god damn it anipepehands

pale vessel
#

you're looking for loops @earnest phoenix

regal jacinth
#

soo does any body know how?

nimble escarp
#

while(false === false)

regal jacinth
#

XD

turbid bough
#

while(true == 1)

earnest phoenix
#

I make spam ping bot

nimble escarp
#

while(false == 0)

regal jacinth
#

while true == false

nimble escarp
#

thats illegal

earnest phoenix
#

where to insert

nimble escarp
#

while(true!=false)

pale vessel
#

your objective is really useless

turbid bough
#

#define true false
while(true == false)

summer torrent
#

I make spam ping bot
@earnest phoenix that is api abuse

regal jacinth
#

SOME ONE PLS ANSSWER MEEEEEE ;=;

nimble escarp
turbid bough
#

hi

regal jacinth
#

TF

turbid bough
#

please kill it

earnest phoenix
#

^^^^^^^^^^^^

#

kill it with fire

#

before it spreads

regal jacinth
#

how do i change the font colour in pillow ?

earnest phoenix
#

wdym pillow

regal jacinth
#

hmm

heavy anchor
#

I am having problems with my embed links not opening when you click it for one of my commands, It contains a link you can copy it but it doesn't do anything when you click it...

slender thistle
regal jacinth
#

oh ty

pale vessel
green vale
#
--JS--
args.slice(1).join(" ");``` I want to make sure that this means that this takes the content of the first argument, right?
heavy anchor
earnest phoenix
#

what's the url of the hyperlink

#

tf is up with that qr code tho 👀

heavy anchor
#

It's a guild invite I don't want to get banned for ads

earnest phoenix
#

omit the code from the invite

#

[invite](discord.gg/dbl)

heavy anchor
#

it wont let me send it here

earnest phoenix
#

oh

#

You're not allowed to

#

do you have the protocol in the url

#

https://

#

As a whitename

heavy anchor
#

yes

earnest phoenix
#

are you already in the guild

heavy anchor
#

I can dm you if you want

#

yes but i tried in account that was not

earnest phoenix
#

i wanna try to do some stuff outside my bot, so i got visual studio code
when i try to console.log somthing it will error

#

i never really used it before so im confused on why

#

it works for me

#

did you install somthing so it works or ?

#

i was talking to cedar

#

@heavy anchor i'm already in the guild and it just transfers me to it when i click on it, are you doing anything else?

#

just tested something

#

it doesn't do anything once the invite doesn't exist anymore

#

which means that the invite had been deleted

#

maybe u need to escape the link because discord is dum dum?

#

windows script host
vsc
cant console log

#

so await ReplyAsync(embed: new EmbedBuilder().WithDescription("[invite](https"+"://discord.gg/ku9Wdy").Build())

#

no

#

that doesn't matter

#

the problem is explained

#

just try it

#

no.

#

alr

#

i'm already in the guild and it just transfers me to it when i click on it
it doesn't do anything once the invite doesn't exist anymore
which means that the invite had been deleted

#

also that code isn't escaping anything it's just combining two strings lol

heavy anchor
earnest phoenix
#

so 2 possibilities

  1. im dumb
  2. the problem is dumb
#

are you sure the invite exists

#

i think its 1

heavy anchor
#

yes

earnest phoenix
#

@heavy anchor try calling it directly, if that doesnt work either the link is not existant

#

so open the invite link directly from your browser

#

^

#

or just like

#

send it in chat and see what the embed returns

#

right

#

not here tho

#

gg

#

elp meee

heavy anchor
#

I have and it works fine in the browser

earnest phoenix
#

@earnest phoenix what exactly

#

um

#

could you try to translate that

#

i try to console log

#

and this error pops up

#

oh god

#

arabic?

#

hebrew

#

wait

#

did you call it from the windows javascript host

#

not node.js

#

um

#

i used run ?

#

b ruh

nimble escarp
earnest phoenix
#

on terminal

#

bro IM NEW TO VSC

#

so you opened it directly

#

idk

#

D:

#

so you didnt do node yourfile.js

#

no
when i did now it erroed

#

errored

#

console.log doesnt exist in windows javascript

#

Error: Cannot find module 'C:\Users\איתי\somthing.js'

#

lmao

#

o wait

#

where did you save your thing

#

your file

#

on desktop

#

omfg

#

cd Desktop

#

node somthing.js

#

BRO

#

worked

#

lmao

#

running the file in the correct directory works

nimble escarp
earnest phoenix
#

yeah well i used a website and this is just for testing stuff so yeah

#

thanks

heavy anchor
#

@earnest phoenix it works fine in the browser, Maybe it's something with my code?

nimble escarp
#

I'm reacting to the situation.

earnest phoenix
#

i doubt, if the url displays fine on hover then there's nothing more to it

#

it's maybe some setting in your client

#

give me a minute to try something

heavy anchor
#

Hyperlinks work fine in my other embeds just not this one.

earnest phoenix
#

try doing discordapp.com/invite/code instead of discord.gg/code

#

yeah

#

bruh whitename filter

#

my message got removed

#

again

#

yay

uneven lichen
#
exports.run = (client, message, args, ops) => {
  
  search(args.join(' '), function(err, res) {
    
    if (err) {
      if (message.deletable) message.delete(5000)
      return message.channel.send('Sorry, something went wrong')
      .then(m => message.delete(5000));
    }
    let videos = res.videos.slice(0, 10);
    
    let resp = '';
    
    for (var i in videos) {
      resp += `**[${parseInt(i)+1}]:** ${videos[i].title}\n`;
      
    }
    
    resp += `\n Choose a number between: **1-${videos.length}**`;

    const Embed = new Discord.RichEmbed()
    .setAuthor('Wyszukiwanie', miniatura, zaproszenie)
    .setColor("BLUE")
    .setDescription(resp)
    .setTimestamp()

    const filter = m => !isNaN(m.content) && m.content < videos.length+1 && m.content > 0;

    const collector = message.channel.createMessageCollector(filter);
    collector.videos = videos;
    message.channel.send(Embed)

    
  
    

    collector.once('collect', function(m){
      
      let commandFile = require('./play.js');
      commandFile.run(client, message, [this.videos[parseInt(m.content)-1].url], ops)

  
    
    });
 
  
  });


}
#

Does anyone know how to add a script here, which after writing "cancel" stops the whole script?

earnest phoenix
#

add a if statement to the collect event that checks if the content is cancel

#

and if it is return;

uneven lichen
#

ok thanks

earnest phoenix
#

so for example if(m.content.toLowerCase()=="cancel") return;

ruby warren
#

Yes

uneven lichen
#

Thank you so much

true ravine
#

If my bot is offline when a cron job is due to run, will it wait until the next occurrence or will it do the stuff on startup?

copper cradle
#

@earnest phoenix did you just say 'console.log doesn't exist in windows js'????!!??

earnest phoenix
#

i mean

#

as far as i experimented it doesnt

#

node.js it does, yeah

#

but windows side js dont think it exists

sudden geyser
#

but like, doesn't it?

copper cradle
#

js isn't even made to be run outside of a browser

#

there's node which is a runtime

#

idk what you're using to run js outside the browser or node/deno

earnest phoenix
#

node

copper cradle
#

then why are you saying console.log doesn't exist

earnest phoenix
#

because it is that way

#

to translate what it said there: "Console" isnt defined

copper cradle
#

🤦‍♂️

#

well that's pretty gay

earnest phoenix
#

maybe u get me wrong here but i said that windows script host does not have console.log

copper cradle
#

it doesn't say it doesn't have console.log, is says it doesn't have the console object, and I don't see why anyone would use WSH

nocturne dagger
#

Hey so I'm trying to get my Mute command to work.

#

and its not unmuting at time.

#

woudl this be correct.

#

    setTimeout(function() {
        tomute.removeRole(muterole.id);
        message.channel.send(`<@${tomute.id}> has been unmuted!`);
    }, ms(mutetime));

}
#

discord.js

split hazel
#

Yes, but if your program restarts, any unmutes due to be will not happen