#development

1 messages · Page 125 of 1

hushed robin
#

how do i validate if is url

#

cus error if not

harsh nova
#

Regex

hushed robin
#

i will google the regex

#

and see if work

#

why doesn't this work

#

ok nvm

#

i found new regex that works

pale vessel
#

you can remove the new RegExp('')

#

maybe it had trouble parsing it as string

hushed robin
#

whats the point of new RegExp if you don't need to use it ?

pale vessel
#

if you have a regex string and want to parse it, or if you have template literals in the regex

#

if you have the literal regex in your code you don't need it

lament rock
#

mfw the email regex

desert verge
#

I have to fix something with my character system. When a character is deleted, the ID is deleted too, so I will find a way so that the ID will make a thing like: 1 2 3 4 5 6, not: 1 3 5 6, it cause a lot of problem with the /characters command because when we react with ▶️ it does actual ID + 1

#

If someone can help me when I'll be at my home

snow steeple
#

bro wtf

#

can someone help me :/

quartz kindle
# desert verge I have to fix something with my character system. When a character is deleted, t...

the ids are fine, you dont wanna change them to keep the order as that will cause more issues than it solves.
what you wanna do is simply change the way you list the characters, get/fetch/select them all, put them in an array, and then paginate them, dont paginate the ids themselves.
if youre using a database you can also use its own built in pagination system, most databases have that (query limit offset)

desert verge
#

I made a database in a file system format

#

but thanks for the advice!

#

there is a db folder, then a folder with the user id and then a folder with the character ID where there are meta.json, bio.txt and stats json

#

My server has only 2Go storage so I may upgrade my hosting service but I'll have to pay

lyric mountain
#

you did what we call a "json db"

#

if storage is a premium you can use sqlite, which is extremely small and simple to use

#

later when you upgrade you can move to more complete databases like postgres or maria with almost no changes in your code

desert verge
#

I'll see for a SQL db

#

but I can't

deft wolf
#

Why?

desert verge
#

I have to pay for the next tier

#

I'm only 15

#

If you want to see my work it's on GitHub but I'll update my repo in the evening

deft wolf
#

Well, you can leave link to github here. Maybe someone will have some advice after seeing the source code

lyric mountain
#

all common sql databases are free

#

sqlite doesn't even require a host service

#

don't try to use their database feature, install it yourself

digital swan
lyric mountain
#

you need to give permission to view public schema

#

you cannot hide that schema

digital swan
#

i assume usage allows you to view it too

winged linden
#

hey why does this doesnt work?

.setThumbnail(client.config.embedlostIcon)

note: client.config.embedlostIcon is set to a discord image url and when i log it its all good

digital swan
#

still doesnt work after that

winged linden
#

Is there a specific size required for embed thumbnails?

lyric mountain
lyric mountain
surreal sage
winged linden
surreal sage
lyric mountain
#

I guess so, unless it's nsfw

winged linden
#

It will post it as a photo but here u go

#

https://cdn.discordapp.com/attachments/1065615855762817074/1113095464791842907/orblose.png

digital swan
lyric mountain
digital swan
lyric mountain
#

you dont grant select perm to schema, u grant to its tables

lyric mountain
winged linden
lyric mountain
#

hm, what happens if u try to set it as the embed's image?

#

like, not thumbnail, the image itself

winged linden
#

Let me try wait

lyric mountain
#

it wont be a data leak as the select query is pretty useless without access to the server

#

just omit the columns (or any sensitive data if any) as they're irrelevant

digital swan
#

it works when i use a superuser user

lyric mountain
#

is the table inside public schema or on its own schema?

#

this was supposed to be enough

digital swan
#

public schema

lyric mountain
#

unrelated comment, but u should never use public schema

#

but well, try those 3 commands in the image I sent

#

also make sure ur connected to the correct database

#

you might be executing commands on the default db (postgres)

digital swan
digital swan
#

after changing the perms i don't need to restart the db or anything right

digital swan
#

db name is nypsi

boreal iron
#

If you're genuinely not familiar enough with the command line of SQL, try to use some client app allowing you to manage stuff in the UI

lyric mountain
#

did u define a database to connect to?

digital swan
#

yes im using prisma in the code

lyric mountain
#

not what I mean

#

if u setting permissions you gotta do it throught cli

digital swan
#

you mean to connect to it to do the perms and stuff?

lyric mountain
#

or as fake said, with a visual tool

digital swan
#

yeah im sshed on the server and logged into psql

lyric mountain
#

did u set a database to connect to?

boreal iron
#

There are some commonly known tools to manage stuff via UI

#

I think one is called navcat

#

nvm navicat

lyric mountain
#

pgAdmin and phppgadmin (if storage is premium)

#

there are other general tools too, like datagrip, hedisql, etc

digital swan
#

yeah im gonna try it with pgadmin

boreal iron
lyric mountain
#

yep

#

there's likely a php(database)admin for every sql db

boreal iron
#

Ah ok, never heard of it before

lyric mountain
#

it's uglier than myadmin, but gets the job done

boreal iron
#

Might be because im not using postgres

#

Yeah ugly or not doesn't really matter tho as it's still easier and faster than the CLI

#

And for most use cases, as you usually don't touch a database very often, it's totally enough i guess

lyric mountain
#

(not mine)

boreal iron
#

Yikes looks like it's a few years old

harsh nova
#

mmmmm Beautiful

boreal iron
#

People of nowadays forgot the beautiful time we had in the past enjoying such sites

lyric mountain
#

gifs, autoplaying music, flash everywhere

harsh nova
#

and we will still look at current design standards in 10 years time in the same way we look at that

lyric mountain
#

oh and blazingly fast 3min load time per site

boreal iron
harsh nova
#

I like the late 90-s style with cool flame gifs and whatever

boreal iron
#

lmao

digital swan
#

i logged into the db from pgadmin as the same user im trying to login with in code and i can access the tables

lyric mountain
#

but can you select them?

digital swan
#

ohhh nope i cant view any data

lyric mountain
#

then u dont have access to them

#

u can see the tables because you have access to the structure information, but not to the data itself

digital swan
#

ohhhh shit i think ik what i did

#

ay thx for the help bro

digital swan
lyric mountain
#

u always need to supply a database to connect to, else it'll default to PostgreSQL

severe crown
#

Hi

lyric mountain
#

which usually isn't the one you're actually trying to use

digital swan
#

yeah i had applied the perms to the public schema in the default postgres db

desert verge
#

And I tried sqlite and it doesn't work

#

I can't use this

#

I don't know how

deft wolf
#

What kind of hosting are you using?

desert verge
#

Nevermind, he will give me a SQL db I'll use the mysql2 npm lib

deft wolf
#

"He"? sus

desert verge
#

nobody

#

actually I don't know their pronoun

lyric mountain
#

"viewing"? I use it (integrated on intellij) to straight out edit in-db scripts

lyric mountain
desert verge
#

idk, the .db

#

it wasn't working

lyric mountain
#

because the steps to use sqlite are literally
1 - apt install sqlite
2 - create a file with any name at all

desert verge
#

apt ?

#

i'm not on linux

lyric mountain
#

what OS do u use?

desert verge
#

My computer is Windows, but I think that the host is in Linux so i'll try it

lyric mountain
#

it doesn't matter what OS u use locally, only the host matters

#

so yeah, you are on linux

desert verge
#

no i'm on windows, my computer is on windows

lyric mountain
#

are you hosting the bot on your computer?

desert verge
#

no

lyric mountain
#

then you are on linux

desert verge
#

but to code

#

i'm on windows

lyric mountain
#

doesn't matter, only the host matters

desert verge
#

is it npm install sqlite instead ?

#

and now how to use sqlite ?

lyric mountain
#

you get a library to access the file, like better-sqlite3

#

supposing you're using node

desert verge
#

Oh I know why it wasn't working

#

I couldn't do "IF NOT EXISTS CREATE TABLE table_name (a, b, c)

#

It was saying that there was an error on the IF

lyric mountain
#

that's an invalid sql statement yeah

#

the proper syntax is CREATE TABLE IF NOT EXISTS

desert verge
#

ah

#

okay

lyric mountain
#

the only thing I hate is how sometimes the columns return to initial widths if u exit a cell

#

that's very likely a bug, idk how to reproduce to be able to make a report ticket

desert verge
#

after the EXISTS ?

lyric mountain
#

I recommend doing a few sqlite crashcourses to understand how it works

#

but yes, after exists

#

it's dangerous if you don't know what you're doing

#

you might wipe your database at a snap of the wrist

peak drum
#

so true xd

earnest phoenix
# lyric mountain you might wipe your database at a snap of the wrist

If you're tasked with deleting a database, make sure you delete the right one.

Sources:
https://about.gitlab.com/blog/2017/02/10/postmortem-of-database-outage-of-january-31/
https://about.gitlab.com/blog/2017/02/01/gitlab-dot-com-database-incident/

Notes:
1:05 - The middle bullet point about the account that had 47,000 IPs was never mentioned ...

▶ Play video
lyric mountain
#

lmao

#

too bad I'll likely be ignored, they never want to do courses until something happens

hushed robin
#

sqlite is easy

#

I dont think u need to watch videos on it just learn sql

lyric mountain
#

said the guy who made sqlite slow down to a crawl and was going to create one table for each entry

hushed robin
#

😐

#

liar

#

my sqlite database is fast

lyric mountain
#

say again?

hushed robin
#

fast database

lyric mountain
#

SAY AGAIN

hushed robin
#

well its not my fault

#

its sqlite fault

#

but thats old too my new database is faster

lyric mountain
#

you still managed to make sqlite crawl, so my statement stands up

hushed robin
#

no i didnt make it crawl

#

it made itself crawl

#

cus i did nothing wrong

lyric mountain
#

yes yes, you're never wrong, the world is

#

anyway, this will end in an infinite echo chamber, I'll refrain from getting a mod's attention

hushed robin
#

guys

#

what database do i try next

deft wolf
#

json

hushed robin
#

ni

#

i wanna use a not file databse but i sont knownwhich one to use

#

so i want some advice

#

guyssd

#

whered you go

neon leaf
#

postgres

hushed robin
#

like make database

#

also how does that work if i make it on my pc

#

is it not in my projects folder ?

wheat mesa
#

postgres

hushed robin
#

but what avout wuestions anove

lyric mountain
#

as I always tell you, "hard" is relative

hushed robin
#

ok

lyric mountain
#

and no, it wont be in your projects folder

hushed robin
#

how long it take to make database

#

like with SQLite it quick bc i just make a file

wheat mesa
#

like 3 minutes if you have ever used a computer before

hushed robin
#

ok

#

what uh

wheat mesa
#

install pgadmin 4 and you can have a visual interface for it

neon leaf
#

I have an answer for you ready in 3 minutes made by chatgpt 🥶

hushed robin
#

package suould i use for it

lyric mountain
#

pg

hushed robin
#

ro like insert tows and stuff

neon leaf
#

pg

hushed robin
#

ok

wheat mesa
#

there's a postgres wrapper in almost every language called pg

#

yeah

neat kayak
#

Yuo

hushed robin
#

ok

#

this looks harder than sqlite

#

to use

lyric mountain
#

sqlite is not a good comparison target because it's the basic of the basic

#

nothing will come close to it in terms of simplicity

hushed robin
#

whats benefits of usijg this

#

is it faster

lyric mountain
#

it's easier to list the drawbacks instead

hushed robin
#

what

#

why

#

that means its worse

lyric mountain
#

no, it means that the benefits are too many to be listed

hushed robin
#

ok

#

what are the big ones

lyric mountain
#

not "big ones", but "only ones"

#

1 - it's bigger
2 - more complex as it has more features
3 - will use as much ram as you allow it to

hushed robin
#

const { Client } = require('pg')const client = new Client()client.connect()client.query('SELECT $1::text as name', ['brianc'], (err, res) => { if (err) throw err console.log(res) client.end()})

#

why does the sql look different

#

than on better sqlite

lyric mountain
#

because you copypasted an answer without even reading the context

#

different databases, different wrappers, different usage

#

it's the same as asking why C++ looks different to JS

hushed robin
#

but

#

sql is sql

lyric mountain
#

yes, but some databases have features on top of sql

#

sql (as in, standard sql) is valid across all databases, but it'll not be the optimal way of writing queries

#

it'll only be generic

hushed robin
#

how do i make make prepared statement on it

#

i dont see option to do that

lyric mountain
#

courses

hushed robin
#

courses ?

lyric mountain
#

you're expecting to grab a hammer for the first time and build the eiffel tower

hushed robin
#

i already know sql

#

but it makes this hard

lyric mountain
#

you know sqlite (about 30%)

hushed robin
#

😑

lyric mountain
#

it's not because all sql databases use sql that you know all sql databases

#

all programming languages use english, but you don't know all programming languages

#

(bar esolangs)

hushed robin
#

but why not

#

what more is it than sql

#

why is it overly complex

#

is there a package for that database but like better sqlite3

lyric mountain
#

look, there's an entire semester in college about databases

#

you literally just met postgres

#

you won't be able to use it without putting any effort

peak drum
#

You’re talking to a brick wall KEKWDisco

hushed robin
lyric mountain
#

example

hushed robin
lyric mountain
#

do courses, you don't need college to be able to fucking google

deft wolf
#

rude comment

hushed robin
#

to quick but good tutorial

lyric mountain
#

tutorials are either quick OR good

hushed robin
#

what about both

lyric mountain
#

doesn't exist

hushed robin
#

ok

#

can u send link to quick one ?

#

thats semi good

lyric mountain
#

find it yourself

hushed robin
#

🙁

#

i dont know which ones are good or bad

lyric mountain
hushed robin
#

hoe did you learn it

lyric mountain
#

college + documentation + practice

lyric mountain
hushed robin
#

bruh

#

30 hours?

#

is it free

lyric mountain
#

can you even bother to open the link?

hushed robin
#

no currently i am on mobile dat

#

it will use too much and i need it to lqsy

neon leaf
#

and discord doesnt use much when sending images or what?

#

just go on the link, it eats like max 1mb

#

I measured, its exactly 6.45MB

lyric mountain
#

also that's one course only, which won't teach you everything

#

it usually takes 3-4 days until you firmly grasp the concepts

#

especially given that sqlite doesn't have users, triggers or specialized types

hushed robin
hushed robin
#

i have 250mb of data a month

lyric mountain
hushed robin
#

ok

peak drum
split jay
#

just lost about 99% of my braincells reading that conversation

peak drum
#

KEKWDisco so true xD

deft wolf
#

I guess it's something like collector.stop()

flat copper
#

im using
^.*http[s]?:\/\/(?!.*\.(?:png|jpe?g|gif))(?:[^\s]+).*$
but discord auto mod is saying / unrecognized

boreal iron
# flat copper im using `^.*http[s]?:\/\/(?!.*\.(?:png|jpe?g|gif))(?:[^\s]+).*$` but discord a...

https://support.discord.com/hc/en-us/articles/10069840290711-Filter-Messages-Using-Regular-Expressions-Regex-

Just go through this support article

There’s a link included for another Regex parser and tester

As Discord writes:

We use the Rust flavor of regex and recommend writing your regex in Rust syntax to minimize errors. To edit and test your regex syntax in Rust, we recommend using Rustexp.

https://rustexp.lpil.uk

I’ve got no clue what the “Rust flavor” of Regex is but testing your Regex is causing indeed errors

desert verge
#

GUUUYYSSS

#

wtf is this bullshit

#

Ok sql js libs are simpler to code, but I don't know it shows that

#

My bot will be broken

#

I just replaced all my json system

boreal iron
#

Well u just got an error in your sql statement

desert verge
#

ok i see

boreal iron
#

near AUTO_INCREMENT

desert verge
boreal iron
# flat copper oh thank you

At least the error messages using this tester give you something to google to validate the "Rust like Regex"

desert verge
#

oh fuck

#

it .all

#

not .get

#

Wtf

#

the ID is null

#

why ?

#

it is primary key

#

help please

boreal iron
#

The picture you shared above still does not show the related sql statement

boreal iron
desert verge
#

It dosn't generate an ID

boreal iron
#

Show line 93 of bot.js as the error states

desert verge
boreal iron
#

I only see name and iconURL being passed as arguments to the function not userID

desert verge
boreal iron
#

First column is id and your first value is null, then userID, then name …

boreal iron
#

If id really is a primary key using auto increment then DO NOT set a value for it

#

Remove ID from your INSERT statement and don’t pass a value to it

desert verge
#

It works now

#

You didn't help me

boreal iron
#

The database does this automatically

boreal iron
civic scroll
# desert verge You didn't help me

you didn't help yourself
tip: error messages are almost always useful, read them carefully
stack traces tell you where the error happened

#

don't just "GUYSS IT DIDN'T WORK", actually have a grasp of what's going wrong so people can help you better

boreal iron
#

Except most sql error messages freerealestate

#

Hmm just don’t bother with it

civic scroll
#

i don't use it yet i understood what the error means

#

tfw

boreal iron
#

The last two screenshots (#development message) he should have posted before are showing him trying to pass null as primary key for an AUTO INCREMENT column that doesn’t allow null as value

#

As I explained

#

But yeah

#

Idk

boreal iron
#

I didn’t notice it’s db.js not bot.js

#

Close to impossible to see on phone without scrolling in

civic scroll
#

mainly it was an error with sql exec

#

but even that i would use an ORM, instead of manually writing queries

boreal iron
#

Anyways he got his explanation and fix told

#

We’re not responsible for what he’s doing with it/out of it

desert verge
civic scroll
#

your messages showing you are being Clueless tho

#

but yeah i'd recommend using an ORM

desert verge
#

Because you think that during 4 daysI was doing claptrap ?

#

4 days

civic scroll
#

yeah

#

certainly

#

if you plan the schema out before migration it wouldn't be this problematic

desert verge
#

Someone recommended me sqlite on this server

#

I will not change sql lib for each person

civic scroll
civic scroll
earnest phoenix
#

Just use PostgreSQL mmLol

boreal iron
#

Shoo go away nerd

desert verge
#

Just, it's my bot

#

not yours

civic scroll
#

nah

peak drum
#

at this point use json files and pray for the best KEKWDisco

civic scroll
#

bad practices can go a long way

#

imagine your bot gets scaled up

boreal iron
#

man you're asking for help because you didn't understand and got help

civic scroll
#

you would have a hard time with SQL queries

desert verge
#

I replaced the json files by a sqlite db

civic scroll
#

me when MongoDB:

#

but again, use an ORM
better intellisense and less prone to sql injection attacks, since you don't have to manually write queries anymore

desert verge
desert verge
civic scroll
#

by what

desert verge
#

with the "?"

civic scroll
#

also

#

what does get returns?

#

the || undefined seems redundant

desert verge
#

id INTEGER PRIMARY KEY AUTOINCREMENT, user VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, current BOOLEAN NOT NULL, bio TEXT, avatar VARCHAR(255)

boreal iron
civic scroll
# desert verge

i asked that's the return value of .get call in this snippet, not the query

#

if it always return a query string like that, then || undefined would never hit

desert verge
#

I know that a lot of things seem redundant in my code, but I may optimize my code later

desert verge
#

it's an object

civic scroll
#

then what is it

desert verge
#

that is returned

civic scroll
#

is it nullable

desert verge
#

yes

civic scroll
#

then let it be

#

null better than undefined fr

#

they have the same falsiness

desert verge
#

does "null" has the same nature of "undefined" in a condition ?

civic scroll
#

yes

desert verge
#

does "if(null)" equals to "if(undefiend" ?

civic scroll
#

null is a falsy value

desert verge
#

Okay

earnest phoenix
civic scroll
#

me when you didn't finish javascript tutorial

peak drum
earnest phoenix
boreal iron
earnest phoenix
boreal iron
boreal iron
#

"Touch some green Sir"

earnest phoenix
#

Sir, that's a road, and you're not touching grass

boreal iron
#

Shhhh

earnest phoenix
radiant kraken
#

tysm ily

boreal iron
#

poor undefined boy

desert verge
#

lol

lyric mountain
#

why are u using locks if the images are individual?

#

you're basically disregarding the avantage of multithreading entirely

#

if you're writing individual files I don't see how one generation might affect another

#

if you are writing all to a single file, well, then you have an issue there

#

that's not what corrupted means

#

likely because you're sharing the same plot across different threads

#

given python is not multithreaded, I suppose they didn't make that library thread-safe

#

you need to have each thread have their own plot instance

#

inside generate_frames yes

#

btw, just one note

#

as you have it currently, you're bound to get an ultra high cpu and memory usage

#

you're creating way too many threads (which aren't threads in python, but sub processes) for the task

#

the proper way would be to have a thread pool or make a thread process a "chunk" instead

#

idk how matplot works, but u probably can have more than one instance

#

hm, then it shouldn't be affecting other figures

#

I'd double check the generation logic, as it appears to be generating a 2d graph

#

don't think I can help with that, but u could try printing the images to screen to see it changing in realtime (debugging + hotswap)

desert verge
#

Will some people be able to help re-writing the error and success messages ?

lyric mountain
#

how exactly

desert verge
#

Anyway, I should do that myself because it's me that coded the bot.

neon leaf
#

is there an easy way to merge two javascript objects but keep their references and not modify the original Object (so no .assign() or deepmerge)
example:

const objects = [
  { hello: true },
  { ok: 123 }
]

let result = {}
objects.forEach((obj) => {
  ...what I want to find out how to do
})

result // { hello: true, ok: 123 }
objects // [{ hello: true }, { ok: 123 }]
result.ok = 234
result // { hello: true, ok: 234 }
objects // [{ hello: true }, { ok: 234 }]
#

one thing I though about were setting getters and setters for each key but idk if thats a good idea

lyric mountain
#
const result = {}
for (const o of objects) {
  result = {...objects, ...o}
}
neon leaf
lyric mountain
#

why?

neon leaf
#

spread operator creates a new object

#

it doesnt keep the references

lyric mountain
#

it'll keep references of the entries

#

u cant keep references of the original maps yet have them merged

desert verge
#

I didn't planed for the bot to not have the needed permissions. So when someone tried it on their server, they thought that the bot wasn't working, so they banned my bot.

neon leaf
#

itll only keep the reference if the value is an object

#

thats the main challenge

lyric mountain
# neon leaf I tested it, no it doesnt
const objects = [
  { a: {value: 123} },
  { b: {value: "hello"} }
]

let result = {}
for (const o of objects) {
  Object.assign(result, o)
}

console.log(result) // { a: {value: 123}, b: {value: "hello"} }
result.a.value = "world"

console.log(result) // { a: {value: "world"}, b: {value: "hello"} }
console.log(objects) // [ {a: {value: "world"}}, {b: {value: "hello"}} ]
neon leaf
#

Thats not what im doing

lyric mountain
#

ffs I forgot how to merge objs lmao

neon leaf
#

I want to do that with any value and without screwing the object

#

I know alot of solutions to it but they are all pretty horrendeus

lyric mountain
#

don't think u understand why you example can never happen

#

results.ok is a primitive, it'll always pass by value

#

the only way u can have it updated across the table is by wrapping it into a value holder (map, array, object, whatever u want)

#

if I made it { a: 123 }, doing result.a = 555 would only update the result entry

#

you can ofc do that in languages that allow pointers, but js doesn't

neon leaf
#

It doesnt need to be direct, the object will be used for like 10ms and can assign to Others Afterwards, getters/setters also Work but those are probably Not the best solution to my wanted answer

lyric mountain
#

tl;dr: you can't update primitives across the board

neon leaf
#

technically number is an object too, but its handled differently

#

same with strings

lyric mountain
#

nope, it isn't

neon leaf
#

it is, its a instance of the number class

lyric mountain
#

I mean, in js it kinda is, but they're immutable so effectively the same as a primitive (regarding mutability)

#

they will pass by reference, but u can't edit it

neon leaf
#

yeah im just gonna use getters / setters, actually looks like the best option

wise citrus
#

Hey guys, I'm using discord.py to develop a discord bot on my raspberry pi. I am able to use slash commands and have created 44 command already which work however, when I try to create or remove anymore commands now, they don't update to discord. I removed a command and ran it and my command prompt told me the command no longer existed.

Has there been an internal update within discord.py or any related libraries?

lyric mountain
wise citrus
#

Yes

#

I did

#

I always save the file

#

I edit the file, save, close down command prompt, open new command prompt and rerun the bot

lyric mountain
#

did u add the commands as global or local?

wise citrus
#

I added them the exact same was as every other command, and they all work

lyric mountain
#

yes, but are they local or global?

wise citrus
#

How do I know???

lyric mountain
#

well, when u register a command you either register as global or u supply a server id to register as local

#

global commands used to take around an hour to update on the clients

wise citrus
#

The commands can run in any discord server

#

So I assume global

lyric mountain
#

if u remove the command and try to run it, does it work or shows an error (on discord)?

wise citrus
#

Discord end: the application did not respond

Raspberry pi command prompt end: Traceback (most recent call last):
File "/home/jake/.local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 1089, in wrapper
await self._call(interaction)
File "/home/jake/.local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 1221, in _call
command, options = self._get_app_command_options(data)
File "/home/jake/.local/lib/python3.9/site-packages/discord/app_commands/tree.py", line 1125, in _get_app_command_options
raise CommandNotFound(name, parents)
discord.app_commands.errors.CommandNotFound: Application command 'printusersdb' not found

lyric mountain
#

ok, then it's indeed working on your side

#

try waiting 30m or so to see if it disappears from the list

wise citrus
#

So my rpi says the command cannot be found but discord still shows it as an available command

wise citrus
lyric mountain
#

hm, that's weird then

#

are u running the latest dpy version?

wise citrus
#

I'll update my pi, update discord.py and see if that fixes anything

lyric mountain
#

pi update is not really needed, but dpy is a must

wise citrus
#

I need to update pi as there is an update anyway

#

So may as well while I'm at it

lyric mountain
#

ofc the dev came back after a short hiatus and continued updates

#

but in that time window dpy got extremely broke from constant discord updates

wise citrus
#

Ah fair

#

I'll update it

lyric mountain
#

no, u need pip

#

apt is for linux itself

wise citrus
lyric mountain
#

ig so

wise citrus
#

Aight thx

lyric mountain
#

yw

wise citrus
#

Cause I'm running 2.2.3

lyric mountain
#

from pip site, it's 2.2.3

wise citrus
#

Ahh ok cool

lyric mountain
#

idk why ur getting that issue then

#

you'll need someone with more experience in d.py, that's as far as I can help

wise citrus
#

That's alr man

#

Thanks

lyric mountain
#

gl

uneven tartan
#

ALRIGHT

#

someone told me how to fix this

#

a while back

#

so im posting it here

earnest phoenix
#
  1. git stash stashes your uncommitted changes in the current branch so you can either pull from the origin or upstream or any other remote, or do other operations that can't be done while there are uncommitted changes (https://git-scm.com/docs/git-stash)
  2. There's no git squash command, though I suppose you're referring to an interactive git rebase session, you can squash that, squashing multiple commits together to form a single commit, it basically merges the changes and commit messages of the said commits
  3. Do a git rebase interactively (https://www.git-tower.com/learn/git/faq/git-squash)
uneven tartan
#

upon install of these packages

#

(i believe canvas is the one being a pain here)

earnest phoenix
#

Before you push, but you can also squash after pushing as well

#

Correct

earnest phoenix
# uneven tartan

326 error gyp ERR! stack Error: Could not find any Python installation to use

lyric mountain
#

don't squash, ffs if you value your sanity don't squash

#

so many ways it can go wrong

#

squash a destructive operation, unless you're 100% sure you need to squash don't attempt it

#

at best you need to git clone your repo again, at worst you lose all your previous work

earnest phoenix
#

Kuu I think you're mistaking an actual rebase with squashing

#

Squashing just combines multiple commits, it's not destructive

lyric mountain
#

ah, it's basically batch ammending then

#

I think I did confuse with the former case

#

that thing haunts me from past experiences

earnest phoenix
#

Though technically squashing is part of a rebase process but it's not a destructive one, unlike others like drop (which drops a commit from the commit history entirely)

lyric mountain
#

I just know it once happened to flatten the entire history of one of our project without a chance to go back

earnest phoenix
#

Flatten as in?

lyric mountain
#

HEAD

#

the only commit in the history

uneven tartan
earnest phoenix
#

Damn, that sure is a big fuck up

earnest phoenix
uneven tartan
#

@earnest phoenix

#

whats that command to set msvs version

#

well that wont work anyway cause msvs_version is not a valid npm option anymore apparently

flat copper
#

hello, i want to make an api where the queries are
userId, guildId, roleId

i want to check if user is in guild or not using discord api,
and can i get thia data even if bot is not in the server ?

earnest phoenix
uneven tartan
#

im just gonna install nodejs build tools with vs installer

uneven tartan
flat copper
#

oh

uneven tartan
#

also no you cannot get that data without having a bot in that server

#

installing nodejs build tools did not work

earnest phoenix
# uneven tartan

It seems like you don't have Visual Studio installed, you must install it, and then also install the "Desktop development with C++" workload

uneven tartan
#

ive never needed vs installed

wheat mesa
#

C++ build tools my beloved

uneven tartan
#

im gonna install that and see if it works

wheat mesa
#

You need it to use node-gyp packages usually

uneven tartan
#

ive got it running on my pi without vs installed

#

haha its stuck on win11sdk

earnest phoenix
uneven tartan
#

yeah but ive got the same packages installed and running on my pi with zero issues

#

i wish node installation included these things

earnest phoenix
#

That's because a Raspberry Pi does not run on Windows

uneven tartan
#

fair

#

still i used to have this error and a simple command fixed it

#

setting msvs version or whatever

#

and now the installer is confused

#

stuck here

#

oh now it goes

#

guess that was a big one

earnest phoenix
#

It's the matter of just checking one checkbox

uneven tartan
#

yeah but i doubt it will ever install vs itself

earnest phoenix
uneven tartan
#

ill just install vs community with desktop development

earnest phoenix
uneven tartan
#

now im hyper confused

#

ah i fixed it

quartz kindle
#

i've never used chocolatey lol, is it actually useful?

delicate zephyr
#

mostly for installing programs I cba to go and download from a website when typing it in console is easier

tough scroll
#

Hello

pale vessel
#

node-gay

radiant kraken
topaz terrace
dull dragon
#

is there a way to get my bot link shorter?

radiant kraken
pale vessel
desert verge
#

Hello

#

My bot is open source

rustic nova
#

Ok

pale vessel
#

not many people have the balls to do that

rustic nova
#

That's actually true

desert verge
#

i'm maybe naive then

#

I'll also convert my code into typescript

#

I don't have intellisense in my command files

rustic nova
#

Just say you're working with notepad++

desert verge
#

Visual Studio Code

#

not notepadd++ wtf

wise citrus
#

What’s the most popular language for coding bots?

#

I’m just curious

desert verge
#

javascript

deft wolf
#

The easiest one also because of the huge number of guides

desert verge
#

Pfff, why sqlite3 does that

#

can some people tell me what are the free mysql hosting ?

#

is 5MB of space a lot or it's not enoguh?

deft wolf
#

It depends for what

desert verge
#

mysql db

radiant kraken
deft wolf
# desert verge mysql db

For a public bot, certainly not, such databases are probably used only for testing/learning i guess

rose warren
#

For those of you following along at home, slash command adoption rate at an all-time high in May with 78.6% of my users preferring slash commands compared to 21.4% still using prefixes.

desert verge
#

AHhhhhh I just converted all my code in async/await for the mysql lib and I got this error

boreal iron
#

The syntax isn't the same across all SQL databases

eternal osprey
#

Hey, I recently wanted to create a gui for my javafx program, I have currently coded a bit in normal java but I found out that you can make it easier by using the fxml where you can drag and drop and directly see the changes without having to compile etc. Could I still switch over to fxml and will it eventually provide me its source code?

boreal iron
#

MySQL wants AUTO_INCREMENT not AUTOINCREMENT

#

There are more syntax issues in your screenshot (if you really moved to MySQL)

desert verge
#

Okay my bot is working

deft wolf
#

Good job

desert verge
#

Thanks!

rustic nova
#

No ads please

quartz kindle
desert verge
#

sorry for the ping too

wise lagoon
#

though if you're just messing around with mysql for learning purposes it's good enough

rustic nova
#

Unless you're compiling stuff or run a nodejs project lmao

#

node modules go brr

wise lagoon
desert verge
#

Actually I found a sql hoster but it's 5 MB

#

I need to upgrade for 100Mb

rustic nova
#

Oh you're referring to MySQL space nvm

#

You won't get far with free alternatives though that's the issue

wise lagoon
#

i mean can't you just use a local sqlite database on the same server as your bot lol

rustic nova
#

Especially performance and space

peak drum
#

use a lot KEKWDisco

#

just make more accounts lol

#

idk how you would code to use it

#

but its a loophole

#

😂

rustic nova
#

Sounds bad ngl, especially to implement it

peak drum
#

ikr it just came up in my mind KEKWDisco

rustic nova
#

"yeah we've reached 500mb lemme just get the 100th MySQL server"

peak drum
#

hahaha

#

you would have to get all connections to see where the guild data is stored xD

desert verge
#

I CONVERTED ALL MY CODE in mysql with callback so I converted all MY LIB in promise based

peak drum
#

you dont listen to them just use what you want xd

desert verge
#

xNick...

#

You didn't tell me that

#

Oh otherwise I know, I'll use my brother's sql server

#

If he accepts

peak drum
desert verge
#

whut

wise lagoon
#

try mongodb 🧌

desert verge
#

mh...

#

is there free hoster ?

deft wolf
#

Well, yes

#

512 mb for free

#

Or you can self host it on your vps

#

Like me

desert verge
#

It's not a vps

deft wolf
#

But it's way different than sql

desert verge
#

And I don't have a db on my server

deft wolf
#

It's more like json database

#

Than sql

desert verge
#

yes it seems better then

deft wolf
#

You can try

desert verge
#

pfff

#

It will make the third time

#

I convert all my code

#

Oh I'll ask to ChatGPT

#

omg MongoDB so great

wise lagoon
#

you'll have to rewrite all your code again to use it since it's nosql

deft wolf
#

I don't think so, if it's not vps then it's probably some kind of cloud hosting

desert verge
#

it's a pterodactyl clone

wise lagoon
#

*file still needs to be on your bot host's directory

desert verge
#

I already used sqlite

#

I know dude

#

I converted my code like almost 4 times

#

JSON, Sqlite, mysql2, mongodb

#

How do I get the link of my MongoDB ?

#

Yes I saw that, but I didn't save the password

#

So I re-created a user

desert verge
wise lagoon
desert verge
#

okay

rose warren
peak drum
#

First I didn’t want to use slash commands but then I found out how much easier is was to code xD

#

Since you can require some arguments in de slash command

desert verge
solemn latch
desert verge
#

the message don't send

deft wolf
# desert verge Uh

I guess it's because you need to respond within 3 second after interactioncreate event

lyric mountain
#

yes, any and every processing should happen after defer

#

especially when using a remote (free) database

desert verge
#

so where do I defer ?

lyric mountain
#

right in the first line of your handler

deft wolf
#

Also remember to change interaction.reply() to interaction.editReply()

lyric mountain
#

also why did u give up on sqlite?

deft wolf
#

If you are gonna use defer

desert verge
#

Here ?

lyric mountain
#

yes

deft wolf
#

I think you need to await it but im not sure about it

#

KuuHaKu can correct me if im wrong

lyric mountain
#

me neither

deft wolf
lyric mountain
#

putting an await there wont hurt even if it's not needed

civic scroll
#

me when async but you don't use await

#

await when you want the execution to happen after that operation is done

#

otherwise just ignore it

#

if your ide complains just put void before the statement

desert verge
#

It's infinite

lyric mountain
#

then it's never reaching editReply

desert verge
#

Yeah

#

I can log the db queries

lyric mountain
#

are u running the bot locally?

desert verge
#

but it doesn't send the message

civic scroll
#

try debugging

solemn latch
#

If it timed out they would have gotten an unknown interaction error.

desert verge
lyric mountain
#

put a breakpoint in the defer and run in debug mode

desert verge
#

before I add defer

civic scroll
lyric mountain
#

follow the execution to see where it stops

civic scroll
#

use the step function to move forward in execution

solemn latch
civic scroll
#

like step in and step over

wise lagoon
desert verge
desert verge
#

It's not that?

desert verge
#

it does nothing

lyric mountain
#

first of all, why is debugger a keyword? second, no

wise lagoon
desert verge
#

debugger is for web actually

desert verge
boreal iron
wise lagoon
boreal iron
#

So yes it does nothing

lyric mountain
#

click on the line number and press "run in debug mode" or smth on your editor

wise lagoon
#

it's not specifically tied to browser debugging

lyric mountain
desert verge
#

Can't see

lyric mountain
#

the tiny bug usually means "debug"

desert verge
#

yes

lyric mountain
#

u didn't add a breakpoint

desert verge
#

Is there a rate limit ?

lyric mountain
#

click on 80

lyric mountain
#

at least not while testing

desert verge
#

ok

lyric mountain
#

tbh, not even while using as it's discord sending the request to u, not the opposite

#

the only ratelimits would be mongo itself and IDENTIFY

desert verge
lyric mountain
#

both unachievable without heavy abuse

lyric mountain
#

go until it stops

desert verge
#

???

lyric mountain
#

f8 is "step over"

#

probably, unless vscode changes the usual keybinds

desert verge
#

yes f8 is next tab

lyric mountain
#

f10 then

#

also just a headsup, it'd be better if u used a map

#

that way u can skip the iteration and go right to the command

desert verge
peak drum
boreal iron
lyric mountain
#

u took too long to step over defer

#

it timed out

boreal iron
#

Another reason to not text and drive

lyric mountain
#

let the execution continue on itself and use the command again

#

but this time press f10 right away to let it defer

desert verge
#

I don't understand what ur saying

lyric mountain
#

line 80 is defer, it must complete within 3 seconds

boreal iron
#

He should still await the deferring in cases his reply follows before discord acknowledged the deferring

#

Which will then indeed fail

desert verge
#

Guys It was working, but I just edited one thing then restarted the bot and it doesn't work anymore

lyric mountain
#

move the breakpoint to here, to prevent stopping the defer

desert verge
#

This was the last thing that worked

desert verge
#

It was a promise

lyric mountain
#

well it broke the bot, so it's probably relevant

peak drum
lyric mountain
#

maybe the promise is halting the execution thread

desert verge
lyric mountain
#

as yk, js is monothreaded

desert verge
peak drum
lyric mountain
#

ur using mongo right?

desert verge
#

mongodb yes

desert verge
#

Because it logs the curre nt character

#

the character data is logged

#

when I do the /characters command

lyric mountain
#

I suppose getCharas is retrieving the characters from the db?

wise lagoon
peak drum
#

I know KEKWDisco

wise lagoon
desert verge
#

yes it is in a variable

#

Ik

#

but it was for logging

wise lagoon
#

unless you are resolving from inside a callback you should not need new Promise

boreal iron
peak drum
peak drum
lyric mountain
#

my honest guess is that the total time of execution (db + loops + building embeds) is taking longer than 3s

#

but well, back to the defer thing, did u find where it's stopping?

#

add await to the defer as fake said

boreal iron
#

My gosh just await the defer

desert verge
#

Oh

boreal iron
desert verge
#

it's that

lyric mountain
#

it stopped there?

desert verge
#

"aa" isn't logged

#

so yes

boreal iron
#

Keep in mind for each isnt async

desert verge
#

so I add async ?

lyric mountain
#

put console.log(fields.size()) before fields.push

boreal iron
#

Ah nvm I didn't see the parentheses

lyric mountain
#

to see if ur exceeding the max field count

desert verge
desert verge
#

no i can't see

#

ah

#

wait

#

There is no data

#

Do I add || undefined ?

lyric mountain
#

no, an empty array is still a valid property

#

just means no fields

#

still, that shouldn't prevent the reply

wise lagoon
lyric mountain
#

that'd error in the console

desert verge
#

Yes I now, my character don'yt have stat

#

it's why it's null

wise lagoon
lyric mountain
#

so u don't even start the loop, as there's no data to loop over

#

the error must be inside editReply then

desert verge
#

It's maybe the footer

lyric mountain
#

indexOf is getting stuck then

#

put a breakpoint inside it to see if it loops infinitely

desert verge
#

i'm removing the footer to test

#

it is the footer

lyric mountain
#

it's getting stuck then

#

btw, are u trying to just log the id?

#

don't u have that info already?

#

like, chara._id

#

oh, u want the index

desert verge
#

I can't see why it's not working

lyric mountain
#

hm, I do

desert verge
#

where does it loops indefinitly ?

lyric mountain
#

perhaps if (chara._id === id) is never true

#

so it never resolves

desert verge
#

it's a forEach

#

not a while

#

AH

#

yes

#

Wait I'll add a catcj

#

Like that ?

#

or without the minus 1 ?

#

it is the same

#

same

#

I found it

#

I have another problem

#

Only one character can be current = 1

#

ok it works

civic scroll
# desert verge

fun fact, you can use shorthand assignment

let a = 1;
let b = {
    a: a,
}
let c = {
    a,
}
// b and c is the same structure
peak drum
#

that's indeed a fun fact i didnt know KEKWDisco

desert verge
#

yes I knew it

#

it's just not automatic

eternal osprey
#
 String ringtonePath = "Ringtones/" + countryComboBox.getValue().trim().replaceAll(" ", "-") + ".mp3";
                System.out.println(ringtonePath);
                Media media = new Media(ringtonePath);
                mediaplayer = new MediaPlayer(media);
                builder.createAlert("Successfully started", "I have started " + countryComboBox.getValue() + " for you.", Alert.AlertType.INFORMATION);
                mediaplayer.play();```

why is this returning me error
:: uri.getScheme() == null! uri == '/Ringtones/Oceanic-Movement.mp3'?
#

this is my file structure

#

@. me if you know please

quartz kindle
#

that has nothing to do with js

desert verge
#

it's Java

quartz kindle
#

whatever URL format a function/method/class requires depends entirely on the function/method/class, doesnt matter what language it is

desert verge
#

why do you replace spaces by - ?

quartz kindle
#

its good practice as some languages/systems/OSes may struggle with it

desert verge
#

you're offline

flat copper
#

hello, i want to send a token in fetch request to my server, how can i send it so that none can see it even by developer tools

pale vessel
#

make the request server side, not client side

flat copper
pale vessel
#

you can have an API create a request server side and return the result to the user

flat copper
#

hmhm

#

I'll try, thank you

desert verge
#

fetch

#

integrated in js web

#
fetch(url, {body: body}).then(res => res.json).then(console.log)```
#

@flat copper

quartz kindle
#

thats not what they were asking for but ok

flat copper
#

👍

flat copper
#

is there any api that gives brc 20 realtime data or data by token

wise citrus
#

Does anyone know how I can assign roles to people etc when they vote for my bot?

digital swan
#

listen for votes -> check if theyre in the server -> give role

wise citrus
#

How do I make it listen for votes though?

digital swan
wise citrus
#

That js isn't it?

digital swan
#

yes

wise citrus
#

Damn

#

Alright

quartz kindle
#

if youre not using js, let us know what youre using, there is usually a thing for every language out there

wise citrus
#

I'm using python

quartz kindle
#

there should be a topgg python sdk

wise citrus
#

This?

quartz kindle
#

yep

wise citrus
#

Cool thanks