#development

1 messages ยท Page 1238 of 1

earnest phoenix
#

it installed the dependencies too?

#

Hey guys got a litte question. What do you do with custom prefixes, keep the default bot command and add the custom prefix (listen to two prefixes) or replace the default bot prefix with the custom prefix?
@rare plume replace deafult bot prefix with the custom prefix only for the selected guild

fringe axle
earnest phoenix
#

@fringe axle try installing it again

fringe axle
#

Okay

slender thistle
#

.help_cmds

#

what the fuck

rare plume
#

Okey thanks @earnest phoenix

fringe axle
#

Hm

earnest phoenix
#

Okey thanks @earnest phoenix
@rare plume what are you thanking me for XD

rare plume
#

For your answer bloblul

earnest phoenix
#

@fringe axle 130 VULNERABILITIES GOD DELETE THE PACKAGE

#

npm uninstall phin

pale vessel
#

some of them are probably because of node-fetch dos vulnerability

earnest phoenix
#

then don't

fringe axle
#

And now?

slender thistle
#

axios/built-in http gang

earnest phoenix
#

uhh try the command again

pale vessel
#

node-fetch gang

earnest phoenix
#

axios/built-in http gang
@slender thistle built-in http sucks

fringe axle
#

But if there is no phin?

earnest phoenix
#

pheen geng

#

phin is an awesome AF package

fringe axle
#

I have node-fetch

pale vessel
#

i'd use centra

earnest phoenix
#

shirnks code by half a line

pale vessel
#

centra is better than phin

fringe axle
#

@earnest phoenix what I have to do now?

pale vessel
#

well, phin uses centra

earnest phoenix
#

@fringe axle try the command again

#

you reinstalled the phin package

#

should work now

#

if only i didn't die

fringe axle
earnest phoenix
#

huh

#

smh

#

wait

#

@fringe axle you need to await phin requests

#

they're promises by default

fringe axle
#

Oh

pale vessel
#

.then()

earnest phoenix
#

you can use the unpromisified version by changing

require("phin");

to

require("phin").unpromisified;
fringe axle
#
  async run(message) {
    let response = phin({
        url: "https://nekos.life/api/v2/img/waifu",
        method: "GET",
        parse: "JSON"
      });
    const waifuEmbed = new MessageEmbed()
    .setColor(`RANDOM`)
    .setAuthor(`Waifus!1!1!`, message.author.displayAvatarURL())
    .setImage(await response.url)
    .setFooter(`A cute waifu for you ${message.author.tag}!`)
    .setTimestamp();

    message.channel.send(waifuEmbed)
  }
}
``` That's the code
slender thistle
#

await phin(...

#

then just response.url

fringe axle
#

Oh

#

Okay

earnest phoenix
#

BRUH

faint prism
#

can't reference <object>.url if the object is null

earnest phoenix
#

await response.url

fringe axle
#

Same error

earnest phoenix
#

@fringe axle remove the await on line 9 keep the await on line 2

#

await phin(...

pale vessel
#

const {url} = await phin({ url: "https://nekos.life/api/v2/img/waifu", parse: "json" }).then(x => x.body); trolllaugh

fringe axle
#

I tried it too

vague wigeon
#
    let response = phin({
        url: "https://nekos.life/api/v2/img/waifu",
        method: "GET",
        parse: "JSON"
      }).then(()=>{
    const waifuEmbed = new MessageEmbed()
    .setColor(`RANDOM`)
    .setAuthor(`Waifus!1!1!`, message.author.displayAvatarURL())
    .setImage(await response.url)
    .setFooter(`A cute waifu for you ${message.author.tag}!`)
    .setTimestamp();

    message.channel.send(waifuEmbed)

    }); 
}```
fringe axle
#

Thanks

earnest phoenix
#

ask @pale vessel they'll be able to explain it to you better

pale vessel
#

it's under response.body

#

not response

fringe axle
#
  async run(message) {
    const {url} = await phin({ url: "https://nekos.life/api/v2/img/waifu", parse: "json" }).then(x => x.body);
    
    const waifuEmbed = new MessageEmbed()
    .setColor(`RANDOM`)
    .setAuthor(`Waifus!1!1!`, message.author.displayAvatarURL())
    .setImage(url)
    .setFooter(`A cute waifu for you ${message.author.tag}!`)
    .setTimestamp();

    message.channel.send(waifuEmbed)

    }
}
``` I tried this now. Still not working
earnest phoenix
#

dude

#

AWAIT IT

#

instead of blindly copying our code

fringe axle
#

I tried it with await too

faint prism
#

can you mix promises and async like that in JS?

earnest phoenix
#

not the correct code

pale vessel
#

yes you can

#

and my code should work if you copy paste

fringe axle
#

Nah.

earnest phoenix
#

why let em copy paste

pale vessel
#

oops

#

it was supposed to be a joke but it actually works

earnest phoenix
#

i'll link the MDN docs so you can actually understand what we're tryna say cuz we all suck at explainations

fringe axle
#

And now? :0

earnest phoenix
#

that will explain it better than us

pale vessel
earnest phoenix
#

@vague wigeon why are you typing the whole time

vague wigeon
fringe axle
#

:trolllaugh:
@pale vessel I need JSON stringify(urrl)?

pale vessel
#

no

earnest phoenix
#

that's an example

pale vessel
#

i had to stringify it because runkit shows the image

fringe axle
#

hm

earnest phoenix
#

we're giving you example

fringe axle
#

And .then is undefined

earnest phoenix
fringe axle
#

Hm

pale vessel
#

Nah.
@fringe axle what's the actual error

vague wigeon
#

What data type did phin return?

earnest phoenix
#

What data type did phin return?
@vague wigeon Promise

fringe axle
earnest phoenix
#

GOD

#

STOP COPY PASTING

pale vessel
#

phin returns a json object if you parse it, otherwise res.body would return a buffer

#

you have to add .toString() if you don't parse it as json

vague wigeon
#

phin returned undefined

pale vessel
earnest phoenix
#

suggest a good no-copyright background

#

or a gradient

fringe axle
#

Confusion

earnest phoenix
#

i can quickly generate some

pale vessel
#

custom background smart

earnest phoenix
#

Confusion
@fringe axle more like literally just copy pasting code even and you're understanding nothing

fringe axle
#

I understand it

pale vessel
#

show code again

earnest phoenix
#

then

pale vessel
#

haha good one code, .then()

#

xd

earnest phoenix
#

why do you need to copy paste our stuff

fringe axle
#
  async run(message) {
    const {url} = await phin({ url: "https://nekos.life/api/v2/img/waifu", parse: "json" }).then(x => x.body);

    const waifuEmbed = new MessageEmbed()
    .setColor(`RANDOM`)
    .setAuthor(`Waifus!1!1!`, message.author.displayAvatarURL())
    .setImage(url)
    .setFooter(`A cute waifu for you ${message.author.tag}!`)
    .setTimestamp();

    message.channel.send(waifuEmbed)

    }
}
pale vessel
#

and the error is?

earnest phoenix
#

haha good one code, .then()
@pale vessel that wasn't intentionally a joke but ok

pale vessel
#

i know

#

"xd"

fringe axle
pale vessel
#

debug

earnest phoenix
#

no copyright images

pale vessel
#

console.log(phin({ url: "https://nekos.life/api/v2/img/waifu", parse: "json" })) before const {url} @fringe axle

fringe axle
#

ok

vague wigeon
#

undefined! :v

#

i think...

fringe axle
pale vessel
#

now console.log(phin)

earnest phoenix
#

what the fuck

pale vessel
#

it's a common text

#

lorem ipsum is a placeholder text

earnest phoenix
#

why console.log the whole package

pale vessel
#

so that you actually know what the fuck phin is

fringe axle
pale vessel
#

oh

#

yeah

#

.then is fucked up because code asked you to use unpromisified would've returned an error otherwise

fringe axle
#

uh

pale vessel
#

remove the thing code asked you to add

fringe axle
#

Nah, I don't use unpromisified

vague wigeon
pale vessel
#

you sure?

fringe axle
#

const phin = require("phin"); I have this

pale vessel
#

hmm

vague wigeon
fringe axle
#

I see

earnest phoenix
#

.then is fucked up because code asked you to use unpromisified
@pale vessel i literally just said you can also use the unpromisified version

pale vessel
#

i'm retarded ok

vague wigeon
#

if Unpromisified, u will use callback!?

fringe axle
#

I read and read

earnest phoenix
#

@pale vessel can you use a local file instead of a URL in loadImage() in canvas package

pale vessel
#

it's not unpromisified

#

yes you can

blissful bridge
#

oops

fringe axle
#

Means what now?

earnest phoenix
vague wigeon
#

try simple

const p = require('phin')
 
const res = await p('<your url>')
 
console.log(res.body)
pale vessel
#

he would need to parse the response

earnest phoenix
#

yes you can
@pale vessel lol forgot my express.js server can serve files so i can just send an HTTP request to myself

vague wigeon
#

tell me what returned?

fringe axle
#

try simple

const p = require('phin')
 
const res = await p('<your url>')
 
console.log(res.body)

@vague wigeon means I need to edit my whole code?

vague wigeon
#

yes

pale vessel
#

try it first

earnest phoenix
#

@pale vessel KEKW

let backgroundImage = await loadImage("http://localhost/miscellaneous/profile-backgrounds/pexels-anna-shvets-3683056.jpg");
vague wigeon
#

@fringe axle

const res = await phin('https://nekos.life/api/v2/img/waifu')
console.log(res.body)
fringe axle
#

ok

#

@fringe axle

const res = await phin('https://nekos.life/api/v2/img/waifu')
console.log(res.body)

@vague wigeon Nothinh...

pale vessel
#

try console.log(phin(url))

fringe axle
#

ok

earnest phoenix
#

<@&304313580025544704> 0

slender thistle
#

-atmods @earnest phoenix

gilded plankBOT
#

@earnest phoenix

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
earnest phoenix
#

?

slender thistle
#

And what did you even imply with that message

earnest phoenix
#

??

#

Why did you ping all mods to say 0

#

??

#

??

pale vessel
#

there's something wring with your phin installation @fringe axle

fringe axle
#

hm

pale vessel
#

try npm uninstall phin and npm i phin

earnest phoenix
#

<@&304313580025544704> Pla no ban

pale vessel
#

yikes

earnest phoenix
#

Pls

green kestrel
#

-atmods

small plume
#

-ban 636227331219914753 Useless mentions to moderators and only responding with ??

gilded plankBOT
#

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
#

dblMod Banned turkishpro131#4258 (@queen storm)

earnest phoenix
#

-b @queen storm Clearly trolling. Pinging mods twice.

gilded plankBOT
#

tickNo That user is already banned...

earnest phoenix
green kestrel
#

Lol two atmods

earnest phoenix
#

indeed

small plume
#

Keep this channel on topic ok_hand

fringe axle
pale vessel
#

that's why it broke

fringe axle
#

And now?

#

Can I use node fetch?

pale vessel
#

yes you can

#

node-fetch is poggers

earnest phoenix
astral yoke
#

do yall think it would be a good idea to switch from a VPS to a rasberry pi so that i dont have to deal with down time and issues from only the vps and lagging from mongodb url?

fringe axle
#

Bruh... And how is it working with node-fetch?

pale vessel
#

you should make the text white

earnest phoenix
#

then it will blend with the background

pale vessel
#

@fringe axle node-fetch also uses promises, js const res = await fetch(url); const json = await res.json(); json.url // the url from the json payload

earnest phoenix
#

koya also adds a transparent black back so the text on front is easier to read

#

but the username doesn't have a back

fringe axle
#

Oh, okay

pale vessel
#

@earnest phoenix for the black box i mean

earnest phoenix
#

ok

#

i should make the black box little more transparent as well

pale vessel
#

it's fine i guess

#

also, format the coins using .toLocaleString()

earnest phoenix
pale vessel
#

yes

#

make it User Info

earnest phoenix
#

oh capitalization

pale vessel
#

make the username a little to the right

earnest phoenix
#

and also the localeString

vague wigeon
pale vessel
#

not for vale pepehands

fringe axle
pale vessel
#

phin sounds like a pain

#

use node-fetch

fringe axle
#

I tried to uninstall it

vague wigeon
pale vessel
#

hell yeah

#

the background kind of ruins it

#

maybe a blur

earnest phoenix
#

yeah

astral yoke
#

i like the background

vague wigeon
earnest phoenix
#

maybe a blur
@pale vessel i can't directly do that in canvas so i'll edit the source image

#

i don't have photoshop ;-; CS_AlphabetF

fringe axle
#

Why he still needs phin?! I uninstalled it...

earnest phoenix
#

you totally shouldn't get cracked photoshop from m0nkrus

pale vessel
#

@vague wigeon one line console.log((await phin({ url: "https://nekos.life/api/v2/img/waifu", parse: "json" })).body.url) trolort

earnest phoenix
#

im totally not encouraging use of pirated software

fringe axle
#

Da fuq.. How can I delete phin now?

vague wigeon
#

@pale vessel yep, I just want code to be clear

#

phin is uninstalled

fringe axle
#

huuuh

#

But it throws this error

vague wigeon
#

reinstall :v waitWhat

fringe axle
#

I want to fully delete it

earnest phoenix
#

uninstall === fully delete

pale vessel
#

remove require("phin") in your code

earnest phoenix
#

=== datatype and value are both same

fringe axle
#

remove require("phin") in your code
@pale vessel of course I did that

pale vessel
#

wait

earnest phoenix
#

@fringe axlei knew you were just copy pasting code without understanding anything

pale vessel
#

you need it

#

read the stack trace

#

canvacord and others need it

fringe axle
pale vessel
#

other modules need phin

fringe axle
#

;__;

#

And now?

pale vessel
#

install it back

vague wigeon
#

install it

#

:v

fringe axle
pale vessel
#

where did you run that command?

#

the directory

fringe axle
#

In the node_modules

vague wigeon
#

no

#

in root of your project

pale vessel
#

go back one folder

vague wigeon
#

/vale/bot/<here>

fringe axle
pale vessel
#

try uninstalling it first

earnest phoenix
#

@pale vessel should I make the background more blurry?

pale vessel
#

yes and do something with the username

#

maybe stroke it

fringe axle
#

try uninstalling it first
@pale vessel error

earnest phoenix
#

ok

fringe axle
#

Same error

earnest phoenix
vague wigeon
#

hmm

pale vessel
#

why did you remove fillText

earnest phoenix
#

@fringe axle learn to read errors

pale vessel
#

fillText -> strokeText

earnest phoenix
#

yep

#

maybe stroke it

fringe axle
#

@fringe axle learn to read errors
@earnest phoenix hmm

earnest phoenix
#

too many symbolic links encountered

#

search up for this on google

vague wigeon
#

try backup your bot and create new project, put code again ๐Ÿ˜„

fringe axle
#

I just want to delete this fully fkcing package

earnest phoenix
#

I just want to delete this fully fkcing package
@fringe axle it's not the package's fault

fringe axle
#

try backup your bot and create new project, put code again ๐Ÿ˜„
@vague wigeon Good joke. I need to add a new folder in my server, link them, and and and

earnest phoenix
#

or you can use git to do all in one step

fringe axle
#

Or I just want to install this dumb package

earnest phoenix
#

it's not the package's fault

fringe axle
#

It is because the error is in the package

earnest phoenix
#

no

#

the root is your package.json

#

did you even read the error

#

some kind of loop happening in YOUR package.json which fucks up phin's package.json

fringe axle
vague wigeon
#

No kidding, I think the node_module directory is broken

earnest phoenix
#

delete it

#

and reinstall

#

done

fringe axle
#

I tried to reinstall everything

earnest phoenix
#

nothing will be lost

#

except some discord.js cache which doesn't matter that much

#

No kidding, I think the node_module directory is broken
@vague wigeon * node_modules

#

@fringe axle delete node_modules directory

vague wigeon
#

yep

fringe axle
#

I do

vague wigeon
#

and ... "node ."?

#

||your persistence||

earnest phoenix
#

tested on my friend's pfp

pale vessel
#

make the avatar higher res i guess

vague wigeon
#

Can background be an image url?

pale vessel
#

yes

vague wigeon
#

change another background :\

restive notch
#

i just exported my project from glitch and now its saying ```/home/juls07/echo-bot-discord-juls07/node_modules/discord.js/src/client/Client.js:41
} catch {
^

SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/juls07/echo-bot-discord-juls07/node_modules/discord.js/src/index.js:8:11)

tight plinth
#

upgrade node version

restive notch
#

oh

vague wigeon
#

catch(){} not catch{}

restive notch
#

not my code its in discord.js

tight plinth
#

@vague wigeon catch { is a thing since node 10 or smth

vague wigeon
#

oh

restive notch
#

yeah i need to update as its nodejs 8 yikes

tight plinth
#

yep

#

update to at least node 12

vague wigeon
#

Thanks for that information

restive notch
#

yeah im doing that now

fringe axle
#

Still the same error...

tight plinth
#

@fringe axle what error

fringe axle
tight plinth
#

is there anything above that

fringe axle
#

no

#

It's just the trashy phin

tight plinth
#

missing write access

#

try with sudo

fringe axle
#

ok

molten yarrow
#

or install it global

fringe axle
#

or install it global
@molten yarrow how? ;__;

#

I want to uninstall everything with phin

molten yarrow
#

npm i -g

fringe axle
tight plinth
#

youre on windows?

fringe axle
#

Linux is the server

molten yarrow
#

did you install it on linux or on your win?

earnest phoenix
tight plinth
#

hm

#

@earnest phoenix ok but who asked and why here

fringe axle
#

did you install it on linux or on your win?
@molten yarrow linux

earnest phoenix
#

i am flexing

#

plis~

tight plinth
#

no one cares

tight plinth
#

why star

earnest phoenix
#

ynot

tight plinth
#

smh

earnest phoenix
fringe axle
#

I kill code913

earnest phoenix
#

literally just delete the node_modules folder and remove it from your package.json ??

#

what do you not understand about this simple instruction

fringe axle
#

Did that already...

earnest phoenix
#

also delete your package-lock

fringe axle
#

Oh, delete package-lock and oackage.json too?

earnest phoenix
#

no

#

package.json is your entry file for a project

#

you need it

#

delete package-lock and node_modules though

fringe axle
#

I know. I tried that already. Same error as you see

earnest phoenix
#

and remove the dependency from package.json

#

you did something wrong then

vague wigeon
earnest phoenix
#

delete package-lock, delete node_modules, remove the dep from package.json and run npm i

fringe axle
#

Okay

verbal shore
#

HEllo

restive notch
#

there node 14 is installed (i absolutely despise the people who created apt-secure)

sick cloud
#

does anyone here know vue/nuxt

faint prism
#

Ask2ask. What's your question?

sick cloud
#

yeet
i have a component called Alert and i want to know how to pass it props
tried <Alert warning="This is the content" />
but {{ warning }} does nothing

fringe axle
#

@earnest phoenix nice idea, whole bot

#

broken now.

misty sigil
#

whats wrong

#

there cant be that much that goes wrong unless youre a fool really

fringe axle
#

@misty sigil

delete package-lock, delete node_modules, remove the dep from package.json and run npm i
He said me this... now my bot wont work anymore

restive notch
#

ctrl+z

earnest phoenix
#

nothing can go wrong unless you failed to follow simple instructions

misty sigil
#

^

#

thats what im saying

restive notch
#

ctrl+z

misty sigil
#

and please

#

just fucking please

restive notch
#

or look in the trash folder

misty sigil
#

give me error info

#

so i can at least fucking help

fringe axle
#

No error

#

Just this

earnest phoenix
#

do you have a package.json

fringe axle
#

Of course

misty sigil
#

ah so ur package.json doesnt contain dependencies

#

at least thats what i see from that

fringe axle
#

He said to delete me the dependencies

earnest phoenix
#

i said delete the dep

#

singular

fringe axle
#

Wow....

earnest phoenix
#

โœจ reading comprehension โœจ

misty sigil
#

thats like 3rd grade stuff there

remote ivy
#

anyone here ever work with nextjs and the next/router?

carmine summit
#

I have this code in my index.js

const config = require('./config.json');

and the content of my config.json is

{
  "default_prefix": "?"
  }

But I am getting an error: TypeError: Only absolute URLs are supported. What is causing the error?

fiery hamlet
#

.

carmine summit
#

?

fiery hamlet
#

idk

#

how do i host my discord bot for free?

misty sigil
#

you don't.

fiery hamlet
#

: (

misty sigil
#

if youre gonna make a bot at least put some investment into it

fiery hamlet
#

im 14 i dont have money

#

i spent it on a new phone

misty sigil
#

well, uh, tough luck ig

fiery hamlet
#

can u buy hosting with steam?

misty sigil
#

bruh what

fiery hamlet
#

i got $20 in steam

carmine summit
#

can someone help me with my question?

misty sigil
#

no

#

you cant buy hosting on steam

fiery hamlet
#

paypal?

misty sigil
#

yes

carmine summit
#

WAIT YOURE 14 AND HAVE A PAYPAL ACCOUNT?!?!

fiery hamlet
#

ye

carmine summit
misty sigil
#

๐Ÿ‘โ€๐Ÿ—จ ๐Ÿ‘โ€๐Ÿ—จ

fiery hamlet
#

its free

misty sigil
#

repl it goes offline

carmine summit
#

uptimer it

misty sigil
#

still, goes offline at times.

fiery hamlet
#

oof

carmine summit
#

can someone solve mi question

#

im still confused

remote ivy
#

me 2

fiery hamlet
#

?

misty sigil
#

absolute path means like C:/users/matthew/documents/github/bot/config.json

#

@carmine summit

fiery hamlet
#

ur name is matthew?

vague wigeon
carmine summit
#

im not self hosting my bot ofc

misty sigil
#

always has been

carmine summit
#

please

misty sigil
#

where u hosting then

vague wigeon
carmine summit
#

||repl.it||

fiery hamlet
#

chrome just crashed

remote ivy
#

just buy a vps

vague wigeon
carmine summit
#

nah im too poor

fiery hamlet
#

idk

carmine summit
#

and my bot barely goes offline with that hosting

misty sigil
#

no @vague wigeon.

carmine summit
#

5 minutes offline i think average everyday

misty sigil
#

just buy a vps oooooooooooh

fiery hamlet
#

what host

misty sigil
remote ivy
#

honestly vps is worth it lmao

vague wigeon
#

heroku

carmine summit
#

heroku sucks

misty sigil
#

so does repl

fiery hamlet
#

true

remote ivy
#

i got one for testing then getting another one to host my bot

carmine summit
#

just help me bruh

#

lol

misty sigil
#

repl is alright ig but

vague wigeon
#

why?

misty sigil
#

IDK anything about repl

fiery hamlet
#

do u use github to host it on heroku

misty sigil
#

where the files are stored

#

ugh

remote ivy
#

@carmine summit use path

misty sigil
#

you only get

carmine summit
#

const config = require('./config.json');

misty sigil
#

you only get 550 hours on heroku

carmine summit
#

and ram and cpu is limited

misty sigil
#

it is on repl too

remote ivy
#

const config = require(__dirname + './config.json');

#

try something like that @carmine summit

misty sigil
#

shit i entirely forgot about __dirname

remote ivy
#

haha

carmine summit
#

what?

#

nope.

#

doesnt work

misty sigil
#

const config = require(__dirname + '/config.json');

vague wigeon
#

do u use github to host it on heroku
@fiery hamlet yes?

remote ivy
#

i have not used dirname in so long lmao

slender thistle
#

repl.it is a testing IDE/environment

#

Sure, they're not against programs running 24/7 with uptime robots, but it's still a "meh" idea

earnest phoenix
#
function getInfo(value) {
    const endpoint = `https://en.wikipedia.org/w/api.php?action=query&list=search&prop=info&inprop=url&utf8=&format=json&origin=*&srlimit=20&srsearch=${value}`;
    fetch(endpoint)
        .then(response => response.json())
        .then(data => {
            const results = data.query.search;
            return results;
        })
        .catch(e => console.log(e))
}

Why this return undefiened

#

i returned to result

#

but still undefiened

#

uhh

quartz kindle
#

you have to return the fetch

#

otherwise the function itself is still not returning anything

earnest phoenix
#

oh

#

so

let result = await fetch()

@quartz kindle ?

quartz kindle
#

no need for await, you can return it directly

#

for example:

topaz sleet
#

Can somebody

#

give me

vague wigeon
#
return fetch(endpoint)
        .then(response => response.json())
        .then(data => data.query.search);

i think....

topaz sleet
quartz kindle
#
async function bla() {
  let a = await fetch()
  return a;
}

function bla() {
  return fetch()
}

both ways work, both ways can be used as await bla() or bla().then()

topaz sleet
#

Hey tim

earnest phoenix
#

ok

#

thx

quartz kindle
#

@topaz sleet you want to show your bot's server count on top.gg?

topaz sleet
#

yes

quartz kindle
earnest phoenix
#
message.channel.send(embed).then(m => {
                    const filter = user => user.id == message.author.id;
                    m.channel.awaitMessages(filter, { max: 1, time: 30000, errors: ['time'] })

I think the awaitMessage is not woking

#

cuz it does nothing

#

i console.log(collected) but it not console.logging

quartz kindle
#

you're not collecting anything?

earnest phoenix
#

yes

quartz kindle
#

awaitMessages is also a promise

#

you need to await or .then it

earnest phoenix
#

i think the filter

#

is wrong

#
m.channel.awaitMessages(filter, { max: 1, time: 30000, errors: ['time'] })
                        .then(collected => {
#

you should probably await otherwise you're going to end up with a big stack of thens

#

yes

#

oh

quartz kindle
#

the filter is a message, not a user

#

since you're awaiting messages

earnest phoenix
#

oh no

open rune
#

are you trying to make

#

createMessageCollector

hybrid roost
fringe axle
hybrid roost
#

Why tf this error is coming?
@fringe axle I think wrong pathname

fringe axle
#

I tried so many times to reinstall my packages

quartz kindle
#

which hosting service is that?

fringe axle
#

It's PM2 Logs

earnest phoenix
#
collected.content //undefiened

uhh this is undefieneed : /

quartz kindle
#

so its in your vps?

earnest phoenix
#
deleted: false,
    id: '754634467204792384',
    type: 'DEFAULT',
    system: false,
    content: '1',
fringe axle
#

so its in your vps?
@quartz kindle it's on a server, yea.

earnest phoenix
#
Collection [Map] {
  '754634467204792384' => Message {
    channel: TextChannel {
#

sad

quartz kindle
#

whats your quick.db and better-sqlite3 version?

fringe axle
#

uh

quartz kindle
#

in your package.json

fringe axle
#

"better-sqlite3": "^7.1.0",

#

quick.db": "^7.1.1",

quartz kindle
#

try npm rebuild better-sqlite3

fringe axle
#

ok

quartz kindle
#

@earnest phoenix collected is a collection

earnest phoenix
#

ye

#

i have to .first()

hidden cedar
#

I don't know what's wrong.

// ----------- In npm package ------------- //

let coin = function nsfwCoin(type) => {
   if(type === 'Normal') {
     let Coins = [Heads, Tails];
     var Result = Coins[Math.floor(Math.random() * Coins.length)];
     
     return Result;
   }else{
     let Coins = [Heads, Tails];
     var Result = Coins[Math.floor(Math.random() * Coins.length)];
     
     return Result;
   }
}

module.exports = coin;


// -------- In discord commands ---------- //
let Send = nsfwCoin(Normal);

        var EmbedR = new Discord.MessageEmbed()
            .setTitle('NSFW Coin')
            .setImage(Send)

        message.channel.send(EmbedR);
quartz kindle
#

yes

#

@hidden cedar Normal should be a string, not a variable? unless you have let Normal = "Normal" lol

open rune
#
let coin = function nsfwCoin(type) => {
#

try

let coin = function nsfwCoin(type) {
earnest phoenix
#
(node:9118) UnhandledPromiseRejectionWarning: Error: val is not a non-empty string or a valid number. val=null
console.log(require("ms")((new Date() - res.timestamp), { long: true }));

smh

#

@earnest phoenix

#

ADIM

#

nerden

#

biliniyo

#

@earnest phoenix english

#

turkey

#

-notr

#

No turkish here !

#

what name yusuf

#

@novel estuary

#
(node:9118) UnhandledPromiseRejectionWarning: Error: val is not a non-empty string or a valid number. val=null
console.log(require("ms")((new Date() - res.timestamp), { long: true }));

smh
@earnest phoenix that only accepts strings as a parameter

#

so what i have to do ?

novel estuary
#

azga

#

aga

#

malmฤฑsฤฑn

#

burasฤฑ ingiliz bir botlist

earnest phoenix
#

Mods help

#

mute them

#
require("ms")((new Date() - res.timestamp).toString(), { long: true })```
#

uhh ok

#

Cast it to a string

#

ok

hidden cedar
#

@open rune will the call function be

let Send = nsfwCoin('Normal');

or

let Send = coin('Normal');
earnest phoenix
#

What are you trying to do

#

to get when that info has been updated

#
.setTimestamp()```
#

OMG

#

i am dumb

open rune
#

@hidden cedar
let Send = nsfwCoin('Normal');

earnest phoenix
hidden cedar
#

Because some reason I did

let Send = nsfwCoin('Normal');

But it saying nsfwCoin not a function

Console:

(node:19647) UnhandledPromiseRejectionWarning: TypeError: nsfwCoin is not a function
earnest phoenix
#

nsfwCoin() what is taht

#

show code

#
coin(...param)```
#

You define the nsfwCoin function as coin

hidden cedar
earnest phoenix
#

ur coin is Send

#

ur nsfwCoin is coin

quartz kindle
#

how do you require it

fringe axle
earnest phoenix
#

@fringe axle u should return ur vps

#

it is suck

quartz kindle
#

did the rebuild complete?

fringe axle
#

Yea

quartz kindle
#

or did it error?

fringe axle
#

That worked and fixed the other error

honest perch
#

ok wtf does != mean

quartz kindle
#

not equal?

honest perch
#

ohhhh

earnest phoenix
#

Your shard died before the master process client emited it's ready event @fringe axle

fringe axle
#

oh

eternal osprey
fringe axle
#

But it worked before

#

Your shard died before the master process client emited it's ready event @fringe axle
@earnest phoenix it worked before...

earnest phoenix
#

Then it's a connection problem

fringe axle
#

Means?

hidden cedar
#
let Send = coin('Normal');

Console Output:

  (node:22243) UnhandledPromiseRejectionWarning: TypeError: coin is not a function
earnest phoenix
#

@honest perch example
!js suck = js is good
ez

quartz kindle
#

its not a connection problem, the process is crashing because of the v8 error above

restive furnace
#

ok wtf does != mean
this is basic of basicโ„ข

open rune
#

lol

earnest phoenix
#

its not a connection problem, the process is crashing because of the v8 error above
@quartz kindle What's that v8 error though

quartz kindle
#

a native module crash

fringe axle
#

da fuq

open rune
#

native php

quartz kindle
#

do you have any other native modules besides sqlite3?

fringe axle
#

Means what?

restive furnace
#

^^^ aka c++ module crash iirc

quartz kindle
#

show your whole package.json

eternal osprey
#

anyone that could help me with my problem?

fringe axle
#
{
  "name": "wawa",
  "version": "1.0.0",
  "description": "Wawa - Discord Bot",
  "main": "index.js",
  "scripts": {
    "start": "node .",
    "pretest": "eslint --ignore-path .gitignore .",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Vale",
  "license": "ISC",
  "dependencies": {
    "@discordjs/opus": "^0.3.2",
    "alexflipnote.js": "^1.2.3",
    "asn1": "^0.2.4",
    "assert-plus": "^1.0.0",
    "aws-sign2": "^0.7.0",
    "axios": "^0.19.2",
    "better-sqlite3": "^7.1.0",
    "canvacord": "^3.0.9",
    "canvas": "^2.6.1",
    "centra": "^2.4.2",
    "cheerio": "^1.0.0-rc.3",
    "common-tags": "^1.8.0",
    "country-emoji": "^1.5.4",
    "ctx": "^0.3.0",
    "discord-giveaways": "^4.2.1",
    "discord.js": "github:discordjs/discord.js",
    "discord.js-commando": "github:discordjs/Commando",
    "extend": "^3.0.2",
    "ffmpeg-static": "^2.7.0",
    "follow-redirects": "^1.12.1",
    "http-signature": "^1.3.4",
    "iso-639-1": "^2.1.3",
    "json-stringify-safe": "^5.0.1",
    "moment": "^2.27.0",
    "ms": "^2.1.2",
    "opusscript": "0.0.7",
    "pm2": "^4.4.0",
    "psl": "^1.8.0",
    "quick.db": "^7.1.1",
    "request": "^2.88.2",
    "simple-youtube-api": "^5.2.1",
    "sshpk": "^1.16.1",
    "string-toolkit": "^1.0.59",
    "tough-cookie": "^4.0.0",
    "weather-js": "^2.0.0",
    "ytdl-core": "^2.1.7"
  },
  "devDependencies": {
    "@getify/eslint-plugin-proper-arrows": "^8.0.1",
    "@getify/eslint-plugin-proper-ternary": "^3.0.1",
    "babel-eslint": "^10.1.0",
    "eslint": "^5.16.0",
    "nodemon": "^1.19.4",
    "prettier": "^1.19.1"
  }
}
tight plinth
#

@fringe axle nodejs version?

fringe axle
#

12

tight plinth
#

hmm

restive furnace
#

get latest :)

quartz kindle
#

did you recently move/copy your node_modules folder?

earnest phoenix
#

It's not related to that, quick.db and better-sqlite3 has different binaries

fringe axle
#

did you recently move/copy your node_modules folder?
@quartz kindle yes

quartz kindle
#

then you need to reinstall everything

fringe axle
#

But I tried to run it in VSC. Working

quartz kindle
#

npm install

fringe axle
#

then you need to reinstall everything
@quartz kindle did it already

quartz kindle
#

then rebuild everything

#

npm rebuild

fringe axle
#

okay

eternal osprey
quartz kindle
#

if it fails, delete your node_modules foler and install everything again

fringe axle
#

Bruh... my friend is rebooting the server atm. xD

tight plinth
#

@eternal osprey did you made your bot?

eternal osprey
#

yeah

#

why

quartz kindle
#

@eternal osprey dont split it

tight plinth
#

just to be sure you know what every line of your code does

eternal osprey
#

yeah i know

quartz kindle
#

let [skytext] = msg.slice(prefix.length).split(" ");

#

you dont need this

#

you dont need to split here

eternal osprey
#

okay let me delete the split

lyric valley
#

Hello !

#

Can i get a little help ?

quartz kindle
#

also remove the []

open rune
#

Yes sure

quartz kindle
#

anyway i g2g

open rune
#

@lyric valley

lyric valley
#

I am making a poll command in which the correct usage is >poll QUESTION "YES""NO"

#

This works perfectly fine

#

what i did was split the message.content by "

eternal osprey
#

i fixed my problem, thanks!

lyric valley
#

is there a way i can check if the synatax is right

eternal osprey
#

pleae provide your code when asking questions.

lyric valley
#

i.e i want to check if there is no problem after "

#

@eternal osprey yea ik wait

#
var doublequotesplit = message.content.split(`"`)
        var Question = doublequotesplit[0].substring(6);
        var pollembed = new Discord.MessageEmbed()
        let CHOICE2 = doublequotesplit[3];
        if(!Question){
            message.channel.send(`There Was No Question Mentioned`);
            let pollusage = new Discord.MessageEmbed()
            .setColor(`0x32ddff`)
            .setDescription(`Usage : >poll QUESTION "CHOICE A" "CHOICE B"`);
            message.channel.send(pollusage);
        }
         else{
        pollembed.setTitle(Question);
        pollembed.setDescription(`:a: ${doublequotesplit[1]}\n  \n :b: ${doublequotesplit[3]}`)
        pollembed.setFooter("Requested by "+message.member.user.tag, message.author.displayAvatarURL({ dynamic: true })+"?size=512")
        message.channel.send(pollembed).then(pollembed => {
        pollembed.react('๐Ÿ…ฐ');
        pollembed.react('๐Ÿ…ฑ');
        })
        }```
#

in this how can i check if doublequotesplit[2] is not null or spaces

#

like do i replace spaces with nothing

#

or check if its null idk

tight plinth
#

if (doublequotesplit[2] === ...)?

lyric valley
#

... ๐Ÿค”

open rune
#

So, you want user uses double quotes outside the choice like this: "CHOICE A"

lyric valley
#

@open rune yea see ideally doublequotesplit[2] should be null but if user makes an error in that like gives only 1 " after 1st choice

#

then i want to get that situation and send help msg

#

or something

open rune
#

there is a command startsWith() and endsWith()

fringe axle
#

All issues fixed. :)

lyric valley
#

@open rune didnt get ya ๐Ÿ˜ฆ

open rune
#

well, I will try make one for you and let see if I can

vague wigeon
#

How to change discordjs to eris no bug :))))

lyric valley
#

see all i want to do i check if user makes an error in syntax of choices

#

i got question covered already

open rune
#

Ok, hold on

lyric valley
#

ok !

vague wigeon
#

Discordjs vs Eris

opaque seal
#

Why that:

0|index    | TypeError: Cannot read property 'message' of undefined
0|index    |     at module.exports (/home/user/Astro/events/messageReactionAdd.js:4:16)
0|index    |     at Client.emit (events.js:315:20)
0|index    |     at Client.<anonymous> (/home/user/Astro/bot.js:350:9)
0|index    |     at runMicrotasks (<anonymous>)
0|index    |     at processTicksAndRejections (internal/process/task_queues.js:97:5)

MessageReactionAdd.js:

module.exports = async (client, reaction, user) => {
    try {
        // Don't listen to DMs or Bots
        if (reaction.message.channel.type !== 'text' || user.bot) return;

Raw event:

// Listen to raw events to emit messageReactionAdd event on uncached messages
client.on('raw', async event => {
    // Listen only to reactionAdd events
    if(event.t !== 'MESSAGE_REACTION_ADD') return;

    const { d: data } = event;
    if(typeof client.channels.cache.get(data.channel_id) === 'undefined') return;

    const channel = client.channels.cache.get(data.channel_id);

    // if the message is already in the cache, don't re-emit the event
    if (channel.messages.cache.has(data.message_id)) return;

    const user = await client.users.fetch(data.user_id);

    const message = await channel.messages.fetch(data.message_id);

    // Custom emoji are keyed by IDs, while unicode emoji are keyed by names
    const reaction = message.reactions.cache.get(data.emoji.id || data.emoji.name);

    client.emit('messageReactionAdd', reaction, user);
});
restive furnace
#

D.js for ease of use, Eris for big bots and required js exp

opaque seal
#

It happens sometimes not always and I don't know why

vague wigeon
#

About performance?

restive furnace
#

d.js uses lil more ram compared to eris

opaque seal
#

Not too much, redis isn't that much more performant

#

If you have the effort to switch from discord.js just switch language completely at this point. For example JDA it's really nice

restive furnace
#

(if he switches because of the ram cough, jvm just eats more ram)

tight plinth
#

just use djs-light then

sick fable
#

I am using python to build a bot.

#

So can anyone tell me that how to use an embed colour?

#

For the bot

opaque seal
#

(if he switches because of the ram cough, jvm just eats more ram)
oh xD

sick fable
#

:|

vague wigeon
#

just use djs-light then
@tight plinth i see it!!

tight plinth
#

w h y s t a r

vague wigeon
#

Why not?

hidden cedar
#

let Send = coin('Normal');
And I tried
let Send = nsfwCoin('Normal');
coin and nsfwCoin comes back not a function

Code for new people looking #development message

sick fable
#

Omg

#

:(((({{{{{

vague wigeon
#

Why that:

0|index    | TypeError: Cannot read property 'message' of undefined
0|index    |     at module.exports (/home/user/Astro/events/messageReactionAdd.js:4:16)
0|index    |     at Client.emit (events.js:315:20)
0|index    |     at Client.<anonymous> (/home/user/Astro/bot.js:350:9)
0|index    |     at runMicrotasks (<anonymous>)
0|index    |     at processTicksAndRejections (internal/process/task_queues.js:97:5)

MessageReactionAdd.js:

module.exports = async (client, reaction, user) => {
    try {
        // Don't listen to DMs or Bots
        if (reaction.message.channel.type !== 'text' || user.bot) return;

Raw event:

// Listen to raw events to emit messageReactionAdd event on uncached messages
client.on('raw', async event => {
    // Listen only to reactionAdd events
    if(event.t !== 'MESSAGE_REACTION_ADD') return;

    const { d: data } = event;
    if(typeof client.channels.cache.get(data.channel_id) === 'undefined') return;

    const channel = client.channels.cache.get(data.channel_id);

    // if the message is already in the cache, don't re-emit the event
    if (channel.messages.cache.has(data.message_id)) return;

    const user = await client.users.fetch(data.user_id);

    const message = await channel.messages.fetch(data.message_id);

    // Custom emoji are keyed by IDs, while unicode emoji are keyed by names
    const reaction = message.reactions.cache.get(data.emoji.id || data.emoji.name);

    client.emit('messageReactionAdd', reaction, user);
});

@opaque seal just use if statement to ignore

opaque seal
#

no I think the channel was not cached so it couldn't get the message too and so the reactions, I've used resolve everywhere in the Raw event now

sick fable
#

Aah bye.

#

Nobody answered to my question

#

See ya

vague wigeon
sick fable
#

Thanks bro

slender thistle
#

So can anyone tell me that how to use an embed colour?
@sick fable HEX/integer codes for colors

sick fable
#

Oh

slender thistle
#

There are some built-in classmethods for discord.Embed

sick fable
#

So what would be the function?

earnest phoenix
#

@sick fable just use this

{
    "purple_dark": "#6a006a",
    "purple_medium": "#a958a5",
    "purple_light": "#c481fb",
    "orange": "#ffa500",
    "gold": "#daa520",
    "red_dark": "#8e2430",
    "red_light": "#f94343",
    "blue_dark": "#3b5998",
    "cyan": "#5780cd",
    "blue_light": "#ace9e7",
    "aqua": "#33a1ee",
    "pink": "#ff9dbb",
    "green_dark": "#2ac075",
    "green_light": "#a1ee33",
    "white": "#f9f9f6",
    "cream": "#ffdab9"
}
#

copy and save it in a json file

sick fable
#

I really need an example

#

I need py

earnest phoenix
#

it is json

#

json works for every language

slender thistle
#

Read docs to see the built-in colors

sick fable
#

Kk bro

slender thistle
#

discord.Color specifically iirc

honest perch
#

json

cinder sandal
#
onst economy = require('../economy');
const levels = require('../levels')
const { MessageEmbed } = require('discord.js');

module.exports = {
    name: 'balance',
    description: 'shows ur balance',
    cooldown: 5,

    async execute(message, args) {
       const target = message.mentions.users.first() || message.author
       const targetID = target.id 
       const guildId = message.guild.id
       const userId = target.id
       const level = await levels.getLevel(guildId, userId)
       const coins = await economy.getCoins(guildId, userId)
       

       const BalanceEmbed = new MessageEmbed()
       .setAuthor(`${target.tag}`, `${target.displayAvatarURL()}`)
       .setDescription(`Crystals: ${coins}\nLevel: ${level}`)
       .setFooter('Your balance is per-guild. don\'t ask if you have 0 crystals in one server and 10 in another server.')
       .setTimestamp()

       message.channel.send(BalanceEmbed)
    },
};```
the `Level:` returns undefined
how to fix it
earnest phoenix
#

how to display items coming from python in web using flask

cinder sandal
#

can anyone answer my issue

honest perch
#

console log level

slender thistle
#

how to display items coming from python in web using flask
@earnest phoenix define "display"

#

You could probably use Jinja for that

earnest phoenix
#

I tried jinja but I am returning a list, I tried parsing via javascript but dunno

#

otherwise ill have to do it one by one for list elements

#

@cinder sandal how ur level look like ?

#
const economy = require('../economy');
#

not onst

versed jay
#

hi guys have a question regarding premium bot... what license you are using if you are going to use it as saas? I mean development License since my code is hosted on Github

earnest phoenix
#

oh no wrong ping

#

um

cinder sandal
#

not onst
@earnest phoenix i did a typo that i copied the code wrongly

#

it is const in the real code tho

#

console log level
@honest perch console logged it, says undefined in console

earnest phoenix
#

how ur level file look like ?

honest perch
#

inside the level file?

cinder sandal
#

ok

earnest phoenix
#

show ur level.js

#

or somehitng

cinder sandal
#

i will use hastebin

earnest phoenix
#

ok

cinder sandal
#

the file is large in lines

earnest phoenix
#

ok

carmine summit
#

uh.. Reddit's API docs is melting my eyes. So im here wave ... What is the endpoint to get a random post from a subreddit???

slender thistle
#

otherwise ill have to do it one by one for list elements
@earnest phoenix I mean...

cinder sandal
slender thistle
#

" ".join(your_list)

cinder sandal
#

@earnest phoenix here's the code i uploaded it as a file because it's big

earnest phoenix
#

._.

#

u said hastebin

honest perch
#

@carmine summit https://www.reddit.com/r/subreddit.json?sort=top&t=week

#

then get a random result

cinder sandal
#

this is my levels.js code in a screenshot

jovial nexus
#

ReferenceError: shard is not defined in shard.respawn(), someone know?

open rune
#

@lyric valley do you want something like this?

if(cmd === "poll") { // change it to be your command thing
        var doublequotesplit = msg.content.split(' ')
        var sliceA = doublequotesplit.slice(2,3).join(' ');
        var sliceB = doublequotesplit.slice(3).join(' ');
        var q = doublequotesplit.slice(1,2).join(' ');
        if(!doublequotesplit.length) return console.error('Required an argument');

        if((sliceA.startsWith('"') && sliceA.endsWith('"')) || (sliceB.startsWith('"') && sliceB.endsWith('"'))) {
            var pollembed = new Discordjs.MessageEmbed()
            pollembed.setTitle(q);
            //pollembed.setDescription(`:a: ${doublequotesplit[1]}\n  \n :b: ${doublequotesplit[3]}`)
            pollembed.setDescription("Your question is: "+q+"\nChoice A: "+sliceA+"\nChoice B: "+sliceB)
            pollembed.setFooter("Requested by "+msg.member.user.tag, msg.author.displayAvatarURL({ dynamic: true })+"?size=512")
            msg.channel.send(pollembed).then(pollembed => {
                pollembed.react('๐Ÿ…ฐ');
                pollembed.react('๐Ÿ…ฑ');
            })
        } else if (!q) {
            msg.channel.send(`There Was No Question Mentioned`);
            let pollusage = new Discordjs.MessageEmbed()
            .setColor(`0x32ddff`)
            .setDescription(`Usage : >poll QUESTION "CHOICE A" "CHOICE B"`);
            msg.channel.send(pollusage);
        } else {
            console.error('Error: You didn\'t add "')
            coll.delete("poll");
        }
    } else { return }

Sorry just messed up with your codes

cinder sandal
honest perch
#

i see shit all

carmine summit
#

@carmine summit https://www.reddit.com/r/subreddit.json?sort=top&t=week
@honest perch thanks

cinder sandal
#

so

#

what's wrong in the file

earnest phoenix
#

@cinder sandal bruh

#

go hastebin

cinder sandal
#
const getLevel = async (guildId, userId) => {
    await mongo().then(async (mongoose) => {
        try {
            console.log('running findone')

            const resultLVL = await profileSchema.findOne({
                guildId,
                userId,
            })

            console.log('debug mode says: result:', resultLVL)

            let level = 1
            if (resultLVL) {
                level = resultLVL.level
                return level
            } else {
                console.log('Debug mode says: Inserting Documents')

                await new profileSchema({
                    guildId,
                    userId,
                    level
                }).save()

                return level
            }
        } finally {
            mongoose.connection.close()
        }
    })
}
module.exports.getLevel = getLevel```
#

this is the bad piece of code

earnest phoenix
#
module.exports.getNeededXP = (level) => level * level * 100

module.exports.addXP = async (guildId, userId, xpToAdd, message) => {

@cinder sandal ^^

#

when u get level

cinder sandal
#

after commandslike <mine <chop

earnest phoenix
#
const level = require("../level");
level.addXp()
level.getNeededXP()
cinder sandal
#

so i need to use getNeededXP() or no

earnest phoenix
#

wdym ?

cinder sandal
#

so i need to replace getLevel with getNeededXP and remove the getLevel in levels.js?

earnest phoenix
#

???

#
module.exports.getLevel = async (guildId, userId) => {

#

same

#

fix it

#

and delete thoose

module.exports.addXP = addXP
topaz sleet
#
const Discord = require('discord.js')
module.exports = {
    name: 'snipe',
    execute(client, message, args){
        const msg = client.snipes.get(message.channel.id)
        if(!msg)return message.channel.send("There are no deleted messages")
        const embed = new Discord.MessageEmbed()
        .setAuthor(msg.author)
        .setDescription(msg.content)
        if(msg.image)embed.setImage(msg.image)
        message.channel.send(embed)
    }
}```
#

Why it dont run

cinder sandal
#

what they even do

earnest phoenix
#

exports the function

cinder sandal
#

ah

#

if i delete it, it will not wokr in other files?

earnest phoenix
#

show what u have done

cinder sandal
#

where?

earnest phoenix
#

the level file

#
module.exports = function mute(time, target, muterole) {
    setTimeout(() => {
        if(!target.roles.cache.has(muterole.id)) return;
        target.roles.remove(muterole);
        return `${target.displayName} has been unmuted for ${time}`
    }, require("ms")(time))
}
#

For example this my mute file

#

i use module.exports 2

cinder sandal
#

i deleted them

earnest phoenix
#

burh why

#

why u dleeted

cinder sandal
#

i changed the const = addLevel ... to module.exports.getLevel

#

and removed module.exports.addXP = addXP

#

is that right?

earnest phoenix
#
module.exports = {
  addXp: function addXp() {
    //code
  },
  getNeedXp: function getXp() {
    //code
  },
  getLevel: function getLevel() {
    //code
  }
}
#

u can use this @cinder sandal ^^^

#

u can save all function in a object

#

and u exports the object with functions

#

or u can do this

#

addXp.js

module.exports = function addXp() {
  //code
}

getXp.js

module.exports = function getXp() {
  //code
}

getLevel.js

module.exports = function getLevel() {  
  //code
}

Diffrent files

cinder sandal
#

getLevel() is just a clone of getCoins() from economy.js

earnest phoenix
#

ok

stable eagle
#

Question: How can I make those timers that giveaway bots use, that update like every 12 seconds?

cinder sandal
#

ms

clear arrow
#

hey! how can i see if a user is boosting?

earnest phoenix
#

look docs

#

boosting event

clear arrow
#

link?

earnest phoenix
#

@clear arrow ^^

clear arrow
#

i can t find it

earnest phoenix
#

._.

cinder sandal
#

how to get the user's level
levels.js

earnest phoenix
#
client.on('nitroBoost', (booster) => {
   bot.channels.get('1234567890').send(`${booster} boosted the server!`)
   booster.addRole(booster.guild.roles.find(a => a.name === 'Nitro Booster'))
})
clear arrow
#

aw and if user has nitro booster i can put to show me the badge too no?

#

on userinfo

cinder sandal
#
const mongo = require('./mongo')
const profileSchema = require('./schemas/profile-schema')

const getNeededXP = (level) => level * level * 100

const addXP = async (guildId, userId, xpToAdd, message) => {
    await mongo().then(async (mongoose) => {
        try {
            const resultXP = await profileSchema.findOneAndUpdate(
                {
                    guildId,
                    userId,
                },
                {
                    guildId,
                    userId,
                    $inc: {
                        xp: xpToAdd,
                    },
                },
                {
                    upsert: true,
                    new: true,
                }
            )

            let { xp, level } = resultXP
            const needed = getNeededXP(level)

            if(xp >= needed) {
                ++level
                xp -= needed

                message.reply(`:tada: | Congratulations! You are now Level ${level} with ${xp} Experience! You need more ${getNeededXP(level)} XP to level up again.`)

                await profileSchema.updateOne(
                    {
                        guildId,
                        userId,
                    },
                    {
                        level,
                        xp,
                    }
                )
            }
        } finally {
            mongoose.connection.close()
    }
  })
}

module.exports.addXP = addXP```
earnest phoenix
#

._.

cinder sandal
#

how do i get the Level of a user

earnest phoenix
#

wdym ?

cinder sandal
#

how the function would look like

#

like
Level: 1

earnest phoenix
#

u didn't defiened the level

#

where u get level

#

no where

#

no where, u can't just type level and u will get it

cinder sandal
#
const xp = Math.floor(Math.random() * 50) + 1;
        const coins = Math.floor(Math.random() * 5) + 1;

        const guildId = message.guild.id
        const userId = message.author.id
        
        const newXP = await levels.addXP(guildId, userId, xp, message)
        const newCoins = await economy.addCoins(guildId, userId, coins)

        message.channel.send(`:evergreen_tree: | You chopped a **Tree** and got ${coins} Crystal(s) and ${xp} XP!`)```
in some of these commands u get xp
earnest phoenix
#

ok and ?

#

u have to getXp

#

for exmaple

#

every 200xp u level up

#

so that mean 400xp u are level 2

clear arrow
#

how can i use premiumSince?

earnest phoenix
#
let level = xp / 200 
#

@clear arrow read docs

#

SEARCH

cinder sandal
#
clear arrow
#

i get undefined every time i try

earnest phoenix
#

wtf

#

what the heck

clear arrow
#

idk

topaz sleet
#

ew

earnest phoenix
clear arrow
#

yes i mean i don't know how to define it

#

message.guild.premiumSince?

earnest phoenix
#

You don't define it, it's a property of the Guild Member object

clear arrow
#

so is just premiumSince?

misty sigil
#

no

#

its <member>.premiumSince

earnest phoenix
#
message.member.premiumSince```
misty sigil
#

message.member works

earnest phoenix
#

For example

misty sigil
#

message.guild.members.cache.get(ID) works

carmine summit
#
console.log(api.data.children.length)```
returns undefined ![think](https://cdn.discordapp.com/emojis/700226511227191397.webp?size=128 "think")
earnest phoenix
#

@earnest phoenix wait here are a api anout that ?

#

about djs ?

#

WHAT

clear arrow
#

aw....

misty sigil
#

yea @earnest phoenix

earnest phoenix
#

WHAT

clear arrow
#

yea its good it gets null

misty sigil
earnest phoenix
#

It's null if the guild member never boosted the guild

clear arrow
#

yes.

misty sigil
#

it returns a json embed too @earnest phoenix so you dont need to do anything

#

nice isnt it

earnest phoenix
#

yes

clear arrow
#

i want to make if user boosted the guild to show me the badge

earnest phoenix
#

It returns a MessageEmbed instance @earnest phoenix

#

So just get it and send it

#

That's it

jovial nexus
#

how can i update my bot without restarting it?

earnest phoenix
#

LuL

#

discord.js are making there lib better

#

and ez

#

noice

earnest phoenix
#

btw are they geetting money from it ?

carmine summit
#

i got completely ignored

earnest phoenix
#

axios ?

#

wtf

#

i don't even know what is axios

honest perch
misty sigil
#

thats node fetcch

#

idot

#

they use axios

earnest phoenix
#

lol

#

Doesn't matter

#

They return the same object

#

LoL

misty sigil
#

do they

earnest phoenix
#

Yes

misty sigil
#

axios is just node fetch

carmine summit
#

uh

earnest phoenix
#
Promise based HTTP client for the browser and node.js
carmine summit
#

wut?

jovial nexus
#

what is the best process monitor for discord.js? (not pm2 please)

honest perch
#

pm2

carmine summit
#

WHAT?

earnest phoenix
#

pm2

#

@jovial nexus ^

jovial nexus
#

yes

#

not pm2

honest perch
#

pm2

#

pm2

jovial nexus
#

aaaaaaaaaaaaaaaaa

earnest phoenix
#

pm2 is the best

honest perch
jovial nexus
#

i know

honest perch
#

0

carmine summit
#

whats the difference of axios and fetchnode??

jovial nexus
#

but i dont want it

earnest phoenix
#

pm2

jovial nexus
#

pm2?

earnest phoenix
#

then rip 24/7

#

: /

#

why u install axios

#

._.

#

Systemd?

#

I already had it

carmine summit
#

why it works on you?

#

why

clear arrow
#

can i change the null message?

earnest phoenix
#

@earnest phoenix it is for all os

carmine summit
#

why

clear arrow
#

at premiumSince?

earnest phoenix
#

For testing purposes

carmine summit
#

how does it work on you

earnest phoenix
#

why it works on you?
@carmine summit Just use one more data

carmine summit
#

but me not

earnest phoenix
#

@jovial nexus yes

#

maybe

#

idk

carmine summit
#

@carmine summit Just use one more data
@earnest phoenix huh?

jovial nexus
#

no its not

earnest phoenix
#

Doesn't look like it, idk

carmine summit
#

oh

earnest phoenix
#
api.data.data.children.length```
carmine summit
#

lemme see

jovial nexus
#

i want to know the process manager that looks like thet

clear arrow
#

@earnest phoenix how can i change the null message to no?

earnest phoenix
#

@earnest phoenix how many package does Vx has ?

#

20+

#

right ?

#

10

#

wut

#

i have only 5