#development

1 messages · Page 187 of 1

wheat mesa
#

Yes

sharp geyser
#

I guess that makes sense

unborn panther
deft wolf
#

Unfortunately, you can't set it. This feature simply doesn't work right now

deft wolf
real rose
copper cradle
#

no-

#

malloc returns a void* and you cast that void* to the struct

warm surge
#

lmao

surreal sage
#

im trying to prebuild in gh codespaces buttt

#

it errored on those 2 last lines

#

and doesnt seem to do anything else (so i canceled)

#

cant even share github links...

#

ari-party/sct-module-astronomical-object/actions #3

real rose
surreal sage
solemn latch
#

👀 we do need to work on our regex's a bit

surreal sage
#

google are you stupid

sharp geyser
#

?

deft wolf
#

It's probably because he chose the Netherlands and the error mentions Ireland

real rose
#

Yooo

tulip ledge
#

Did they remove embed colors on mobile?

deft wolf
#

No

#

It's a bug

tulip ledge
#

👍

green kestrel
#

nice, why do i always forget we can do this on desktop

#

it makes <pre> look so damn pretty

#

i had gotten in the habit of not used it, because it would look a mess on mobile... but it looks like they 'kludged' that, so it just displays as plain white on mobile now without the ansi mess in it

#

which means its safe to use 😄

harsh nova
#

still no clue how they dont support syntax highlighting on mobile

sage bobcat
#

One message removed from a suspended account.

harsh nova
#

as real as it gets

sage bobcat
#

One message removed from a suspended account.

green kestrel
#

highlightjs isnt the most efficient of libs

#

it runs the text through thousands of expensive regexes

#

you could probably kill someones device like some sort of denial of service attack by sending a message with ten embeds full of complex ansi escapes or something

#

if its a crappy old motorola or something

sage bobcat
lyric mountain
#

it's really good for that

#

especially for anime-like images

green kestrel
#

youll have to let me know how that works out for you, im doing the same but using midjourney

#

and midjourney makes some awesome stuff!

surreal sage
#

bro

#

i am going fucking crazy

#

i have a template string, where im substituting something

#

when i substitute it, for some reason the value stops before a $ character

#

but when I don't replace and just use the value, it works fine

green kestrel
#

like this.... midjourney v6 can even put text onto an image now

surreal sage
#

i don't understand

#

how does <string>.replace do this

#

the replacement is a file's content

lyric mountain
#
Generate a close-up image of a brown leather book in a tavern table with a candle and a teapot. The book must contain the words "Grimoire Utopius" written in a classical font.
green kestrel
#

that's pretty good

#

midjourney presents four variations and usually some are better than others

#

extra letters and misspellings are a common thing there too

sharp geyser
#

So what's the big difference between a JSON Web Token (JWT) vs Cookie based authentication?

quartz kindle
#

there are many differences and its mostly a matter of opinions, but for me the biggest difference is with cookies you usually store the session id on some db, with jwt you dont really need to store anything server side

#

which also makes it possible to invalidate sessions with cookies, but harder to do with jwt

sharp geyser
#

Yea I was seeing JWT's are completely stateless

quartz kindle
#

jwt is usually time based validity, cookie's valitity is mostly "as long as the session exists in the server"

sharp geyser
#

So essentially JWTs are the thing to use if I want to give temporary access

#

Cookies if I want the access to last the entire session

quartz kindle
#

yeah, like auth tokens than need to be regenerated every once in a while

sharp geyser
#

Is that what discord uses on their oauth2 stuff ?

#

are they technically just jwt tokens

quartz kindle
#

OAuth 2.0 doesn’t define a specific format for Access Tokens. However, in some contexts, the JSON Web Token (JWT) format is often used. This enables token issuers to include data in the token itself. Also, for security reasons, Access Tokens may have an expiration date.

sharp geyser
#

gotcha

lament rock
#

Discord auth tokens, you could consider JWTs

#

The first part of the token is the client ID

sharp geyser
#

I always figured they were as they have to be tied to a user somehow and I doubt they do that server side

lament rock
#

Well. They have to for MFA tokens since all of it is random

#

So a token > user ID relation wouldn't be absurd

final nymph
#

Discord.js version: v14.14.1
Node.js version: v20.11.1

can someone help me?

solemn latch
final nymph
#

and this...

#

I looked on the internet but I didn't understand anything about bitfield or anything

solemn latch
#

If you're following a guide or video its pretty outdated.

final nymph
#

i think the problem is chat gpt version

lyric mountain
#

You'll not be able to sustain the usage

twilit beacon
#

Hello, could anyone clarify a doubt? How do I know that my bot is under analysis? Know if it was actually sent? Where can I see this

gilded plankBOT
#

@twilit beacon

topgg Bot Review Notifications

If your bot is approved:
You'll get a DM from @gilded plank, a ping in #logs and you'll be assigned the <@&265125253443878912> role here.

If your bot is declined:
You'll get a DM from @gilded plank and you'll also get a ping in #mod-logs.

💡 Please make sure you have your DMs activated for this server.

real rose
twilit beacon
#

in logs it says it hasn't found it yet

real rose
#

I can only see a bot you submitted in 2023

#

Nothing recent

twilit beacon
#

I'll send it again, wait a minute

#

now it was

#

thanks

twilit beacon
#

Or is it possible to have the evaluation beforehand?

real rose
#

It's a lot shorter right now

twilit beacon
#

How many days more or less?

warm surge
#

Max

final nymph
sharp geyser
#

Im seriously getting tired of this ownership shit in rust

wheat mesa
#

it exists in rust and C++ and almost any language that isn't garbage collected

#

😉

#

rust just enforces it

sharp geyser
#

But I can be angry with it in the moment

#

:C

radiant kraken
#

Besides the compiler has one of the sanest error messages

sharp geyser
#

@radiant kraken @wheat mesa https://www.youtube.com/watch?v=8mAITcNt710 time to watch this

Learn the basics of computer science from Harvard University. This is CS50, an introduction to the intellectual enterprises of computer science and the art of programming.

💻 Slides, source code, and more at https://cs50.harvard.edu/x.

⭐️ Course Contents ⭐️
⌨️ (00:00:00) Lecture 0 - Scratch
⌨️ (01:45:08) Lecture 1 - C
⌨️ (04:13:23) Lecture 2 -...

▶ Play video
#

im joking i'd never watch it seriously that'd take way too long, but it would be an interesting thing to watch when im going to bed

sharp geyser
#

not nice

#

its a day long

#

💀

radiant kraken
sharp geyser
#

fair

#

tho its a harvard level class so idk if I will understand any ofi t

radiant kraken
#

i expected huge brain stuff when i hear harvard

pale vessel
#

yeah u probably already knew all those

#

except for maybe algos and cybersex

radiant kraken
#

yup

#

why is emoji a chapter

#

is that talking about unicode

pale vessel
#

it's talking about decancer (real)

radiant kraken
#

🙀

pale vessel
#

it does seem to include unicode though

#

although it is weird that this is part of a cs course

#

it seems out of place

sharp geyser
#

Okay so binary is 0's and 1's
Counting in binary can be done as

4         2           1 = 4 * 0 or 1, 2 * 0 or 1, 1 * 0 or 1. Sum up the results of these multiplications
|         |           |
0         0           1
4 * 0 = 0 | 2 * 0 = 0 1 * 1 (0+0+1 = 1)
0         1           0
4 * 0 = 0 2 * 1 = 2   1 * 0 = 0 (0+2+0) = 2
1         0           0
4 * 1 = 4 2 * 0 = 0   1 * 0 = 0 (4+0+0) = 4
1         0           1
4 * 1 = 4 2 * 0 = 0   1 * 1 = 1 (4+0+1) = 5
1         1           0
4 * 1 = 4 2 * 1 = 2   1 * 0 = 0 (4+2+0) = 6
1         1           1
4 * 1 = 4 2 * 1 = 2   1 * 1 = 1 (4+2+1) = 7

Now with this "system" you can only go up to 7 correct?
Which means if I wanted to go higher than 7 i'd need to add on an extra bit.

8           4           2           1 = 8 * 0 or 1, 4 * 0 or 1, 2 * 0 or 1, 1 * 0 or 1
|           |           |           |
1           0           0           0
8 * 1 = 8 | 4 * 0 = 0 | 2 * 0 = 0 | 1 * 0 = 0 (8+0+0+0) = 8
1           0           0           1
8 * 1 = 8 | 4 * 0 = 0 | 2 * 0 = 0 | 1 * 1 = 1 (8+0+0+1) = 9
1           0           1           0
8 * 1 = 8 | 4 * 0 = 0 | 2 * 1 = 2 | 1 * 0 = 0 (8+0+2+0) = 10
1           0           1           1
8 * 1 = 8 | 4 * 0 = 0 | 2 * 1 = 2 | 1 * 1 = 1 (8+0+2+1) = 11
1           1           0           0
8 * 1 = 8 | 4 * 1 = 4 | 2 * 0 = 0 | 1 * 0 = 0 (8+4+0+0) = 12
1           1           0           1
8 * 1 = 8 | 4 * 1 = 4 | 2 * 0 = 0 | 1 * 1 = 1 (8+4+0+1) = 13
1           1           1           0
8 * 1 = 8 | 4 * 1 = 4 | 2 * 1 = 2 | 1 * 0 = 0 (8+4+2+0) = 14
1           1           1           1
8 * 1 = 8 | 4 * 1 = 4 | 2 * 1 = 2 | 1 * 1 = 1 (8+4+2+1) = 15
#

My god my tired brain just made me type something out that wasn't a question

#

I started typing this at 2am which was 25m ago

#

💀

sharp geyser
#

Learning how to count in binary has opened the doors to a lot of things.

#

I could probably write a message in binary if I wanted EYES

deft wolf
#

No setup fee on contabo peepoPOGGIES

stiff dust
#

Hello

#

how can I create something like this:

earnest phoenix
#

Hello

quartz kindle
#

256 possible combinations from 0 up to 255, after that more bits are required

little cosmos
#

zz

past field
#

ok question

#

is there a way to get my bot to announce when a server subscriber subscribes to the server? i’m assuming that’s an event listener

wheat mesa
twilit beacon
#

Can anybody help me? How do I put these commands that appear when clicking on the bot?

deft wolf
#

You can't

#

It's automatic

twilit beacon
#

I have a bot where the command is /price but it doesn't appear in it

#

here

deft wolf
#

Yea, it's not verified by Discord

solemn latch
#

Discord decides when to add it.

twilit beacon
#

I understand, the verification is automatic?

lyric mountain
#

no, you'll get a message when you're ready for verification

#

also be warned that you'll have to fill a fairly technical form for it, so pay attention to your bot development

ornate dune
#

@solemn latchthis is my bot

#

how i don't have permissions

solemn latch
#

(wrong channel, but whatever)

ornate dune
solemn latch
#

Ownerships listed under someone else.

ornate dune
#

its my other account

solemn latch
#

Yeah, youd have to edit things from that account.

ornate dune
solemn latch
#

You'll have to ask for some mod to help you in #support from the saad account.

I am working, so I cant help with site related problems right now.

flat copper
sharp geyser
lyric mountain
#

the unsigned integer limit is the actual amount of combinations

wheat mesa
#

2^bits - 1

sharp geyser
#

Oh I see

wheat mesa
#

(The -1 is because of signed-ness)

#

Since you need 1 bit to represent it

#

Each bit you add multiplies the number of unique combinations by 2

sharp geyser
#

Signed ints can be negative right? But unsigned can’t

wheat mesa
#

Hence why it's such a convenient system for computers

#

Large amounts of data in small spaces

sharp geyser
#

That’s why it’s 4b possible combinations

#

Cause it’s neg and pos

wheat mesa
#

Actually I think I explained the signedness thing wrong

#

But kuuhaku prob about to correct it

lyric mountain
#

lul, u said it correctly

solemn latch
#

Signed can have a sign, if that's what you mean.

lyric mountain
#

it's basically this: if you're dealing with bitwise ops, it doesn't really matter if something is negative or positive

#

you're dealing with the 32 bits, nothing more

#

the actual value is useless

sharp geyser
#

Bit operations is something I still don’t understand but I’ll figure it out in due time

lyric mountain
#

it's basically and array of booleans if u stop to think

sharp geyser
#

I’m already happy I figured out how to count in binary and dealing with bits

solemn latch
#

Bit operations can be really fun.

Bit math is so interesting

lyric mountain
#

0000 0000 0000 0000 0000 0000 0000 0000 this is your array (an int)

#

for signed ints, the very first bit is what defines if it's positive (0) or negative (1)

#

(very first in the message, but it's actually the last bit for computers)

#

as yk, u read from left to right

sharp geyser
#

Yea

lyric mountain
#

using bitwise is just like using arrays, but on steroid

#

8x more space-efficient than an array

solemn latch
#

https://youtu.be/wvJc9CZcvBc

^
He makes a whole cpu. It's a really fun thing to make, you learn a lot about bit operations

Let's build a circuit that adds numbers! Binary addition is even easier than decimal addition since you don't have to know how to add numbers larger than 1.

Support me on Patreon: https://www.patreon.com/beneater

You can get all the components used in this video from any online electronic components distributor for a few dollars.

Complete par...

▶ Play video
#

It used to be way cheaper to do, damn inflation ^-^

wheat mesa
sharp geyser
#

I have the kit lol

wheat mesa
#

guaranteed to run at 10hz 😉

solemn latch
#

It's such a good learning experience

solemn latch
#

^-^

#

No wait, khz? 200hz

#

Lol

#

It's been awhile

#

I followed along with that tutorial from money from my first paycheck.

wheat mesa
#

man I wish I could buy fun things

#

Gotta save like every cent possible though because uni is gonna eat my money next year

lyric mountain
#

do yall have something like ENEM there?

wheat mesa
#

No idea what that is

lyric mountain
#

basically a very long very broad exam where u can gain discount for uni if you score high

wheat mesa
#

Nope

#

You can get scholarships and such for scoring high on the SAT

#

But that time has passed

#

My scholarship is $3k/year for 4 years

lyric mountain
#

holy

wheat mesa
#

But the cost of tuition is roughly $15k/year for 4 years

solemn latch
#

Yikes

wheat mesa
#

Right now I have federal and state grants paying for it all

#

But the new financial form for college is probably going to take away half of that aid

#

(My federal pell grant, which gives me $7k/year)

#

Probably because I have a decent amount of money in my bank account that I had to tell them about

#

Which I had earned from my job saving specifically for college

#

The US doesn't understand that just because you have the money in your account doesn't mean you can afford to give it all away

#

If my car breaks down AND my aid gets taken, then I'm fucked

#

oh well

lyric mountain
#

or if you step on a nail and need to go to hospital

wheat mesa
#

yeah

solemn latch
#

And that's why uni is dying in the US

wheat mesa
#

also because a bachelor's degree is the equivalent of a high school diploma 15 years ago

#

can barely get anything with it

#

that's why I'm doing a master's, hopefully it will offset me from others

lyric mountain
#

I mean, you have quite a bit of portfolio to put on resume

#

those past projects, even if unfinished

sharp geyser
#

I’m hoping to be able to go to college myself

wheat mesa
sharp geyser
#

We’ll find out Wednesday

wheat mesa
#

applied to 60+ internships, only had 10 emails back

#

7 were rejections, 3 were virtual prerecorded interviews

#

the rest ghosted me

#

Those 3 interviews ghosted me afterwards also

solemn latch
#

👀

#

Classic

wheat mesa
#

The market is really rough right now

lyric mountain
#

come to brazil

wheat mesa
#

Born too late to get into peak CS, born too late to buy a house

wheat mesa
#

Might visit sometime

lyric mountain
#

as much as I dislike this country, the IT area is pretty starved for applicants

wheat mesa
#

Hell, my own uncle manages a team of 15+ software engineers (regularly hires interns), and told me "Yeah we usually only consider juniors and seniors"

#

That was rough

#

Can't even get in with nepotism lmao

sharp geyser
#

Usually they want young people they can manipulate not graduates trollface

solemn latch
#

Graduates are young people they can manipulate.

#

No internships during uni = graduates are manipulatable

sharp geyser
#

Honestly an internship just seems useless to me but idk

quartz kindle
#

reject jobs, create your own company

sharp geyser
wheat mesa
#

I have a job in the works with a nonprofit which might help me get seen

#

(No pay, but joining because I want to actually help, not for the resume)

sharp geyser
#

Oh cool

#

What they do

wheat mesa
#

Teach skills (business, engineering, medical) to middle school aged refugees

#

I'd be joining their engineering team if I am accepted

sharp geyser
#

Nice

sharp geyser
#
  string input;

  string response;

  vector<unsigned long> decimals;

  cout << "input your binary (seperate the 8 bit sections with spaces): ";
  getline(std::cin, input);
  cout << "to confirm is this your binary? (y/n): " << input << " ";
  cin >> response;

  if (response == "n") return -1;

  auto result = split(input, " ");

  for (int i = 0; i < result.size(); i++) {
    decimals.push_back(bitset<8>(result[i]).to_ulong());
  }

  cout << "Here is the message you wanted to send: ";
  for (int i = 0; i < decimals.size(); i++) {
    cout << (char)decimals[i] << " ";
  }

binary to decimal to ascii

#

I could honestly just push the ascii character into the decimals vector but I wanted to follow it through each step

radiant kraken
sharp geyser
#

thanks

#

stackoverflow helped a lot

#

:^)

radiant kraken
#

that's okay, at least you learned

sharp geyser
#

Only thing I don't really understand is this:

vector<string> split(const string& input, const string& delim) {
  vector<string> ret;

  size_t pos = 0;
  size_t lpos = 0;

  auto dlen = delim.length();

  while ((pos = input.find(delim, lpos)) != string::npos) {
    ret.push_back(input.substr(lpos, pos - lpos));

    lpos = pos + dlen;
  }

  ret.push_back(input.substr(lpos, input.length()));
  return ret;
}
radiant kraken
#

which part do you don't understand?

sharp geyser
#

I dont get what the while loop is doing

#

mainly the condition and ret.push_back

radiant kraken
#

hmmmm, i could be wrong but @sharp geyser

string::npos = max value of size_t, probably some kind of value that gets returned from find() once it couldn't find delim in or after lpos

delim = the delimiter
lpos = the starting index to search from
pos = the position of the detected delimiter

                          pos
                          v
finding "misty" in "today misty is learning c++"
                    ^ lpos (0)

finding "misty" in "today misty is learning c++"
                    ------ input.substr(pos - lpos)

finding "misty" in "today misty is learning c++"
                               ^ lpos = pos + dlen
sharp geyser
radiant kraken
#

wait

#

there we go

#

sorry it's 3 am lol

quartz kindle
sharp geyser
#

I know what it does but not how its doing it

quartz kindle
#

find()'s second parameter basically means which index to start searching from

radiant kraken
quartz kindle
#

so find first delimiter, get its position, slice the word, update the position, search again starting from the previously found

radiant kraken
#

😔

#

which part do you not understand

quartz kindle
#

does cpp not have an string.split() equivalent?

sharp geyser
#
  while ((pos = input.find(delim, lpos)) != string::npos) {
    ret.push_back(input.substr(lpos, pos - lpos));

    lpos = pos + dlen;
  }

while pos = find delim at lpos does not equal npos then push the substring at position lpos to pos - lpos then set lpos to be the current position + the delim length

#

is how I interpret it

#

pos is the position of the delimiter in the input, so I am sub strining the lpos (which is 0 to start out with) to positonOfDelim - lpos and pushing t hat into the ret vector

quartz kindle
#

its correct

radiant kraken
#
                          pos
                          v
finding "misty" in "today misty is learning c++"
                    ^ lpos (0)

finding "misty" in "today misty is learning c++"
                    ------ input.substr(pos - lpos)

finding "misty" in "today misty is learning c++"
                               ^ lpos = pos + dlen

in the next iteration, pos = last index + 1 because it cant find "misty"

                                               v pos
finding "misty" in "today misty is learning c++"
                               ---------------- input.substr(pos - lpos)

in the next iteration, pos is string::npos, because pos is out of bounds
#

here's the entire iteration

quartz kindle
#

the cool thing about cpp is that every single question on SO, no matter how simple, has all sorts of different answers, often absurdly different

radiant kraken
#

well C++ has lots of standards

#

like C++11, C++14, C++17, C++20, and C++23

sharp geyser
quartz kindle
#

but cpp differences betwen versions are often much larger, code-similarity-wise

radiant kraken
#

yes

#

some entire modules just get deprecated for no reason

sharp geyser
#

Sounds like a djs update

quartz kindle
#

what annoys the heck out of me is all those solutions that require using boost

#

boost is like, lodash for cpp

#

lol

radiant kraken
#

except it's much worse because it's thicc asf

quartz kindle
#

ye

#

xdd

radiant kraken
#

me when boost

quartz kindle
#

lmfao

sharp geyser
#

wtf is boost

radiant kraken
#

lodash for cpp

quartz kindle
#

a cpp mega-lib

sharp geyser
#

wtf is lodash

quartz kindle
#

lmao

radiant kraken
#

the js lib that tries to do everything

#

like a multipurpose bot

quartz kindle
#

lodash is a js lib that has like hundreds of functions for all sorts of silly things

sharp geyser
#

oh thats probably why I never heard of it

radiant kraken
#

like it has its own toLowerCase function

sharp geyser
radiant kraken
#

lol boost takes up 705 MB in my PC

quartz kindle
#

LOL

sharp geyser
#

jeez

#

almost 1gb

quartz kindle
#

also, lodash performance:

sharp geyser
#

so its slower

quartz kindle
#

ye

#

lmao

sharp geyser
#

What the fuck is the point of it then

radiant kraken
#

i mean lodash is one of the oldest Node.js libraries so

sharp geyser
#

Its like 2x+ slower

radiant kraken
quartz kindle
#

ye

#

i mean, back then it has its purpose

sharp geyser
#

ye but did js not have those functions themselves ?

quartz kindle
#

back in the days of not all browsers supporting all js

sharp geyser
#

or were they added after lodash made them popular

radiant kraken
#

i mean back then, those functions probably didnt exist yet

sharp geyser
#

fair enough then

quartz kindle
#

a lot of things js didnt have yet, some things only some browsers had

sharp geyser
#

it's last update was 3 years ago

#

why dont they just archive it

radiant kraken
#

maybe because they gave up on it

sharp geyser
#

its not useful anymore by the looks of it

quartz kindle
#

lmao

radiant kraken
#

You Dont Need Boost when

quartz kindle
radiant kraken
quartz kindle
#

xD

sharp geyser
#

IE is already dead

#

dont bring it back

#

😭

#

Its been replaced by an even worse option edge

eternal osprey
#

hey guys suppose i use docker for my project

#

and i run the project using docker run ...

radiant kraken
#

misty

eternal osprey
#

if i make changes to it, do i need to rebuild the whole image again>

radiant kraken
#

i USE edge

sharp geyser
#

dont

#

Edge sucks

radiant kraken
#

i cant misty

#

i use a low-end pc

sharp geyser
#

opera gx

radiant kraken
#

and chrome is just slow as fuck

sharp geyser
#

ez

radiant kraken
#

tbf edge is much more lightweight than chrome

sharp geyser
#

or use brave browser, built in ad blocker, ram limiter, even a built in vpn if you pay

quartz kindle
#

im using brave

sharp geyser
#

I do as well

quartz kindle
#

so far its been the only solution that never gave me any issues on youtube

sharp geyser
#

Third time i've installed the browser

#

stats reset between installs

#

I've blocked probably 400-500k ads

radiant kraken
#

idk man opera gx/brave looks pretty heavy for my pc

#

i want lightweight

#

like i cant even use VSCode

quartz kindle
#

if you want lightweight get rid of chromium lel

sharp geyser
#

I like this extension

#

cause of the whale

quartz kindle
#

someone made a browser with node+electron

sharp geyser
#

unrelated

quartz kindle
#

and claim its fast and lightweight

sharp geyser
#

electron fast and lightweight?

radiant kraken
#

yeah

sharp geyser
#

500mb just opening the damn application

radiant kraken
#

the only electron app i use atm is Obsidian

sharp geyser
#

anyway bye guys work calls

radiant kraken
#

bai bai misty

quartz kindle
radiant kraken
#

i gotta study rn am about to have math finals in 3 hours

quartz kindle
#

gl

eternal osprey
#

each time i use fucking docker, when i make one single change i have to rebuild my whole image and then rerun docker to make the changes go through. Is there a better way to make docker just save changes on rerun or something? Cuz else i will throw it out of my project hella fast as it's so annyoing

quartz kindle
#

simple

#

dont use docker

#

:^)

eternal osprey
#

my project uses a lot of dependencies and using docker i think it's pretty useful

#

to get everything installed already,

quartz kindle
#

make an install script

#

gg

eternal osprey
#

Tim, i am trying to use docker and learn it. It may be beneficial in the future.

quartz kindle
#

then idk, i dont use docker myself

solemn latch
radiant kraken
#

when i see duckduckgo i immediately closed the tab

#

Min is written entirely with CSS and JavaScript using Electron
yeah nope

#

definitely not min for my pc

wheat mesa
#

60gb+

eternal osprey
#

in sql, why does BOOLEAN evaluate to TINYINT?

#

does it actually evaluate true/false to binary?

solemn latch
lyric mountain
#

on postgres for example, there is an actual boolean datatype

sharp geyser
#

Although it’d be fun to make my own language in c++

eternal osprey
eternal osprey
#

idk mysql is pretty well optimized in terms of speed it seems

#

it literally doesn't let me create a foreign key unless i index a table

#

other sql clients don't really limit you to doing so

true star
#

Has 'boot scootin' Boogie ' been flirting out on any other plays, Or just Me and mine?

lyric mountain
#

and every PK is indexed

#

if you're using an FK without the other table having a PK, something is really wrong

quartz kindle
#

thats why in most databases, booleans are stored as 8bit ints

past field
#

sam.. bestie.. can I get your help best friend in the whole entire world

#

best pal

past field
#

i was trying to dissect what you were saying with getting started on the actual function of the bingo game

#

and i couldn’t get it LOL

sterile lantern
#

in your interaction handling

#

you have a part where you check the number of players, right?

#

if you have enough players (some sort of if statement), then you can either begin the game in that if statement, or have a separate function to start the game and call it in that if statement

past field
past field
sterile lantern
past field
sharp geyser
#

Cause a bitset can store it as 1 bit

radiant kraken
sharp geyser
#

I know its an array of booleans but they are 8 bits anyway, how is it stripped down to just 1 bit

radiant kraken
#

a single byte (the minimum size to be stored in memory) can hold 8 bits, so instead of an array/struct of 8 booleans, you can just store them in a bitset thus requiring 1 byte instead of 8 bytes

sharp geyser
#

I can store an array of 0's and 1's but how does it know its supposed to be a bit, and not an int which is also 4 bytes

radiant kraken
#

a bit can only be 1 or 0

#

booleans work the same way, but takes up 1 byte or 8 bits if you're not using a bitset

sharp geyser
#

ok, but like...how the fuck do you specify that you are storing bits and not just a list of numbers

radiant kraken
#

you do bit operations on them, like OR or |, or SHIFT TO THE RIGHT or <<

#

or you can use a bit literal or 0b01010111

sharp geyser
#

didnt know that was a thing

radiant kraken
#

(this is if you're going the raw/universal way, instead of using c++'s built-in class wrapper)

sharp geyser
#

yea

radiant kraken
#

i use bitsets everywhere throughout my major Rust project

#

really saves a lot of bytes especially when you're storing lots of numbers/packed data

sharp geyser
#

So wait, even if I give an empty string to an Option<String> it will still emit Some and not None?

#

Good to know

pale vessel
#

if u want to give an empty string you'd still have to do Some(string)

#

so yeah it'd be Some, not None

sharp geyser
#

gotcha

#

I just wont provide the param in the request at all

#

Which should give me a none

#

Also figuring this ownership out hurts my brain

#

I had to do this:

            let email = login_data.email.clone().unwrap();
            let email_exists = does_entry_exist(&pool, ETable::USERS, ETableFields::EMAIL, &email).await.exists;

            if !email_exists {
                return HttpResponse::BadRequest().json(LoginError {
                    reason: String::from("An account with this email does not exist")
                })
            }

            FieldData {
                field: String::from("email"),
                value: email
            }
#

instead of passing &login_data.email.unwrap() to does_entry_exist

#

This is because unwrap takes ownership of the value being unwrapped

#

so I can't give it to the does_entry_exist func

pale vessel
#

use as_ref().unwrap() then

sharp geyser
#

oh?

#

is this better than using clone?

pale vessel
#

yeah

#

it's cheaper

sharp geyser
#

gotcha

#

also if I do that then I have to use to_string on email in the FieldData struct

pale vessel
#

right

#

or provide login_data.email directly if nothing else needs it

sharp geyser
#

hm

#

That doesn't seem to work

#

which makes sense

#

cause the type of value is String

#

So wait

#

hm

pale vessel
#

did u not unwrap it

sharp geyser
#

oh shoot

sharp geyser
#

What kind of data would I even put inside a cookie for my auth systemthinkEGG

pale vessel
#

a session token xD

sharp geyser
lament rock
#

My bot used to not have a rewind button. Currently, it just seeks to 0 of the track. Do you think this is a good layout? I've seen some players on apps do ⏪⏭️⏯️ and usually there is no stop button. Spotify does ⏪⏯️⏭️ Like I do so I went with that. Though I'm also worried about users who have built up muscle memory over 4+ years to click the left most button to pause/resume

#

Also, my bot doesn't hold references to previously played tracks, so to subtly convey that, I used ⏪ instead of ⏮️ since skip goes to the next track and that's ⏭️

quartz kindle
#

data is just data, the program handling the data is responsible for knowing what the data contains and how to read it

#

but you can use bitwise to store extra information alongside the actual data if you want to store them together, otherwise you will likely store it in different places, ie keys types and values

lyric mountain
#

simply because that emoji looks too similar to "Next song"

neon leaf
earnest phoenix
#

Any python bot dev dm me i need help

lyric mountain
#

just ask here, easier for someone to help than on dm

earnest phoenix
green kestrel
#

I've said so many times you need to see a doctor about those. /j

deft wolf
#

I'm curious what "discord tools" he needs PepoThink

green kestrel
#

special tools.

#

for secret tasks.

earnest phoenix
deft wolf
#

Here you are asking about python developers, on the discord developers server you are asking whether they also create "discord tools" there

#

I am curious what "tools" you mean

earnest phoenix
#

But wait a sec why you guys stalking me yash_ka_muh

lone plinth
#

Guys I need some help. I've this chatbot which swears and it's a bit goofy. It does some inappropriate chats with the users. If the user enables /swear feature. So idk that will discord interfere in future or not so should I make it like it will only talk inappropriate when you've annbles nsfw in the channel settings?

gilded plankBOT
ornate dune
#

how a add if any one vote bot send a message?

soft gazelle
#

I have a question may I post the code here? Because not sure if I got this right or not

deft wolf
#

Of course, just remember to remove any "sensitive" information such as the token

soft gazelle
#

Here is this correct?
import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.messages = True
intents.guilds = True

bot = commands.Bot(command_prefix='/', intents=intents)

@bot.event
async def on_ready():
    print('Bot is ready.')

@bot.command()
async def promote(ctx):
    await ctx.send("Promotion\nUsername:")
    username_msg = await bot.wait_for('message', check=lambda message: message.author == ctx.author)
    username = username_msg.content
    
    await ctx.send("Old Rank:")
    old_rank_msg = await bot.wait_for('message', check=lambda message: message.author == ctx.author)
    old_rank = old_rank_msg.content
    
    await ctx.send("New Rank:")
    new_rank_msg = await bot.wait_for('message', check=lambda message: message.author == ctx.author)
    new_rank = new_rank_msg.content
    
    await ctx.send("Note:")
    note_msg = await bot.wait_for('message', check=lambda message: message.author == ctx.author)
    note = note_msg.content
    
    await ctx.send("Approved by:")
    approved_by_msg = await bot.wait_for('message', check=lambda message: message.author == ctx.author)
    approved_by = approved_by_msg.content
    
    await ctx.send("Congratulations!\nHello {}, you got promoted!\nUsername: {}\nNew Rank: {}\nReason: {}\nNote: {}\nApproved by: {}".format(username, username, new_rank, "Promotion", note, approved_by))

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        await ctx.send("Command not found.")

bot.run('YOUR_BOT_TOKEN')
``
pale vessel
#

it should work if it's right

#

just make sure you've enabled the intents on developer portal

soft gazelle
#

@pale vessel ^ sorry for pinging

pale vessel
#

where are you launching the code?

#

usually it wouldn't cost anything extra to run the code

solemn latch
#

Thats a library, not a place to run code.

soft gazelle
quartz kindle
#

you said something about publishing and launching

#

thats what they are asking about

#

what are you using to "publish" or "launch"

soft gazelle
quartz kindle
#

yes, what are you using to launch

#

like, what system, hosting, website, platform

soft gazelle
quartz kindle
#

so you never started your bot yet? this your first time?

soft gazelle
lyric mountain
#

hosting on a phone will be complicated, but possible

#

this excluding botmakers like botghost

#

all in all, you dont pay at any of the stages of hosting a bot

#

well, except for buying a VPS ofc

soft gazelle
lyric mountain
#

you can use whatever language or library you want

soft gazelle
#

Okay, how can I view how many servers that my bot is in?

lyric mountain
#

the client object will have a guilds property

#

the size of that property is the server count

#

(unless you're sharding, but this is story for another day)

soft gazelle
#

Okay, do I need make a code it will tell me how many servers that my bot is in?

neon leaf
#

whats the best way to convert all post bodies I recieve into valid utf8 in nodejs?

#

or atleast valid utf8 when its not binary data

#

so like utf16, ascii, ...

lyric mountain
lyric mountain
#

when creating a string, you can specify the encoding

#

also some libraries will automatically convert to the encoding specified in the header of the response

neon leaf
#

what exactly do you mean?
If I take the raw bytes of the post body and do toString('utf8') I get a string yes but it doesnt seem to be actual utf8 because postgres complains
invalid byte sequence for encoding "UTF8": 0x00

lyric mountain
#

the response body is just a bunch of bytes, you can encode it however you like

#

it might cause broken characters tho if the original encoding isn't utf8 compatible

#

the 0x00 thing is because you have a null character somewhere, probably part of the request stream as a delimiter

#

if you're the server, then simply force utf8 upon your clients through Accept-Encoding header

#

otherwise, cut out the null character from the req

lyric mountain
#

oh wait lul, wrong header, sec

#

Accept-Charset

#

this

neon leaf
#

its from the client to server

lyric mountain
#

oh nvm, discontinued header

neon leaf
#

ill try replaceAll("\u0000", "")

lyric mountain
#

that'll do too

neon leaf
#

seems to not explode

#

👍

earnest phoenix
lament rock
lyric mountain
#

that's an option

lament rock
#

Shit, now I'll have to also do that on the website

lyric mountain
#

tbh, without the blue bg it looks fine

#

maybe it's the low contrast messing with me

lament rock
#

Blue bg?

#

You mean on the emojis?

#

Those are the built in emojis

lyric mountain
#

yes, meant them

#

well, try gathering some more opinions on it

#

perhaps it's fine as-is

lament rock
#

I personally like it

#

I think the icons convey the intent

eternal osprey
#

this isn’t the case in other clients

lyric mountain
#

that's the entire gimmick of pks

#

and as I said, if you have an FK that's not referencing a PK, then you need to rethink your structure

surreal sage
neon leaf
#

ah yesd

past field
#

if anyone has experience with node canvas pls lmk! i’d appreciate some guidance on my project with it

solemn latch
#

Canvas is a fun one.
I had a bot that had a 1v1 fighting game.

Instead of being text based it would use canvas to make a gif of a bunch of frames, then in the response message it would show the fight with animation and damage taken, etc.

I got so indepth with it you could customize what your character would look like.

#

Fun times

#

I would calculate the time the gif would take to play, and the size of the gif itself to determine how long to wait to send another message containing the stats for the match.

That took so long to make, then I killed the project 😭

sharp geyser
solemn latch
#

It was slow, yeah

sharp geyser
#

probably killed your ram and cpu as well

solemn latch
#

100%

#

I had made a bunch of workers so individual frames would render across cores.

#

It was an expensive project, which is why it was buried.

#

This was so long ago that discord actives hadn't launched, no one had done anything like it before either.

The bot gained a fair bit of growth

#

If someone ever does the same idea, but in opengl or some other proper rendering method, and does like a pokemon style to it it would grow so fast.

#

imagine pokemeow or one of those bots, but you actually fight with animations.

past field
#

dang

#

so it’s not that easy to coach me through lol

#

doesn’t sound like it 😭

solemn latch
#

I was doing something stupid complex, I'm sure what you're doing is simple enough

past field
#

I’m working on a bingo game LOL

earnest phoenix
#

Hello

past field
#

I have a blank bingo board, was trying to see if I can use canvas to generate numbers in the board for every players that joins

solemn latch
#

Oh yeah, that wont be "easy" but the canvas part shouldn't be too complex.

past field
solemn latch
#

This is one of those times chatgpt can get a lot of the legwork done within canvas.

past field
#

oohhh yeahh let me see what it’ll do

sharp geyser
#

put my C++ skills to use

solemn latch
#

If you ever do, let me know ^-^

#

Its worthy of a staff pick

sharp geyser
#

oh definitely not

#

opengl is so fucking hard

#

I like the idea

#

but

  1. Opengl hard
  2. Nintendo Sues for Everything
solemn latch
#

I'd suggest not using pokemon yeah, but a pokemon style

#

pull a palworld ^-^

sharp geyser
#

I like the idea of a graphical rpg game with opengl tho

#

palworld is being sued out the ass by nintendo rn

solemn latch
#

Is it? 👀

sharp geyser
#

As of my latest knowledge yea

#

Wait no, it was rumored to have happened.

#

All nintendo did was announce that any use of IP would be pursued by legal action.

sharp geyser
#

Its protected under parody laws

solemn latch
#

It would have to be gamefreak too

#

Nintendo cant sue afaik

sharp geyser
#

nope

#

They can try

#

but it'd be thrown out unless the judge is biased and ignores the laws

solemn latch
#

Nintendo doesnt own pokemon 👀

#

They just own a part of gamefreak, which owns pokemon

sharp geyser
#

Aren't they one of the largest share holders

#

They absolutely could

solemn latch
#

The only thing I can find is 1/3rd, and the source on that is a reddit comment

#

They could be the largest shareholder, its impossible to say tbh.

sharp geyser
#

I'd say a safe bet is they are.

#

Pokemon brought them in a lot of money

#

they'd secure that

#

They'd be dumb not to

#

not to mention they are a multi billion dollar company

#

they absolutely could

solemn latch
#

gamefreak is a 90 billion dollar company 👀

#

which is just wild

#

Nvm

#

I mighta lied there

#

3.8 billion apparently. 90 billion in profit over the years?

Something like that

#

Crazy nintendo doesnt own the whole thing.

radiant kraken
#

can u imagine the computing power needed for ffmpeg to render all that

solemn latch
#

👀 hopefully they fixed all that

#

lol

radiant kraken
#

that command must have really really strict ratelimits

earnest phoenix
#

OSError: dlopen failed: library "libpthread.so.0" not found
Guys can you help me?

wheat mesa
#

Usually this means that the system compiling whatever program is missing the pthread library (commonly used when compiling on Linux systems)

sharp geyser
#

Right, so what I store inside my redis session store is a user id. Would it be smart to store more application critical information like their username so that way the client can easily display it, or simply keep their user_id and just have the client use that to fetch the backend api for more user info

lament rock
past field
#

is it possible to create a slash command to schedule a post ?

past field
#

nvm figured it out

lament rock
#

Anything is possible

soft gazelle
#

I have a question, so I use ChatGPT to help me with the code with Javascript, can I use ChatGPT to help me with the code?

deft wolf
#

Partially yes, but certainly not entirely

#

You can ask about some individual issues but he will never write you the entire code correctly + chat gtp stopped on discord.js v13

#

So any code that will refer to discord.js you will have to check if it is compatible with v14

sharp geyser
#

Simple solution

#

Don’t use ChatGPT for code

deft wolf
#

Of course, but not everyone has enough patience and willingness to read documentation and tutorials

eternal osprey
#

ChatGPT can give you a gentle push in the right direction

sharp geyser
#

Uh no

#

Not any modern libs

eternal osprey
#

Not to necessarily fully rely on it, but it can be pretty helpful sometimes

sharp geyser
#

It only has information up to 2022 iirc

eternal osprey
#

Owh are we talking about libs

sharp geyser
#

Anything after that is useless information

eternal osprey
#

you were talking about code in general right?

sharp geyser
#

No

eternal osprey
sharp geyser
#

It’s helpful to understand coding concepts sure. Even that’s a little bit of a stretch sometimes cause it’s not perfect

eternal osprey
#

nvm then, yeah for libs it's helpless.

sharp geyser
#

Even with general coding concepts it’s still not the best

#

ChatGPT can get confused on what you want to know with what’s found in stackoverflow pages that lead to no result

eternal osprey
sharp geyser
#

Not always

#

You have to be very specific as to what you want to know

#

And new programmers suck at that it’s the hard truth

eternal osprey
#

yup that's true.

sharp geyser
#

If you simply ask ChatGPT how does this work or how would I use it. It’s not always going to give you a "correct" answer as it can pull that information from anywhere even code of people asking for help

eternal osprey
#

ChatGPT really helped me a lot when i was learning haskell. I specifically asked it a little question like, how does currying work etc en tbf it did a good job explaining and giving examples.

#

Especially as a visual learner it was great.

sharp geyser
#

If you can give specific instructions then it’s great tool but don’t rely on it

eternal osprey
sharp geyser
#

Oh shoot I’ve been using Xfinity WiFi the entire time pog

#

Fuck using my data when I don’t need to

eternal osprey
#

Always happens to me as well

#
 INSERT INTO Messages (backup_id, owner_id, server_id, channel_id, message_content, message_author_id, message_timestamp, embed_id) VALUES ('qqPvtaL3vR2h1ByQZw8E', 345138133429649408, 734123033782124575, 945460738418421861, 'testig this out!', 456226577798135808, 2022-04-15 10:29:12.962, null) Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10:29:12.962, null)' at line 1```
hey guys, what's the matter with that fucking timestamp?
#

the thing itself is a string, mysql expects it to be a timestamp but i am unsure what kind they define timestamp to be.

sharp geyser
#

It’s a normal timestamp?

eternal osprey
#
and the range for TIMESTAMP values is '1970-01-01 00:00:01.000000' to '2038-01-19 03:14:07.499999'. The fractional part should always be separated from the rest of the time by a decimal point; no other fractional seconds delimiter is recognized. For information about fractional seconds support in MySQL, see Section 13.2.6, “Fractional Seconds in Time Values”.```
sharp geyser
#

How are you inserting the timestamp as a string?

eternal osprey
#

This comes from their docs, i do think i meet all constraints.

sharp geyser
#

Like wrapping it in single quotes

#

Or smth

#

You can’t just give it a raw timestamp it looks like

eternal osprey
#
  const formatter = function (message) {
          const createdTimestamp = new Date(message.createdTimestamp);
          const year = createdTimestamp.getUTCFullYear();
          const month = String(createdTimestamp.getUTCMonth() + 1).padStart(
            2,
            "0"
          );
          const day = String(createdTimestamp.getUTCDate()).padStart(2, "0");
          const hours = String(createdTimestamp.getUTCHours()).padStart(2, "0");
          const minutes = String(createdTimestamp.getUTCMinutes()).padStart(
            2,
            "0"
          );
          const seconds = String(createdTimestamp.getUTCSeconds()).padStart(
            2,
            "0"
          );
          const milliseconds = String(
            createdTimestamp.getUTCMilliseconds()
          ).padStart(3, "0");

          const sqlFormattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`;
          return sqlFormattedDate;
        };```

this is the formatter i use
sharp geyser
#

God I’m on my phone

eternal osprey
#

i indeed think that it expects it to be wrapped in ' '

sharp geyser
#

Can you put that in a bin please 😭

sharp geyser
#

It does

#

It doesn’t accept a raw timestamp it has to be "stringified" in a sense

soft gazelle
#

Hey is this good code?

 const Discord = require('discord.js');
const client = new Discord.Client();

client.on('message', message => {
  if (!message.content.startsWith('/')) return; // Check if the message starts with '/'

  const args = message.content.slice(1).trim().split(' ');
  const command = args.shift().toLowerCase();

  if (command === 'punish') {
    // Check if the user has permission to use this command
    if (!message.member.hasPermission('ADMINISTRATOR')) {
      return message.reply('You do not have permission to use this command.');
    }

    // Parse arguments
    const username = args[0];
    const rank = args[1];
    const punishment = args[2];
    const reason = args.slice(3).join(' ');
    const duration = args[4];
    const note = args.slice(5).join(' ');
    const approvedBy = message.author.username;

    // Check if all required arguments are provided
    if (!username || !rank || !punishment || !reason || !duration || !note || !approvedBy) {
      return message.reply('Please provide all the required arguments: Username, Rank, Punishment, Reason, Duration, Note, Approved by.');
    }

    // Check if punishment is zero tolerance policy and if user mentioned
    if (punishment.toLowerCase() === 'zero tolerance policy') {
      const mentionedUser = message.mentions.users.first();
      if (!mentionedUser) {
        return message.reply('You need to mention the user when using zero tolerance policy.');
      }
    }

    // Perform action based on the punishment
    // Here you can add your logic to apply the punishment, like adding a role, sending a message, etc.

    message.channel.send(`Punishment applied to ${username} for ${reason}. Approved by ${approvedBy}.`);
  }
});

client.login('your-bot-token');
sharp geyser
#

Which is why I say fuck the built in data types and just use Unix timestamps

#

Date.now = god tier

#

Who needs all the useless info like the day month and year when I can parse that later if I need it

neon leaf
#

thanks for the idea of feeding my ai discordjs docs

sharp geyser
#

No problem

#

Make an ai specifically for the djs docs and anything djs v14 and up related

#

You’ll make bank

#

Trust

#

You know how many lazy people will buy it to write code for them trollface

#

Might as well make money off lazy people

neon leaf
#

eh

#

maybe

sharp geyser
#

No it’s bad

#

You aren’t using a switch case

deft wolf
#

What discord.js version are you using?

eternal osprey
#

Ahahahh OMG i just found something funny

#

i forgot to prepare my sql statement content

#

so one of my messages was DROP table and it literally executed it

#

Damn

sharp geyser
#

Lmao

#

Good job mate

#

Hopefully it was a test db

eternal osprey
#

it was luckily

#

why is mysql2 so dumb with their error handling?

#

They give me no info

#
database
                  .execute(
                    `INSERT INTO Messages (backup_id, owner_id, server_id, channel_id, message_content, message_author_id, message_timestamp, embed_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
                    [
                      randomString,
                      interaction.member.id,
                      interaction.guild.id,
                      channel.id,
                      fetchedMessage.content,
                      fetchedMessage.author.id,
                      formatter(fetchedMessage),
                      null,
                    ]
                  )```

Error executing SQL statement: INSERT INTO Messages (backup_id, owner_id, server_id, channel_id, message_content, message_author_id, message_timestamp, embed_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?) Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, ?, ?, ?, ?, ?, ?, ?)' at line 1
#

They tell me to read the manual and go fuck myself

sharp geyser
#

Hm

#

I’d try and help further but I’m currently on the bus and on my phone

eternal osprey
#

it's okay!

soft gazelle
#

What version should I use for Discord.js

#

@eternal osprey

charred nest
rustic scarab
eternal osprey
#

why ping men

neon leaf
lament rock
#

Always use latest stable anything for Discord related stuff

harsh aspen
# eternal osprey ```js database .execute( `INSERT INTO Mess...

It seems like the error you're encountering is related to a syntax issue in your SQL statement

Here are a few steps you can take to troubleshoot and improve error handling:

  1. Print or Log the SQL Statement:
    Before executing the SQL statement, print or log the generated SQL statement with the actual values filled in. This way, you can see the complete query that is being executed, which can help you identify any syntax errors.

    const sqlStatement = `INSERT INTO Messages (backup_id, owner_id, server_id, channel_id, message_content, message_author_id, message_timestamp, embed_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`;
    const values = [
      randomString,
      interaction.member.id,
      interaction.guild.id,
      channel.id,
      fetchedMessage.content,
      fetchedMessage.author.id,
      formatter(fetchedMessage),
      null,
    ];
    
    console.log("SQL Statement:", sqlStatement);
    console.log("Values:", values);
    
    database.execute(sqlStatement, values, (error, results) => {
      if (error) {
        console.error("Error executing SQL statement:", error.message);
      } else {
        console.log("Query executed successfully:", results);
      }
    });
    
  2. Check Placeholder Values:
    Ensure that the number of placeholders in your SQL statement matches the number of elements in the values array. In your case, there are eight placeholders and eight values, so that seems correct.

  3. Verify SQL Syntax:
    Manually review the generated SQL statement to ensure that the syntax is correct. In your case, the syntax appears to be fine, but there might be subtle issues.

  4. Use Named Placeholders:
    Consider using named placeholders instead of positional placeholders. Named placeholders can make the code more readable and can help you spot errors more easily.

By incorporating these steps, you can make your code more robust and enhance error handling for MySQL queries.

wheat mesa
#

we don't do that

harsh aspen
#

but I do

wheat mesa
#

My point was that ai generated answers are not appreciated

harsh aspen
#

but I appreciate 'em

#

they do help me a lot

wheat mesa
#

If their problem could be solved by chatgpt I'd imagine they would've tried it

#

If they wanted an AI generated answer, they could get it themselves

#

The reason that people ask questions here is because that want human help

harsh aspen
wheat mesa
#

🤦‍♂️

neon leaf
#

dont u love it when you release a true gimmick ai feature and 1 month after release u get comments about it being so crazy and wondering where these people were the last entire month

solemn latch
#

battless?

lament rock
#

battless vibes fr

wheat mesa
#

honestly wouldn’t be surprised

silk flame
#

Is there a way to clear the repositories that you’ve cloned on vsc and start over?

solemn latch
#

You can just delete the files from your file explorer

harsh aspen
#

what if they use MacOS and linux and they don't have that file explorer

spark flint
#

then open finder

wheat mesa
surreal sage
spark flint
sterile lantern
#

what role permission is considered "moderator"

real rose
#

or perhaps kick or ban

sterile lantern
#

aw that sucks for channels for mods only 😔

#

wanted to create a private thread in one of those channels

harsh aspen
sterile lantern
#

o

harsh aspen
sharp geyser
real rose
#

makes sense

sterile lantern
#

kick/ban/manage msg

harsh aspen
#

i see

warm surge
#

Remove node:

silk flame
warm surge
restive trail
#

hey how do I refresh my bot still not updating

trail marten
#

node:fs will work fine

silk flame
#

Is there something else I could do instead of removing it?

pale vessel
#

looks like you're missing the quotes

twilit beacon
#

I have this problem, sometimes this error happens, I don't know what it could be, if anyone has had something similar I can help. I thank

'throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);'

silk flame
deft wolf
charred nest
#

oof im slow typer LOL

twilit beacon
#

How can I solve?

charred nest
#

give the bot permissions in the channel

twilit beacon
#

It has the necessary permissions

#

This one

charred nest
#

no, in the channel -- go to the channel permissions, edit -> give your bot's integrated role permissions to read/send message

twilit beacon
#

ok

twilit beacon
charred nest
#

check permissionsbitfield

twilit beacon
#

thranks

charred nest
#

no problemo c:

past field
#

ok so i have this counting bot in my server

#

is there some type of listening event i need to have to code that myself in my own bot?

charred nest
#

you would have to listen on messageCreate i would think

#

probably narrow it down to a channel to avoid listening to messages that are unneeded, then from there make the counter system

past field
#

thank you

past field
#

ok question

#

I'm working on my counting game and it's coming a long ok right now

#

but I want it to also accept math equations as the next number in the sequence

#

what am I doing wrong

#

this is the event listener I added to my index.js

deft wolf
#

You know it's going to be quite a pain to code this without a database, right? After restarting, all information about the last number and the last person who wrote the message will be lost because they are stored in the bot's memory, which will be deleted after restarting

past field
#

ah I didn't know that

#

ok i need to look into some databases. rn ive had my eyes on SQlite.. but i can do under another time

eternal osprey
#

hey my fellow people

#

how is everyone doing

past field
charred nest
#

either of those are good options

#

is lastUserId defined outside of the listener ?

#

ah nvm i see it now

#

my bad, my client didn’t load in the full text properly

past field
quartz kindle
#

better-sqlite3 good

charred nest
#

fax

eternal osprey
#

why is the site's image not available eventhough i explicitly added an icon?

#
<link rel="icon" type="image/png" href="./src/logo.png">```
acoustic bough
#

because google is special

#

it displayed an entirely different image for months for my website

eternal osprey
#

hahahah so i just gotta wait and thug it out?

acoustic bough
#

actually now it’s nothing again lol

eternal osprey
#

yeah google is hella annyoing

acoustic bough
#

yeah

#

it indexes like only 1/3 of all my pages

past field
#

good lord

#

i installed the sqlite packages in vsc

#

and installed db browser on my computer

#

but i hit “create new database” and its asking me to edit a table

wheat hemlock
#

Does anyone have a bot that can pick up pairs and calculate the percentage based on Voice?

wheat mesa
#

What?

charred nest
#

ie create if not exists table

#

create table if not exists tablename ( bla bla

#

or whatever it is

#

i haven't touched sqlite in a hot min

wheat mesa
#

It looks like you tried to add a command that doesn't have a name or description in it

wheat mesa
#

np

#

happens to everyone at some point

charred nest
#

if it helps, use it. if it doesn’t, ditch it

past field
past field
quartz kindle
#

sqlite is a good db to start with because its much simpler than a standard database software in the sense that most databases operate as a server, while sqlite uses a single file to store data.
a db browser is useful to load the sqlite file and view its contents, but its not strictly necessary to make it work

#

the sqlite file can be created, read and written to 100% via code

lament rock
#

Never use eval. You can pass a string into the Number() constructor

wheat mesa
#

Yeah eval is completely unsafe. Never expose eval to a user that you don't absolutely trust

quartz kindle
#

^ for context, if you use eval, the person running the command can do something like /command process.exit() and your eval will run that and quit your bot

wheat mesa
#

That's not even the worst of your fears, a user can find your bot's token with eval and use it to login themselves

quartz kindle
#

or worse, they can do something like /command require("child_process").exec("rm -rf /") and delete your entire server

wheat mesa
#

I'm sure they could also do something bad with your host machine if it has elevated permissions enough

#

Yeah ^^

past field
#

whoa

#

what

#

i deleted it

wheat mesa
#

The eval() function essentially interprets the given string as if it were code

#

One of the worst vulnerabilities in any sort of security sense is arbitrary code execution

#

You NEVER want anyone running untrusted code on your machine

past field
#

so how should i modify the code to something safer?

quartz kindle
#

like papi said

#

you can use Number() to convert a string into a number

past field
#

like this?

quartz kindle
#

yes

charred nest
#

fixing massive amounts of tech debt after you learn more also sucks TT_chiyo_cry

#

also, any reason you're declaring w your let statements at the end of your code rather than before you use them?

#

iirc you'll get an initialization err

past field
#

ah

#

ok i’ll have to move it

charred nest
#

no problemo ! mdn docs helps a lot

wheat mesa
charred nest
#

oh absolutely. there’s a lot of fundamentals that need to be learned and understood first before diving into the deep end

#

things i think are easy, basic javascript concepts didn’t use to be for me, and that’s simply bc i didn’t take the time first to learn those easy things

dusky idol
#

When I apply for verification of my new discord bot on developer portal (75+ servers), will it ask me for my id again considering that I already have submitted it once back in the day to get my other bot verified?

silk flame
#

What code do I use to randomize these responses instead of just getting the first one each time?

craggy pine
#

you should learn basic Javascript. This woud easily be done via an array and randomzing the result from said array to then be used in your reply.

silk flame
craggy pine
#

Then if you have, store the "Jokes" in an array and shuffle them and return the first result.

sharp geyser
wheat mesa
#

just generate a random index between [0, length)

#

no need for mutation of the array

sharp geyser
#

yup

wheat mesa
#

that's messy

sharp geyser
#

theres a funny lib including in js called math

#

use it to get that index