#development

1 messages · Page 1730 of 1

eternal osprey
#

well where is he using db then in this little snippet?

earnest phoenix
#

I'm using both eris and discord.js

umbral zealot
#

you don't mean exports then you mean function arguments

umbral zealot
#

you can't mix two libraries

#

that's... just wrong.

earnest phoenix
#

Well I am

umbral zealot
#

no but you cannot

#

you can try but that's just wrong

earnest phoenix
#

imagine

umbral zealot
#

eris and discord.js aren't compatible

earnest phoenix
#

using both eris and discord.js

#

Well how on earth am I successfully doing it?

#

;-;

umbral zealot
#

I don't know but it must be a random-ass convergence of stars

earnest phoenix
umbral zealot
#

because that's just bad, wrong, don't do it.

#

Yes. End of conversation. Choose one.

earnest phoenix
#

Period

#

.

#

haha luca you cant delete my dot post

#

I'm using discord.js to use embeds, etc.

umbral zealot
#

Ok so use discord.js fully

earnest phoenix
#

wtf

umbral zealot
#

You can't send an embed from discord.js into eris and expect this to always work

#

that's just randomly stupid

#

And that is precisely the problem you're having right now

earnest phoenix
#

const Discord = require('discord.js')

naive light
#

Successfully? If so, then how come you're looking for help, because something is not working. KEKW

earnest phoenix
#

eris KEKW

#

Here's the deal tho...it's been working fine since 2019

umbral zealot
#

Ok so here's the deal though

#

discord.js and eris both HAVE CHANGED

#

just because it randomly worked in 2019, doesn't mean it will continue to work

#

because neither Abal or Hydrabolt have made any effort to make their libraries work together since then or before then

#

So the fact that it worked? Completely random.
The fact it broke now? probs because of an update
The solution? Choose one.

earnest phoenix
umbral zealot
#

I am not saying that you're lying

#

I did not claim it never worked

#

I'm telling you it stopped working and will probably never work again

#

and the solution is to stop being an idiot and choose ONE.

earnest phoenix
#

But like

umbral zealot
#

There's not Ifs, Thens, or Buts.

#

choose one, go with it.

earnest phoenix
#

that's a lot of commands and such that I have to change...

#

Eh I will

umbral zealot
#

That's your problem, now, ain't it?

earnest phoenix
#

So it isn't related to the server?

#

ye should listen to server auntie

umbral zealot
#

You chose to make a Frankenstein-esque monster, now deal with it.

naive light
#

Of course, you can stick to using two libs, but then you can be sure, that you will encounter even more issues.

lavish minnow
umbral zealot
#

same, tbh

earnest phoenix
#

lol

lavish minnow
#

It's a rat nest and I love it

umbral zealot
#

Me reading old code to be precise.

earnest phoenix
eternal osprey
#

hey evie, i was wondering whether i can use the delete operator to delete the specific element.

earnest phoenix
#

it is so thicc it crashed my repl

umbral zealot
#

Nah that's not frankenstein-esque. What would be though, is to try to mix a React app with Vue components and Angular logic, and then go "But it worked and now it doesn't!"

earnest phoenix
#

hhhh

umbral zealot
earnest phoenix
#

array.splice(index of element, 1)

umbral zealot
#

really though the easiest way to remove an array element is myArray = myArray.filter(e => e === 'my value to remove')

#

¯_(ツ)_/¯

eternal osprey
#

as i would only be searching for name

umbral zealot
#

what link values

#

hold up now

umbral zealot
#

I'm talking about your link array

eternal osprey
lavish minnow
umbral zealot
#

yes, links

quartz kindle
#

there is a trick to make item removal 5x faster, but it only works if your array is unordered

umbral zealot
umbral zealot
eternal osprey
#

yeah, but names is linked to links (well the length)

earnest phoenix
quartz kindle
eternal osprey
#

so that is why i want to filter by array.length

#

and not by name

umbral zealot
lavish minnow
eternal osprey
umbral zealot
#

that doesn't make sense

eternal osprey
#

as you have to add a link + name to save

earnest phoenix
#

ok

umbral zealot
#

don't use 2 different arrays then

#

use one array with an object with name and url

earnest phoenix
#

well time to go write some code for me lib

umbral zealot
#

¯_(ツ)_/¯

earnest phoenix
#

bye

umbral zealot
#

I should be working on my damned Juhachiban project too tbh

#

I wrote one line today.

#

I'm here helping noobs instead because I'm obsessed

earnest phoenix
quartz kindle
#

lmao

umbral zealot
#

smh

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
quartz kindle
eternal osprey
#

so if i have 3 links set, my array.length = 2. Can i do this then: array.splice(2, 1)

umbral zealot
#

no no hold up

#

back up

eternal osprey
#

haha oaky.

umbral zealot
#

you're doing something fucky

#

use ONE array

#

with OBJECTS

#

that have TWO VALUES

earnest phoenix
#

woah auntie stop with the caps

quartz kindle
#

no, please continue with the caps :^)

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

good luck

umbral zealot
#
const links = [
 {
   name: 'google',
   url: 'https://www.google.com',
 }, {
   name: 'yahoo',
   url: 'https://www.yahoo.com',
 }
];

Here @eternal osprey this is what you need to do

#

This Is The Way ™

quartz kindle
#

this is the way

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
eternal osprey
#

mhm yeah i get that

sage bobcat
#

One message removed from a suspended account.

eternal osprey
#

just need to find a way on how to get to that way

umbral zealot
#

... well ... not to be a condescending cunt but the answer to that is : with code

#

Since I've only seen the data I Can't tell you what code you need

#

but definitely, the structure you need is that one above

#

To be perfectly fair though

#

the actual answer is

#

STOP USING JSON

earnest phoenix
#

is there a way to use my Snowflake typedef without having to import it from the module in every file

gritty ice
#

why

#

anyone know?

umbral zealot
#

Well clearly command.name is undefined

finite leaf
#

Why is the date not converting right?

umbral zealot
#

"converting"?

finite leaf
#

changing format

umbral zealot
#

well it seems like you're trying to read Y/d/m

#

but...

#

uhm...

#

2021-03-19

#

that's... not slashes, those are dashes.

#

not the same character 😉

earnest phoenix
umbral zealot
#

I don't think you can without importing

umbral zealot
#

but don't worry importing is cached so it doesn't affect your performance.

earnest phoenix
#

DRY - Dont repeat yourself

umbral zealot
#

yeah I understand the concept, but either you repeatedly send that structure throug function arguments, or repeatedly import it where you need it

#

both ways are correct

#

but importing is cleaner

earnest phoenix
#

k

umbral zealot
#

DRY isn't a universal global rule that means "never ever have the same code". It means don't re-do the same code more than once, re-use it instead. and that's what imports are

#

and also what functions and loops do, too 😛

earnest phoenix
#

okie

gritty ice
#
 for (const file of commands) {
        const command = require(`./commands/${dirs}/${file}`);
        console.log(`✔️  Ready ${file}`);
        client.commands.set(command.name.toLowerCase(), command);
    };```
toLowerCase is undefined why
earnest phoenix
#

you forgot to export .name in one command

gritty ice
earnest phoenix
#

how would i know

gritty ice
sudden geyser
#

[PostgreSQL] Is it possible to create a table where a column references another table? For example, I have a users table and want the avatar column to point to a row from the images table (which could have information like the id, url, dominant color, and description).

dusky sundial
#

You can look up how foreign keys are used, pretty sure that's what you're looking for

earnest phoenix
#

how do you loop over an object

quartz kindle
#

for..in or Object.keys/values/entries

sudden geyser
#

I recommend you use one of the Object methods since for in will also factor in the prototype (which can be manipulated)

earnest phoenix
#

im using it to assign properties in my constructor

#
constructor(info: {
    content: string,
        options: OptionList | null
    user: User,
    channel: GuildChannel | DMChannel,
    member?: Member,
    guild?: Guild,
  }) {
    for (let k in info) {
      this[k] = info[k];
    }
  }
sudden geyser
#

What about Object.assign

#

but there are probably better ways of assigning properties given the props are static

earnest phoenix
#

how about for k of Object.keys()

quartz kindle
#

in the above case, you can simply use Object.assign

#

but yes, for of Object.keys() also works

quartz kindle
#

Object.assign(target, source)

#

for example

#
a = {};
Object.assign(a, {f:10})
console.log(a) // {f:10}
earnest phoenix
#

ok

#

but how would i explain typescript that the property is already assigned in the constructor

quartz kindle
#

you can do Object.assign(this, info), which will copy all poperties of info into this

#

for typescript you prpbably need to give your class an interface that has the properties already

earnest phoenix
#

?

dusky sundial
#

In what lang?

pale vessel
#

php

#

mysqli_connect() troll

eternal osprey
#

Cannot find module '../build/Release/canvas.node'

#

i've typed npm i canvas for a trazillion times by now

#

npm i canvas returns me:

earnest phoenix
#
function s(e,l){
g=e.length%2==0?g=e.length/2:e.length/2,
h=l.length%2==0?h=l.length/2:l.length/2,
x=e.slice(0,g),y=l.slice(h,l.length),
console.log(x+y)}
s(process.argv[2],process.argv[3]);```

possible to make this script shorter or not?
sudden geyser
#

assign process to variable p, remove any extra whitespace you can

earnest phoenix
cinder patio
#

Why do you want to make it short as possible

#

what's the point

sudden geyser
#

probably some challenge

eternal osprey
#

still at this issue for 2 hours already

sudden geyser
eternal osprey
#

uhhm

sudden geyser
#

follow the instructions at the url

eternal osprey
#

okay i am trying

#

so should i remove my current vs and download the 2k17 one?

#

wait why do i even need vs for vsc to work?

#

it doesn't make sense to me

lusty quest
#

its a Build Tool

blissful coral
#

I have a function I created for my bot called endGame() which takes the parameters of the database then deletes the database table so that the next game can continue, for some reason, when I sent ended = true after doing this and run my later statement if(!ended) board.save() to save the db if the game was not ended I am getting a error telling me that it can't save a deleted board

lusty quest
#

on linux its g++ and the other you need, its needed for compiling some binaries

eternal osprey
#

so which one should i install

lusty quest
lusty quest
blissful coral
#

No @lusty quest

eternal osprey
blissful coral
lusty quest
eternal osprey
blissful coral
lusty quest
lusty quest
blissful coral
#

?

#

When?

lusty quest
#

you told me that you delete the Document when the Round ends right?

blissful coral
#

Yes

#

the document board

#

not the document guild

lusty quest
#

after this you run the if(!ended) stuff

blissful coral
#

yes

#

guild never gets deleted

lusty quest
#

well ended is true, and you try to save a non existing document

blissful coral
#

this is when they win

#

this iss after

pale vessel
#

koding

lusty quest
#

you delete the Document inside the Board collection at some point when the round ends right? before the if (!ended) statement

blissful coral
#

yes

#

if(!ended)

#

means if ended = false

#

ended is false unless I set it to true after ending game right there

lusty quest
#

something executes and try to save it, but it cant save it bcs the document is already deleted.

eternal osprey
desert drift
#

how i check a account if he alt
he crated before 100 days

lusty quest
desert drift
#

?

lusty quest
#

would help if we would know what language/ api wrapper you use

sudden geyser
desert drift
#

what you say

sudden geyser
#

Do you want to check if the account was created before 100 days? What library are you using?

desert drift
#

I already checked

eternal osprey
#

how do i rebuild node_modules

#

as i keep getting the same error

desert drift
#

the user created 100 days ago

lusty quest
eternal osprey
lusty quest
lusty quest
eternal osprey
#

yeah definitely sure

sudden geyser
desert drift
sudden geyser
#

Who though?

sudden geyser
#

The person who's account is under 100 days old?

lusty quest
#

PROGRAMMING LANGUAGE ffs

desert drift
eternal osprey
#

omg i still get the same shitty error

sudden geyser
#

It's hard to interpret what you're saying, but assuming you're talking about the user's account age, I would use it as an indicating factor but not as confirmation (e.g. making a note to users about the account's age).

desert drift
#

yes the account age

#

If his age is 101 days is alt?

lusty quest
cinder patio
#

You can't determine whether an account is an alt just using the account's age...

eternal osprey
#

i even tried to install the build tools

#

but it gave me the exact same error

lusty quest
#

installing them takes a while

eternal osprey
#

npm i windows-build-tools

#

yeah but look at this

solemn latch
eternal osprey
earnest phoenix
lusty quest
#

why tf did you need Visual studio?

#

what module did you installed to cause this?

eternal osprey
#

i have no clue

#

i am just trying to intall canvas

#

i once installed vc for c++

#

and from that day i just can't install canvas nor node-gyp

lusty quest
#

you have to install the build tools or Visual studio

sudden geyser
#

@eternal osprey try running npm i -g windows-build-tools from an admin cmd or powershell

lusty quest
#

ive sended him the instruction for this already, but once again people here refuse to read stuff

sudden geyser
#

They're probably just new to this and confused

solemn latch
#

the canvas install guide is really easy to understand

#

assuming that was the one that was sent

jovial nexus
#

The join logs on my bot only work on half of the shards, and i dont even have privileged gategay on, someone knows?

lusty quest
#

the one for installing build tools, and he got the instruction for this already send earlyre

lusty quest
solemn latch
#

ah yeah

jovial nexus
#

the guildMemberAdd and remove

lusty quest
#

need priviliges, its possible that you still query the V7 API

jovial nexus
#

now is v8?

lusty quest
#

ye

jovial nexus
#

when?

lusty quest
#

V7 is a bit strange with the enforcing of the new Gateway intends

solemn latch
#

v9 is about to come out 👀

signal estuary
#

why is my bot stopping at this line of code:

let members = (await msg.member.guild.members.fetch()).array()

It doesnt throw an error. It just doesnt run the code further at this point

lusty quest
#

i dont think you can call array on this

sudden geyser
#

If you want to fetch the member list, you should use intents instead.

solemn latch
#

honestly, not sure why fetch(for all members) even exists.

signal estuary
#

why is my bot stopping at this line of code:

let members = (await msg.member.guild.members.fetch()).array()

It doesnt throw an error. It just doesnt run the code further at this point
EDIT: An error ist arriving 4 hours later

Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
    at C:\Users\Flo\Desktop\Discord_Bot\node_modules\discord.js\src\managers\GuildMemberManager.js:317:16
    at Timeout._onTimeout (C:\Users\Flo\Desktop\Discord_Bot\node_modules\discord.js\src\client\BaseClient.js:83:7)
    at listOnTimeout (node:internal/timers:556:17)
    at processTimers (node:internal/timers:499:7) {
  [Symbol(code)]: 'GUILD_MEMBERS_TIMEOUT'
}
solemn latch
#

its not really the way to fetch memebers

signal estuary
gritty ice
#
 const dbresult = await GuildSchema.findOne({guildId: message.guild.id})```
await only the async function  why?
solemn latch
sudden geyser
#

Go to the dashboard and enable the server member list intent

gritty ice
#

how to solve that

#

error

solemn latch
#

make the function async.

gritty ice
#

? example

solemn latch
#

linked above

sudden geyser
#

Now check where you initialize the client that you're asking for the member list

signal estuary
#

where do i check that?

sudden geyser
#

e.g.

const Discord = require("discord.js");
const client = new Discord.Client({
  ws: {
    intents: [Discord.Intents.GUILD_MEMBERS]
  }
})
#

You may need to enable some other intents, like GUILD_MESSAGES

signal estuary
#

like that?

sudden geyser
#

yah

signal estuary
#

ok and then?

#

my bot doenst react now

sudden geyser
#

Try running your bot, but instead of fetching the members with .members.fetch(), rely on the cache for the member list (.members.cache). It should be populated with the member list.

#

Like I said, you may need to enable other intents.

signal estuary
#

oh waiut

sudden geyser
#

Because it's not a variable; it's a property.

signal estuary
#

Im lost

#

I think this is beter

#

but my bot still doesnt react

#

on a message

sudden geyser
#

That may be due to another intent (e.g. GUILD_MESSAGE_REACTIONS). I encourage you to review the docs and how intents work.

opal plank
#

List of all intents

#

Realistically unless your bot is quite big, intents wont cause much of a footprint

#

Bandwidth wise

#

At higher scale, yeah, specially presences

lost wadi
#

anyone know how to download songs from newgrounds?

last tapir
#
class Test {
    constructor (val) {
        this.number = val;
    };
};

const number = new Test(14);
console.log(number)

Is the class Test an object or a function, I'm confused.

umbral zealot
#

@blazing sentinel show the code that relates to top.gg here

umbral zealot
#

@blazing sentinel hi. please show code here so we can help you

blazing sentinel
#

ok

#

requests is an aiohttp session instance

#

that is why it is awaited

umbral zealot
#

Ok so just to be clear this only specifically runs whenever you want to check if a user voted, right? For particular, exact commands that are vote-locked?

last tapir
blazing sentinel
#

all my commands are vote-locked for now? except help and prefix change

umbral zealot
#

Ah I see. So, you don't necessarily need a database tbh, but you certainly would benefit from caching the data

#

like not query it every single command, but just every... say every hour for example

#

or every 6 hours

#

Calling an external API every single command is what's making this slow, not the fact that it's the top.gg api specifically

blazing sentinel
#

then he/she has to wait until next caching?

umbral zealot
#

capture incoming votes with the #topgg-api webhooks and store that then

#

you can do both

umbral zealot
#

#topgg-api , check the docs in the topic title, there's event coming in for votes, which tell you what user it is

#

should be simple enough (I don't use it, and don't use python, but I know it's possible)

blazing sentinel
#

thanks, i didn't know there is a webhook api. i dont know much about webhooks but suppose it isnt that hard

umbral zealot
#

it's pretty straightforward actually

blazing sentinel
#

i don't use the library. library is more complex and less understandable than sending get/post requests for me.

umbral zealot
#

how though

blazing sentinel
#

but i can use webhooks

#

thanks

umbral zealot
mellow jewel
#

What kind of authorization I need to fetch data from this API route?

quartz kindle
#

just a bot token

#

if your bot is in that guild

pine pasture
#

Hello, How can I make the replit page have my bot on 24/7 without me turning it on every 1 hour?

#

@rustic nova

#

Hello, How can I make the replit page have my bot on 24/7 without me turning it on every 1 hour?

rustic nova
#

Pinging me for what reason?

#

I can't help you, just ask and wait

sudden geyser
#

repl.it is not a reliable hosting service if you want your bot running persistently.

pine pasture
sudden geyser
#

A ping is when you mention someone (e.g. @pine pasture)

pine pasture
sudden geyser
#

What do you mean?

pine pasture
sudden geyser
#

A word can have multiple meanings.

pine pasture
sudden geyser
#

What is a "page"?

pine pasture
solemn quartz
#

guys any ideas for a fun category command? (no economy)

pine pasture
sudden geyser
sudden geyser
solemn quartz
#

its a multi-task bot

#

and its private

pine pasture
pine pasture
sudden geyser
pine pasture
vivid fulcrum
#

acronym for thank you

pine pasture
#

That being using a translator is very difficult V:

opal plank
#

realistically you shouldnt be making muti-purpose bots, which is what the majority will recommend

#

that, at least, if you plan to grow your bot

sudden geyser
#

they said it's private

pine pasture
#

Aver, Aver

#

Ya se me fue el internet /;

#

Y sigo hablando aqui

opal plank
#

thats why i said the second part

slender wagon
#

is there a way i can send some text in discord as .txt file with discord.js?

midnight blaze
#

anyone an idea, what this regex mean?

#
global.regexEscape = string => string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
sudden geyser
#

It replaces a set of special characters with the same character but escaped.

#

Though I doubt it's actually useful.

deep mantle
solemn quartz
#

very interesting

midnight blaze
#

@sudden geyser ahhh, I get it..replace function => the thing after the comma will replace it?

#

I see

sudden geyser
#

$& is a special replacement pattern. It inserts the matched substring (which is any special character in the regex).

midnight blaze
#

ok, I think I see, thanks for the help

sudden geyser
midnight blaze
#

yes, the replace thing is ok, but I was more interested in the regex 😛

#

I see there is an or within the regex

#

the second option seems easy to understand

#

[]{}

still sky
#

Anyone knows how to use environment variables in npm script? I tried different ways but npm takes it as text

"scripts": {
    ...
    "server:start": "npx serve -l $CLIENT_PORT",
    ...
},
midnight blaze
sudden geyser
#

You can set it, but not pass it.

sudden geyser
#

There are probably ways to dance around the restriction

still sky
#

Gonna try via .js file somehow

dire kraken
#

Can anyone please help me make a eval command i use python

dusky sundial
#

What are you getting stuck on?

pale vessel
#

Use the eval function or Jishaku

dire kraken
#

i am like brand new to using python/making a discord bot with python i have everything else ready and i just need an eval command

dusky sundial
#

So you know how to create a command?

dire kraken
#

yes

dusky sundial
#

So just make a command that runs the eval method

#

probably a good idea to lock the command to bot owners only too

dire kraken
#

Can you please show a example

dusky sundial
#
if ctx.message.author.id == "your-discord-id":
  eval(expression)

Should do the trick

dire kraken
#

ty

blissful coral
#

what's the best way to see how many emojis a server is allowed to have

dire kraken
#

and how would i make what i type a var to put in the expression part?

#

i was planning on making it a embed

dusky sundial
#

Actually your id is an int, not a string sorry

slender thistle
#

It's a pain in the ass to do in a clean way

dire kraken
#

omg is that an eval command

#

TYSM

lyric mountain
dusky sundial
#

Yeah, it's int in python

past dove
#

Please, any solution ?

pale vessel
#

uh, transpile it?

earnest phoenix
#
    guild.owner.send("test")
}``` why is send null
pale vessel
#

because the owner isn't cached

earnest phoenix
pale vessel
#

no

#

guild.owner is

earnest phoenix
#

well it still doesnt work tho

pale vessel
#

because it's null

#

fetch the owner first

blazing sentinel
#

do you know about infailedsqltransaction: sql transaction is aborted, command are ignored until ... error? i use postgresql with psycopg2

pale vessel
#

using guild.members.fetch(guild.ownerID) where guild is the guild

snow vector
#

how would i fix that

quartz kindle
#
  1. make sure the file exists
  2. make sure your require paths are correct
snow vector
#

they are there

sudden geyser
#

But you should also be aware of the path from the file you're searching for the path from

quartz kindle
#

show your require

#

and the location of the file that has the require

snow vector
quartz kindle
#

show your index.js

snow vector
sudden geyser
#

remove the prefixed spacing

umbral zealot
quartz kindle
#

lmao

snow vector
quartz kindle
sudden geyser
#

the void

snow vector
#

...

umbral zealot
#

THE SPACE

snow vector
#

my b

umbral zealot
#

lmao

sudden geyser
#

lol

quartz kindle
#

lmfao

snow vector
#
const fs = require('fs');

module.exports = (client, Discord) =>{
    const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));

    for(const file of commandFiles){
        const command = require(`./commands/${file}`);
        if(command.name){
            client.commands.set(command.name, command);
        } else{
            continue;
        }
    }
}```
#

i am setting up a new cmd handler

umbral zealot
#

So, fs is relative to the root.
require is relative to the current file

snow vector
#

i have not put in any commands

umbral zealot
#

So, if you're loading something with fs and you're in /folder/file.js , another file called /other/thing.js will be loaded with ./other/thing.js whereas you need to require it using ../other/thing.js because you're in another folder already

snow vector
#

confusion

umbral zealot
#

./ is the current folder

snow vector
#

sorry im switching from BDFD

umbral zealot
#

../ is up a folder

#

I... don't care actually what you're switching from I'm trying to explain operating system paths

#

a thing that's been around since longer than both of us have been alive kekface

snow vector
#

im just saying its all brand new to me

#

so i may not understand

umbral zealot
#

do you understand what a folder is

snow vector
#

so you have to explain it like your talking to a 1st grader

#

yes i do

umbral zealot
#

ok do you understand what a "parent" is

#

in terms of folder

#

or "up a folder"

snow vector
#

no

digital swan
#

its like pressing the back button on file explorer

#

sort of

snow vector
#

oh yeah

solemn latch
#

./file.js
means look where i am for file.js

../file.js
means look up a directory for file.js

the bottom arrow is where ./file.js would look
the top arrow is where ../file.js would look
https://i.woo.pics/9d5d54045f.webp

snow vector
#

so in a sub folder

dire kraken
#

I hate python becuase of how picky they are about indentation

solemn latch
#

sub folder is the other way around

snow vector
#

yeah

dire kraken
#

It's so annoying

snow vector
#

ok yeah ik what that is

#

@umbral zealot ik what they are

umbral zealot
#

great so you should understand

#

../ is one level higher or in the parent

#

./ is the current folder

#

now, your fs is relative to the root of your project

#

that is to say, this folder

#

BUT

snow vector
#

but so index is in DroxZ-Bot folder in that folder is handlers and in handlers are the js files

umbral zealot
#

require() is relative to the current folder of the file

#

So for require, ./ is this folder.

#

but for FS it's other one around

#

see what I mean?

boreal iron
#

MegaThonk OneDrive... witch found - burn it!

umbral zealot
#

shhhh

snow vector
#

i followed a video on how to setup discord.js they just told me to add the fs

#

idk what it does

#

so no i dont rlly understand

#

OH yes i do

boreal iron
#

You understand that you don’t understand?

snow vector
#

no

cosmic forum
#

Hello, I have a canvas element:

<canvas class="background" style="position: absolute; display: block; top: 0; left: 0; z-index: -1;"></canvas>

That sets its height to fill the whole screen. However, whenever I scroll down on the page, the canvas element gets scrolled away as well. How would I make it stay fixed in the background without it scrolling along? I tried position: fixed, but it broke the js animation that plays on the canvas.

lost wadi
#

Do you know how to send a link that is a download as an attachment?

deep mantle
#

like the image location of an image sent through a channel?

lyric mountain
snow vector
#
module.exports = (client, Discord) =>{
    const load_dir = (dir) =>{
        const event_files = fs.readdirSync(`./events/${dirs}`).filter(file => file.endsWith('.js'));```
#

anyone have any idea whats wrong

#

@umbral zealot your smart

sudden geyser
#

you omitted the error

#

but dirs probably doesn't exist

#

notice how you do have a variable named dir

umbral zealot
#

yeah we have no idea what's wrong either.

umbral zealot
copper cradle
#

dw I am a mind reader, you problem is on your main.c file, on line 503, I know your file is only 15 lines but trust me, it's on line 503

sudden geyser
#

teach me your ways

copper cradle
#

the uzbek ways

lyric mountain
#

He now da wae

snow vector
#

how i fix

blissful bridge
snow vector
#

12.5.3

blissful bridge
earnest phoenix
#

how do i webscrape a table and get specific data in a specific row (python)

next ferry
#

How can do vote required command please tell me

tacit sequoia
next ferry
delicate shore
#

Can anyone guide me that how exactly I can connect to discord gateway

#

I am new to Websocket thing

sudden geyser
#

looks average

fiery stream
#

idk how to do the logo

lyric mountain
#

Yellow thunder

solemn latch
#

👀 i didnt know thunder looked like that

lyric mountain
#

And move the logo a bit closer to the top-left corner

#

It's too near the chaotic pattern with too much empty space to the corner

sudden geyser
#

oh no

fiery stream
#

wait should i make it yellow?

lyric mountain
#

Nonono

#

Go back go back

sudden geyser
#

keep the thunder the dark color

#

align them so they don't spaz around

#

maybe make the giant one smaller and farther away

fiery stream
#

wait what do you mean alight them?

#

like pointing downwards?

sudden geyser
#

The smaller lightning bolts all pointing in one direction (like downwards)

lyric mountain
#

I think the chaotic pattern is fine, it's just that the logo is too near them

#

Like, it's the logo that should capture the attention

#

Not the bg

fiery stream
#

that ?

lyric mountain
#

No

#

As I said, bg cannot draw the attention more than the logo

fiery stream
#

tried moving them away from big logo...

lyric mountain
#

A little dimmer

#

Also why is the logo so far away from the borders?

#

Yep

fiery stream
#

wdym far away?

#

should i also decrease the amount of small logos i got

#

or increase maybe

lyric mountain
#

It'll look like a baby blanket then ig

fiery stream
#

lemme try n see

#

but not bad

#

wait yooo this actually doesnt look that bad

stuck quail
#

@fiery stream bhn k lode

fiery stream
#

lun ta baj

stuck quail
#

@fiery stream means?

fiery stream
stuck quail
fiery stream
#

Teri budi madarchod salya

stuck quail
#

🤣

stuck quail
fiery stream
#

Teri budi da lun a chung la

stuck quail
fiery stream
#

Smd

stuck quail
#

@fiery stream kya hua randi k bache

fiery stream
#

Teri ma randi salya

stuck quail
fiery stream
#

<@&304313580025544704> ^^ feel free to mute this kid

gilded plankBOT
#

@fiery stream

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.
fiery stream
#

He bullying me in other langs tho

ripe prairie
fiery stream
#

He bulling me tho... 🥲

mint thicket
#

not a valid reason to ping mods, sorry

ripe prairie
#

not repeating myself, please don't ping mods for something that only requires one person to handle

mint thicket
#

use your head

fiery stream
#

Nvmm

#

Ill deal with him myself

solemn latch
fiery stream
#

now you gonna bully me too pandasad

earnest phoenix
#

never said anything bad

#

just bruh for that modping

#

also just realized this is development

last tapir
#
class Form {
    constructor (name, email, age, ID) {
        this.name = name;
        this.email = email;
        this.age = age;
        this.ID = ID;
    };
};

const student = new Form("Jack", "Jack@jack.com", 24, "LOL");

console.log(student.name, student.email, student.age, student.ID )

I'm having this class, and I'm trying to check that if ID is not a number then it would return a console.log("ID not a number."), but I am not sure how I can do that.

#

I added this before this.ID = ID which is if (isNaN(this.ID)) return console.log("NO"), but it logs ```js
NO
Jack,"Jack@jack.com",24,undefined

restive furnace
#

you could try using typeof operator. check it before assigning into the value.

example:

if (typeof this.thing !== "number")
    // throw some error here
ripe prairie
#

sql noob here, what does the "UNIQUE" constraint do

thorny flume
#

can someone tell me what is the name of the route that i can put a user ID or product on?

opal plank
#

it can be handy instead of AGGREP or GROUP clauses

ripe prairie
opal plank
#

imagine this

ripe prairie
#

oki

opal plank
#

==========================
id | name | role

1 | lerwin | dev
2 | lerwin | dev
3 | Nekomaki | dev
4 | Nekomaki | dev

Each of the ID's are unique

ripe prairie
#

oh

opal plank
#

however the names or the roles arent

ripe prairie
#

i see

opal plank
#

meaning if i try to make the role collumn unique

ripe prairie
#

so i can't have two id -> 1s

opal plank
#

correct

#

if you have a column with UNIQUE you cant insert the same value twice

#

that ensures its actually only that one occurance

#

and no more

ripe prairie
#

so if i have a table that takes into account people's discord IDs, i should probably set it to unique? (even if there probably won't be any conflict given how discord uids are made)

#

or something of the same concept

ripe prairie
#

lets goo

opal plank
#

you using postgres?

ripe prairie
#

sqlite

#

dunno if that's a proper answer to your question

#

all i know is i'm using some sql and the sqlite3 lib in python lol

opal plank
#

postgres, like sqlite, is another db

#

its SQL based tho

#

but postgres usually offers a shitton more stuff, but its also heavier

thorny flume
#

can someone tell me what is the name of the route that i can put a user ID or product on?

opal plank
#

you mean the api?

#

for a GET request?

thorny flume
#

Exemple: ('/user/[:id]')

opal plank
#

just ask which endpoint

#

but yeah, thats the one for user

#

and for product...

frigid mountain
#

do you guys only help discord.js or also discord.py

opal plank
#

this would likely be the one for store

#

@thorny flume

opal plank
thorny flume
#

no man, it is express, I want to create a route with a user id or product

opal plank
#

should've said so

#

yeah, that would work

ripe prairie
#

okay so

#

here we go

thorny flume
#

Lol

opal plank
#

look at the docs i sent above

#

you could use discord's format with endpoints for that

frigid mountain
thorny flume
#

Ok

opal plank
frigid mountain
#

well it is what it is

thorny flume
#

@opal plank

.get('/user/${user.id}')

?

opal plank
#

that would work, yeah

#

also

#

plural

#

users

#

though thats just preference

thorny flume
#

Okay, but I can create a const containing the information I want to pass on, for example:

const userId = '90';

.get('/users/${userId}')

?

opal plank
#

well, its a server, yeah, you can send whatever you want to whoever does the GET request

cinder patio
#

So I have a struct, which owns an object let's say A, is it any way to transfer the ownership of that object to the current scope, and then return it once the scope is over, I don't wanna borrow because I'll need to borrow again later on

ripe prairie
#

@opal plank

@commands.command()
    async def dbtest(self, ctx, currency: int):
        conn = sqlite3.connect(some database path)
        c = conn.cursor()
        c.execute("SELECT ID FROM UserCurrency WHERE ID=?", (ctx.author.id,))

        if c.fetchone():
            await ctx.send("Found!")
        else:
            await ctx.send("Not found.")
            c.execute("INSERT INTO UserCurrency VALUES (?, ?)", (ctx.author.id, currency,))
        
        conn.commit()
        conn.close()```
#

i did a thing

#

and it works

#

but is there anything i can prolly do better

#

(all command is supposed to do is just check if uid exists when running the cmd, then if it doesn't, just put the uid in and add the currency value)

#

also, is there a way to get like, ID, as an actual value that i can use in code hmm
nvm got it pogu

thorny flume
earnest phoenix
#

I'd suggest you do a connection pooling, idk if sqlite3 has it. Also, ig sqlite has similar syntax as postgre for upsert clause

ripe prairie
#

i dont think it does (from searching it up)

earnest phoenix
#

yeah ig, there's sqlalchemy afaik. I haven't tried sqlite though

ripe prairie
#

ah well how bad can it get

#

(very bad)

earnest phoenix
#

Oh, forgot to mention, you should be using aiosqlite instead as sqlite3 is blocking

#

not sure if it has connection pooling though

ripe prairie
#

aiosqlite?

#

oh

#

i see

#

thank you

earnest phoenix
#

what code should i use i want that bot say something when it is pinged (node js)

lavish bramble
#

What is the opposite of guildCreate

opal plank
opal plank
earnest phoenix
opal plank
earnest phoenix
#

Discord.js

#

@opal plank

opal plank
#

use websocket ping or make a simple request to see how long it took

#

oh

#

nvm im stupid

#

you mean when you MENTION the bot?

#

lik @<botname>?

#

@earnest phoenix

earnest phoenix
#

Yes

#

@bot

#

This

#

And he replies 😅

opal plank
#

listen to messageCreate event, then just check if the <message>.content includes the bot id or mention

earnest phoenix
#

🤔

opal plank
#

discord.js should ship mentions wth it

#

something long those lines

quartz kindle
#

you havent used djs in so long you forgot how it works?

quartz kindle
#

xd

opal plank
#

i assume it has your own users/@me payload attached to the client somewhere, no?

quartz kindle
opal plank
#

yeah that ^^

#

totally knew

#

was testing you tim

#

good job, you pass

quartz kindle
#

:^)

lavish bramble
#

What is the opposite of message.mentions.users.first()

long crow
lavish bramble
#

Thnx

long crow
#

there is middle too

#

LIES

opal plank
#

is there quarter()?

#

third()

#

8th()

#

420th()

long crow
#

69?

opal plank
#

69th(), yes

quartz kindle
#

.first(10).last() is a real thing tho :^)

opal plank
#

kill it with fire pls

#

today i learned that map() is unoptimized af

#

for loops ftw

quartz kindle
#

nothing beats for loops

#

also object > map if your keys are strings

#

map is only good for non-string keys

opal plank
quartz kindle
#

bias king :^)

opal plank
#

dunno wutchu on' bout

long crow
long crow
#

(╯°□°)╯︵ ┻━┻

opal plank
#

ts gang

#

the docs are there, in intellisense format

opal plank
#

@long crow pls cake-san dont bonk me for exposing dms

#

cake definitively has plans to improving the docs

#

i've talked to him before, im willing to give some help too

#

might write a base clone-ready bot for new people full of comments

long crow
#

I'm looking forward to it, sure it handy for intellisense, but as now I dont want to rely fully on automatic pops without knowing what it does

opal plank
#

i mean, in all honesty most of the is kinda intuitive

#

also biased opinion, cuz you need to know a bit of how discord api works beforehand

#

for new users, without intellisense its a nightmare

long crow
#

when I active here, most feedback I see is about documentation, so yeah. looking forward to it.

opal plank
#

voice support

#

better docs

#

message collectors

#

and seemless scale

#

though he did point out not having much interest in the latter

long crow
#

already supporting / command?

opal plank
#

dunno if i should actually say much about it since most of it was spoken in dms, and he's traveling rn

#

dont wanna put unwanted pressure

#

but yeah, he is doing something about slash commands, possibly a slashCommands client

#

dunno exactly what he's doing, i havent asked much

#

but im already using slash commands and some newer stuff

#

his lib has no problem whatsoever interacting with it

long crow
#

button?

opal plank
#

yeah, i got to test the buttons

#

they are amazing

long crow
#

I'll just wait it out, btw we stray out of #development topics. kekw

opal plank
#

not really, this is dev talk

#

talking about a library and its capabilities is well within topic

#

but the new stuff is looking hella sweet

#

threads and buttons are pog

long crow
#

threads, never heard of it

#

button yeah, when someone show it to me

opal plank
#

its been talked about quite a while in the past

#

not sure if i can comment about anything in details tho

#

they specifically asked not to share it

long crow
#

I'll take a stand wait and see

opal plank
#

fair enough

long crow
#

not rushing stuff till it ready

opal plank
#

indeed

#

though im going the other way around

#

i may already be porting my commands to use it

#

like, almost all of them

#

of course, gonna leave the old ones as is, but i'll clone them to be able to use the newer stuff too

quartz kindle
#

im probably not gonna do shit

opal plank
#

im 100% using it

#

too pog to pass by without really any drawbacks

#

specially for ratelimits

#

this will massively decrease some ratelimits

quartz kindle
#

im sick and tired of updating shit

#

generally sick of discord devving too lmao

long crow
#

soon acquired by microsoft

#

heh

lavish bramble
#

How can I mix two name with each other

earnest phoenix
#

len/2+len/2

#

you get the idea

earnest phoenix
#

how make an api in heroku

spare badger
#

@earnest phoenix Learn how program

earnest phoenix
#

but my cnt workk

lavish bramble
#

😅

cinder patio
#

you get the first half of the first string, second half of the second string, and you add them

spare badger
lavish bramble
spare badger
#

A ship command?

lavish bramble
#

Yup

spare badger
#

Don't judge me I'm mostly just a web dev getting into bot development lol. So what do you mean with a ship command?

#

What is it supposed to do?

lavish bramble
#

Like this

hazy sparrow
#

basically fusion names if you ever watched dbz

lavish bramble
#

Idk

cinder patio
#

you get the first half of the first string, second half of the second string, and you add them

earnest phoenix
long crow
#

python maybe, js not so

earnest phoenix
#

its the concept

cinder patio
#

A lot of people can't be bothered to use their brain

long crow
#

yeah yeah ,you're the smart ass

pale vessel
#

🙄

earnest phoenix
# lavish bramble

post your command and we will help you fix it. cant really spoonfeed

lavish bramble
#

Oksir

rose canopy
#

@earnest phoenix do U understand urdu

earnest phoenix
#

correct

cinder patio
#
    pub fn peek(&mut self) -> Option<&Token> {
        if self.current.is_some() {
            return self.current.as_ref();
        }
        self.current = self.consume();
        self.current.as_ref()
    }

Any rust pros here know how can I make it so the function doesn't return a reference to Token without cloning it, or maybe return a reference to token which isn't tied to self's lifetime

cinder patio
#
let token = self.tokens.peek()?;
match &token.val {
    ...
    self.tokens.next(); // cannot borrow `self.tokens` as mutable more than once at a time
}

That's why I'm asking ^^

eternal osprey
#

i am trying to install windows build tools

#

and it has been stuck on this page for like 30 minutes or so

quartz kindle
#

its normal, keep waiting

eternal osprey
#

sure

lusty quest
#

saw this taking 1-2 hours on low powered Devices

static matrix
#

Why i cant add backgrounds?

eternal osprey
#

still at the same page lmao

minor urchin
lusty quest
quartz kindle
#

installing stuff is more network and disk dependent than cpu and ram

lusty quest
#

or just gets limited by your OS, but for this you have to run funny stuff like a Raid 0 array of mutiple NVME SSDs. then windows starts to limit speeds to the array bcs it cant handle it.

but this again is not really something that a normal person will encounter

earnest phoenix
#

Hey why this is not working for me?
message.guild.me.voiceChannel.join()

lusty quest
#

you call the voiceChannel property from a member object

earnest phoenix
lusty quest
#

me gives you the member object of the bot, you probably want to get or fetch the voicechannel and then get the bot to join it

earnest phoenix
#

Oh ok

earnest phoenix
earnest phoenix
#

Then do what I said

#

ok

#

How can I make my bot send his stats every 5min in a specific channel?
DJS

earnest phoenix
sudden geyser
cinder patio
#

Thanks for the answer but I already solved it 😅

sudden geyser
#

ah, alright

eternal osprey
#

i am still at the same page with my download

#

wtf is it doing

#

still waiting for installer log

quartz kindle
#

well try restarting your pc

#

and try again

eternal osprey
#

i already tried that

#

nothing changed

#

what should i do now? @quartz kindle

umbral zealot
#

How long did you actually let it run? because I've seen this take, like, 45 minutes.

#

depending on the machine

quartz kindle
#

are you using cmd or powershell? try installing with the other one

#

you could also try installing chocolatey and installing through there

eternal osprey
eternal osprey
umbral zealot
#

alright well try using it to install those

eternal osprey
#

yeah i will

#

i am trying it with powershell

#

but i think it will get stuck again

eternal osprey
#

seems like it won't work

solemn latch
tired panther
#

whats the regex to match everything except of undefined?

quartz kindle
#

leave it running for like an hour, then open task manager and kill any installer.msi thingy (make sure cpu usage is 0%)

#

sometimes works

pale vessel
#

string.replace(/undefined/g, "")?

tired panther
pale vessel
#

You can just fetch all and filter the results

tired panther
pale vessel
#
guilds.find({ test: { $ne: undefined } })```
#

$ne would be not equals

#

test is the property

tired panther
quaint wasp
#

How do I know where this error came from?

#
E:\Program Files\smug\code\node_modules\discord.js\src\rest\RequestHandler.js:154
      throw new DiscordAPIError(request.path, data, request.method, res.status);
            ^

DiscordAPIError: Unknown Channel
    at RequestHandler.execute (E:\Program Files\smug\code\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at async RequestHandler.push (E:\Program Files\smug\code\node_modules\discord.js\src\rest\RequestHandler.js:39:14) {
  method: 'post',
  path: '/channels/825367843355885608/messages',
  code: 10003,
  httpStatus: 404
}```
sudden geyser
#

It's often not helpful.

#

One way would be to catch it early.

quaint wasp
#

how

#

?

#

I got over 50 files... idk where the error exactly came from.

clear marlin
#

What command did you just execute?

sudden geyser
#

e.g. ```js
try {
something()
} catch (err) {
handle(err);
}

surrounding the command. Logging stuff like what command was used can help as well.
pale vessel
#

Make sure to await it

sudden geyser
#

if it returns a promise of course ^

clear marlin
#

well tbh, Hoister just wants to know where the error came from, although yes exception handling is a good thing.

sudden geyser
#

Handling the exception will allow the error stacktrace to point to where it came from (I believe)

#

Plus you should have the info on what command it was by doing so.

#

[PostgreSQL] I have a media and tags table. I want the media table to have a tags column that should be a collection of references pointing to some row in the tags table. PostgreSQL has an array type, but I don't believe it's appropriate for this as I don't think you can store arrays with references (foreign keys). How would I accomplish something like this?

rapid wharf
#

Hey Guys, In Dicord.py I coded

async def on_member_join(member):
    em = discord.Embed(title=f"Welcome {member.name}!!", color=0xd24dff)
    em.add_field(name=f'Welcome to my World Baby {member.name}!', value=member.mention)
    em.set_footer(text="Hope you will have Fun with me here!!!")
    await client.get_channel(799980929056768003).send(f'{member.mention} has Joined.')
    await client.get_channel(799980929056768003).send(embed=em)```
this for the welcome sys for only my support server, it will welcome new joiners on this channel, but the bot is welcoming every new member which joins in any server where the bot is. how to make it for my my support server, i tried adding 
```if dicord.Guild.id(696969696969): ```
 but it didn't helped.....
sudden geyser
#

That if condition doesn't make sense.

#

You should check what guild the member is from.

#

I think you can do if member.guild.id == ...: pass

rapid wharf
clear marlin
#

like getting row data from another table

sudden geyser
#

You're on the right track. The tags column would hold some collection of references pointing to some row on the tags table. But it won't hold an "instance" of a row (since that's not possible). The foreign key will instead hold a primary key (in my case an ID) that's sure to exist on the tags table (e.g. e577c582-6537-4b1f-ac8d-5dc8a64bbf30).

#

But I'm not sure how you'd have a collection of references work with a database

clear marlin
#

are you using sql or orms?

#

If you are using sql

#

Use SELECT INTO

sudden geyser
#

An ORM to interact with the database, but I'm creating the table from SQL.

clear marlin
#

ye well that can help

#

lemmi give you an example

#
SELECT data1 data2 INTO TABLE subtable FROM supertable
#

should work like a charm

earnest phoenix
#

WHAT THE..

clear marlin
#

huh

sudden geyser
#

I'll look into SELECT INTO, thanks :)

clear marlin
#

np

quaint wasp
clear marlin