#development
1 messages · Page 187 of 1
I guess that makes sense
Unfortunately, you can't set it. This feature simply doesn't work right now
Top.gg is awesome 
It's such a toxic love. You seem to hate this site but you use it anyway 
you're right
welcome to the average topgg user
lmao
Yea I know
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
🙂
👀 we do need to work on our regex's a bit
google are you stupid
?
It's probably because he chose the Netherlands and the error mentions Ireland
Yooo
Did they remove embed colors on mobile?
👍
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 😄
still no clue how they dont support syntax highlighting on mobile
One message removed from a suspended account.
One message removed from a suspended account.
as real as it gets
One message removed from a suspended account.
probably cpu cost
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
One message removed from a suspended account.
ok, just subscribed to gpt cuz I wanted to see if I could use some generated images for my card game, and I gotta admit
it's really good for that
especially for anime-like images
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!
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
like this.... midjourney v6 can even put text onto an image now
i don't understand
how does <string>.replace do this
what
what
the replacement is a file's content
sadly it made a mistake with the double T there
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.
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
So what's the big difference between a JSON Web Token (JWT) vs Cookie based authentication?
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
Yea I was seeing JWT's are completely stateless
jwt is usually time based validity, cookie's valitity is mostly "as long as the session exists in the server"

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
yeah, like auth tokens than need to be regenerated every once in a while
Is that what discord uses on their oauth2 stuff ?
are they technically just jwt tokens
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.
gotcha
Discord auth tokens, you could consider JWTs
The first part of the token is the client ID
I always figured they were as they have to be tied to a user somehow and I doubt they do that server side
Well. They have to for MFA tokens since all of it is random
So a token > user ID relation wouldn't be absurd
Discord.js version: v14.14.1
Node.js version: v20.11.1
can someone help me?
MessageEmbed is now named EmbedBuilder
https://discordjs.guide/additional-info/changes-in-v14.html#messageembed
and this...
I looked on the internet but I didn't understand anything about bitfield or anything
If this is a command, I dont think this is how permission checks are handled anymore.
If you're following a guide or video its pretty outdated.
Im trying to make a fully ai bot
i think the problem is chat gpt version
If you plan on making it public, don't bother
You'll not be able to sustain the usage
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
-notified :p
@twilit beacon
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.
So, I would like to know where I can check that it is under analysis? I sent it just now and just wanted to confirm that it was actually sent for analysis, I can't find anywhere about this feedback
in logs it says it hasn't found it yet
Then it wasn't sent yet
I can only see a bot you submitted in 2023
Nothing recent
The evaluation time is 2 weeks?
Or is it possible to have the evaluation beforehand?
It's a lot shorter right now
How many days more or less?
yeah you're right thanks for the help
Im seriously getting tired of this ownership shit in rust
it exists in rust and C++ and almost any language that isn't garbage collected
😉
rust just enforces it
I knowww
But I can be angry with it in the moment
:C
It's okay, i can always help you

Besides the compiler has one of the sanest error messages
@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 -...

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
nice
just watch each chapter per day
idk looking from the chapters they look like cs basics
i expected huge brain stuff when i hear harvard

it's talking about decancer (real)
🙀
it does seem to include unicode though
although it is weird that this is part of a cs course
it seems out of place
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
💀
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 
No setup fee on contabo 
Hello
yup, thats why its so common to see numbers like 255
256 possible combinations from 0 up to 255, after that more bits are required
zz
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
Now you can understand how everything at the lowest level is represented with just bits
Can anybody help me? How do I put these commands that appear when clicking on the bot?
Yea, it's not verified by Discord
Discord decides when to add it.
I understand, the verification is automatic?
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
whats the bot id?
(wrong channel, but whatever)
897315312368771173
- i create a team and transfare bot to the team and i deleted a team
Ownerships listed under someone else.
Yeah, youd have to edit things from that account.
i did this and tell me you don't have a permissions
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.
https://codepen.io/dreamboy-cyber/pen/poBoajx
unable to align div horizontally
im making a pager. <bg> should cover whole screen
So 8 bits = 1 byte
Integer typically is 4 bytes
Which is a 32 bit number which can go from 0-8000+ possible combinations right?
4b combinations
the unsigned integer limit is the actual amount of combinations
The amount of combinations grows expontentially
2^bits - 1
Oh I see
(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
Signed ints can be negative right? But unsigned can’t
Hence why it's such a convenient system for computers
Large amounts of data in small spaces
Actually I think I explained the signedness thing wrong
But kuuhaku prob about to correct it
lul, u said it correctly
Signed can have a sign, if that's what you mean.
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
Bit operations is something I still don’t understand but I’ll figure it out in due time
it's basically and array of booleans if u stop to think
I’m already happy I figured out how to count in binary and dealing with bits
Bit operations can be really fun.
Bit math is so interesting
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
Yea
using bitwise is just like using arrays, but on steroid
8x more space-efficient than an array
^
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...
It used to be way cheaper to do, damn inflation ^-^
(on 64 bit computers)
Funnily enough I could build this as well
I have the kit lol
guaranteed to run at 10hz 😉
It's such a good learning experience
I got mine to .2mhz
^-^
No wait, khz? 200hz
Lol
It's been awhile
I followed along with that tutorial from money from my first paycheck.
man I wish I could buy fun things
Gotta save like every cent possible though because uni is gonna eat my money next year
do yall have something like ENEM there?
No idea what that is
basically a very long very broad exam where u can gain discount for uni if you score high
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
holy
But the cost of tuition is roughly $15k/year for 4 years
Yikes
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
or if you step on a nail and need to go to hospital
yeah
And that's why uni is dying in the US
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
I mean, you have quite a bit of portfolio to put on resume
those past projects, even if unfinished
I’m hoping to be able to go to college myself
yeah, but still not enough
We’ll find out Wednesday
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
The market is really rough right now
come to brazil
Born too late to get into peak CS, born too late to buy a house
as much as I dislike this country, the IT area is pretty starved for applicants
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
Usually they want young people they can manipulate not graduates 
Graduates are young people they can manipulate.
No internships during uni = graduates are manipulatable
Honestly an internship just seems useless to me but idk
reject jobs, create your own company
Exactly
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)
Teach skills (business, engineering, medical) to middle school aged refugees
I'd be joining their engineering team if I am accepted
Nice
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
congrats! that code looks good

that's okay, at least you learned
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;
}
which part do you don't understand?
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


its walking through the string finding each delimited one at a time
I know what it does but not how its doing it
find()'s second parameter basically means which index to start searching from
does my explanation work for you 
so find first delimiter, get its position, slice the word, update the position, search again starting from the previously found
not really sorry 
does cpp not have an string.split() equivalent?
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
its correct
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
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
not that I know of
ye, similar to js ES verions
but cpp differences betwen versions are often much larger, code-similarity-wise
what annoys the heck out of me is all those solutions that require using boost
boost is like, lodash for cpp
lol
except it's much worse because it's thicc asf
me when boost
lmfao
wtf is boost
lodash for cpp
a cpp mega-lib
wtf is lodash
lmao
lodash is a js lib that has like hundreds of functions for all sorts of silly things
oh thats probably why I never heard of it

LOL
What the fuck is the point of it then
i mean lodash is one of the oldest Node.js libraries so
Its like 2x+ slower

ye but did js not have those functions themselves ?
back in the days of not all browsers supporting all js
or were they added after lodash made them popular
i mean back then, those functions probably didnt exist yet
fair enough then
a lot of things js didnt have yet, some things only some browsers had
its not useful anymore by the looks of it
lmao
You Dont Need Boost when
lodash seems like it's made for js devs who still want to support internet explorer

xD
IE is already dead
dont bring it back
😭
Its been replaced by an even worse option edge
hey guys suppose i use docker for my project
and i run the project using docker run ...
misty
if i make changes to it, do i need to rebuild the whole image again>
opera gx
and chrome is just slow as fuck
ez
tbf edge is much more lightweight than chrome
or use brave browser, built in ad blocker, ram limiter, even a built in vpn if you pay
im using brave
I do as well
so far its been the only solution that never gave me any issues on youtube
Third time i've installed the browser
stats reset between installs
I've blocked probably 400-500k ads
idk man opera gx/brave looks pretty heavy for my pc
i want lightweight
like i cant even use VSCode

if you want lightweight get rid of chromium lel
someone made a browser with node+electron
unrelated
and claim its fast and lightweight
yeah
500mb just opening the damn application
anyway bye guys work calls
bai bai misty
gl
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
my project uses a lot of dependencies and using docker i think it's pretty useful
to get everything installed already,
Tim, i am trying to use docker and learn it. It may be beneficial in the future.
then idk, i dont use docker myself
wtf
ewwww
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
in sql, why does BOOLEAN evaluate to TINYINT?
does it actually evaluate true/false to binary?
yeah, its way more storage efficient.
depends on the database
on postgres for example, there is an actual boolean datatype
No thanks I’d rather not
Although it’d be fun to make my own language in c++
that's really interesting
i see
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
Has 'boot scootin' Boogie ' been flirting out on any other plays, Or just Me and mine?
I mean, you'll pretty much always have a primary key on the table
and every PK is indexed
if you're using an FK without the other table having a PK, something is really wrong
a boolean only requires 1 bit of storage, however in every single system out there, the minimum amount of data that can actually be stored is 1 byte / 8 bits
thats why in most databases, booleans are stored as 8bit ints
yeah sure whats up
only if you want to of course
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
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
yes right now i think i have it set to 30 players
oh that’s a good idea! are you familiar with using canvas with node?
heard of it but never used it
ahh ok gotcha, i got some thinking on how this can be played lol
Then how does a bitset work?
Cause a bitset can store it as 1 bit
a bit set is a set/array of bits or booleans, think of it as
a = false
b = true
c = true
d = true
1110
^ a
^ b
^ c
^ d
I know its an array of booleans but they are 8 bits anyway, how is it stripped down to just 1 bit
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
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
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
ok, but like...how the fuck do you specify that you are storing bits and not just a list of numbers
you do bit operations on them, like OR or |, or SHIFT TO THE RIGHT or <<
or you can use a bit literal or 0b01010111
didnt know that was a thing
(this is if you're going the raw/universal way, instead of using c++'s built-in class wrapper)
yea

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
So wait, even if I give an empty string to an Option<String> it will still emit Some and not None?
Good to know
if u want to give an empty string you'd still have to do Some(string)
so yeah it'd be Some, not None
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
use as_ref().unwrap() then
gotcha
also if I do that then I have to use to_string on email in the FieldData struct
hm
That doesn't seem to work
which makes sense
cause the type of value is String
So wait
hm
did u not unwrap it
oh shoot
What kind of data would I even put inside a cookie for my auth system
a session token xD
Should I just make one or?
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 ⏭️
it doesnt, its the db that defines what it is
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
Personally I'd separate pause and resume buttons
simply because that emoji looks too similar to "Next song"
Any python bot dev dm me i need help
just ask here, easier for someone to help than on dm
It's something personal 

I've said so many times you need to see a doctor about those. /j
I'm curious what "discord tools" he needs 
Who?
You
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
I am developing something suspicious 
But wait a sec why you guys stalking me 
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?
@harsh nova can you help?
-notdiscord
@lone plinth
We do not represent Discord, nor are we affiliated with them. We merely use their service.
If you have any questions and/or suggestions regarding Discord itself, or wish to report any violations to the Terms of Service, you can use any of these links:
How to leave feedback/suggestions to Discord
How to report bugs/issues to Discord
How to report a violation of the Terms of Service to Discord
How to contact Discord for general inquiries
how a add if any one vote bot send a message?
I have a question may I post the code here? Because not sure if I got this right or not
Of course, just remember to remove any "sensitive" information such as the token
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')
``
it should work if it's right
just make sure you've enabled the intents on developer portal
Okay, whenever I make those codes, can I test it out before I publish it and launch it? (Can't spell) does it cost anything?
@pale vessel ^ sorry for pinging
where are you launching the code?
usually it wouldn't cost anything extra to run the code
Thats a library, not a place to run code.
Or should I use Pycord or Discord.py?
you said something about publishing and launching
thats what they are asking about
what are you using to "publish" or "launch"
Oh, sorry I misunderstood my bad, but anyways, like launching the bot.
Since it's go be my first time doing it well I'm on mobile. So about hosting.
so you never started your bot yet? this your first time?
The botghost without a code I have but with the code, I haven't started hosting my own.
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
Okay, about this code, should I use Pycord?
you can use whatever language or library you want
Okay, how can I view how many servers that my bot is in?
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)
Okay, do I need make a code it will tell me how many servers that my bot is in?
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, ...
yes ofc, the bot wont do anything you dont tell it to do
simply read the bytes as utf8
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
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
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
isnt that just for compression
oh wait lul, wrong header, sec
Accept-Charset
this
its from the client to server
oh nvm, discontinued header
ill try replaceAll("\u0000", "")
that'll do too
Developer portal
alternatively, I could edit the icon
that's an option
tbh, without the blue bg it looks fine
maybe it's the low contrast messing with me
yes, meant them
well, try gathering some more opinions on it
perhaps it's fine as-is
No but like even if I have a pk and fk I MUST have that table I am referencing to indexed
this isn’t the case in other clients
but that's what I'm saying, all tables that have a PK are indexed
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
ah yesd
if anyone has experience with node canvas pls lmk! i’d appreciate some guidance on my project with it
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 😭
you used canvas to generate each individual frame 
It was slow, yeah
probably killed your ram and cpu as well
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.
I was doing something stupid complex, I'm sure what you're doing is simple enough
I’m working on a bingo game LOL
Hello
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
Oh yeah, that wont be "easy" but the canvas part shouldn't be too complex.
well, easy is probably not the word I should l have used lol, more like “coachable”
This is one of those times chatgpt can get a lot of the legwork done within canvas.
oohhh yeahh let me see what it’ll do
I gotchu

put my C++ skills to use
oh definitely not
opengl is so fucking hard
I like the idea
but
- Opengl hard
- Nintendo Sues for Everything

I like the idea of a graphical rpg game with opengl tho
palworld is being sued out the ass by nintendo rn
Is it? 👀
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.
Palworld can't even get sued even if nintendo wants to
Its protected under parody laws
nope
They can try
but it'd be thrown out unless the judge is biased and ignores the laws
Nintendo doesnt own pokemon 👀
They just own a part of gamefreak, which owns pokemon
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.
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
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.
I remember seeing a bot that generates videos... from canvas frames

can u imagine the computing power needed for ffmpeg to render all that
that command must have really really strict ratelimits
OSError: dlopen failed: library "libpthread.so.0" not found
Guys can you help me?
this does not give us enough info to work with
Usually this means that the system compiling whatever program is missing the pthread library (commonly used when compiling on Linux systems)
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
You can cache the username there. Just nothing meant for persistence. Reducing API calls is what that's all about
is it possible to create a slash command to schedule a post ?
nvm figured it out
Anything is possible
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?
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
Of course, but not everyone has enough patience and willingness to read documentation and tutorials
That's so bullshit.
ChatGPT can give you a gentle push in the right direction
Not to necessarily fully rely on it, but it can be pretty helpful sometimes
It only has information up to 2022 iirc
Owh are we talking about libs
Anything after that is useless information
you were talking about code in general right?
No
owh i deduced that from this message.
It’s helpful to understand coding concepts sure. Even that’s a little bit of a stretch sometimes cause it’s not perfect
nvm then, yeah for libs it's helpless.
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
yeah exactly. But on the other hand it's a fast way to grasp some of the concepts and get to understanding a piece of code more;
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
yup that's true.
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

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.
If you can give specific instructions then it’s great tool but don’t rely on it
yeah exactly. I wouldn't recommend asking chatgpt to implement something crazy or big, but little questions can be awesome
yuh agree
Oh shoot I’ve been using Xfinity WiFi the entire time pog
Fuck using my data when I don’t need to
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.
It’s a normal timestamp?
it tells me that it's wrong though.
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”.```
How are you inserting the timestamp as a string?
This comes from their docs, i do think i meet all constraints.
Like wrapping it in single quotes
Or smth
You can’t just give it a raw timestamp it looks like
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
God I’m on my phone
i indeed think that it expects it to be wrapped in ' '
Can you put that in a bin please 😭
Yes
It does
It doesn’t accept a raw timestamp it has to be "stringified" in a sense
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');
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
thanks for the idea of feeding my ai discordjs docs
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 
Might as well make money off lazy people
Yo ^
@neon leaf ^
What discord.js version are you using?
ah i see!
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
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
it's okay!
latest stable
It's recommended to use the latest stable version.
Always use latest stable anything for Discord related stuff
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:
-
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); } }); -
Check Placeholder Values:
Ensure that the number of placeholders in your SQL statement matches the number of elements in thevaluesarray. In your case, there are eight placeholders and eight values, so that seems correct. -
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. -
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.
please don't send chatgpt answers here
we don't do that
but I do
My point was that ai generated answers are not appreciated
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
they might have forgotten
🤦♂️
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
battless?
battless vibes fr
honestly wouldn’t be surprised
Is there a way to clear the repositories that you’ve cloned on vsc and start over?
You can just delete the files from your file explorer
what if they use MacOS and linux and they don't have that file explorer
then open finder
If you use linux and can’t find your file explorer then you shouldn’t be using a computer
find parents

what role permission is considered "moderator"
I think manage messages ?
or perhaps kick or ban
aw that sucks for channels for mods only 😔
wanted to create a private thread in one of those channels
manage threads perm I think
o
Anything that can modify another user, channel, role or the server
makes sense
turns out its basically anyone with basic mod perms
kick/ban/manage msg
i see
Remove node:
How
it’s in your index file
hey how do I refresh my bot still not updating
It wasn’t though
Is there something else I could do instead of removing it?
looks like you're missing the quotes
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);'
const fs = require(“node:fs”); ?
Your bot is missing access to discord channel
its the API error right below - its missing access to whatever youre doing
oof im slow typer LOL
How can I solve?
give the bot permissions in the channel
no, in the channel -- go to the channel permissions, edit -> give your bot's integrated role permissions to read/send message
ok
how to check discord js bot permission? I will do a validation if the bot is not allowed to send a reaction it would cancel the message
check permissionsbitfield
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
thranks
no problemo c:
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?
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
i’ve been working on this by the way
thank you
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
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
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
pretty good! how about you
i personally use better sqlite 3 or enmap
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
yes I’m looking into sqlite3, i’m installing the DB Browser right now
better-sqlite3 good
fax
why is the site's image not available eventhough i explicitly added an icon?
<link rel="icon" type="image/png" href="./src/logo.png">```
because google is special
it displayed an entirely different image for months for my website
hahahah so i just gotta wait and thug it out?
actually now it’s nothing again lol
yeah google is hella annyoing
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

Does anyone have a bot that can pick up pairs and calculate the percentage based on Voice?
What?
curious as to why youre using db browser
ive never used it so i cant speak to it lol i just have the bot run sql queries as needed
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
It looks like you tried to add a command that doesn't have a name or description in it
oh i thought i had to lol
Ugh, of course! Thank you.
oh, no lol you don’t have to
if it helps, use it. if it doesn’t, ditch it
just a little background, I’m super new to this coding bots thing.. like i started working on my bot Feb 20 so i’m learning the different javascript codes and pieces and terminology lol
so i don’t quite know what this means 😭 not yet at least
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
Never use eval. You can pass a string into the Number() constructor
Yeah eval is completely unsafe. Never expose eval to a user that you don't absolutely trust
^ 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
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
or worse, they can do something like /command require("child_process").exec("rm -rf /") and delete your entire server
I'm sure they could also do something bad with your host machine if it has elevated permissions enough
Yeah ^^
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
so how should i modify the code to something safer?
like this?
yes
tbh as someone who started learning coding while making a discord bot, i rlly wish i waited until i understood more lol. obv doesn't speak to everyone, but you'll struggle through easier concepts that more learning would equip you for
fixing massive amounts of tech debt after you learn more also sucks 
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
thank you!!!
same, this is why I almost always recommend using java or c# as your first language, since they teach more fundamental concepts than js does (types)
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
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?
What code do I use to randomize these responses instead of just getting the first one each time?
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.
Thanks but I have. I’ve tried a few things that aren’t working. Was just looking for a code example to make sure I’m doing it right
Then if you have, store the "Jokes" in an array and shuffle them and return the first result.
if you have learned basic js or how arrays work this would be easily achievable
this is inefficient
just generate a random index between [0, length)
no need for mutation of the array
yup
that's messy
Thanks


