#development
1 messages · Page 257 of 1
o current-report é a area dinza, mas o current-display é o pai do current-report
e só tem o width: 100%
ele era o q era pra ter flex: 1
essa quantidade de citizen-name
ou vc deixou sem width?
nao
.citizen-list {
position: relative;
width: 100%;
max-width: 100%;
display: flex;
gap: 1%;
overflow-x: scroll;
overflow-y: hidden;
&::-webkit-scrollbar {
display: none;
}
.citizen-name {
padding: .5% 1%;
box-sizing: border-box;
background-color: var(--mdt-focus-color);
border-radius: 2vh;
color: var(--mdt-primary-background);
font-size: 1.4vh;
display: flex;
align-items: center;
white-space: nowrap;
.icon {
flex-shrink: 0;
width: 1.5vh;
height: 1.5vh;
background-color: var(--mdt-primary-background);
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
margin-right: 0.5vh;
svg {
font-size: 1vh;
color: var(--mdt-focus-color);
}
}
}
}
hm
só pra testar, coloca 1% de width e max-width
pra ver se vai encurtar ou ficar igual
ele encurtou
então n é isso
ele aumenta?
ele aumenta o container e expande o pai
ta, então é isso parece
a caixa preta onde ele ta, como ta o tamanho?
esse é o estilo dela
width: 100%;
height: 13%;
background-color: var(--mdt-primary-background);
border-radius: 2vh;
display: flex;
flex-direction: column;
gap: 10%;
padding: 2% 2%;
box-sizing: border-box;
flex-shrink: 0;
tenta com flex-grow: 0;
igual
mas q caraio kkkk
to achando q pode ser o padding/margin
o tamanho extra é exatamente a soma dos paddings
se for, subtrai o padding dos widths
tipo, width 96%
hm
por isso achei q fosse
mas experimenta tirar tds os paddings de dentro do container cinza só pra ver
parece q n é só vc https://stackoverflow.com/questions/33746041/child-element-100-width-of-its-parent-with-overflow-scroll
tenta fzer como diz na resposta pra ver se funciona
nao percebi a resposta 😂 eu nsei se tem haver com o meu bug
é suposto eu fazer o calc 100% + 100%
ah acho que tem de ser o padding ne
2x o padding
mesmo assim
coloquei width: calc(100% + 8%); mas nao funciona
consegue ir privado?
da pra ir, mas pq?
this api thing too hard ;((
if you give up that fast then you wont go far
Keep in mind that you’ve just been trying for 2 days on a concept that takes a lot of time to master. Programming is not easy and neither is researching how to solve a problem, but it is very rewarding when you figure it out
how do i get a free domain
you dont, at least not if you want those domains to be usable in any service
and not be flagged by literally anything
it's always padding and margin...
stares at you judgementally
You're in the part of bot-making where you realize either you pay up or your work ends up being just a portfolio project
One message removed from a suspended account.
One message removed from a suspended account.
is my quick start guide good? https://tutorials-vortexus.zayy.pro/getting-started/quickstart
.tech, .live and .me
first image is with next's Image
second image is with native img
hmmmmm
iirc it optimizes images hence compresses them
Yeah, anything web-related usually tends to compress images since that’s a major source of slow load times
that's fair, but it only did it with 2 out of 8 images i have
2 out of 8 were worth the compression
dont freak out i'm trying to make this
i never tried canvas on react so yuh
that's my way
ya making a tamagotchi?
lmao, kinda, except this is not a game
whatever it is it's cute
Should a CE major start with learning C++?
Learn C first
doesnt it depend from uni to uni
C is going to be more useful in the grand scheme of things because it’s more popular for embedded systems. C++ is fine too but if you know C, you’ll know C++ pretty quickly after that
Most universities are going to make you write C for a CE major, at least to start with
Yup, issue is our university's CE syllabus starts with C++ directly.
& their entire Programming I course is an absolute joke. 
You can learn C++ first then, but you’ll eventually want to learn C anyways
They’re not very far off from each other as the names suggest, learning 1 will teach you parts of the other
Yes, they're both under the C family, and C++ is an extension to C from what I know
I never officially “learned” C, but I am comfortable enough with C++ that I am relatively comfortable with C
C++ has more features (templates, a stdlib, classes, inheritance, etc) but almost all C code is legal C++ with some exceptions
Our university's Programming I course is W3School's "C++ Tutorial" and Programing II course is "C++ Functions & Classes". 
If it makes you feel any better I’m taking a senior level course right now and some of the kids only know python
You're a senior student? Ohh, just understood it.
In the UAE, some universities don't even accept AP credits. 😭
Some don’t either here
I just go to a mid tier school that accepted all 42 transfer credit hours I had
Some universities hardly don't accept any credits at all
You enter the uni, study syllabus as is (no words said) and that's it
by the end of the semester I'll be a senior
But I'll only have been at this school for 3 semesters
How many AP courses did you take for 42 credits, damn
I took not a lot
I did a lot of dual credit courses at my local community college
I think I had 19 credit hours from AP and 23 from community college
I just wish they do that here but they just don't.
I got a whopping 8 credit hours from calc BC
That class and AP Comp Sci A are the best classes I took for value
??? what.. that's so good 😂
Yeah it counts as calc 1 and 2
Honestly, I regret taking AP CSP, I wasn't aware it's fully theory.
CSP is useless ngl
I told the school I needed comp. related APs.
Instead, I was assigned AP CSP, fully theory.
I took a 4 in both AP CSP & AP Calculus AB.
The degree is the only thing that matters
I do not pay attention in any of my classes anymore and I've just been trying to score internships
Tbf, I'm not studying CS with the demand right now
Yeah, same here... rest caring about marks (which I still do, fyi) & I'm caring about opportunities
I don't have many connections in the industry but I overcompensated for that by having impressive projects when I was in high school
I got my first internship about 2 months ago, now I'm chasing about 4 others
Software Engineering internships?
Expecting an offer from 1 within the next week or so, then the other 3 are going to depend on how well I do in the interviews and such
Yeah
It was a massive grind
But worth it, now I feel like I'm actually doing something in my career that isn't school
Atm, I'm at the top of my class in terms of the "programming mindset"
For context, I'm currently freshman year, but everyone's clueless about CS/CE except me.
You'd be surprised how little other people tend to know in CS and programming in general
I feel like a lot of people do CS because it makes a lot of money, not because they have passion for it
If you have passion, that'll set you apart from everyone else
Yes, they enter clueless; are hit with the harsh reality; subsequently quit.
That's the CS pipeline
Almost 60% of my class entered because it's "the future for AI"??? (what)
Discrete math is a good filter class
People start to realize how cooked they are when they do discrete math for the first time
I thought I was cooked but it turns out I had a shitty prof because I scored almost a 100% in my discrete math 2 course
"what do you know about coding" - "nothing really", "what's a variable" - "what". 😭
People like to exaggerate what they know
You'll start to see people in your classes that have superiority complexes and ask questions to the professor that they already know the answer to so they can get validation
It's really annoying
Computer engineering might have less of that since that is harder than CS as a major
I haven't enrolled in either, to be fair
But you'll still have at least 1 person in every class that acts like that
Yeah, already having one in Calculus I.
There was a kid in my senior level class that bragged about knowing 2 programming languages
If anything by that point you should know more than 2 languages as a CS major
Isn't it already not a flex to know a lot of programming languages?
Honestly I don't think it's much of a flex
After 2 languages it's really easy to learn more
Yeah, but harder to keep track of new updates
I "know" like 9 or 10 or something like that, but I wouldn't call myself a master in all of those
I'm currently studying over 5 and it's not fun
Yeah, the moment they release a "major" update, you go ahead and sit while you read & learn the changes
I think my current list is like
Rust, C++, C, Java, JavaScript, Go, TypeScript, Python, and C#
I kinda know some dart but I wouldn't say that I know enough to be comfortable with it
I'm JS, TS, Swift, Python, Java & C++.
What I really need to do is learn a FP language like F# or Haskell
That would broaden my horizons
Do universities ever teach what you want to learn? 😂
Surprisingly I'm going to be learning a functional language in one of my classes
I think it's based on scheme
called Racket
ffs... I haven't even begin programming courses
The uni's making me finish their required courses
Welcome to uni
Thankfully I'm done with that part because of AP classes and I opted to do summer courses at my community college
bs~ just jump straight to the point... 😂
Did 13 credit hours in 1.5 months at community this summer, was brutal but I'm glad I did it
I'm not even talking about Physics, Calculus, or etc. (those are compulsory and important), I'm talking about history, country society, etc.
Yeah I had to take government first semester
If they just gave us the same opportunity in our country, but they don't... :?
You're US?
Yeah, Texas
Ah, thoughts on masters there?
Depends on what you want to do and what your job prospects look like
Cybersecurity Masters
If you want to go into something theory-heavy or with labs and such, go for it
ehhhhhh
If you're really passionate sure
I'm thinking of studying my masters at iit.edu.
Yeah, its demand is increasing, no?
tbf~ cs, ce & cse's demands fluctuate, but they've been hitting down low in terms of demand
Cybersecurity can pay very well but I'd be careful, focus on making projects and getting internships. I know grad students that can't find a job because they were too focused on school to ever build anything on their own
I'm thinking about doing a masters but ONLY if I don't have a job offer following my bachelor's. But that's because I would only need 1 year to finish my masters at that point
Exactly~ given the university aren't going to be accepting my AP classes, I might as well focus on achieving that meanwhile (and ofc before the harder classes arrive).
Build something from the ground up. Show companies that you are capable of going from an idea to a finished product
But also don't forget to socialize and have a little bit of fun. My university is so depressing because nobody does that and it's all just about classes 24/7
We have events, dw~ if they're ever managed properly
what is stairs in spanish
One message removed from a suspended account.
i made an api but ion know how to use it for my bot :/
Even in java it's fairly simple, ur not really supposed to use httprequest
Tho I still make a global function to have a one-liner
I blame java not having a native json class
oh
use dependency? or is there a native way beside httprequest?
Dependency yeah, java gives the tools as barebones as possible
Somewhat the same case as fetch and axios
Openjdk could develop a better replacement, but I doubt it's be better than what apache/square give, they've been working at it for years by now
In case ur curious, Http from apache and Okio from squareup
Think about httprequest as the last resort, no-dep option when being minimalist is paramount, at the cost of QoL
Tho it did become more streamline after streams were added
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://foo.com/"))
.build();
client.sendAsync(request, BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println)
.join();
We used to use HttpUrlConnection which...was bad, thing wasn't updated since java 1
imagine still using axios
🤢
using any lib other than the built in http lib or fetch is kinda cringe in js
so real
though you are insane if you use the built-in http lib instead of fetch
Well the main reason people use axios is because of all the additional parsing it can do
(and because they use old node versions)
:)
I don't use nodejs anymore
oohh, interesting. thanks for the insight
pro
said someone who use rust
nah
very useful documentation™️
@pearl trail aww C added a little emoji next to my text 😍
average c experience
gotta love C
I love how even printf is a vulnerability 😍
nah
pov: you forgot to null-terminate a string with *output = 0;
printf is a vulnerability if you directly feed user input to it
Because if the user feeds %p %p %p… it’ll print out addresses on your stack
wait fr?
like ```c
char text[] = "%p %p %p";
printf("%s\n", text);
No that’s safe
oh
Feeding text to the first argument would be vulnerable
But that’s an easy mistake to make
Because you’re just printing out some user input
then i get why that's a vulnerability
Maybe even for debugging purposes
Yup
It’s crazy how like 90% of the C stdlib functions are insecure
Aka anything to do with strings
Which is partially a design flaw of C strings themselves but still
UNLIKE RUST WHICH IS ALWAYS SECURE, MEMORY-SAFE, AND BLAZINGLY FAST 🔥🚀
Rust String goated 💪
OH AND ALSO UTF-8 SUPPORT 🗣️🔥
jokes aside i still love C regardless
i love the notion of being able to manipulate bytes manually ❤️
memcpy() and memset() my beloved
I like the low level aspect of it but the security of it is really annoying
If I had to actually write safe code then I would not go with C
It requires too deep an understanding of every standard function, in terms of knowing the exact behavior of each function and how to use it in such a way that it’s safe
you can make safe code in C, just put if (ptr == NULL) everywhere 
like golang
gotta love them
If C’s only flaw was null pointers then it would be a much better language
Java is a great language aside from the performance penalties you incur
C scanf regex my beloved
hey, why does my tsconfig add .default after each import?
does it matter?
yeah
because then i need to remove .default from each import manually
example:
import moment from 'moment-timezone'
🧐
now the whole code will have moment.default.property_to_be_called
I mean yeah you are transpiling to cjs
never heard that issue with ts
and that does not work, i must remove the .default like a morron.
its just what ts does for cjs
you can always add a comment to ignore the next line and keep it as-is
so there's no way at all to remove the .default?
Hello, I need help! When I create a bot, the bot is immediately deleted
Like discord is deleting your bot/
?
Are you getting emails from discord explaining why?
Discord doesnt typically delete bots without sending you some form of message, typicall in an email
No
I even checked the spam folder and they haven't sent a single e-mail.
on my old account, the bots I opened were never deleted back, this is the first time something like this has happened to me
Then I'd reach out to discord support
You can’t have same number on different account
simple
cant you just do import * as moment from "moment-timezone"?
that's what sql transactions are for
@solemn latch
It...depends, if you didn't close the connection yet then it MIGHT be reversible
Tho tbh it tends a lot towards the "no"
All in all why the hell don't u have backups
Less worse then ig
Do set backups, cron makes it so easy
All u need is a pg_dump script
Then u can make it scp to your pc if you must
To have it in a safe place
Transactions
You can rollback a transaction before you commit it
Transactions are usually reserved for millions of row insertions though
Hi i need help
const { ActivityType } = require('discord.js');
const fs = require('fs');
const path = require('path');
module.exports = (client) => {
const restartFilePath = path.join(__dirname, '..', 'lastRestart.txt');
function logRestartTimestamp() {
const now = new Date().toISOString();
fs.writeFileSync(restartFilePath, `Last Restart: ${now}\n`);
}
let shardsReady = 0; // Variable to track the number of ready shards
client.on('ready', async () => {
const shardId = client.shard ? client.shard.id : 'Main';
console.log(`Client - Logged in as ${client.user.tag} on shard ${shardId}`);
// Log restart timestamp
logRestartTimestamp();
// Set the initial status to "Loading..."
client.user.setActivity('Loading...', { type: ActivityType.Watching });
// Increment the shard count when this shard is ready
shardsReady++;
console.log(`Shard ${shardId} is now ready. Total ready shards: ${shardsReady}`);
// If in sharded mode, you can handle shard-specific logic
if (client.shard) {
// When all shards are ready, update status
client.shard.on('ready', () => {
console.log(`Shard ${client.shard.id} is now ready. Total ready shards: ${shardsReady}`);
updateTotalMembersStatus();
});
} else {
// Update the status if running in non-sharded mode
updateTotalMembersStatus();
}
// Initial status update
updateStatus();
// Update status every 15 minutes (900000 milliseconds)
setInterval(updateStatus, 900000);
});
function updateTotalMembersStatus() {
const totalMembers = client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0);
client.user.setActivity(`Serving ${totalMembers} members`, { type: ActivityType.Watching });
}
function updateStatus() {
const totalMembers = client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0);
client.user.setActivity(`Members: ${totalMembers}`, { type: ActivityType.Watching });
}
};
how could i fix this?
I didn't deep dive into your code, but try using
client.shard.ids
To get your client's shard ID.
I know it's weird being plural. That should fix your undefined issue in the logs.
Also, try
client.on('shardReady', () =>
Instead of client.shard.on('ready'
That should fix your bug. Create listeners with the client directly for shard events.
Also extra question I want to do like 3 server 1 shard is it possible?
You can do as many shards as you want manually, discord will automatically choose which servers will be assigned to which shards efficiently based on the number you choose.
I really really hate docker
Trying to have a container access a pg db that isn't behind docker seems to be more annoying than it should be
i love C
am i dumb or what, i couldnt understand this message
You need to make a loopback network
Or use the public IP of the host system
If the Pg db is exposed
why on earth does the text not get cut off with an ellipsis 😔
you need to set its width
doesnt work
what did you set the width to?
did you make sure to add it on the h3
on all of them
weird
adding overflow-hidden works
weirdly
but the flex child just expands without an explicit width
i hate css
you use tailwind?
if yes, why dont you use truncate
fixed it by setting min-w-0 on h3 and parent div
i have set it to auto
hey guys, so i have a program that uses the fnostack protector or whatever it is called, so basically it uses canaries.
The program DOES use gets though, is there any way to still be able to change the return address?
i tried a buffer overflow and all it says is illegal instruction..
Then discord will create the number of shards it seems necessary for your bot on startup, and assign servers automatically. If it's not on a lot of servers, then it will create one shard numbered "0"
auto will give you 1 shard until you go past 1500 servers
its just make another shard by itself?
yes
is this a good logo for my bible bot?
is that AI generated
The Discord logo that's 50 shades of fucked is a dead giveaway
This isn't a good representation of an angel as angels didn't have Halos
You obviously dont have to make something biblically accurate but :(
It's kinda a bad representation for your bot to be honest. "I don't wanna design a logo. But i'll let a machine do it for me" As a user I would be put off by that. Personally I just use something like "Canva" which is good for me since I have no background in graphic design and it looks okay
I agree
AI generated code, AI generated logo. What else can be generated with AI to make literally an entire bot made by AI
AI generated vps /s
lol
If only AI could generate free 24/7 hosting, preferably with 4 processor cores and at least 8GB of RAM. The world of bot developers would then be a real idyll
You want ai to generate hardware? That's called a 3D printer 
Sooo... I just need to find someone with a 3D printer to print my own 3D printer so I can make components and assemble servers that I can then rent out to unsuspecting Discord users 
And solar panels to ensure 24/7 electric to the server. 
Depends on where you live
it might not be 24/7
Also whether or not you have a battery keeping the excess power stored when its night time / when sun is not really out
😂 😂
the number of shards are determined at login, so if your bot is in more than 1500 servers when you connect, the gateway will recommend you 2 shards, and djs will automatically run 2 shqards for you
but it will not change shards while running, you have to restart it to make it check that again
<style>
iframe {
border: 1px solid black;
width: 100%; /* takes precedence over the width set with the HTML width attribute */
}
.css-1ghqurz {
border-radius: 50% !important;
border: 3px solid gold;
}
.chakra-link.chakra-button.css-u2j4ww {
background: red;
animation: glow 1s ease-in-out infinite alternate;
}
.chakra-button.css-hon801 {
background: #85C888;
animation: glow3 1s ease-in-out infinite alternate;
}
@keyframes glow {
0% {
box-shadow: 0 0 5px red;
}
100% {
box-shadow: 0 0 5px red, 0 0 10px red, 0 0 20px red;
}
}
.chakra-link.chakra-button.css-qy8lgb {
background: blue;
animation: glow2 1s ease-in-out infinite alternate;
}
@keyframes glow2 {
0% {
box-shadow: 0 0 5px blue;
}
100% {
box-shadow: 0 0 5px blue, 0 0 10px blue, 0 0 20px blue;
}
}
@keyframes glow3 {
0% {
box-shadow: 0 0 5px #65BA69;
}
100% {
box-shadow: 0 0 5px #65BA69, 0 0 10px #65BA69, 0 0 20px #65BA69;
}
}
.page__PageContentWrapper-sc-iv577v-0.iidttR{
width: 100%;
height: 100vh;
overflow: scroll;
overflow-x: hidden;
background-repeat: no-repeat;
background-size: cover;
scrollbar-width: none;
}
.page__PageContentWrapper-sc-iv577v-0.iidttR::-webkit-scrollbar {
display: none;
}
body{
scrollbar-width: none;
}
body::-webkit-scrollbar {
display: none;
}
#menu {
background: transparent;
}
.chakra-text.css-rd8i1m {
color: #00c9f9;
}
.transparentCover {
display: none
}
</style>
# Commands
moderation command
fun command
welcome system
leveling system
and many more
<iframe id="inlineFrame" title="TryHard's Commands Page" width="300" height="200" src="https://tryhard.up.railway.app/commands" />
# What I Am Currently Doing
improving my dashboard and making the bot's commands better and trying to promote it as much as possible```
the ifram doesn't show, any idea why?
Can you add a new line between "and many more" and "<iframe"
Weird, looks like you can't have anything after iframe for some reason too
aight
💀
Front end is weird af
ikr
nothing worked
I removed the lines after the iframe
and added a line between and many more and the iframe
try removing the markdown tags and using only html
how so?
like <h2>commands</h2>
<p>moderation, fun, ... </p>
<iframe>
ah
ok wait
still no iframe
well I guess it's a bug then
this isn't chat, go to #general or #general-int
this is for coding help
did you check only in the preview or did you actually save and check live?
both
oh
no wait
I'll check live
its showing up for me
and dedicated gpu, basic necessity yk yk
Its working :D im sending docker events via webhook
how can i improve this embed
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
wut
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
nuh
?

Nuh uh
One message removed from a suspended account.
One message removed from a suspended account.
I'm still salty about those cuz they changed the colours for md and it looks so bad now.
cry....
anyone know what's wrong here?
ooo oke got it, i need to make the player array a pointer
hi chat
what's the best way to make async push() wait for the result from the callback
actually i have an idea
why are those async?
hold onnn
push doesnt really need a return value, and promises.push doesnt need to be inside a promise
push is supposed to be an add operation
seems like i have to rename the push method
idea is that it waits for the callback return value
make it async then and remove the outer promise
but well, why do u need the callback value for a queue?
uh
say a slash command makes multiple http requests that have rate limits
i want to have e.g. 5 seconds between those http operations so the rate limits arent a problem
push to queue, wait for return value, end slash command
it's a bucket then
renaming the class to that..
so, you can simply do ```js
async push (item: T) {
const p = new Promise((resolveRunner) => {...});
this.promises.push(p);
return await p;
}
doesn't await p run the promise?
ah right, then u can just return the promise itself
return p
if it gets completed from another place it'll return the value to awaiters
uh
if i do that
then it gets like
run immediately
afaik
idk
doesnt seem to be working anyhow
oh im stupid
- im not pushing it to this.promises
question is
why did it run the promise anyhow
perhaps you'll need to make your own task object
how are you running the promise?
run method await runnerPromise.catch(() => {})
like, what is the class supposed to do?
it's supposed to be a rest bucket so they dont hit ratelimits
like just show an example of the class being used in code
basically a task scheduler
sums it up i guess
looks like it works (but does it?)
so basically you do new Bucket(function, n)
and then you do bucket.run()
and then it runs the function, but it only allows it to run n times concurrently?
im still trying to understand exactly what its supposed to do lol
oh wait run() is private, so you call bucket.wait()
renamed some vars
lemme send completed code
type Callback<I, R> = (item: I) => R | Promise<R>;
export default class Bucket<I, R> {
public blocking: boolean = false;
public promises: Array<Promise<void>> = [];
public callback: Callback<I, R>;
public idle: number;
constructor(callback: Callback<I, R>, idle: number = 0) {
this.callback = callback;
this.idle = idle;
}
public async runScheduler() {
this.blocking = true;
while (this.promises.length > 0) {
const runnerPromise = this.promises.shift();
if (!runnerPromise) continue;
await runnerPromise;
if (this.idle > 0)
await new Promise((resolveIdle) => {
setTimeout(resolveIdle, this.idle);
});
}
this.blocking = false;
}
public scheduleAndWait(item: I) {
const { promise, resolve, reject } = Promise.withResolvers<R>();
const runnerPromise = new Promise<void>((resolveRunner) => {
Promise.resolve(this.callback(item))
.then(resolve)
.catch(reject)
.finally(resolveRunner);
});
this.promises.push(runnerPromise);
if (!this.blocking) this.runScheduler();
return promise;
}
}```
so much cleaner code
i assume callback is an async function right?
the moment you do this.callback() that function will start running regardless
if you dont want that, you need to check for this.blocking before that
What
??
there is nothing like promise.run()
the moment you do new Promise(), its contents will already run, like a self invoking function
Another support scam attempt? 
ok guess im making it uh
callback functions
instead of promises
in the array
thank u tim
basically yeah, promises are like fancy callbacks
callbacks that you dont know when will finish
/* eslint-disable no-await-in-loop */
type Callback<I, R> = (item: I) => R | Promise<R>;
export default class Bucket<I, R> {
private blocking: boolean = false;
private bucket: Array<() => Promise<void>> = [];
private callback: Callback<I, R>;
private idle: number;
constructor(callback: Callback<I, R>, idle: number = 0) {
this.callback = callback;
this.idle = idle;
}
private async runScheduler() {
this.blocking = true;
while (this.bucket.length > 0) {
const runnerPromise = this.bucket.shift();
if (!runnerPromise) continue;
await runnerPromise();
if (this.idle > 0)
await new Promise((resolveIdle) => {
setTimeout(resolveIdle, this.idle);
});
}
this.blocking = false;
}
public scheduleAndWait(item: I) {
const { promise, resolve, reject } = Promise.withResolvers<R>();
this.bucket.push(
() =>
new Promise((resolveRunner) => {
Promise.resolve(this.callback(item))
.then(resolve)
.catch(reject)
.finally(resolveRunner);
}),
);
if (!this.blocking) this.runScheduler();
return promise;
}
}
yippee
so much for a ```java
var cbk = new CompletableFuture<Integer>();
tasks.add(cbk);
var value = cbk.get();
...
// somewhere else
for (var t : tasks) {
t.complete(123);
}
🪣
This is the implementation I've worked on for some time and found works.
80 lines so long
Its rather customizable and functional
That's what I needed for the lib
Only issues I've had is when the routify regex fails which is totally unrelated to the bucket impl
Need to fix eventually but I just stole the regex from eris
can someone help me with a python cmd
Ask the question, no need to ask to ask
idk how to make a command to enable the qotd. which would send at a certain time each day in a selected channel if its enabled
@solemn latch
@solemn latch
Well. Google how to run something every so often
If you want it at a specific time, set a timeout to wait until it reaches that time
then enable a loop
wut
whats so confusing
You can also use a cron job, but that’s more complex than what @lament rock suggested
cc @earnest phoenix
im going off my api
i js gotta fetch the data and send it at a certain time as long as its enabled
Here's a flow that should make sense:
If the time isn't right, set up a timeout to wait until the time you want to send the quote (if the time is negative, just assume the quote was already sent)
when the timeout is reached if any, send the quote then set up an interval to do that every 1 day.
In the body of the send quote function, get the quote, filter servers by which have the qotd enabled, send to a channel for each server if any.
i did
axios.post('https://top.gg/api/bots/1134246383587688488/stats',
{
server_count: 18200
},
{
headers: {
'Content-Type': 'application/json',
'Authorization': ''
}
})
.then(response => {
console.log(response.data);
})
yet it still shows as 0. It just returned {}.
did it return status 200?
just had to wait a bit and clear cache in browser
it works now
the body most of the time doesn't matter when using apis to post, all you need is the status
but yeah, topgg has cache issues with a lot of things, usually just ctrl + f5 is enough to see your changes
it wont work
i cant figure it out
what is your current progress?
That's about as much as I'd be willing to elaborate on the logic behind what I do for donor payments for my bot for example
which is weekly
honestly all that's needed is setTimeout + database, or even crontab which will make the messages be sent precisely at the same time everyday
ah, nvm, you and waffle both suggested those already
They mentioned they're using python as well iirc
py has an equivalent to setimeout
I figured as much. Or rather I would sure hope so

( ps. @lyric mountain @lament rock he's using AI to code the majority, if not all his API, he's new to Python )
That would explain it
Hi, may i know did i do anything wrong? it dont show any alert
// memberJoin.js
module.exports = (client) => {
client.on("guildMemberAdd", async (member) => {
const LOG_CHANNEL_ID = '1294785149380202637';
try {
// Fetch the log channel
const channel = await client.channels.fetch(LOG_CHANNEL_ID);
if (channel) {
// Prepare the join message with a pink theme and emojis
const embedMessage = {
content: `🌸 **Welcome to the Server!** 🌸`,
embeds: [
{
color: '#FF69B4', // Pink color
title: `🎉 New Member Joined!`,
description: `> Welcome, **${member.user.tag}**!\n> We're excited to have you with us!`,
thumbnail: {
url: member.user.displayAvatarURL({ dynamic: true })
},
fields: [
{ name: '👤 Username', value: member.user.tag, inline: true },
{ name: '🆔 User ID', value: member.user.id, inline: true },
{ name: '📅 Joined Server On', value: `<t:${Math.floor(member.joinedTimestamp / 1000)}:F>`, inline: false }
],
footer: { text: `Member #${member.guild.memberCount} in ${member.guild.name}` },
timestamp: new Date()
}
]
};
// Send the message to the log channel
await channel.send(embedMessage);
} else {
console.error(`Channel with ID ${LOG_CHANNEL_ID} not found.`);
}
} catch (error) {
console.error('Error handling guildMemberAdd event:', error);
}
});
};
how do i advertise my server, bot, and api
try asking AI
Rude
You could fetch your server count instead of just putting an estimate unless this was an example
any logs or errors in your console?
nope
Are you sure you have the correct intents enabled?
can you show your index.js?
or the place where you create a new client?
the event thing i use the same which the one same with my bot
you need to add the GUILD_MEMBERS intent to your client
GatewayIntentBits.GuildsMembers?
yes
is there like a way to list all intent?
you can do like console.log(Object.keys(GatewayIntentBits)) if you want to list them all
or if you want to apply them all, you can do intents: Object.values(GatewayIntentBits)
The documentation probably has them too, the documentation has everything
const client = new Client({
intents: Object.values(GatewayIntentBits)
});```
like this?
here is the full list
yeah
Thanks
embeds[0].color[NUMBER_TYPE_COERCE]: Value "#FF69B4" is not int.
is this color error?
Try 0xFF69B4 instead if you are using discord.js v14
Discord takes integer based colors, not hex
that was first time i tried just to see how to do it and it wasn’t estimate i got it from dev page
oh alr
hi woo
Hi ^-^
hi woo
hi tim
hi woo
you are not woo hi
lmao
what library are you using
idek
because for the programming language x and library y it will be different than the programming language a and library b
so you coded a bot but have no idea how? amazing, then we can't help you either
pretty much
i can send the script
how did you even code it if you have no idea what you're doing?
copy pasted?
good thing you have the active "dev" badge though
my friend made some of itt
built off it with chatgpt
simple
share the part of the command
how do i put it in a codeblock
...
```
code
```
@bot.slash_command(name="verse", description="Fetches a Bible verse by reference.")
async def fetch_bible_verse(interaction: Interaction, reference: str):
data = await fetch_data_from_api(f"https://praxis.multiple-uses.site/verse?ref={reference}")
if data and data.get("text"):
verse = data["text"]
ref = data["reference"]
# Create an embed for the Bible verse
embed = nextcord.Embed(
title="📖 Bible Verse",
description=f"**{verse}**\n\n**{ref}**",
color=nextcord.Color.from_rgb(31, 86, 149)
)
embed.set_thumbnail(url="https://i.ibb.co/nR7Wv5J/logo.png")
embed.set_footer(text="Powered by Praxis API")
# Send the embed response
await interaction.response.send_message(embed=embed)
else:
await interaction.response.send_message("Sorry, I couldn't find that verse.", ephemeral=True)
and what's in the requirements.txt file
i dont have anything in it yet
im js making it in replit
then puttting it in a host
😔
and what's at the top of the file
what imports
import nextcord
from nextcord.ext import commands, tasks
import os
import json
import asyncio
import requests # Add requests for API calls
from nextcord import Interaction # Corrected import for Interaction
Either use docstrings or set the option to
reference: str = nextcord.SlashOption(description="....")
where do i put that
As I said, set the option to that
Look where you have something similar and replace it
Also consider learning python, discord bots are not meant for beginner neither people that can just use chatgpt or whatever else shitty ai
nextcord, the library used in your case, is not a library meant for beginners
im pro!
im still lost on where to put it
is it so hard to ctrl+f
you being that lost clearly shows the opposite
sooo
do i replace the whole line
or just add it on
Re-read
async def fetch_bible_verse(interaction: Interaction, reference: str = nextcord.SlashOption(description="eg. John 3:16"))
like that
?
try it and see
i did
keeps showing errors
async def fetch_bible_verse(interaction: Interaction, reference: str = nextcord.SlashOption(description="...."))
File "/home/runner/Praxis-Bot/main.py", line 99
async def fetch_bible_verse(interaction: Interaction, reference: str = nextcord.SlashOption(description="...."))
^
SyntaxError: expected ':'
got it
how and where can i make a bot
I heard you have to type some magic words into a computer but idk
A
gonna be honest to you, I see devs come and go around here, some doing exactly what you're doing
it never ends well, they always lose all the motivation and end up with a half-assed bot
it's time to stop, drop and roll to do it the right way
run a newbie's python course till you get what's what, then start build a bot, brick by brick
can you make a slash command that can only be used 3 times per user?
yes, just make a db to store how many times its been run by the user, and block them once it hits a specified number
so there is no app_commands check for it? provided by discord.py
no idea, what you could do, is make your own decorator check for it
databases seem like a waste of time, when i could do it more simply, still learning code so
or use a .json, not recommended for big projects
ok
i would be more than happy to help if you need any assistance
NO. JSON files should be read only. Read and write mixes are awful
Writes should be done when you are done with it totally like on process exit
ive never had any issues
I only use JSON to pickup where I left off on process restarts for ephemeral data. If they had it in such a way where they kept that data in memory for the time being and wanted to pick up after restarts that's fine, but people would build a reliance on JSON for what it wasn't made for. It isn't a db
it aint that deep bro
Most of the frequent proficient devs here would probably tell you similar stuff
again, its not that deep
It's deep when people give amateurs advice that can lead to pitfalls
its not that deep
What a conversation
its very deep bro
speaks to my soul
Though I agree with mr Ophidian
Json is a terrible thing to recommend as a persistent database

L

that shit was peak
i used to always do that a few years back when i was getting spoonfed code
cant lie my go-to has become either sqlite or mysql.
I like the way that sqlite is basically plug and play lmao, but mysql needs like a whole structure, login, daemon etc running...
but i think it's more safe than just a local file you can accidentally delete
I just use postgres, because its so simple to spin up a docker container
hey @neon leaf
could you quickly add me as a friend i need to send you something in the dm
ok
dpy cant provide everything
and dont be afraid to use databases, they're not highly expensive premium storage, they're just storage
JSON is indeed NOT made for interactive data retrieval and storage at the exact same time, but as long as you sync the read and writes and make sure that the each interaction with the json 'database' happens on refreshed data, all should be fine for small scale projects
There is a change of race conditions though if 2 ppl interact with the same json at the exact same time, but at that point just implement a lock type shit.
orrr spend 30 mins figuring out sqlite instead of trying to build a json database
no but i get where they are coming from though
i was like this as well, it's just a human tendency to stay with the things you are familiar with and not go with 'hard' and 'scary new' options that may be better.
And for a small case project, it doesn't really matter
People seem to be "afraid" of databases for some reason 
yeah
sql is scary
step 1 - create a file
step 2 - point sqlite package to that file
step 3 - done
cant get simpler lmao
actually step 1 is optional even, most libs will create one if not found
Sql is fun, overall working with data is fun.
Except for working with Hadoop. That shit is deadass fucked up.
Scala used by spark on the other hand is cool and allat, just don't like hadoop's way of fucking serialization and class objects.
Hi
Oop
so it adds 1 after you restart it when you past 1500 server
why can it do it automaticly
There is a way to fix that if you haven't figured it out yet
once a session is running you cant change its shard count
you need to create a new session with a new shard count
since the shard count defines which guilds go to which shard, when the shard count changes the guilds also change
Guys i need some quick AI for a specific light task
Its supposed to put a link together on a certain message
In a way that i cant handle with regez
Regex*
Any suggestions?
I have fixed it thanks a lot tho for your concern!
Sure u can't?
Yep
any example?
Ahhh
Btw can you force another shard being added
you cant change an existing session, but you can have multiple sessions running at once
you also dont need to have all shards in a session running, you can have a session with only certain shards running, leaving other shards offline
but how the guilds are spread through the shards will be different every time
Ahh
so you cant really mix sessions
for example running a 2-shard session at the same time as a 4-shard session, both sessions will have different guilds in shard 0 for example
Hmm
well, its not technically right to call it a sessoon
its basically just "i want to connect shard 0 out of 4" vs "i want to connect shard 0 out of 2"
it will be the same shard 0 but will have different guilds on it
i rewrote almost 90% of one of our projects which made many things much better but now means that im responsible for it 
rip
in postgres, can I do INSERT INTO ........ RETURNING * ?
what i know it may working is INSERT INTO ......... RETURNING id
yea
You can
nice to hear, thanks!!! :D
what's the returning for?
to respond with the created rows i assume
what do you mean?
e.g. your id is a uuid generated, you insert and get the id back
let's say the user is on /products and creates a new product
it gets inserted, uuid generated and returned
sometimes you want to know how many things were inserted or updated, RETURNING allows you to return that
then the client can directly go to /products/{uuid} without the backend having to select the last inserted row
so the uuid generation is from postgres's end?
for example, yes
interesting, never knew postgres could do that
many can?
look i am not that deep into SQL lmao
im just using auto increments
why not just a unix timestamp and a random generated number bitwise OR-ed
because uuids have become a standard
i understand that
or auto increments :^)
meh, that's not really recommended
why not
depends what you do though
having user id 1 is weird 💀
the OG row
some simple media player
imma think that later
why the reaction?
you can but I dont advise
it may lead to hard to debug errors regarding column order in *
ooh, so it's just about order?
havent tried it yet but my guess that it can parse it correctly no matter the order is (?)
pretty much, tho you also increase the return data side since ur returning more stuff
it depends on the library usually, most will map columns by name so it doesn't matter
but it's a good standard to always be explicit about your columns when working with sql, merely because it's very predictable about what's doing what
oke, thanks for the advice!!
2024/10/15 17:11:21 [error] 850#850: *14236 upstream timed out (110: Unknown error) while reading upstream, client: 172.71.30.169, server: , request: "POST /zitadel.admin.v1.AdminService/TestSMTPConfig HTTP/2.0", upstream: "grpc://127.0.0.1:8080", host: "auth.chimeralabs.sh", referrer: "https://auth.chimeralabs.sh/ui/console/instance/smtpprovider/generic/create"
2024/10/15 17:20:50 [error] 850#850: *14288 upstream timed out (110: Unknown error) while reading upstream, client: 172.69.70.64, server: , request: "POST /zitadel.admin.v1.AdminService/TestSMTPConfigById HTTP/2.0", upstream: "grpc://127.0.0.1:8080", host: "auth.chimeralabs.sh", referrer: "https://auth.chimeralabs.sh/ui/console/instance?id=smtpprovider"
2024/10/15 17:21:51 [error] 850#850: *14297 upstream timed out (110: Unknown error) while reading upstream, client: 172.71.31.80, server: , request: "POST /zitadel.admin.v1.AdminService/TestSMTPConfigById HTTP/2.0", upstream: "grpc://127.0.0.1:8080", host: "auth.chimeralabs.sh", referrer: "https://auth.chimeralabs.sh/ui/console/instance?id=smtpprovider"
2024/10/15 17:30:02 [error] 850#850: *14301 upstream timed out (110: Unknown error) while reading upstream, client: 172.69.70.75, server: , request: "POST /zitadel.admin.v1.AdminService/TestSMTPConfigById HTTP/2.0", upstream: "grpc://127.0.0.1:8080", host: "auth.chimeralabs.sh", referrer: "https://auth.chimeralabs.sh/ui/console/instance?id=smtpprovider"
2024/10/15 17:31:03 [error] 850#850: *14303 upstream timed out (110: Unknown error) while reading upstream, client: 172.71.31.133, server: , request: "POST /zitadel.admin.v1.AdminService/TestSMTPConfigById HTTP/2.0", upstream: "grpc://127.0.0.1:8080", host: "auth.chimeralabs.sh", referrer: "https://auth.chimeralabs.sh/ui/console/instance?id=smtpprovider"
I have this nginx error log, anyone can tell me what it means/ what could cause this? this is using grpc_pass rather than proxy_pass
Ask chatgpt if you havent

?
argh
I hate nginx
I have to build it from source, since i need to add modules that aren't in by default

and now my stuff no worky
use openresty
its nginx but with lua modules
man I would but idk if I have the patience rn
What is the difference between the two?
openresty is a fork afaik
OpenResty® is a full-fledged web platform that integrates our enhanced version of the Nginx core, our enhanced version of LuaJIT, many carefully written Lua ...
honestly idk what the issue is
and at this point i;d be willing to pay someone to solve my networking issue
💀
I've been at this for 4 days now
Only rip if i fucked something up :^)
You have 144 typos
In one of the script lines
Causing it to fail with a fatal error
Such as what you stated
Which is very common to get this type of error honestly
Are you using Linux to code all this?
Np
solved it with gpt its fast and most of the time does the job better than any regex or function
nope
@quartz kindle is there a way to restart the bot automatically when it needs another shard?
pro
I believe it should reallocate automatically on auto
I mean, I can't imagine bots like dyno full restarting every 1500 servers
lowkey I could see that happenin
It takes a loooooooong time to coldboot a big bot
Because you'll face IDENTIFY ratelimits often
true
if you are using async then yes, diesel-async + deadpool
deadpool handles pooling, and diesel-async allows you to use diesel asyncronously (obv)
Womp
what's a deadpool
nope, it wont do it auto
i have no idea what actually happens if for example you keep running a shard continuously until is goes past 2500 guilds
but either they let it pass 2500 and do nothing, or they terminate the session and ask you to reconnect
but djs for example will not launch a new shard, it will try to reconnect using the existing shard setup, and probably fail
djs decides the shard configuration during startup only
you often get by the websocket an event to reconnect and resume session, i guess it's done here - you'll get kicked and when reconnecting if you don't have the good amount of shards, it won't let you connect
so you don't really need to do anything, just let ws tell you to reconnect and then it will reconnect - and libraries should handle that
resume doesnt change shard count afaik
you need to connect with a new session with a different shard count
i dont think libs change the shard count number from a standard reconnect flow
the lib should do the following:
- try to reconnect, receive invalid session
- get /gateway/bot
- check that recommended shard count is different than program's current shard count
- terminate all sessions/shards
- create new shards with updated shard count
idk if libs do this when running internal shariding, but i am pretty sure djs wont do this when running normal/child_process sharding
or maybe they will idk, check their sharding manager code lel
One message removed from a suspended account.
character development
no but if you don't reconnect with the right amount of shards you'll get rejected
How to get the server count on a bot
on "a" bot or on your bot?
the former you'd need to rely on whatever they posted on topgg
the latter depends on what lib u use
you can fetch a specific bot using the api, it'll return the server count shown in the page
unless you actually mean posting the server count
to put your server count on top.gg you need to send the server count yourself using the topgg api
How Cen I do that?
you can either do it manually or using a top.gg library
what language are you using?
Js
are there any servers where people talk about start up ideas etc? 
i got some ideas. who wanna build it with me 
Tim
lmao
fiverr has some cheap workforce 🙃
would you pay me
I mean you get equity
we get paid if we many moni
Plus prototyping will probably only take like a week
Just throwing the idea out there
I don't think Tinder is about dating 
Dating apps are very difficult and expensive to create
absolutely 0 experience with mobile apps
But just saying this is like an extra flavor to your typical dating app experience
It’s really just react
Nothing extra
React native 
Real
Lmao I mean it gets the job done
Why chase the rabbit hole when we wanna build something quick and dirty to see if it works
i generally avoid (making) any apps that hold personal info:/
Prototyping would be even simpler. Set up some page showing how it’d work and get a waiting list for people to sign up
Isn’t that every app to an extent though
personal like real names mobile numbers etc
I mean dating apps do require some info tho
Names and numbers are not that sensitive
they are
We don’t even need to share numbers
Credit cards are sensitive, but names and numbers are very commonly leaked
It’s a messaging app. Users can exchange numbers of they want
getting your full name leaked is just a few steps away from your home address being leaked :v
You’re worrying about things that don’t matter here
Not really no
Bro your data is alr leaked
yes really white pages and dumbass relatives on facebook

If someone can find your home address from your name then you shouldn’t be posting your home address online
not really
nah
white pages
Nah it is
lol
Think about how many social media celebrities don’t have their address leaked
they often do
it is
Or atleast 100m
This is a bad idea here
Hype = pressure to release an app = releasing an unfinished product
Some other way to validate the idea then
Oh no dw

It’s just to see how many sign ups you’d get
Then release it 6 - 12 months after
While leaking your idea? Fantastic idea lol
Well maybe we need some working prototype
most people aren't celebrities and most people i saw getting doxxed was due to white pages/relatives rather than them leaking that themselves
But there are products that have a wait list
If it actually got traction you’d be outpaced by a corporate conglomerate
It’s common way to validate quickly
And what does anyone want with an average person’s address
Ye true that’s why gotta build mvp too
Another point: why would it get leaked
anyways
send you unpaid pizzas
Fam once you get rich you can hide all you want
You could do that to any house around you.
Lmao
Irrational fear
Fr
They don't even deliver pizza to me 
people on discord on the internet in general aren't "average" people plus it's easy to have someone obsessive target you
Calm down man
Is this a new guy
Nobody is going to meet with someone on a dating app without their real name too lol

We are not average 
Fr
i hoard databreaches
Bro data breaches alr happened and they alr have your data
Your data is probably already online somewhere
Just last week the biggest insurance company in my country was breached with over millions of data
give up mindset
And it’s suspected that CTO of the company sold it cause he want more money
I’m against storing super sensitive data myself like SSNs or credit card numbers, that stuff is different
sure, find it
And this is a huge company that was trusted for years
i'll pay you
that's why i offered to pay you https://cdn.discordapp.com/emojis/1198325952116174879.webp?size=48&quality=lossless&name=frenzied_cat
Pay me for free if you got so much moni

Stop being unnecessarilyparanoid pls
Nobody knows who you are
Well if serial killers are using dating apps idk what to say man. Wtf
Then stop using the internet and go off the grid




