#development

1 messages ยท Page 1104 of 1

opal plank
#

where is that at?

weak rain
#

the file which is giving error

nova dock
#

๐Ÿ˜“ ๐Ÿ˜“ ๐Ÿค” ๐Ÿค” ๐Ÿ˜ค

weak rain
#

it is of music.js

opal plank
#

@nova dock move to a different channel dude

#

which folder is that in ?

#

oh i see the issue

weak rain
#

what is that?

opal plank
#

you are going 1 folder up in relative

#

../config is looking at music folder

#

go up 1 more folder

weak rain
#

what do u mean

opal plank
#

do you know node path?

weak rain
#

i m noob

opal plank
#

okay, lets go then

#

for simplicity sake

#

i'll be referring to this

weak rain
#

okay

opal plank
#
const something = require('inside here');
#

im referring to inside here

weak rain
#

ohk

opal plank
#

so

weak rain
#

so?

opal plank
#

if i do 'config.json' where is it looking for that file?

#

dont be afraid, im teaching ya

weak rain
#

my dc is broke

#

it crashed

opal plank
#

anyway

weak rain
#

@opal plank it will look for that file in the folder i guess?

opal plank
#

what would happen with 'config.json'

#

technically yes, but it'll try to load it as module

weak rain
#

ok

opal plank
#

what happen if i do './config.json'

weak rain
#

one folder up

opal plank
#

same folder*

weak rain
#

lol

#

okay

opal plank
#

what if i do '../config.json'

weak rain
#

one folder up

opal plank
#

correct

weak rain
#

or

opal plank
#

now

weak rain
#

okay

opal plank
#

Error: Cannot find module '../config.json'
Require stack:

  • /app/commands/music/music.js
  • /app/handlers/command.js
  • /app/server.js
#

from this i can see its 3 folders down the rabbit hole

#

app/commands/music/music.js

#

one folder up goes music

#

2 up goes commands

#

im betting you dont have your config inside your commands folder

weak rain
#

hm

#

yes

opal plank
#

then you need to go up 1 more folder

weak rain
#

okk

opal plank
#

so it looks in the proper place

weak rain
#

one more .

opal plank
#

correct

weak rain
#

@opal plank U r great :^)

opal plank
#

ty

broken crow
#

const { MessageEmbed } = require("discord.js");const { COLOR } = require("../config.json");module.exports = { name: "drop", description: "Drop The Song From Queue", execute(client, message, args) { let embed = new MessageEmbed().setColor(COLOR); const { channel } = message.member.voice; if (!channel) { embed.setAuthor("YOU ARE NOT IN VOICE CHANNEL"); return message.channe.send(embed); } const serverQueue = client.queue.get(message.guild.id); if (!serverQueue) { embed.setAuthor("The Queue is empty"); return message.channel.send(embed); } if(isNaN(args[0])) { embed.setAuthor("Please Use Numerical Values Only") return message.channel.send(embed) } if(args[0] > serverQueue.songs.length) { embed.setAuthor("Unable to find this song") return message.channel.send(embed) } serverQueue.songs.splice(args[0] - 1, 1) embed.setDescription("DROPED THE SONG FROM QUEUE") embed.setThumbnail(client.user.displayAvatarURL()) return message.channel.send(embed) }};

opal plank
broken crow
opal plank
#

what is that code suppose to be?

broken crow
#

Uhm

opal plank
#

give context

broken crow
#

Play

#

For

#

Music bot

#

I think

opal plank
#

you think?

#

yoiu the one who coded it, no?

summer torrent
#

use bin services pls

broken crow
#

@opal plank i am

opal plank
#

then, what does it do?

#

and whats wrong with it?

broken crow
#

Idk

weak rain
#

{
"token": "",
"PREFIX": "tr!",
"YOUTUBE_API_KEY": "",
"QUEUE_LIMIT": "5"
}

broken crow
#

I jist posted it here

weak rain
#

NOW their is error

#

unexpected token

broken crow
#

I can fix that

pale vessel
#

bro you leaked your token

weak rain
#

nope

broken crow
#

{
"PREFIX": "tr!",
"TOKEN": "TOKEN",
"YOUTUBE_API_KEY": "YOUTUBE API"
"QUEUE_LIMIT": "5"
}
@weak rain

#

On token add ur own token

opal plank
broken crow
#

Lmao

#

Not

#

Vsc

opal plank
#

for your own sake

#

dont use glitch

#

its not a bot hosting service

broken crow
#

Lol

weak rain
#

@broken crow That is for music bot

broken crow
#

Im on mobile

weak rain
#

made by DBD i guess

opal plank
#

also pls

#
const { MessageEmbed } = require("discord.js");
const { COLOR } = require("../config.json");
module.exports = {
  name: "drop",
  description: "Drop The Song From Queue",
  execute(client, message, args) {
    let embed = new MessageEmbed().setColor(COLOR);
    const { channel } = message.member.voice;
    if (!channel) {
      embed.setAuthor("YOU ARE NOT IN VOICE CHANNEL");
      return message.channe.send(embed);
    } const serverQueue = client.queue.get(message.guild.id);
    if (!serverQueue) {
      embed.setAuthor("The Queue is empty");
      return message.channel.send(embed);
    } if (isNaN(args[0])) {
      embed.setAuthor("Please Use Numerical Values Only")
      return message.channel.send(embed)
    } if (args[0] > serverQueue.songs.length) {
      embed.setAuthor("Unable to find this song")
      return message.channel.send(embed)
    } serverQueue.songs.splice(args[0] - 1, 1)
    embed.setDescription("DROPED THE SONG FROM QUEUE")
    embed.setThumbnail(client.user.displayAvatarURL())
    return message.channel.send(embed)
  }
};```
broken crow
#

Dbd?

opal plank
#

make it readable

weak rain
#

@broken crow youtuber

broken crow
#

????

opal plank
#

my linter struggled to prettify that code ngl

#

again Micheal

#

context?

#

what is wrong with that?

#

you're just giving us code

broken crow
#

Okay

opal plank
#

and not telling whats the problem

broken crow
#

The thing wrong with it

#

Is

#

When its on me boy

#

It doesnt work

#

I do =play Savage Love

earnest phoenix
#

uwotm8

broken crow
#

It gets in vc 1 sec

#

And them leaved

earnest phoenix
#

any errors?

weak rain
#

giving error

earnest phoenix
#

??

weak rain
#

at Object.<anonymous> (/app/commands/music/music.js:4:26)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Module.require (internal/modules/cjs/loader.js:666:19)

opal plank
#

i dont see any problem with that command

weak rain
#

I too

opal plank
#

specially cuz this isnt the play export, its the drop export

broken crow
#

Huh

weak rain
#

what do u mean

#

๐Ÿ˜–

opal plank
#

not u thunder, micheal

weak rain
#

kk

broken crow
#

Ooh

#

Ohhhh

opal plank
#

im willing to be this is the wrong command

#

if you get errors with =play

#

its on the play module

#

not the drop one lol

#

also

weak rain
#

I m fucking confused

earnest phoenix
#

he's not speaking to u

opal plank
#

they wont finish code execution

broken crow
#

Ok

weak rain
#

@earnest phoenixnot that

#

My code works on another project

faint prism
#

return message.channe.send(embed); } const
where is the spacing

weak rain
#

but now i tried to make them one

#

and its trash

faint prism
opal plank
#

what do you mean me?

#

its not my code

#

look at my link

#

i just made it readable in my linter

faint prism
#

oh

#

I see

#

My b. I'm not following the convo

weak rain
#
    throw err;
    ^
Error: Cannot find module '.../config.json'
Require stack:
- /app/commands/music/music.js
- /app/handlers/command.js
- /app/server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
    at Function.Module._load (internal/modules/cjs/loader.js:526:27)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/app/commands/music/music.js:4:26)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
internal/modules/cjs/loader.js:613
    throw err;
    ^
Error: Cannot find module '.../config.json'
Require stack:
- /app/commands/music/music.js
- /app/handlers/command.js
- /app/server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
    at Function.Module._load (internal/modules/cjs/loader.js:526:27)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/app/commands/music/music.js:4:26)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)```
opal plank
#

are you importing or requiring?

weak rain
#

Me?

opal plank
#

yes

weak rain
#

see to be honest music isnt my code

tranquil patrol
#

.../config?

weak rain
#

I got this

opal plank
#

if it was config it'd look for a module

#

config.json would look for json

broken crow
#

.../config lol

tranquil patrol
#

i mean

#

...

weak rain
#

wt

broken crow
#

Its ./config.json

weak rain
#

lel

broken crow
#

Not .../config.json

opal plank
#

its 3 folders up

broken crow
#

Get it right

opal plank
#

../..json

#

wait what

rancid oriole
faint prism
#

Get approved

tranquil patrol
#

yeah that's about it

weak rain
#

dbl api @rancid oriole

tranquil patrol
#

no

earnest phoenix
#

no

faint prism
#

no?

tranquil patrol
#

pretty sure dbl api is just for server stats

earnest phoenix
#

it just needs approval

tranquil patrol
#

speaking about server stats they are approved

#

they have server stats and you can only get a token when approved

#

๐Ÿ‘€

earnest phoenix
#

see to be honest music isnt my code
@weak rain bruh imagine copying code

rancid oriole
#

well i done

earnest phoenix
#

it needs to be approved

rancid oriole
#

its working

earnest phoenix
#

the bot itself

rancid oriole
#

aaah! ok. THX!

tranquil patrol
#

the bot is approved though

opal plank
tranquil patrol
#

i can see it

opal plank
#

no shit its working lol u got role

tranquil patrol
#

i am looking at the page

#

the thing is the bot does not appear to be here

earnest phoenix
#

that's a rip

earnest phoenix
#

bruh

rancid oriole
#

yep its my bot

#

Would the bot have to be in this discord?

#

@tranquil patrol

tranquil patrol
#

dunno but i think that might be related

#

e.e

#

@modern sable

modern sable
#

@torn zenith dont use such words in this server, ty

opal plank
#

๐Ÿ‘€

earnest phoenix
#

that's a good boy

rancid oriole
#

dbl api its works fine

weak rain
#

hm\

idle mountain
#

@rancid oriole happens because your bot isn't in the server

weak rain
#

๐Ÿ™‚

rancid oriole
#

Nice! Thx @idle mountain

opal plank
#

has anyone used pupeteer before?

faint prism
#

No, but I've used selenium

wide python
#

#p hen zl bo parte

weak rain
#

@opal plank hm can u help me fixing the code?

opal plank
#

if you coded it, sure

#

copy pasting it will not lead you anywhere though

weak rain
#

:/

#

i made that in 5hours though

#

that video

opal plank
#

first things first

#

do you know JavaScript?

weak rain
#

hm basically no

faint prism
#

wb any other OOP?

opal plank
#

then start with that

weak rain
#

i know little

#

wb any other OOP?
@faint prism ?

faint prism
#

Oh boy

opal plank
#

Object oriented Programing lang

weak rain
#

kk

#

i thought oopled

opal plank
faint prism
opal plank
#

read this

#

specially the #before you begin bit

weak rain
#

:/

opal plank
#

nah i mean it

#

bots are intermediate level projects

weak rain
#

hm

opal plank
#

as i always say

#

you are trying to write an essay in russian without knowing russian

faint prism
#

You gotta know how to code, maintain a repo (how to use SCM), make classes and functions, know some good design patterns (like SOLID), etc

opal plank
#

dont get me wrong, you dont need to be an expert

#

but you need to know the basics

weak rain
#

hm

opal plank
#

anything till you reach classes should be fine

weak rain
#

i read

pure lion
#

*shitty full stack noises*

opal plank
#

w3schools and mozzila has some amazing docs

#

you should go thru them

weak rain
#

its saying to buy cources lol

pure lion
#

Mozilla especially

opal plank
#

nah

#

w3schools

#

its free

#

skim thru their docs with they live snippets

pure lion
#

Imagine paying to read a book

opal plank
#

that gives you both the infomartion plus a snippet to play with

#

so you understand live whats going on

pure lion
#

Mrdoob has a live html edito-

weak rain
#

i will start that from tom

opal plank
#

it gives you info + snippets to try yourself

pure lion
#

Yes good smart

weak rain
#

@opal plank please help me

opal plank
weak rain
#

just for this time

warm sonnet
#

How can i learn coding

opal plank
#

you need to know js beforehand my dude

warm sonnet
#

By myself

opal plank
faint prism
#

The google

opal plank
#

literally right there

weak rain
#

@opal plank :/

warm sonnet
#

Thank you

weak rain
#

i have the code

warm sonnet
#

Is that free @opal plank

weak rain
#

i just have to fix it

faint prism
opal plank
#

you have the 'COPIED code' that you dont know what it does

warm cloud
#

learn what it does

opal plank
#

you NEED the basics before you start

weak rain
#

hm

warm cloud
#

this would be like me saying

opal plank
#

otherwise you'll go into a vampire loop

warm cloud
#

i'll use the alien technology

#

but i wont learn what's in it

#

and fuck it i'll just grab more tech

opal plank
#

you'll copy code, see it doesnt work, and come here asking for us to fix it

warm cloud
#

and pile it on in weird ways

opal plank
#

thats why you need to know basics first

warm cloud
#

right

weak rain
#

k

faint prism
#

https://discordapp.com/channels/264445053596991498/502193464054644737/555644686199422976

pure lion
#

Vx how 2 mkae methodes?

mild flower
#

how do i await reactions without using async

#

@ me

pure lion
#

Uh

#

@mild flower you can't

mild flower
#

hmm

#

i thought in discord.js 0.14 we could?

faint prism
#

w/o async?

amber fractal
#

awaiting without async isn't a d.js thing, it's a js thing and it's not possible

mild flower
#

:(

pure lion
#

Doesn't node 14 have global async :/

amber fractal
#

if you want to await you need an asynchronous function

mild flower
#

welp

faint prism
#

If you don't want to await an async function, then it isn't really async then, is it?
Just synchronous

mild flower
#

if only there was a way to await reactions or messages without async :(

faint prism
#

awaiting means waiting for an async to finish

restive furnace
#

just install that ^?

faint prism
#

You just call something like normal if you don't want it to be async

mild flower
#

but then

#

how do i do the tingy where the bots wait for what you type

#

like

#

when you create a giveaway using giveway bot for example

faint prism
#
// Async - Execution on this thread will continue
await MyFunctionAsync()

// Synchronous - Has to finish other function call before continuing 
MyFunction()
mild flower
#

???

#

oh

faint prism
quartz kindle
#

there is a way to wait for messages without using await or collectors

#

but its a bit more complex

faint prism
#

I think he just wants synchronous for some reason

mild flower
delicate shore
mild flower
#

how do i make these hyperlinks in embed

quartz kindle
#

[text here](url here)

mild flower
#

okie

delicate shore
#

x

mild flower
#

congrats me for winning my mum tho

delicate shore
#
if (command === 'work') { 
 
const worke = new Set();
    
    
        if (worke.has(msg.author.id))
      return msg.reply(
        `**You are on cooldown you can work every 30 minutes!**`
      );
 
//CODE
 
    worke.add(msg.author.id);
        setTimeout(() => {
          worke.delete(msg.author.id);
        }, 1800000);
      
    
  }
#

my cooldown is not working

#

idk why

faint prism
#

dude you gotta stop with this formatting

delicate shore
#

why

faint prism
#

worke ?

delicate shore
#

yea

quartz kindle
#

you create the Set inside the command

delicate shore
#

i did

quartz kindle
#

so every time someone uses the command, you create a new empty set

delicate shore
#

ok

#

oh

#

wait

#

ok

#

i get it thanks

lethal pine
#

hey there can anyone explain me what is ctx

faint prism
#

context

lethal pine
#

kk

mild flower
#

.setDescription(['Test']('https://discordapp.com/oauth2/authorize?client_id=728176491514298478&scope=bot&permissions=268954742'))
wut am i doing wrong

restive furnace
#

its string

mild flower
#

how should i write it then

faint prism
#

the entire thing

pale vessel
mild flower
#

oh

faint prism
#

.setDescription('[Test](link)') @mild flower

lethal pine
#

('Testing')

pale vessel
#

bruh

mild flower
#

yes i saw it

lethal pine
#

how to get bot-devloper role

#

?

faint prism
#

get a bot approved

lethal pine
#

k thankx

faint prism
#

np

delicate shore
#

ok

restive pebble
twilit rapids
#

Do any of you know an NPM Module or something like that which allows you to check if a song title (String) is from an Anime (Opening/Ending/OST/etc...)

pale vessel
#

how about a lookup

faint prism
pale vessel
#

e.g. from anilist api

faint prism
#

You could query that website maybe?

pale vessel
#

i'm pretty sure anilist api stores openings

#

it's using graphql too so it's easy to use

summer torrent
#

animejs ๐Ÿค”

#

lemme check that

twilit rapids
#

Endings and OSTs as well flapeze?

pale vessel
#

let me check rq

twilit rapids
#

@faint prism you know if that site has an api?

faint prism
#

I don't. But scraping it shouldn't be too difficult

twilit rapids
#

Never really got into web scraping but if there's nothing else I'll look into that

faint prism
#

It's all about Web clients and regex

viral spade
#

Can i add plaintext (a mention/ping) before an embed in the same .send command? or do i have to trigger two messages?

pale vessel
#

you might want to web scrape

twilit rapids
#

Message.reply(embed)

viral spade
#

the person getting pinged is not the author of a message

twilit rapids
#

Can't you add it to the message options

faint prism
summer torrent
#

@viral spade .send("mention", embed)

twilit rapids
#

Hmm interesting, I'll do some more searching for apis and if I can't find any I'll look more into scraping, thanks

viral spade
#

yes sorry, i am not doing msg.send, but a channel.send

faint prism
#

Np

twilit rapids
#

Use the code NMW03 send

viral spade
#

Thx ill try

pure lion
#

Is there a thing on mongoose that allows me to automatically add and remove stuff from all documents in a collection at once?

twilit rapids
#

deleteMany()?

lyric mountain
#

so, I have a quite annoying issue, consider the following scenario:

User A has 0 XP
User A writes a message, giving him 10 XP and triggering UPDATE query

BUT

User A somehow writes another message before the previous transaction is complete, giving him 10 XP but without the previous XP added
User A sees his profile and notices that he has only 10 XP despite writing 2 messages

#

What can I do to prevent such race condition from happening?

weak rain
#

module.exports = {
  name: "purge",
  category: "moderation",
  description: "purge messages",
  usage: "ban <@user> <reason>",
  run: async (client, message, args) => {  if (!message.member.hasPermission("MANAGE_MESSAGES"))
    return message.reply(
      ":x: You don't have perms, sorry."
    );
  let delmsg = args[1];
 if (!args[1])
    return message.channel.send(
      ":white_check_mark:  Please specify a number of messages to delete with the command."
    );
  message
    .delete()
    .then(
      //message.channel.bulkDelete()
      message.channel.bulkDelete(delmsg)
    )
    .catch(() => message.channel.send("Error when deleting messages"))
    .then(() => {
      message.channel
        .send(
          ":ok~1: Deleted " +
            delmsg +
            " message(s)."
        )
        .then(msg => msg.delete(3000));
    });
  }
}```
This is my code this is saying  -->โœ…  Please specify a number of messages to delete with the command. but it was working fine
#

previously

#

Anyone? -_-

lyric mountain
#

dude, you didn't even wait a full minute

weak rain
#

oh lol

#

i m so freackened

opal plank
#

Did you learn js?

weak rain
#

nvm

opal plank
faint prism
#

why are you panicked?

weak rain
#

@opal plank hm i know little

opal plank
#

did you LEARN js?

weak rain
#

why are you panicked?
@faint prism becuase my bot wents offline

#

it went 2 times

faint prism
#

A crash?

weak rain
#

think so

faint prism
#

Do you have a logger?

weak rain
#

@opal plank : )

misty sigil
#

catch errors.

weak rain
#

@faint prism no

faint prism
#

I'd make a logger, and implement more try/catches of sketchy areas

#

catch { logger.Log(exception) }

weak rain
#

what should i do

misty sigil
#

i try/catch everything eyess

weak rain
#

to make this work ๐Ÿ˜‰

restive furnace
#

so, I have a quite annoying issue, consider the following scenario:

User A has 0 XP
User A writes a message, giving him 10 XP and triggering UPDATE query

BUT

User A somehow writes another message before the previous transaction is complete, giving him 10 XP but without the previous XP added
User A sees his profile and notices that he has only 10 XP despite writing 2 messages
make cooldown of getting xp

faint prism
#

i try/catch everything :eyess:
not necessarily

earnest phoenix
#

Yeeet

opal plank
#

bruh

#

first

#

what kind of slow af database you using

#

second

weak rain
#

quick @opal plank

lyric mountain
#

it's not database's fault actually

opal plank
#

update inserts are quick

#

i doubt without spamming you'd be able to catch the update event fired before the get rquest

lyric mountain
#

I do some processing before calling the update, and in the fraction of millis sometimes it happens to have two instances of the same user running parallel to each other

opal plank
#

if you adding exp on every message you just need author id and then insert + exp

#

if you can somehow spam within that 3ms time, good luck

#

ยฏ_(ใƒ„)_/ยฏ

solemn latch
#

could get message events super close to each other

lyric mountain
#

ik, that issue happens mostly when discord freaks out

twilit rapids
#

Don't most databases handle that on their own anyways

opal plank
#

still, an update call shouldnt take more than that

#

they do aswell Timo

#

unless they are fired at the same time i doubt you'll find issues with multi processes

twilit rapids
#

Never had that issue with Mongo and I request very frequently (every 1-5ms)

opal plank
#

one way is like kuu said, where you'd have some lenghty code processing message that ends up clogging

#

but even that isnt a big gap either

#

we talking 10ms max usually

#

spamming 2 messages in that gap of time is somewhat hard

lyric mountain
#

I'll see if I find anything else that could be causing my issue then, maybe it isn't happening where I think

opal plank
#

USUALLY

#

this is a big USUALLY IF

#

you'd only want to fire on message event to add exp

#

and the retrieve to be only a db call + an embed or something(i disencourage using embed builders, build the payload manually)

#

there isnt much need for code elsewhere unles you going extra fancy

#

i recommend sending the payload manually rather than wasting time building the object via d.js or other builders

#

saves even more processing power

lyric mountain
#

actually, I think my issue is WHERE I'm adding the xp, which is at the end of the event

#

there's a lot of stuff before adding the xp, which could be clogging it

opal plank
#

you'd need to be looping quite a bit of stuff to be impacting the code heavily though

lyric mountain
#

well, then placement ain't the issue too

#

I'll try some kind of mutex to see if it works

opal plank
#

aight

earnest phoenix
#

all this time i thought member was only a property of the user object but message.member is how you use it...

#

almost wrecked servers

#

i was adding moderation commands

solemn latch
#

๐Ÿค”

lusty quest
#

wtf is this line

solemn latch
#

pro programmer moves

#

i need more fetches

pale vessel
#

?. is really important on this one

solemn latch
#

^

misty sigil
#

how do i send image file along with embed data/meta tags?

regal creek
#

Explain

#

What language?

quartz kindle
#

you mean opengraph tags or...

regal creek
#

And do you mean to upload a file? Or? Explain pls

misty sigil
#

wait nope i got it working

sudden geyser
#

[Python] Why can't I declare point as an instance of Point in the same class? For the record, I know it's just a decorator and doesn't actually enforce it to be an instance of Point.

quartz kindle
#

cant you do something like self.__class__? idk python

slender thistle
#

inb4 self

sudden geyser
#

I can't seem to use self in that position (and yes inb4)

amber fractal
#

Put it in quotes?

#

point: 'Point'

quartz kindle
#

^ just found that in SO as well

sudden geyser
#

that fixed the issue, ty

trim saddle
#

does .filter return a bool or an array

faint prism
#

array probably

#

or some collection

#

#IdkJS

amber fractal
#

@trim saddle it returns an array with everything that passes the function

solemn latch
trim saddle
#

ts is fun

quasi bear
#

Scree my bot ins't coming online anyone know how to help?

#

Im using node.js

sand condor
#

what library

#

and show code

earnest phoenix
#

How i can check does String has same value to one of element of a array ?

#

let String = "a";
let array = ["a", "b", "c"]
solemn latch
#

using includes

earnest phoenix
#
if(array.includes(String)
earnest phoenix
#

?

solemn latch
#

yeah

earnest phoenix
#

ok

bright dove
#

Change
categories.push(require(`../commands/${file}`))
to
categories.push((require(`../commands/${file}`)).category)
@jolly quail don't I have to remove something now?

#

and y'all said I don't need the slice cause it's already capitalized right? ๐Ÿ˜น

bright dove
#

there's a MUCH easier way to go about this
@indigo folio wha

#

idk

pure lion
#

Can we just take a moment to appreciate the safe search of this madlad

earnest phoenix
#

wtf lol

#

For "client.on" is on a method of client object or event? cause on the the documentation i cant find on keyword under client

lusty quest
#

event

#

client is your Discord client

solemn latch
earnest phoenix
#

ohhh does it always accept a string as its first parameter and a function for its second?

pure lion
#

Yup

#

Welcome to listener land

#

Where nothing makes sense

lusty quest
#

they make sense

earnest phoenix
#

oh okay thankyou now everything makes more sense

pure lion
#

M a k e s s e n s e t o m e

lusty quest
#

i had once the issue that i was unable to remove stuff from a object. this made no sense. to fix it i just set them to invalid

pure lion
#

:o

earnest phoenix
#

What's sharding

lusty quest
#

running the bot on mutiple processes with the same instance

earnest phoenix
#

Does it take a lot of RAM and CPU

lusty quest
#

it can make it x2 (per shard) if it scales linear. but its only needed if you reach 2500 Guilds

pure lion
#

Can you set up sharding in a way to run off of several machines?

lusty quest
#

yes

pure lion
#

:o

lusty quest
#

start the bot on Server A with Shard ID 1 and on Server B with shard ID 2

pure lion
#

Ohhhh makes sense

restive furnace
#

thats called clustering

earnest phoenix
#

cool

restive furnace
#

or nvm

earnest phoenix
#

me broke so me needs donations (and a bank account) to buy a good vps or just upgrade my repl.it account as they're fine with bots and ping services

lusty quest
#

get a Job?

earnest phoenix
#

I still don't get why Karens use glitch

#

get a Job?
In quarantine and the only thing I am good at is annoying people and coding

lusty quest
#

when i was 12 i made money with newspapers

earnest phoenix
#

what

#

the

#

heck

lusty quest
#

like once per week i went to every single house in the village and delivered newspaper

#

got me about 20โ‚ฌ/month

earnest phoenix
#

Hello i have an question

If i add if (message.author.bot) return;
My bot ignore all of the bot or only my bot?

lusty quest
#

all bots

earnest phoenix
#

Thanks you

#

Now i need to add this in all of the command wow it will be long

lusty quest
#

just add it to your command handler

#

saves you a lot of time

earnest phoenix
lusty quest
#

everyone needs to start somewhere. over time you will encounter challenges and will develop solutions for it

torn ravine
#

having a bit of trouble with my code

#

I'm trying to setup my bot so that when it gets mentioned it will send a message with help and prefix info

#

and I was testing things on my embed and found something that works

#

but then putting it into execution, it didn't work as intended

lusty quest
#

check if the message mentioned user is your Bot user?

torn ravine
#

yup

lusty quest
#

like if(message.mentions.users.first() == client.user)

torn ravine
sand condor
#

message.content is a property

obtuse jolt
#

How do code discord bots

amber fractal
#

usually you get a cat to walk across your keyboard

#

and you get a generic mod bot

#

and then your cat learns turkish

obtuse jolt
#

How do I make regexes

solemn latch
#

does anyone know how to make regexes

faint prism
#

Use a website

#

I do

misty sigil
#

use a website?

#

you can do that for regex?

faint prism
#

Yeah

misty sigil
#

ty

solemn latch
#

i need to figure out look ahead/behind with regex.

faint prism
#

For instance, this is to match a phone number:
[0-9]{?}-[0-9]{3}-[0-9]{3}-[0-9]{4}
Would match if 1-123-456-7890 or 123-456-7890

solemn latch
#

you didnt ? the -

#

id group those two together, and ? it

faint prism
#

I was actually just doing that ๐Ÿ˜›

#

([0-9]?)(-?)([0-9]{3})(-?)([0-9]{3})(-?)([0-9]{4})

#

I usually use regex with scraping, so wildcards are where it's at for me

amber fractal
#

do you want groups for every -?

#

very slow

solemn latch
#

can you group the numbers together, without grouping the optional -'s

amber fractal
#

just (?:-?)

#

that just makes it a non-capturing group

solemn latch
#

oo

amber fractal
#

or, if you just want one big match, you can do that to all of them

#

it makes it perform better, but regex will always be slow

#

https://oliy.is-just-a.dev/ae0bs_5334.png see, when you have them all grouped you gain access to each individual section of numbers, if you don't want this functionality, it's more performant to just have all of them in non-capture groups

surreal sage
#

Any light-weight db's for a web app, no quick.db

#

like quick.db only for a website

#

quick.db is not web-based

#

it has to be a signle .js nothing else

#

no npm

solemn latch
#

uh

#

modules are not heavier than just a js file

sage bobcat
#

One message removed from a suspended account.

surreal sage
#

ok wait

#

a database as single javascript file for non-node web applications

sage bobcat
#

One message removed from a suspended account.

solemn latch
#

you want to run a database in a webapp?

surreal sage
#

yes

#

and no mongo

sage bobcat
#

One message removed from a suspended account.

surreal sage
#

it has to be local tho

sage bobcat
#

One message removed from a suspended account.

surreal sage
#

it is a uhh

solemn latch
#

mysql wouldnt run like that

surreal sage
#

like

#

uhh

#

yeah

solemn latch
#

youd have to build something yourself

sage bobcat
#

One message removed from a suspended account.

solemn latch
#

since this is very unique

sage bobcat
#

One message removed from a suspended account.

surreal sage
#

redisdb exist

#

wait

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

surreal sage
#

yes lol

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

surreal sage
#

hippity hoppity lokijs is now my property

strange trout
#

I use loki for some stuff

#

It's really simple

surreal sage
#

how does it work lol

strange trout
#

What are you trying to make

surreal sage
#

a local panel to see bot stats

#

looks nice right?

#

exept the footer

opal plank
#

token

#

that scares me a bit

solemn latch
surreal sage
#

lol

strange trout
#

Lot of whitespace but that's besides the point. Why do you need a database for that?

surreal sage
#

do you know discord bot controls

#

well its like discord bot maker

#

but cheaper and other stuff

#

im making a plugin for it

#

(and no this is not a token stealer)

strange trout
#

Suspicion levels +1000

surreal sage
#

lol

#

but ok

#

how to like write

#

i want to add a content for 'token' and a content for 'prefix'

sage bobcat
#

One message removed from a suspended account.

strange trout
#

Like a text area?

surreal sage
#

well

#

i am adding the db to store content

#

(token and prefix)

#

but how to add a content to a like

#

yeah

strange trout
#

You'd probably do that with an API call to your API

surreal sage
#

wut

#

it has to be local

#

not remote

strange trout
#

Why

surreal sage
#

bc multiple pple use it

#

its a plugin

strange trout
#

That doesn't make sense

solemn latch
#

so users get their own data and store it themselves?

surreal sage
#

sigh

#

ok skip that

#

how do i store

#

how do i store data

stiff stream
#

please someone that knows heroku help

strange trout
#

You make an API call and save it in the backend

surreal sage
#

to who ru talking

strange trout
#

You

surreal sage
#

ok

#

but

#

there is no api

#

no remote stuff

#

HOW DO I STORE DATA

strange trout
#

Then make one neko_think

surreal sage
#

I dont want?

#

ITS A LOCAL DB

solemn latch
#

make the user install a local db?

surreal sage
#

no

faint prism
#

Serialize to a file

surreal sage
#

these kids that do stuff dont know what they are doing

faint prism
#

What sort of data are you storing?

solemn latch
#

your asking to do something abnormal

surreal sage
#

What sort of data are you storing?
@faint prism im making a dashboard where they can see some stuff

#

and i want it to able to let the user make a new token or prefix

#

and it has to safe it ofc

strange trout
#

I have a dashboard

#

I know what I'm doing

solemn latch
#

i also have a dashboard

faint prism
#

Does everyone have a dashboard?

solemn latch
#

pretty much

faint prism
#

For what purpose? @solemn latch

surreal sage
#

idc lol

#

dont ask

#

im asking something lol

#

how to store

#

locally

#
var db = new loki('sandbox.db');
<how to store now>```
solemn latch
#

items.insert({ name : 'mjolnir', owner: 'thor', maker: 'dwarves' });

surreal sage
#

yes but

faint prism
#
surreal sage
#

wait

#

nvm

earnest phoenix
#

Anyone know a never have i ever API?

#

ping me

faint prism
#

You could make one

solemn latch
#

wouldnt be hard

faint prism
#

What's it supposed to do?

earnest phoenix
#

api for a comman

strange trout
#

Or web scrape

earnest phoenix
#

d

faint prism
#

if false

#

lol

earnest phoenix
#

Or web scrape
@strange trout can u teach me

faint prism
#

if (!message.channel.nsfw)

#

Do that ^

strange trout
#

Google it

pure lion
#

I have a dashboard

faint prism
#

Don't bother comparing booleans. If statements handle that

pure lion
#

It took me 3 days of pain but I have a dashboard

solemn latch
zealous torrent
#

hey, how can i make a pay command?

strange trout
#

Yeah or localstorage

faint prism
#

localstorage ftw

strange trout
#

Not very safe or good though lol

faint prism
#

def not

#

user specific

solemn latch
#

well, thats what happens when you dont wanna do the work

#

๐Ÿค”

strange trout
#

He needs to make an API

faint prism
#

just have your service serialize data to a file

strange trout
#

He's trying to make a service like DBM

solemn latch
#
DBm

dBm (sometimes dBmW or decibel-milliwatts) is unit of level used to indicate that a power ratio is expressed in decibels (dB) with reference to one milliwatt (mW). It is used in radio, microwave and fiber-optical communication networks as a convenient measure of absolute power...

strange trout
#

Discord Bot Maker is an app though right?

solemn latch
#

yeah

zealous torrent
#

Hey, how can i make a pay command for a currency bot?

strange trout
#

Looks like he's doing it online so it's probably more similar to botghost

solemn latch
#

like moving money to someone else? or buying something?

zealous torrent
#

moving to to someone else

#

like %pay @solemn latch 10

#

and it takes $10 from you and gives you it

surreal sage
#

Alexis that db is bad btw works real bad

solemn latch
#

remove the amount from the transferrer, and then after thats successful give it to the mentioned user

zealous torrent
#

yeah i tried that and i get tons of errors

solemn latch
#

like?

zealous torrent
#

TypeError: message.guild.members.get is not a function

#

Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict

solemn latch
#

you shouldnt need to get the user, its already in the mentions

zealous torrent
#

ok hold on

#

lemme try and chang eit

#

nope, another error

strange trout
#

Well yeah it's an in-memory/embedded data solution @surreal sage

#

It's good for what it's meant to do which in my case is to store temporary variables that get deleted on runtime

earnest phoenix
#

Or web scrape
@strange trout Which website?

#

I did reddit

#

but not good

midnight blaze
#

@fleet hornet dont use if else, use switch, or you ll get haters

solemn latch
#

if else is fine, if you have only a few if else's

earnest phoenix
#

Anyone know a "never have I ever" API or command?
PING ME

fierce vector
#

How do I send a message to a certain channel when someone votes for the bot?

solemn latch
#

do you have a webhook setup?

fierce vector
#

No

solemn latch
#

on the left theres a few libs which may or may not have webhook support

fierce vector
#

Ok thanks

#
dbl.webhook.on('vote', vote => {
  const channel = bot.guilds.channels.cache.get("738863158994927637")
  channel.send(`User with ID ${vote.user} just voted!`);
});
#

@solemn latch Is this how?

misty sigil
#

ye

fierce vector
#

Ok thanks

solemn latch
#

yeah.
youll need to give a webhook url to top.gg

fierce vector
#

How??

solemn latch
#

on your bots edit page, at the bottom

misty sigil
fierce vector
#

Also

#
bot.on("ready", () => {
  console.log(
    `${bot.user.username} is online on ${bot.guilds.cache.size} servers!`
  );
  bot.user.setActivity(`Orcoid Beta`, { type: "PLAYING" });
  setInterval(() => {
    dbl.postStats(bot.guilds.cache.size);
}, 1800000);
});
#

This would post my bot's server size to the website right?

solemn latch
#

yeah

#

or you can use the inbuilt postStats

fierce vector
#

Ok so

#

What happens here?

solemn latch
#

http://ip:port/dblwebhook

fierce vector
#

Post that there?

solemn latch
#

ip would be your bots servers pub ip
port and path would be whatever you set

fierce vector
#

I'm so confused

solemn latch
#

your creating a webhook server that top.gg posts vote events to

fierce vector
#

So what do I put in the http://ip:port/dblwebhook

#

My IP address?

solemn latch
#

your bots public ip.
if its on a vps, it would be the vps's ip.
if its on your home network its your ip

#

if its on your home network, you will need to port forward

fierce vector
#

Would anyone be able to access it or only top.gg?

tranquil patrol
#

anyone but it's got a password

solemn latch
tranquil patrol
#

if i remember right

#

yes

fierce vector
#

So how would I port forward?

solemn latch
#

it depends on your router

fierce vector
#

I know how to but like

#

Is it UDP?

#

Or TCP

#

Or both?

solemn latch
#

usually tcp

fierce vector
#

And I can make it ANY port?

solemn latch
#

typically over 1000, but yeah any available port

fierce vector
#

Okay

#

I've port porwarded

#

Okay so now

#

Authorization?

#

http://ip:port/dblwebhook

solemn latch
#

its whatever you set in the auth
webhookAuth: 'password'

fierce vector
#

What goes in dblwebhook?

#

Keep it default

solemn latch
#

dblwebhook is the default path

fierce vector
#

So I keep it?

solemn latch
#

yeah, unless you change it with "webhookPath"

fierce vector
#

So authorization is my private password?

solemn latch
#

yeah, can be whatever

fierce vector
#

And now save?

solemn latch
#

yeah, just make sure you set the auth in your code aswell

fierce vector
#

How??

solemn latch
#

in the options, like the example shows

#

"webhookAuth: 'password'"

fierce vector
#

So

#
const dbl = new DBL('token', "webhookAuth: password", bot);
solemn latch
#

options need to be an object

#

you also will want to set port

fierce vector
#

Okay so

solemn latch
#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }, client);

fierce vector
#
const dbl = new DBL('token', { webhookPort: port, wekhookAuth: 'pass' }, bot);
solemn latch
#

yep

fierce vector
#

Now am I good to go?

#

It's working!!!

faint prism
#

Does js have intellisense?

#

Or rather, any ide that does

fierce vector
#

@solemn latch

#
dbl.webhook.on('vote', vote => {
  const channel = bot.guilds.channels.cache.get("738863158994927637")
  channel.send(`User with ID ${vote.user} just voted!`);
});
#

Why didn't this send any message?

#

Oh it's bot.channels isn't it

solemn latch
#

yeah

dusty onyx
#

hai, in python pillow, how would you overlay a gif on another gif? so far i have for frame in ImageSequence.Iterator(gif): but i do Not know how id phrase it so that the frames of my two gifs overlay each time... :(

fierce vector
#

yeah
@solemn latch It still didn't send any message

solemn latch
#

channel may not be in the cache, you might have to fetch it

fierce vector
#

Hm

#

So .fetch instead of .get?

solemn latch
#

and without cache

#

fetch also returns a promise

fierce vector
#

But I use v12

#

So I need cache

solemn latch
#

for get

fierce vector
#

So for fetch there is no .cache?

fierce vector
#

Ok

#

Thanks

#
dbl.webhook.on('vote', vote => {
  const channel = bot.channels.fetch("738863158994927637")
  channel.send(`User with ID ${vote.user} just voted!`);
});
#

Like this?

solemn latch
#

youll have to await, or .then

fierce vector
#

Ok

#
dbl.webhook.on('vote', vote => {
  const channel = bot.channels.fetch("738863158994927637")
  await channel.send(`User with ID ${vote.user} just voted!`);
});
#

And vote.user returns their ID?

opal plank
#

what

#

dont await the send

#

await the fetch

fierce vector
#

oh

#

I'm dumb

opal plank
#

make it async

fierce vector
#

How

opal plank
#

you should really learn js before doing a bot

#

here

fierce vector
#

Lol

opal plank
#

learn that, at the very least

fierce vector
#

I'm confused

fierce vector
#

oof ok then

#

Bye

trail reef
#

hello

#

I'm trying to create something in Express, and for some reason the first if statement in my code doesn't appear to work...

router.get('/captcha', (req, res) => { // Captcha generator, takes a size param
  let size = parseInt(req.query.size);
  let imgOnly = req.query.imgonly;

  console.log(`size BEFORE if statement: ${size} (Type: ${typeof size})`)

  if (size == null || size == NaN) {
    console.log('if statement runs'); // doesn't run
    size = 4;
  }

  console.log(`size AFTER if statement: ${size} (Type: ${typeof size})`)

  if (size > 5 || size < 1) {
    res.status(400).json({success: false, message: 'The size field must be an integer between 1 and 5.'});
    return;
  }

  let captchaGenned = new Captcha(200, 100, size);

  if (imgOnly == 'true') {
    res.send(`<img src="${captchaGenned.canvas.toDataURL('image/png', .25)}"/>`);
    return;
  }

  res.json({success: true, text: captchaGenned.value, data: captchaGenned.canvas.toDataURL('image/png', .25)});
});

If I try to visit this endpoint in my browser the if statement doesn't appear to work and curl just freezes.

Console output:

size BEFORE if statement: NaN (Type: number)
size AFTER if statement: NaN (Type: number)

Urls tried:

localhost/gen/captcha (if statement doesn't work, intended behavior is that size should be set to 4 in this scenario)
#

Could someone tell me what I'm doing wrong?

tight plinth
#

try if (!size)

trail reef
#

Alright

#

omfg that worked

fierce vector
#
dbl.webhook.on('vote', vote => {
  bot.channels.cache.get("738863158994927637").send(`User with ID ${vote.user} just voted!`);
});
trail reef
#

@tight plinth could you tell me why the other one didn't work?

fierce vector
#

Maybe it's an issue with dbl.webhook.on('vote', vote => {

#

Maybe the webhook doesn't work?

opal plank
#

learn js

trail reef
#

That's literally what I'm trying to do

#

lol

opal plank
#

not u

#

Cloud

fierce vector
#

No like

solemn latch
#

webhook works fine

fierce vector
#

Hm

trail reef
#

oh

fierce vector
#

Oh I think I may know why

opal plank
#

we told you to use async and you just reverted back rather than learning async which i linked you to

#

ยฏ_(ใƒ„)_/ยฏ

fierce vector
#

It's not showing my IP

#

It's coming up as 0.0.0.0

solemn latch
#

its hard coded to 0.0.0.0

fierce vector
#

Maybe I have to define my IP?

#

Oh

misty sigil
#

if you don't understand async/await should you be making a bot thonkku

opal plank
#

i'll awnser that one

misty sigil
#

it's a very good idea to get knowledge of the base language

opal plank
#

no

misty sigil
#

then the environment

#

then get used to the modules

opal plank
#

the problem isnt even learning or not

#

its unwillingness to

#

i did link him async doc

misty sigil
#

ah

opal plank
#

he just reverted his code back

misty sigil
#

you're right

opal plank
#

rather than learning

#

ยฏ_(ใƒ„)_/ยฏ

misty sigil
#

v. big smart

bright dove
#

why do y'alls
text like this
have all the different colors and like actually looks like code and mine is just grey and ugly??

opal plank
#

like this

fierce vector
#

Okay so

opal plank
#

```js```

#

erm

fierce vector
#

I tried console logging when someone votes

opal plank
#

no

fierce vector
#

That doesn't work either

solemn latch
#
```js

#

oof

#

there are attempts

opal plank
#

```js
```

#

there

#

you can use other markdowns

#

js is one of them

#

apache

#

json

bright dove
#

oh so if you put js it'll make it look like js when you type the code?

opal plank
#

if you are using js, yeah

solemn latch
#

did you

#

\

#

each `

opal plank
#

make sure theres a space

#

i did

bright dove
#
client.on('ready', ready => {
console.log('boobs')
}```
#

bruh

#

I'm a magician

#

I don't even think that code is correct anyway

#

lol

solemn latch
#

2

#

๐Ÿค”

bright dove
#

wrote it off the top of my head

solemn latch
#

my 2 in cs isnt working

opal plank
#

asciidoc
bash
autohotkey
coffeescript
cpp (C++)
diff
ini
json
py
xml

#

those are the ones i remember

bright dove
#

coffeescript

opal plank
#

i dont remember the rest, but i think there are others

misty sigil
#
client.on('ready', ready => {
console.log('boobs')
}) //here```

@bright dove you were almost right, but you forgot a )

void vale
#

@bright dove

client.on('ready', () => {
console.log('boobs')
})
faint prism
#

I can't find streaming option for a bot in my library or the discord api docs.
Does it exist?

solemn latch
#

dont think so

#

dont think bots have the ability

faint prism
tranquil patrol
#

it does

faint prism
#

Ik they use WebRPC, but not sure if this page makes me think it's available or I'm looking in the wrong area

#

@tranquil patrol Do you have a link to the api docs?

tranquil patrol
#

what is your library

faint prism