#development
1 messages Β· Page 271 of 1
Need to do a bit of testing with how stacks will work and also do permission controls too
I also made a nice task list for long running operations π
just curious, is there anything in your project that portainer doesnβt have
Yea it's gonna have a bunch of developer tools and services integrated into it like project/website management, short links with customization, pastebin/privatebin, game console access for minecraft/battleye, server tools, image gen, API access (which portainer does not have)
i see, interesting
Minecraft and Dayz/Battleye games rcon
Brent desk mvp
now top dot gee gee is no longer modern because it doesnt use mongo anymore
Fr? :o
Running sqllite now? 
- exposing it to the frontend so that there's no backend needed for fetching data, client-side ftw
/s

Thats why its called Serverless, right?
hellyeah
heck yeah π₯
Just ship it all to client!
we just need to make sure we sometimes send the local sqlite db so that they can update the served db
just to be sure things are up to date for everyone else as well
Can someone assist me with this issue
are we meant to mind read the issue
aren't you a seer? unfortunate
Mb mb
The program does not return any output in the canvas
open dev tools, go to console, check errors there
happy bday tim
Happy birthday
tenk yu!!
look on github sponsors mighty sir
oh my, thanks for the birthday gift :))
<3
hbd Tim!!
How many segfaults will there be today
@lament rock@crystal wigeon tenk yo tenk yo
how do discord activities work visive top.gg?
can you post them just like a bot and people invite them
im just starting to learn about activities after making a couple bots a long time ago
also im researching how i would get into making an activity using unreal and c++ (and i assume some js is required as well)
so any info/links on that would be amazing
K thx
I dont think topgg accepts activities on the list
for the same reason they dont accept interaction-only bots
as for your other question, you dont need js, you'll make a game as you would normally, then export for web
be aware that the game will be running in a browser, so dont go too fancy
used to using unreal and have been spending a lot of time learning c++ lately, looks like the better option for this is to use godot and learn gdscript though
godot works well, albeit unable to use c# for web on latest version (and I refuse to use a python-like lang to code a big project)
I have yet to try unity as they seem to have good support for web apps
this is a remake of a pixel art bot game i made where i would draw pngs and send them, i figure if i can make it this way it can exist out of discord and actually be animated and a proper game
do you even need an engine in that case?
that should be simple enough to make using raw html + js (+ jquery)
i don't know javascript though
i did start remaking the entire thing as a bot using c++ only and started getting fancy with performance maxxing then i realized this was an option π
create your own engine
you'd be surprised how powerful a simple ECS and renderer can be
the hardest part is just finding out a way to export to web
Hi guys, i currently use postgres for most of my db tasks in my bot.
But there is a new feature im introducing where i have to store all the messages of each person in a certain channel, and then after a x amount of time i extract them out and clean it from the db.
For now i have used a statemanager with just array's but i don't feel thats right.
What do you guys suggest i use, so something quick and not heavy
so basically it's a ticket transcription feature
idk what a statemanager is, but could instead of saving to the db, fetch the last N messages in that channel
you can only fetch 100 at a time, but you can do it in chunks till u reach the start
it is a transcription but not for tickets, and these channels are debate channels. (up to 5 hours)
i would not trust discord with that
fetching will be the best way if you dont want to store thousands of messages
considering the messages will be deleted after 2 - 5 hours
most of them after 2 hours
yes, but still
on a hot topic it'll be several messages per minute
but huge ones
by fetching you can take your time processing them all without bloating your bot's memory
yeah but i was thinking of using a db instead of an array
it'll waste a lot of I/O unless you use a separate DB specifically for that
r u sure i wont get rate limited by discord
there's a bulk message fetch endpoint, just give it some time between chunks and you're good
okay thank you!
you can also transcript as you go
like, if it's a file output you can use the logging technique
basically make a queue to store the messages, then every X seconds you flush to the file
this would be the most straightforward option with zero fetching required
whats the difference between that and just using the db?
no entries deleted, no post-processing, no second queries
and the only memory spent would be the one you reserved for the buffer
this is a very common technique for loggers when you have many threads and a lot of writes at once
because from the file's POV, it's only being written once every few seconds
oh gotcha, that makes sense
i will probably go with that. However i do need to store each user id for each message and the channel id they came from
would that be possible with a file
you can format the file contents however you want
would json be ok
what were u planning to do with the messages afterwards?
or csv
they will go through a AI query
and be summarised
then i don't need em anymore
well, it doesnt have to be any format in specific, just something the ai can understand
well the ai does need to know the users
or the usernames at least
and then i need to know which channel it was taken from
@lyric mountain can u go dms real quick
aight
would 1 file per channel be ok? so i can just drop it after the debate is done
yep
get it prod ready 
You could try test out the docker features if you like at the end of the week when i release this build π
wao, didnt know portainer got that
You mean the process list?
You basically click the stats of a container
And it will show the process and graphs
Gonna replicate this and improve it in my project
I could probably even implement like alerts if a certain container cpu usage is being maxed out > 70% total
ππi know the graph is there but didnβt realize there is processes ;D thanks for letting me know
Can someone say me how to make an discord dashboard on Discord.py? Also I am on phone β οΈ
you cant make one with d.py
you have to use some web framework (like flask in python's case) or straight up html
then you make an api to supply info to the site
the api can use d.py to retrieve data tho
d.py can only make bots, for a dashboard you need a site + api
so yeah, you'll need to learn separate stuff
tho being on a phone will make it much harder for u
if (rawCtx is not SocketUserMessage { Channel: SocketTextChannel channel } reactedCtx) this is cool 
Nope
I mean - if you set up such condition you should already handle that rawCtx is failing it
or I'm understaing it wrong
yes and no, that condition returns true when either channel and reactedCtx is not the desired type, so we never actually get null value (in my case, i return it)
Ah right
I have big codebase in plain react, but I'm struggling with SEO (google does it better when we're doing the SSR thing). Anyone have any ideas, how can I smoothly move my codebase to Next.JS so SEO will be more... working? π
follow its guide for integrating into an already existing react codebase
In retrospect there isnt much difference between react & nextjs since all nextjs is just a framework that has built in routing and other features
All you gotta do is learn how its routing works and thats pretty much it
graph theory my behated 
what's the best and cheapest way to keep a large(10,000) rank order list?
like a leaderboard with 10,000 players and they check their rank 500 times a days. and ranks are changing all the time
wdym
like a 10,000 person chess tournament
Ah okay
so for example, with topstats
we store the rank and the vote_count in the same table
we calculate the rank every hour after the votes update
is that a mysql table?
and then a query like this?
"SELECT COUNT(*) FROM player WHERE mmr >= %s ORDER BY mmr DESC;"
and thats 45k+ bots
yup pretty much
do you think postgres or any sql database will be cheaper than DynamoDB for this use case?
i think it would be around $15 a month to handle those queries via DynamoDB
i'm not sure though
the pricing is confusing
actually i think my math was way off.
10,000 * 500 = 5 million read request units
5 * $0.125 = $0.625
what kind of instance/machine is the sql db running on?
oh wait, this is daily. $0.625 * 30 = $18.75 a month
a dedicated server lol
16gb+ ram?
i'm guessing a free tier EC2 instance wont have enough ram or cpu power to handle that
i think running redis on an EC2 and using ZREVRANK might be the best way. it'll only use around 10MB of memory for a list of 10,000 numbers
https://redis.io/docs/latest/commands/zrevrank/
uhh
timescale only takes like 12GB
and postgres uses less for me
hold on lemme check
cause rn topstats has zero caching so it's worst case scenario for you ig
postgres uses under a GB of ram
Yea pg is rather cheap
nice, so that's an option too. it's going to be annoying to make sure the data is synced between dynamodb and sql or redis
could just move to postgres and use prisma
i'll check that out. i was looking at upstash.com for redis hosting
this is what AI is saying
@quartz kindle @lyric mountain @pearl trail thoughts? https://devblogs.microsoft.com/typescript/typescript-native-port
it still compiles to js right?
tsgo πΏ
that's a bit stereotypical
ok, apply to his "jobs"
i'm not looking for a job, however that doesn't change that your basing something off a stereotype that anything regarding "tech" and "india/indian" is a scam
this is a scam though
its a recruitment scam, they join dev servers trying to recruit for jobs that dont exist
yes i get that, but i'm talking about the fact that they are basing part of that from the fact that it mentions india
its the same as crypto people trying to hire
4 yeras
The only person who might get offended by this is the scammer who is still a scammer and no one cares about his opinion
Every other person doesn't care

awesome
Uhm hello
It's objectively where most of the scammers are
And the use of "kindly" as well, typical scammer jargon
@dense flame
I'm trying to do borderRadius on a next/image with objectFit contain
bounding box won't match image content
are u setting height somewhere?
which element are you setting the border-radius on?
fun fact, it isn't
that's just corporate bullshit conventions that people think is java
as for this, factory is a class whose only purpose is to generate pre-configured disposable instances
for example a database pooler is a connection factory
it exists everywhere, people just dont notice cuz it's not explicitly named factory
java be like: no need of comments when the function name is the comment already
i love using a server cpu with single thread rating comparable to that of a pi 5
(3 and a half minutes to build a simple nextjs project)
so i woke up this one day and i can't fetch/pull/push from github
it times out
Host MyUsername.github.com
HostName github.com
User MyUsername
IdentityFile ~/.ssh/grainger
this always worked but now it doesn't wanna work
that's weird, i guess you use ssh?
yes
oh, you have multiple github user
origin git@MyUsername.github.com:redacted/redacted.git (fetch)
yes
but it always worked okay
times out
can you ping github.com ?
let me try again and give u the exact message, but it will take a few minutes
your isp might block port 22 i guess?
you can look at the debug logs with -v. What does ssh -vT git@MyUsername.github.com give you?
theres no way right? π
but there's still a way 
ssh -vT git@MyUsername.github.com
OpenSSH_8.9p1 Ubuntu-3ubuntu0.11, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/grainger/.ssh/config
debug1: /home/grainger/.ssh/config line 13: Applying options for MyUsername.github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to github.com [140.82.121.4] port 22.
this will 100% time out
what about this
i can imagine the isp having technical issue
still waiting
damn
pretty sure time out
you can try port 443
nc: connect to github.com (140.82.121.3) port 22 (tcp) failed: Connection timed out
that's definitely weird yeah
after updating the config file to use 443 do i have to restart anything
or should it pull automatically
we gaming
nope
ima try to ssh on my vps see if same thing happens
hope it works
π no way
is it time to call my isp?
wait let me check firewall
but it shouldn't be firewall since i haven't touched any config files on this system
π π
okay yeah this sealed things up
i switched system
from ubuntu to windows
same thing
i'll sue my isp
haha, good luck!
back to testing CCX13 π
why do you need dedicated cores
Its more the memory side, more memory for the cost.
ah
But I do want something that makes sense π
Actually its a port not a rewrite 
rust developers when they see a project not using rust
nah squeeze it through jsfuck
did this change already happen? π
Isnt it only 5.8.2 rn
which is like in 2026 if not later
they plan for some changes etc for 6.0 and then tsgo the next one
they always do
true
CPX21: https://browser.geekbench.com/v6/cpu/11002291
CCX13: https://browser.geekbench.com/v6/cpu/11002032
π goofy hetzner pricing
Their limits are really really high from what I've heard
Even if I used 40%(of the three cores) I still get more cpu power
yeah
update, i contacted the isp they opened a "major" ticket for me, and the problem has been resolved
ay
1 of 4 servers replaced with arm π
Is there an absence bot for players so that they can do an absence??
can you not post this in every channel please π
To find a bot that you need, please try searching for it on our website.
You may need to refine your search term, but with just a little effort you can find the bot that you need. Read our Quick Start Guide to Top.gg support article for more information on how to best use our search.
If you still haven't found a bot that suits your needs, then try searching on Google for it.
Cpx, ccx just makes no sense
i was thinking about trying the hetzner arm servers but i ran a lot of my own apps which dont compile on arm easily (except the nodejs apps)
compiling my rust project to arm64 failed, c++ project definitely wont compile because some of the libraries dont have arm64 code and use x86 instruction sets for acceleration
Yeah, my main issue was a rust app but GitHub added native arm runners a month ago so that wasn't too hard
Got docker logs working with a nice auto scroll toggle and up/down
auto refresh without autoscroll
I love you unironically, I want it
Docker also has a way to track file system changes might be useful to track down extra log files π
What...am I supposed to be seeing?
adding reaction in discord
post liked on bluesky
that's a screenshot
Oh wait
you have to look further down
π
lmao
That's pretty sick
Do you use a bot?
I assume right
Honestly no idea what is possible on discord anymore
π
yes it's a bot
my initial idea was just adding buttons on bluesky notifications but I thought 'why not let users react to any message containing a bluesky post'
How do you post the like to that post though?
Is that even allowed via their api?
or is it only posts that you make
bluesky has a shit ton of alternative frontends through which you can like posts - so why shouldn't you be able to from discord
you can like any post
I know its a twitter alternative
open twitter
it's technically impossible for them to close their api
interesting
bluesky is just an app view for the atprotocol
Browse and manage atproto repositories
this ironically makes edge tempting..m
https://bsky.app/profile/9to5google.com/post/3lkds45vqgb2k
Chrome for Android doesnβt have extensions, but Microsoft Edge now has a whole store
chrome is just digging its own grave with those recent updates
esp now that there are other chromium alternatives
fishing bot
Pretty much everything I want to do works on arm now
I'm the IT guy at my irl job and when it came to maintenance recently, I saw all of the PCs had a chrome update and after updating, it disabled ublock origin
Time to switch I guess
suppose so. manifest v3 is more restrictive if i recall, so ublock origin was forcefully disabled for that reason by chrome.
Yup. Funnily enough, you can just go back into the ext page and re-enable it and it still works
so mv2 is still in the code?
i guess? i mean i havent used chrome in years but using same extension on firefox.
I only deal with chrome for work because our POS system is intended for use in Chromium browsers and FireFox sometimes works and sometimes doesnt
makes sense
Personally not really trusting FireFox anymore because of some recent controversy, but I'd been using Arc for a minute anyways
didnt read much on that but didnt bother me anyway
I mean, basically FireFox going back on its promises of never selling your data and being privacy centric
ah
look into https://zen-browser.app/
been using it for a while. it's a firefox fork skinned like arc
best of both worlds
Someone just mentioned this browser the other day
ZEN MENTION
I guess I shall
hello, best browser
I'm trying so hard to use it
its comfy
i havent fully swapped either, ive just been using it for a lil search here and ther
Yeah
i had so many issues with ublock that i never had with brave its not even funny
never had an issue with ublock tbh
it was mostly youtube randomly showing ads again
prob looks nicer
It does
Oh well yeah but thats not really ublocks fault. Just yt being stronger against ad blockers
I even use some dynamic ad blockers that dont rely on hosts files and they didnt pick it up
yeah but somehow that never happend with brave
lmao youtube once lags my laptop like a lot that i can barely do navigation in youtube when im using adblocker that blocks their ads
My laptop gpu has a really weird issue with Discords tenor gif popup if you try to scroll or load a few gifs it just blanks out the entire Discord app with the theme color or maybe some obscure electron issue
Happens to mobile too
Has this on mobile as well
android?
iOS
weird, i never encountered that issue
wait you run mcjars?
thats sick dude
has fire ptero addons too π₯
chromium has so many GPU related bugs that i lost count
it is almost impossible to have a graphics glitch free experience using anything electron/chromium with hardware acceleration on
i think its partly due to graphics drivers and gpu companies making changes faster than the chromium team can keep up
Video decoding often fallbacks to my CPU for no reason
and then randomly it's on my GPU again
guys is it good practice to if bot gets removed from a server delete the server data?
Or do i keep it for future incase they add it back
we usually keep data for a week or so and after that delete it
Too hard to code
bruh my worst enemy is await
you should be able to just have a column which tracks when an entry was added then have a loop which does a query that deletes all records older than x
if i need to use async function it doesnt even error it just sets the variable to a promise
idk what you mean
yes thats what async does, when you run an async function you get a "promise" that the function will eventually finish and return some data
i ran var dd = loadData(); which loads data from json but it didnt even add guild data to data.json cause it would try to run saveData(<promise>) instead which didnt save stuff so i was wondering why didnt it save data
async function do() {
const data = await load();
data.lol = true;
void save(data);
}
i did
bot.on("guildCreate", async (guild) => {
var dd = loadData();
dd[guild.id]=dd[guild.id]==null?{}:dd[guild.id]
dd[guild.id]["prefix"]=dd[guild.id]["prefix"]==null?defaultPrefix:dd[guild.id]["prefix"]
dd[guild.id]["roleData"]=dd[guild.id]["roleData"]==null?[]:dd[guild.id]["roleData"]
dd[guild.id]["userData"]=dd[guild.id]["userData"]==null?[]:dd[guild.id]["userData"]
dd[guild.id]["commandData"]=dd[guild.id]["commandData"]==null?[]:dd[guild.id]["commandData"]
dd[guild.id]["levelData"]=dd[guild.id]["levelData"]==null?[]:dd[guild.id]["levelData"]
for (var i in dd[guild.id]["userData"]) {
if (dd[guild.id]["userData"][i]["permissionLevel"] == 6) {
dd[guild.id]["userData"][i]["permissionLevel"] = 0
}
}
dd[guild.id]["userData"].push({
"userId": guild.ownerId,
"permissionLevel": 6
})
saveData(dd);
})
what the fuck
.........
do you just have a huge json file for like all servers?
kinda
i never understood sql
or how to set up an database
json is my favourite database for now
it's also the least reliable one
And worst at the same time
i just told you i dont know SQL
time to learn
i am still gonna use json cause its dynamic
when I started with wamellow I didn't know shit about it either
well, nobody does until they learn
now it has 13k servers and handles 30k slash commands a day using sql
you can use mongodb for the same effect but faster and safe
no sql needed
well faster then json
(I'm not a fan of mongo due to performance issues and constant crashes)
isnt mongodb based on BSON?
i think it is
Yes
bson = json but binary
bson is still json
Not really lol
you can use the client with normal json
for larger searches yes
in the way you interface with it is just json
helllo
Do you think that I could clone whole disk/part using clonezilla in order to move from higher vps plan to lower one on contabo?
Could that work when I buy new vps with lower plan, resize disk partition (because lower plan has less storage) and then boot into rescue mode with clonezilla option
Hardly noticeable
anyways i dont think im gonna rewrite the entire code for the bot to use mongodb
your memory usage is though
cause it has like 20 js files that use the same json file
Yeah I guess so
How many of them js files interact with each other?
none
You'll be fine for now, but consider learning how web db's work
i kinda wana switch to a db cause
it takes 10 seconds to run the leaderboard command
there are only 12 people on it
Make a test environment and setup mongodb (I personally don't like it)
https://www.mongodb.com/lp/cloud/atlas/try4-reg?utm_source=google&utm_campaign=search_gs_pl_evergreen_mongodb_core-high-int_prosp-brand_gic-null_ww-tier1_ps-all_desktop_eng_lead&utm_term=mongodb&utm_medium=cpc_paid_search&utm_ad=e&utm_ad_campaign_id=22194044352&adgroup=174717514299&cq_cmp=22194044352&gad_source=1&gclid=Cj0KCQjwytS-BhCKARIsAMGJyzrlxSkuZyNnyeQ0yKCyqJLRv7cUHeHc1KDymI4pwu3eI2f2-J_2jDwaAuGIEALw_wcB
dbs are just way easier to interface than with... what ever you made
My developing enviroment is an raspberry pi
My sd card is probably dying rn
Then do it locally
Shut up
π€ free money
?
bot.on("guildCreate", async (guild) => {
console.log("New guild");
var dd = await loadData() || {}; // set new guild data
dd[guild.id]=dd[guild.id]==null?{}:dd[guild.id]
dd[guild.id]["prefix"]=dd[guild.id]["prefix"]==null?defaultPrefix:dd[guild.id]["prefix"]
dd[guild.id]["roleData"]=dd[guild.id]["roleData"]==null?[]:dd[guild.id]["roleData"]
dd[guild.id]["userData"]=dd[guild.id]["userData"]==null?[]:dd[guild.id]["userData"]
dd[guild.id]["commandData"]=dd[guild.id]["commandData"]==null?[]:dd[guild.id]["commandData"]
dd[guild.id]["levelData"]=dd[guild.id]["levelData"]==null?[]:dd[guild.id]["levelData"]
// remove anyone who had owner previously
for (var i in dd[guild.id]["userData"]) {
if (dd[guild.id]["userData"][i]["permissionLevel"] == 6) {
dd[guild.id]["userData"][i] // delete it
}
}
// owner = level 6 permission
dd[guild.id]["userData"].push({
"userId": guild.ownerId,
"permissionLevel": 6
})
saveData(dd);
});
``` help
how do i delete the user data for owner
lemme ask the local ai
btw how do i edit messages more?
cause it gets rate limited fast
for my ai commands it has live message thing
it edits at every 30 token for now
but i want it less
chunk it to only update once per second at max
dang bruh the ai yapped so much it crashed my bot π
I just have it like that
ok but what about slash commands
idk how to do that
You need to create a slash command loader
follow ups
oh i forgot that exists

my ai command looks like garbage
action_slash: async function(interaction, client, permissionLevel) {
const prompt = interaction.options.getString("prompt");
if (!prompt) {
return interaction.reply("You need to provide a prompt!");
}
const model = "gemma2:2b";
const system = "Be friendly";
await interaction.deferReply();
try {
const response = await axios.post(
ip + "/generate",
{
stream: true,
prompt: prompt,
model: model,
context: context,
system: system
},
{
responseType: 'stream'
}
);
let buffer = ""; // Buffer to accumulate the response
let userResponse = "";
let nextTime = 0;
for await (const chunk of response.data) {
// Accumulate the chunk data
buffer += chunk.toString();
// Split the buffer by newlines to handle separate JSON objects
let lines = buffer.split('\n');
// Reset the buffer to the last incomplete line
buffer = lines.pop(); // The last part may not be complete
// Process each line
for (let line of lines) {
try {
let restext = JSON.parse(line);
console.log(restext.response);
userResponse += restext.response;
if (nextTime == 30) {
nextTime = 0;
await interaction.editReply("Generating...\n" + userResponse + "\n-# Generated with " + model);
}
if (restext.done) {
console.log("Done!");
userResponse = userResponse.trimEnd();
await interaction.editReply(userResponse + "\n-# Generated with " + model);
context = restext.context;
console.log(userResponse);
break;
}
} catch (err) {
console.error('Error parsing JSON:', err);
}
}
}
} catch (error) {
await interaction.editReply({
embeds: [
new EmbedBuilder()
.setColor(colors.deny)
.setTitle("Failed!")
.setDescription("Failed to generate a response!")
.setFooter({text:error})
]
});
}
}
Why so many comments?
...
dont use ai to code if you want to learn
i used ai so much to code that i learned
nah but fr every code snippet i made in C# i used ai
now i know C# so well
my ai code is ~3000 lines
i cant use multiple models cause local
it takes like 10 minutes to switch to another model
completely slows down the queue
Srry I meant C not JavaScript
at least make a central database acessor lul
I also recommend not relying entirely on AI, sometimes AI may struggle with handling complex code
wtf is going on with the ips
it keeps changing from 192.168.1.13 to 192.168.1.132
and vice versa
I did
It just keeps setting the ip to one that already exists
Even tho i set the one that exists to use another one
π you did this in your router settings right?
yea
now it bound correctly
idk why but it connects with both wifi and lan instead of just lan
so i have to separate the ips
my ips havent changed in years
though I mostly just use the ips from my vpn
100.65.0.1/24
Mines been the same for around 4 years lmfao
WinSCP 
im not on windows
I know lol
Why do low param models like to yap a lot
I sent a message 2 mins ago
lol
Its still thinking
Cool
2b params - 10 token/s
that bot name is very silly to remember
its the multi-boot magic number
its what tells an multi boot boot manager that the os is multi boot
and if you want to actually grow the bot that name kinda sucks seo wise
Well, there's no data set to the variables....
lmao

i think its cause i deleted a item while iterating
a .filter(Boolean) would safe that
thats how i fixed it
btw my bot is heavily reliant on the administrator permission and it would crash without it
will it affect the review thing
Yes
no bot should ever have admin perms
NONE
ok
Literally none lol
Just set it to the normal oath
discord already handles the permissions anyways
Just set the correct ones in discord
What does that mean
And how do i set scopes then
Here
Oh
discord should disallow that permission for bots
Ok but what if i set all permissions except admin
I know lol
Do you need every single one?
I doubt you do
Maybe
Make sure
Well MEE6 is awful
ok what about this
just put in the permissions your bot really needs
the bot is in development
im adding moderation and stuff
then add the permissions when you add a feature that effectively needs the permission
when i invite a bot and see all those permissions it asks for, i just invite another bot
will discord update permissions on servers with the bot in it
no, which is why you should do some brainstorming about what you plan on adding
if one day later your bot needs another permission, you can put that in your support server announcement & website
i was thinking of letting users add a #announcements channel to their servers to send stuff
cause i dont have a website or will i plan on maintaining an support server
unless i make it anarchy
I really want to rewrite the mcjars api in rust but that means id have to make this query proper https://github.com/mcjars/api/blob/main/src/api/routes/global/v2/build.ts#L42

tbf its not as needed anymore as in the past
with cf d1 this made the api call be 200ms instead of 800ms
wtf is that nested tenary
β¨ magic
Seems okay to me
horrible
That looks horrific
ternary should be rather simple, if it looks like this, it shouldn't be a ternary
yeah I have an eslint rule that I cannot nest them
also, a lot of redundancy and repeated operations in there xd
idk didnt bother reading it
if only js had php8's pattern matching expression
there is a stage 1 proposal for that, but atm its ugly af
pg probably has a way to just pass in json and compare with that
Code use to be allot uglier back in the days lol
Almost done
alternative to Portainer
got everything set up to develop games with godot and make them work on discord activities
someone tested it on ipad and got "this activity is not currently available on this os" and i have no idea if it's discord not handling ipads well or something i've done 
your activity has a settings page in devportal i think, for choosing which platform the activity is best for.
You actually got godot working with Discord activities nice
i wonder why Microsoft didn't choose C# for their TypeScript rewrite
its a port, not rewrite though.
Looking very docker panel like
https://github.com/microsoft/typescript-go/discussions/411 if youre interested
although thats more of "why go and not why not c#"
No way exactly what i was going for 
v1 lookup translated
```rs
pub async fn by_v1_identifier(
database: &crate::database::Database,
identifier: &str,
) -> Option<(Self, Self, Version)> {
let hash: Option<&str> = match identifier.len() {
32 => Some("md5"),
40 => Some("sha1"),
56 => Some("sha224"),
64 => Some("sha256"),
96 => Some("sha384"),
128 => Some("sha512"),
_ => {
if identifier.parse::<i32>().is_ok() {
None
} else {
return None;
}
}
};
let query = sqlx::query(&format!(
r#"
WITH spec_build AS (
SELECT {}
FROM {}
LIMIT 1
)
, filtered_builds AS (
SELECT {}
FROM builds b
INNER JOIN spec_build sb
ON sb.id = b.id
OR (COALESCE(sb.version_id, sb.project_version_id) = COALESCE(b.version_id, b.project_version_id) AND sb.type = b.type::text)
WHERE b.type != 'ARCLIGHT' OR (
(sb.project_version_id LIKE '%-fabric' AND b.project_version_id LIKE '%-fabric')
OR (sb.project_version_id LIKE '%-forge' AND b.project_version_id LIKE '%-forge')
OR (sb.project_version_id LIKE '%-neoforge' AND b.project_version_id LIKE '%-neoforge')
OR (sb.project_version_id NOT LIKE '%-fabric' AND sb.project_version_id NOT LIKE '%-forge' AND sb.project_version_id NOT LIKE '%-neoforge')
)
)
SELECT *, 0 AS build_count, now()::timestamp as version2_created, '' AS _version_id, 'RELEASE' AS version_type, false AS version_supported, 0 AS version_java, now() AS version_created
FROM spec_build
UNION ALL
SELECT x.*, mv.*
FROM (
SELECT *
FROM (
SELECT {}, count(1) OVER () AS build_count, min(b.created) OVER () AS version2_created
FROM filtered_builds b
ORDER BY b.id DESC
) LIMIT 1
) x
LEFT JOIN minecraft_versions mv ON mv.id = x.version_id;
"#,
Self::columns_sql(None, None),
if let Some(hash) = hash {
format!("build_hashes INNER JOIN builds ON builds.id = build_hashes.build_id WHERE {} = $1", hash)
} else {
"builds WHERE builds.id = $1::int".to_string()
},
Self::columns_sql(None, Some("b")),
Self::columns_sql(None, Some("b"))
))
.bind(identifier)
.fetch_all(database.read())
.await
.unwrap();
if query.is_empty() {
return None;
}
return Some((
Self::map(None, &query[0]),
Self::map(None, &query[1]),
Version {
id: query[1]
.try_get("version_id")
.unwrap_or(query[1].try_get("project_version_id").unwrap_or_default()),
r#type: query[1]
.try_get("version_type")
.unwrap_or("RELEASE".to_string()),
supported: query[1].try_get("version_supported").unwrap_or(true),
java: query[1].try_get("version_java").unwrap_or(21),
builds: query[1].try_get("build_count").unwrap_or(0),
created: query[1]
.try_get("version_created")
.unwrap_or(query[1].get("version2_created")),
},
));
}```
damn, never seen SELECT {}
its probably a placeholder for format!()
ye
huh?
docker build --tag filestash
failed to fetch metadata: fork/exec /usr/local/lib/docker/cli-plugins/docker-buildx: input/output error
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
Install the buildx component to build images with BuildKit:
https://docs.docker.com/go/buildx/
docker: 'docker build' requires 1 argument
Usage: docker build [OPTIONS] PATH | URL | -
Run 'docker build --help' for more information
why is it complaining about a deprecated builder when i installed the latest docker
illegal sql statement
i would just make a view so i dont have to look at that in my code
you dont have buildx plugin installed, legacy one has been deprecated since 23.0
ty
I meant to say enterprise grade* π
I mean you can't really expect me to make something that amazing by myself xD
idk man. You're pretty cracked at code
This query was ported straight from sqlite to pg
I probably could but honestly idk if it'll make it any better
Guys is my data structure good??
π do all of these need to be classes
i liek to visualise stuff in js classes before actually making it in a data structure
```js
function format(data) {
const customFloatType = new yaml.Type('tag:yaml.org,2002:float', {
kind: 'scalar',
resolve: function(data) {
return /^[-+]?[0-9].[0-9]+$/.test(data);
},
construct: function(data) {
return data;
},
predicate: function(object) {
return typeof object === 'string' && /^[-+]?[0-9].[0-9]+$/.test(object);
},
represent: function(object) {
return object;
}
});
const preserveDecimalsSchema = yaml.DEFAULT_SCHEMA.extend({
implicit: [customFloatType]
});
const loadedData = yaml.load(data, { schema: preserveDecimalsSchema });
return yaml.dump(loadedData, {
schema: preserveDecimalsSchema,
sortKeys: true,
lineWidth: Infinity,
});
}
never ever use var
unless that isnt js
it is
then dont, use let instead
var has scope issues you'll eventually run into
it exists solely because legacy web
is this good use?
this.onscreentitle = `${emoji} ${name} `+((count)=>{if(count != 1){return `(${count}x)`}else{return'';}})(count)
I think so, just beware excess
tho I'd make a separate function personally
inlined functions will get ugly if you format the code, and can get very unreadable
anyways how to try to convert this to sql
well, do you know how sql works?
all i know is create table and select
ok, which database are u going to use?
sqlite
you basically just declare your classes as tables then, sqlite only has a single datatype for each type
ok so how do i make types in sql
like, to use your first class, it'd become
CREATE TABLE economy_data AS (
user_id INT PRIMARY KEY,
cash INT NOT NULL DEFAULT 0,
bank INT NOT NULL DEFAULT 0,
daily_claimed TIMESTAMP,
weekly_claimed TIMESTAMP
)
if it's a number without decimal it's INT, if it's a string it's TEXT, if it's a decimal it's FLOAT
and so on
in other databases you'd have different types depending on context, but sqlite is straightforward
as in, select into a js class?
no like
in c# would be
public class uhhtest {
uhhtest(bool aaa) {
this.aaa = aaa
}
}
public class testtwo {
testtwo(uhhtest bbb) {
this.bbb = bbb
}
}
i havent use c# in a while so sorry if wrong
not that cry lul
in sql tables are what your classes would be
and the rows would be equivalent to instances
ok so if i make a table i can just use it as a type?
well, no, you link to it through a foreign key
for example, in the ddl I sent earlier there's user_id
you'd use that value to find a specific row in that table
ah, yeah lmfao
I'm skim reading the chat
ok i dont understand at all so imma just ask chatgpt to tell me how do i create a table with types as other tables
if there were other tables that'd need to refer to that table, then you just save the same value in it
consider this:
or are there any other sql providers that have custom types
wait
ohhh
i see
FOREIGN KEY (itemId) REFERENCES InventoryItems(id),
this is an example it gave me
CREATE TABLE owner AS (name TEXT, birth DATE);
CREATE TABLE car AS (id INT, owner_id INT, color INT, model TEXT);
CREATE TABLE wheel AS (id INT, car_id INT, wear FLOAT);
no need
i understand now
thanks tho
sql doesn't use types in the same way programming languages do
in this declaration it's telling the table where itemId points to
so u cant insert a row with an itemId that doesn't exist in InventoryItems
sql is too confusing
it's just different, you'll get the hang of it with usage
you dont insert objects inside objects, you just put them in their own tables and link them together through an identifier
is postgres good?
i found a guide
sigh, look, postgres can have custom types, but that's not how sql works
you'll ve trying to fit the circle in a square hole
all i want is a db that i can use like json
thats called mongodb
is it easy?
the thing is i want something dynamic
so if i wanna add a feature to my bot
i can add another item to the data
you can do that with any db
every database has their pros and cons, dont just choose based on what is easier
if u want something close to json then there's redis, albeit not made to be used like that
do note that it's hell to have it work in windows
im on macos
it's only windows the issue
ignore the cloud part, just install locally
oh you need brew
i dont have brew cause 12.7.6
imma use the linux version on my server
isn't brew the core feature of macos?
wrong
its a community made tool
none
hm, I thought being based on bsd it'd have some package manager built in
no
its not bsd based i think
it uses darwin
which is their own unix clone
anyway, I'd seriously recommend eventually learning how to work with sql, most tech jobs you'd find out there will have some form of interaction with it
what did u do?
i did the commands on the docs
for linux
oh it fixed
i did apt remove redis-server
π I wonder what doesnt run on arm right now
windows on a raspberry pi 5
and fortnite
-# but that is coming soon already
I mean server side
rust had some issues a few years ago iirc, I wonder if thats still an issue
rust is fine
hmm
imma just use mongodb
There is no arm64 debian can i just use ubuntu
They both use .deb
How do i log into mongo bruh
By default mongodb is authless you need to set the root password, enable authorization in config file and restart mongodb
It doesnt support arm anymore
imma use postgres
cause it works on arm
Ok you never used a phone or you never heard of computer architecture π
arm64 is a more efficient cpu architecture used by phones and single board computers
i use raspberry pi
which is arm64
x64 however is the bulky cpus
Intel is x64 based
Low power cpus use arm64
You can get 3ghz out of arm64 at 25 watts now
Darwin is BSD based i believe.
im watching a sql tutorial
imagine you have 2 documents, they're related but from different contexts so you must store them in separate drawers
how do you link them? with a label/identifier
that's how you do in sql too
(which is named after the 8086 chip)
quick question, i am setting up my bot with docker the bot uses postgres as a db. Should i setup the db as well with docker or should i do it separately
I tried to deploy wamellow with docker, but I just couldnt get the bot to connect with postgres - got connectio refused errors all over
even though I added 0.0.0.0/0 to the hba conf and as listening to all (*) network interfaces
I am probably just stupid but still
Docker is a fantastic option for deployment. Especially with Postgres
i had no issues with Docker networking between the two for mine.
i fixed that part just now
when i setup a new vps its really a pain in the ass to download docker and everything
i was just wondering what u guys do
yeah that's what i have done until now
installing Docker engine on fresh VPS/VM seemed painless for me, i guess its different for each distros.
as for networking, i currently have postgres and bot containers in same compose file and use the postgres container's hostname for connection string
You shouldnt default to 0.0.0.0 btw that exposes it to the internet use 127.0.0.1 for localhost
Docker is very easy to setup
was just for debugging, I removed it again
i meant postgres here
my bad
Docker by default bypasses the firewall so its accessible to the internet unless you alter the iptables.
thats normal, no altering needed then
Yeah with docker Postgres is super easy to set up. Definitely worth it
this finally has 1:1 parity with serde_yaml for rust π https://pastes.dev/vtpqKSQyUU
serde_yaml πΏ
isn't it deprecated
is it
i mean
I highly doubt any exploit can exist in this for rce or whatever
if just parsing is outdated its fine
shrug
dont want to bother making the js implementation have 1:1 parity again
yeah null why are you blocking requests
your browser is not allowing you to use the file:/// protocol, you need to use a webserver and load it via localhost
also, you need to add type="module" to your app.js <script>
Kk thanks
is that fast?
not fast, blazingly fast π₯π₯ ππ π₯
blazingly fast, the endpoint requires quite a lot of server side processing
(also I changed the implementation from O(n*d*n) to O(n*2) but shh)
Hi guys, I want my uses to vote my bot to let them use it, could you help me to do that? My bot language is python
ee
has anyone used wireguard
also like does anyone know how i can open a port?? i used iptables to allow connections on the port. but when i run curl command it says connection refused
i tried doing ddd in golang, and it's hell
got 4 same package name. it's time to refactor
edit: oh right, i can edit package name. i thought it's not recommended but seems like it's fine
If you're using your home internet you need to port forward on your router
No like Iβm trying use it to connect between 2 servers. 1 client and 1 server
Tryna get the client to connect to server. Idk if Iβm doing the configuration wron
Tried to use wireguard, it sucked. Swapped to OpenVPN, my life was infinitely easier
when you add peers what do I add in allowed IPs? The client wg0 ip? Or eth0 ip
Oh xd Iβm doing this for an assignment xd
So learning a bit
ddd?
yes, domain driven design file structure, https://dev.to/stevescruz/domain-driven-design-ddd-file-structure-4pja
waffle told me ddd few days ago in general, so i'm interested and seems like it looks professional
If I remember correctly it should be your client configβs wg0 IP
For the server peers
the on in the [interface] right?
yeah i've set them up correctly but for some reason it still isnt pinging
Show your client and server config (keys omitted ofc)
Client ```[Interface]
PrivateKey =
Address = 10.0.0.1/24
ListenPort = 51820
MTU = 1800
[Peer]
PublicKey =
AllowedIPs = 192.168.0.1/32
endpoint = 172.19.46.130:51820```
Server
[Interface]
Address = 192.168.0.1/24
MTU = 1280
SaveConfig = true
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE;
ListenPort = 51820
PrivateKey =
[Peer]
PublicKey =
AllowedIPs = 10.0.0.1/32
Endpoint = 172.19.6.218:51820```
I did ip link up and everything.
its added to ip addr also
Get rid of that SaveConfig = true lime
I had issues where it was fucking with iptables rules with that on
lemme try
.documentation
nop still doesnt work
is everything else correct tho?
Restart the entire service and make sure your server config file is correct after deleting that line
SaveConfig messes with the file itself is what I found, sometimes it would delete stuff from my config after I had already saved it
i delete the entire server and rebuilt again and added all the config.
i only added saveConfig now
to see if that worked
but i didnt have it before
for the same config
If you try to connect via public IP to your server when youβre on the same network at your client, it wonβt always work
Your using diffrent MTU could that issue?
im able to ping the server with ipv6
Some routers do not support that feature
shouldnt matter, its only byte size so
Itβs called NAT Loopback and if this is a self hosted server on your home internet, your consumer grade router probably doesnβt support it
Try changing your client config to use your serverβs local IP instead of the public IP of your network
See if that works
no no thats what im doing. im doing all this on 2 vms
1 client vm and 1 server vm
in the docs it says i gotta use the eth0 ip in allowed ips
the 192.168.0.1 is random. it can be anything. or so i read
Never worked with VMs in this scenario before, I just know that if you have the client and server on the same network, most routers will not support connecting via public IP between one another
When theyβre on the same network you must use your local IP
Curl wont work im pretty sure curl uses TCP but wiregaurd uses UDP
is there a way?
Iβm assuming 172.xx is your public IP
actually i dont have public ip at all
on the machines
my machine details
no public ip
I had something like this for when I used wireguard
Here is my server side config
[Interface]
Address = 10.0.0.1/24
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE
ListenPort = 51820
PrivateKey = <Server Privkey>
[Peer]
PublicKey = <Client Pubkey>
AllowedIPs = 10.0.0.2/24
``` and my client side
[Interface]
PrivateKey = <Client Privkey>
Address = 10.0.0.2/24
[Peer]
PublicKey = <Server Pubkey>
AllowedIPs = 10.0.0.0/24
Endpoint = <My Local Network IP>:51820
PersistentKeepalive = 25
I did find that installing docker after installing wireguard fucked with my IPTABLES rules and broke it, beware
I had to reinstall wireguard for some reason
And this was the headache that caused me to just switch to OpenVPN instead
wait your instance says 10.0.0.1/24 but in your client you are using 10.0.0.0/24?
shouldnt it be the server address?
10.0.0.0 is the tunnel itself. 10.0.0.1 is my serverβs IP within the tunnel subnet, and 10.0.0.2 was my clientβs IP within the tunnel subnet
hmm, so i put my server's interface ip in allowed ip
maybe i gotta set it to 192.168.0.0/24 to be able to ping 192.168.0.1?
also i see you using /24 but i have /32 does it matter?
cause while adding the ip initially with wg add i used /24
but in config i set /32
I would use /24, I honestly donβt really know what that does
hmm
so there nothing wrong with my config
i dont see any errors also
do i need to open some port maybe?
im using iptables so didnt use uwf. but i havent opened 51820 port
imma try
actually i tried installing ufw but it said there some conflict with ip6table
so had to get rid of it
ok but like all im trying to do is ping 192.168.0.1
Not sure. Honestly this might be one of the few situations where AI might be able to help
ye i tried gpt, the free version sucks with random hallucinations
shit makes no sense
can i address be the same or should they be same?
the 10.0.0.1 on client and 10.0.0.2 on server
hmm, it says it can be problem since they not same subnet
Hello, I made a bot and shared it on top.gg but it didn't appear on the list. There is a warning that it is in the approval process. Does anyone know how long this process takes?
FROM node:21
WORKDIR /app
COPY package*.json ./
RUN npm install
RUN npm install prisma --save-dev
COPY prisma ./prisma/
COPY src ./src/
COPY tsconfig.json ./
COPY wait-for-db.sh ./
RUN npx prisma generate
RUN npm run build
RUN chmod +x wait-for-db.sh
CMD ["sh", "-c", "./wait-for-db.sh && npx prisma migrate deploy && npm start"]
i have added the prisma migrations in the dockerfile, would this be risky or is it ok to use like that?
why node 21
good question, what should i go with




