#development
1 messages · Page 2050 of 1
no
😭
Guys anyone developer of bots can help me with something?
Mmm, at this point I do see where you are going with it
Not with a question like that no
Don't ask 2 ask
simply state the issue, provide the relevant code and error
someone who can answer will eventually answer
kek
How to upload a file of discord bot to visual studio
@solemn latch In some cases though I do see having my own
wtf I swear to god I meant to delete that
sorry woo
Accidentally hit enter ig instead of deleting what I was going to write before thinking it over

What are you talking about
How i can get file of code discord bot in visual studio
To put token bot and host it
you write the code yourself
But i have it in file?
Visual studios is not a hosting service
node?
visual studio is a text editor
Run install.bat then once all the modules are installed run run.bat
YOU NEED THE NODE.JS```
i got this from GitHub told you how to make bot and give you file
Where i have to upload the file
If you want to keep it running forever either use an old pc that you won't use and will constantly stay awake, or use a vps which you'll have to pay for
but listen what site i have to put the code of bot?
You dont...?
Dont what
How the hell am I supposed to tell you what it is
you quoted the github repo
so obv run.bat is included with the github stuff
so follow its instructions
we dont know the repo you're looking at so we cant really tell you how to use it.
If you're unsure what to do make an issue on github for help, or see if they have a support method
show the github
h
h
i cant run it?
and why not?
so how pls
make a bot by learning js not stealing someone's code lol
oh, i thought that was a rethoric, you saying that "i cant run it because it doesnt work"
🔝 @echo off
npm i
npm i discord.js
npm i node-html-to-image
npm i puppeteer
npm i mime
npm i fs
npm i path
goto top
if its a genuine question, yes you can run it, even if its old, but some things might not work anymore
what is this
the commands that are executed
where i have to put this?
just doing npm i would install everything
cmd?
ye
make sure the cmd is cd'd to the same file path the json file is in
you literally double click the .bat file
and it runs them for you
what it says, it can't install cause there is no package.json
make sure the cmd is open in the same file path the bat file is in
cd FILE_PATH
npm i
node MAIN_FILE.js
I can't understand
What file path mean?
did you double click the bat file?
No
??? wdym
and why not?
double click in which one?
open file explorer and copy the file path of the folder u downloaded
Can i stream for you guys?
whats so hard about following instructions? >.>
how to following them
lol
Screenshot or something
dude are you trolling rn?
what is so hard about "run install.bat"
like how can you not understand what that means?
I did its .zip
bottum compress
bruh u have to extract it
Then how
I JUST TOLD U HOW TO
Ok i need to download winrar

network included?
yeah
then yes its good
ok good
but a better metric would be to measure the api performance without network
since network is 90% latency caused by distance
as i said, you didnt need winrar, but you didnt listen so whatever.
anyway extract everything into a folder
i did?
then you can close winrar
ok
and open the folder where you extracted everything to and double click install.bat
when i double click on install cmd says global or local and close
that means its installing
ok what next
did it create a "node_modules" folder?
thats not what i asked
if you dont have a node_modules folder, then the install failed
hold shift and right click on an empty area inside your folder, and click on "open command window here"
then run cmd and navigate to your folder
do you know the cd command?
cd FILE_PATH
I have a little batch script I wrote I can give it to u
cause u aren't forwarding it to a filepath...
you see how it says C:/Users/liyass?
i dont see yur msg sorry man
thats the folder where your current cmd is right now
replace the index.js with your main file
the cd command lets you change this folder to what you want
for example
if your files are in a folder called "mybot"
and this folder is inside Users/ilyass
then you do cd mybot
and your cmd will enter that folder
i have to do cd my folder name?
you can also use push and popd if u are 1 folder below ur filepath
yes
do pushd foldername
wtf are these checkmarks
what you type in the cd command depends on what your folder is named, where your folder is, and which folder cmd currently is
shared with google drive? idk
they just appeared randomly
ur files have now become verified lol
I looked it up and it says something about onedrive, but I have never used onedrive
and my onedrive is empty
syned to onedrive usually
but the icon looks different
right click --> properties
should say
im using lightshot
pretty cool
lol
@quartz kindle this is so hard thank you for helping
I cant do this
@ancient nova thank you too
np
you should first learn JS and basics of the discord.js library next time before attempting to create bot
message.guild.bans.fetch().then(bannedMembers => {
const bannedList = bannedMembers.map(user => `${user.user.username} (${message.user.id})`);
if (bannedList.length >= 10) bannedList.slice(0, 10);
const bannedEmbed = new MessageEmbed();
bannedEmbed.setTitle("Terminated Users List");
bannedEmbed.setDescription(bannedList.join("\n,"));
return message.channel.send({embeds: [bannedEmbed]})
}).catch(message.channel.send("Could not find any banned users in this server."));
``` so I'm trying to fetch bannedMembers, I was wondering what would be the best way to do pages? So if there is more than 10 users I could just list the rest of them in a book like system
^ also it doesn't appear to slice
Chunkification
Basically you split the list into smaller lists
yeah but how would I know when to change a page
Are u using buttons?
...that's still buttons for this matter
well I still don't really want to use them for this
maybe doing something like
command <value> and <value> would be a page indicator?
Doesn't matter, there are 2 ways of doing it: either buttons or index specification
that seems easy enougb but not quite sure how to convert it
No, that's pretty bad since you'd be re-fetching the ban list each time the user wants to change the page
I could fetch all of them into a variable without slicing
and slice only based on input?
still, that sounds quite complicated
User still would need to specify index on each command run
default would be the first page
You'd take a single page and discard the rest, inefficient
but I'm already doing that
so paging would be an upgrade
try {
await message.guild.bans.fetch().then(bannedMembers => {
let bannedList = Array.from(bannedMembers.values()).map((user, index) => `${index + 1}. ${user.user.tag} (${user.user.id})`);
if (bannedList.length >= 10) bannedList = bannedList.slice(0, 10);
const bannedEmbed = new MessageEmbed();
bannedEmbed.setTitle("Recent Terminated Users List");
bannedEmbed.setDescription(bannedList.join("\n"));
return message.channel.send({embeds: [bannedEmbed]})
});
} catch {
return message.channel.send("Could not find any banned users in this server.")
}
that's my current code
it only goes from 1 to 10
and if I do command 2 I want it to go from 11 to 20
is that not possible?
Make the command fetch the entire list, chunky it.
After that, show the first page and add interactive buttons to allow navigation without having to fetch the list again
Each next button increments chunk index by 1, previous decrements
When you change index, update the page
For-loop + remainder operator
var chunks = []
var currChunk = []
for (int i = 0; i < list.length; i++) {
// If this isn't the first pass and it reached the defined chunkSize
if (!i > 0 && i % chunkSize == 0) {
// Add the current chunk to chunk list
currChunk << list[i]
chunks << currChunk
// Clear current chunk to start the next
currChunk.clear()
continue
}
// Add current item to current chunk
currChunk << list[i]
}
// If there're leftover items in an incomplete chunk, add to the chunk list
if (!currChunk.isEmpty()) {
chunks << currChunk
}
Groovy example, without stream or map whatever
There's a smaller way of doing it with reduce in js, but I don't remember
that seems quite confusing, I wish you'd add comments to that lol
how do I integrate that into the list?
This is just an example to understand the concept
I see
There
Chunks will be something like
list = 1..23
chunkSize = 5
[
[1,2,3,4,5],
[6,7,8,9,10],
[11,12,13,14,15],
[16,17,18,19,20],
[21,22,23]
]
List being the original list, chunk size being the maximum amount of items per chunk
I think I get the basics of how that works but I don't think I know enough to put that into practice
I'd rather try to make a function out of it
something like
const Chunkify = function(...) {...}
try {
await message.guild.bans.fetch().then(bannedMembers => {
let bannedList = Chunkify(Array.from(bannedMembers.values()).map((user, index) => `${index + 1}. ${user.user.tag} (${user.user.id})`));
if (bannedList.length >= 10) bannedList = bannedList.slice(0, 10);
const bannedEmbed = new MessageEmbed();
bannedEmbed.setTitle("Recent Terminated Users List");
bannedEmbed.setDescription(bannedList.join("\n"));
return message.channel.send({embeds: [bannedEmbed]})
});
} catch {
return message.channel.send("Could not find any banned users in this server.")
}
and use it like
Forget slice
I don't want to over complicate that
single page is fine, really
By not overcomplicating you'll be doing a lot of unnecessary api calls
however I'm still not quite sure how the Chunkify function would fully work
it's fine, discord isn't gonna kill me for that
You don't need to chunkify if you'll be sending a single page
plus the command is only restricted to server owners
Anyone can be a server owner btw
I do, I still don't know how to slice the array into pages tho
You won't slice into pages, you'll just get a range of it
.slice(pageSize * page, pageSize * (page + 1))
Subtract 1 if u consider page 1 as first page
Remember tho, this is a BAD way of showing a potentially huge list
okay, explain where exactly to put the .slice and where all these variables come from
The variables are pretty much self-explaining no?
I don't think it's gonna be that big?
You set them to whatever u want
not really
let me see though
A server I am moderator of has more than a thousand bans
Maybe tens of thousands, but I'm not counting it, just estimating
It takes minutes to go from the top to the bottom of it
just how big is that server
And you'll be fetching every single user in that list every time someone runs that command
Then discarding it the very next moment
okay what is the pages and page variables supposed to signify
The page number
Whatever you pass as argument
Typo
I'd say on the lower end of "average"
bannedEmbed.setDescription(bannedList.slice(10 * (args[0] || 0), 10 * (args[0] + 10 || 0)).join("\n"));
so
You can't do math operations with strings
...um is that good enough
impossible it has this many bans then 😐 you'd have to get raided by anonymous to get this many bans lol
If we consider only terrible choices, ye it's good enough
Not really, just have a long livrd server
Is there any way to get ban number on discord without resorting to eval?
ban number?
Like, you really shouldn't be making the user rewrite the command every single time they want to change the page
This is terrible both on UX side and on code side
So I can screenshot it for u
well
pretty sure the ban has a counter in the guid settings
I thought something happened to the bans endpoint didn’t it?
if not, then eval may be the only way
Didn’t they take down the ban fetching endpoint or was that something else?
it changed from fetchBans() to bans.fetch()
nah
No not djs
well either way it doesn't seem like they taken it down
so I think it's something else
No ban number on mobile, but whatever, here's only 5 raid reports from my antiraid system on that server
let bannedList = Array.from(bannedMembers.values()).map((user, index) => `${index + 1}. ${user.user.tag} (${user.user.id})`);
//if (bannedList.length >= 10) bannedList = bannedList.slice(0, 10);
const pageNumber = !args[0] ? 0 : args[0];
const bannedEmbed = new MessageEmbed();
bannedEmbed.setTitle(`Terminated Users List (Page ${pageNumber})`);
bannedEmbed.setDescription(bannedList.slice(10 * pageNumber, 10 * pageNumber).join("\n"));
return message.channel.send({embeds: [bannedEmbed]})
``` idk I'm trying to fix it
Those 5 alone are almost a thousand banned users
Apparently this is what I was thinking of:
Guild Bans Pagination
Today we've made a breaking API change to improve reliability and stability of the GET /guilds/{guild.id}/bans endpoint. Starting today, a maximum number of results will be returned in the response (configurable via a limit parameter). before and after can be supplied with a user id to paginate the response from the endpoint. You can learn more about the new endpoint parameters over on our docs site: https://discord.com/developers/docs/resources/guild#get-guild-bans
oh how to limit???
that'd be amazing if the guilds have too many bans
I can limit it to 100
This was a while ago
I believe it was due to some guy constantly fetching like 425k bans every now and then and nearly taking down the DAPI with it 
Future itsokaybee
shhh 😠

lmao
Ban lists can become huge, it's a serious issue if u fetch it every time a command is ran
try {
await message.guild.bans.fetch().then(bannedMembers => {
let bannedList = Array.from(bannedMembers.values()).map((user, index) => `${index + 1}. ${user.user.tag} (${user.user.id})`);
//if (bannedList.length >= 10) bannedList = bannedList.slice(0, 10);
const pageNumber = !args[0] ? 0 : args[0];
const bannedEmbed = new MessageEmbed();
bannedEmbed.setTitle(`Terminated Users List (Page ${pageNumber})`);
bannedEmbed.setDescription(bannedList.slice(10 * pageNumber, 10 * (pageNumber + 10).join("\n")));
return message.channel.send({embeds: [bannedEmbed]})
});
} catch {
return message.channel.send("Could not find any banned users in this server.")
}
doesn't work
I don't know how to fix it
:c
huh no I thought it was how many people are showed per page
That's the number before multiplication
then
I'm confused
if I remove it it will be the same as the first one
so nothing will fetch anyway
No it wont
??? wdym it will not
Because you're doing page + 1
.slice(10 * page, 10 * (page + 1))
If we consider page as 0, this will be:
.slice(10 * 0, 10 * 1)
Or "items from 0 to 10"
Aka first page
Because your code is broken
how
!args[0] is a boolean conversion
!args[0] ? 0 : args[0] will make it always pick the second option unless user DOESN'T supply a page
Because any non-zero, not-null/undefined value in js is true
that's what I want.. at least I think so
every number return the number and if the user doesn't prove a number return 0
0 being the first page
my head hurts
coalescing operator
If the first value is null/undefined, return the second value
Else return itself
surprisingly works
thanks for da help
There's also elvis, which is similar to coalescing operator
how does it look and what does it do?
seems there is plenty I don't know about JS yet
Elvis doesn't exist in js afaik, but it kinda works like coalescing op
value ?: alternative
If value is null return alternative
Else return value
Both are short for value == null ? alternative : value
It's the same as js' ??
😭
oh
i wish js had a ?? that could be used in place of !
something like if(??variable) { do something }
Isn't that base js boolinization of variables?
Like, anything put inside a condition without any other context is supposed to be either true or false
it does tho
no?
the ?? operator was introduced to deal with situations where you want 0 and "" to be valid values since || would consider them false values instead. the ! operator behaves like || and considers 0 and "" to be false values and there isnt any null-coalescing NOT operator that would give the same behavior as ?? gives but in a ! situation
so what you're saying ?? always returns some value?
no
0 ?? 10 = 0
0 || 10 = 10
|| considers 0 as a false value
?? only considers null and undefined as false values
wha
! is gonna reverse whatever output ?? gives
not sure myself I'm kinda tired
trying to educate tim is like trying to educate a brick wall
it is pointless
except that brick wall is a walking living javascript spec book
im talking about this situation specifically:
var a = 0
var b = null
if(!a) do something
if(!b) do something
both a and b conditions will do something, but i want only the actual null condition to do something, like like ?? only considers actual null and undefined
understood
I was thinking you were talking about something completely different
so for example, if(!something) works on both null and 0, but it would be cool if there was something like if(?something) that only works on null and undefined, and not on 0 and ""
ahhhh
makes sense
yeah, so you could do some shenanigans with it to achieve the same thing
double negative with bitwise NOT lmao
looks weird
ever seen how to remove a flag from a bitfield?
bitfield &= ~flag
yes lets not
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#short-circuiting-assignment-operators this shows the ??= and shit that ts 4.0 adds support for
TypeScript 4.0 Release Notes
??= was already in node 16+ i believe
Yea but ts didn't add support for it until 4.0
eslint still doesnt support static methods on classes
👀
I am thinking I should read the typescript handbook to learn more about the language I constantly use but who cares 
theres like a several years old issue about it and they just tell you to use a plugin
kek
im playing around with jsdoc and enabled type checking for js in vsc
pretty much the same tyoe safety and type errors as ts lel
also, yes im a stubborn prick
gn!
gn kek
ok
phishing scam don't click link
-b 526435656482684948 compromised account
Glare#3843 was successfully banned.
Seems like that is a webhook or smth
this is not webhook
That's just a codeblock with the ANSI language, you can color anything you want
Is there a source where I can look at examples or features?
♥
\u001b[0;40m\u001b[1;32mThat's some cool formatted text right?
or
\u001b[1;40;32mThat's some cool formatted text right?
I think it is no longer supported
You need to copy the \u001b character from the mentioned website in the Gist, or just look it up and copy it from a different website
You don't need to copy it for bots, just for yourself
oh thanks now i understand
Before I dig too far into it, is it possible to make a command to vote for your bot? or do they have to actually go to the website.
They have to go to the website
thanks
Yeah they would need to visit the website https://top.gg/bot/735842992002433084/vote
No way to do it in-line
You can then either pull votes by checking if they have voted using https://docs.top.gg/api/bot/#individual-user-vote
Or receiving incoming votes by listening to our webhooks https://docs.top.gg/resources/webhooks/
nvm
got deleted
https://hiekki.me/crjGxeExg doing the webhook now. just didn't know if i could make it easier for the users to just do /vote or not. in the command, you could pull the user ID and obviously the bot's information to send it to the correct place. but since you can't do that, a simple link and threatening asking them nicely to vote is all i can do 🙂
That’s all you can do, yes
yeah, i gathered that, thanks
Just force your users to listen to BTS until they go to the website and vote for the bot
Lol. Some people have voted locked commands or features to incentivise voting. Just make sure the majority of the bot isn’t voted locked xD
lmao where did that come from
Bot developers on their way to vote-lock the help command
None of it will be locked due to that, lmao.
Older people already know everything
We don’t need to be educated

However, i do see a blacklist feature coming soon™️ if they don't vote. it's a win/win, really.
Aye
Require administrator permissions then force them to vote or delete one channel every hour

Sounds about right
Threaten the users to nuke the server if they don't vote, problem solved
Ok Sir, support is over now!
Please pay the invoice we have sent to you or we will delete your server

!pay theMan already
Support has been going on for 5 mins, means you gotta pay 1 hour
FakE with their FakE payment request
buh duh tss
Shhhh i will pay you off if I got the money
if, clearly he hasn't been paid his dues from his toe pics yet this month

Leaked OnlyFans?
if (!toePics) force vote();
if (!vote) force unfriend();
if (unfriend) force block;
exactly
i forgot one
if (blocked) insert
;
hey, this guy found your brick wall
alright, i got my answer a while back. i'm out. lol. thanks for the entertainment and information
entermation
or infortainment
talk about operating systems he doesn't know everything
last time I asked him about programming the ACPI I was rather disappointed
I'm pretty sure Tim is around his 30s
lmao
That’s what we say to hide our midlife crisis
Is it possible to change that embed that shows from link using description CSS??
No
What programming language can I use to code discord bot? Can I use C#?
That can be done by changing the (HTML) meta tags
Can you tell me how, me stupid
never knew Facebook had its own tag
Thx
What programming language can I use to code discord bot? Can I use C#?
You can use a variety of languages, and yes, also with C#. C# has a library, Discord.NET
discord.asm
Thanks
I thought I can use only Python
Or js
You can make discord bots with basically any language
Nice
Can anyone help me with this error?
This is when i write git init on the visual studio terminal :/
...install git?
that's what i thought it was but i have it already installed i guess
np
its saying the same after the installation
did u add it to path? ig there is an option to add to path during installation
the path to my bot?
no, in the system path variable
yeah it was installed there
hmm
try restarting ur computer if that doesnt work idk then or maybe u installed it incorrectly 
restart it again
hey guys is it possible to specify am/pm in node-cron?
Like: 9:00am
no
just add 12 when dealing with pm
Imagine not using 24h or the metric system or anything else that’s cool
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.
but you need glasses to use C# because otherwise you wont be able to C# (see sharp)
overused joke, i know, but im old, i can

hello
How do you paginate through the /users/@me/guilds endpoint?
Cant seem to find solid documentation
pagination is not needed, discord returns all user guilds on request.
This endpoint returns 200 guilds by default, which is the maximum number of guilds a non-bot user can join. Therefore, pagination is not needed for integrations that need to get a list of the users' guilds.
https://discord.com/developers/docs/resources/user#get-current-user-guilds
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
unless you're limiting the size, then you'll want to use the after query string
Gotcha, well im hitting the endpoint for the bot user
yeah, I didn't think about that.
you'll want to use the after query string,
the last guild returned from the first page will be what goes in the after query string
for page 2 for example*
I see.
Yeah Im trying to return mutual guild results, filter the nonbot users results with the bot user's results to determine, if the bot is in a guild as well as the user with perms is in the same guild
I guess ill have to figure out how to get the id of the last result and pass as a param in next query
you could just make an endpoint for ur bot and request guild info from it
Very true....
that also doubles as an online status checker
if the api stops answering, the bot is off
are you not running a websocket or you have guild cache disabled?
You know that you need to have some cash on the card to pay bills with it?

Also paying money to Oracle?
Wtf is wrong with you 
BRO I HAVE 1000+ ON IT
i changed the quoted reply to this
lol
but seriously that is the most appalling support i have ever experienced aside from the discord verification process
"yeah something went wrong but we cant tell you what now go away"
💀
I'm using minecraft-protocol and want to create an "overlay" that get's the chat messages of the current logged in client. I know how to create fake bots, but if the user launches an instance of Minecraft, how can I intercept the packets of that instance rather than create an entirely new one? TLDR, how can I use NodeJS to intercept packets of a currently launched instance of Minecraft?
and include a letter with your account info
you need a mod that opens some port or something that another process can listen in
Yeah I'm using Electron. I've gotten far enough to get the access token of the user once they login and also creating a separate server, but I'm stumped on how to get the packets of the current instance the user has open.
if the current instance is unmodified, you cant
Or wait are you saying that the Minecraft instance needs to listen on the port? Ex. an electron app won't work because it's not Minecraft?
the new instance is probably modified in some way to allow it
so you need the current instance to also be modified, via a mod or something similar
ah ic. so the best solution would be to modify any current instance the user has open via a mod or smth?
something like that yeah
maybe this would help
dang it okay. thanks
oh yeah i havent taken a look at that yet. tysm ill look into this
Hey guys im moving over to slash commands, is this a pretty decent handler for latest d.js? I kind of have a grasp on these but pretty new to the slash commands
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Each command looks something like this ```js
module.exports = {
aliases:[],
description:"Play music.",
enabled:true,
name:"play",
avaliability:"global",
options:[
{
name: 'song',
description: 'Song name/url',
required:true,
type: Discord.Constants.ApplicationCommandOptionTypes.STRING
}
],
//Extra Handler
userInVC:true,
botInVC:false,
needsQueue:false,
botPERMS:36751424n,
usrPERMS:0n,
cooldownType:'user',
cooldown: 5,
async execute(interaction) {```
just noticed the spelling mistake also, fixing that
Got it working with this. Thanks!
nice
Is it true that discord.js is bad when it comes to scaling?
lmao i'll ask them if i can do that
"can i send the dollar via mail?"
yes
speedyos update: speedyos user namespace now supports async
int data = async<int>(some_long_operation).exec(some_parameter).await().value();
or if you want a solution which does not use await and does not park the thread while it waits:
auto promise = async<int>(some_long_operation).exec(some_parameter);
while (!promise.completed()) {};
int data = promise.value();
thread pool version of async coming soon
you can also cancel promises by calling the destructor (mainly because i cant be bothered to add a dedicated method)
promise.~promise();
but thats quite dangerous since it will abruptly kill the thread which might be in the middle of drawing something or writing some data
lmao
Recorded live at Reactathon 2022. Learn more at https://reactathon.com
Syntax.fm Live!
Get Ready for a jam packed hour of tasty web development treats. Wes Bos and Scott Tolinski will record a live version of their popular weekly podcast that will include audience participation, web development trivia, terrible jokes and prizes to be won!
Abou...
goddamn you're still working on that?
yea but not every day anymore
Alright I don't really know where to ask this, but I'm creating a proxy between my Electron app and Minecraft. I've gotten pretty far already, but now am just having issues sending packets between the two. My code is pretty simple:
// Once someone logs into the server...
server.on('login', ((client) => {
client.on("connect", (packet) => {
console.log("Client connected.");
const bridge = mc.createClient({
... // Creates a client with the same account details
});
bridge.connect(25565, "play.endran.net"); // private server
bridge.on("connect", () => {
console.log("Bridge connected to the server.");
});
client.on("packet", (packet) => {
bridge.write(packet.name, packet.data);
});
bridge.on("packet", (packet) => {
client.write(packet.name, packet.data);
});
});
});
However, I get a bunch of errors (see the screenshot). Is there a better way to do what I'm doing?
Libraries: electron, minecraft-protocol. I'm coding in NodeJS.
embeds have been changed in v13?
did you console.log packet to see what it is?
on both bridge and client
wait can you make a minecraft server in node
if not someone needs to make that
native node
technically you can, but good luck doing that
i mean, there are many alternative minecraft servers, like paper, pufferfish, purpur
pretty sure they are open source
but nodejs
so you could remake them in node
the legendary
idk why they all write the servers in java
i saw someone wrote a c++ minecraft server but its not complete
perhaps could use that under the hood with node-gyp
there is a nodejs server for bedrock edition
its still on v1.16 tho
Isn't a minecraft server just a TCP server?
well yes, but it does need to control every aspect of the game
like chunk generation and sync, entities, etc
I'm surprised nobody has made a framework for node.js yet
probably just too much of a pain
apparently there is a big difference between java and bedrock editions of the game
such as that even their servers are entirely separate projects
who plays bedrock
aka "original minecraft" and "bugrock"
and mobile too
and turks without a pc
in bugrock there's a common bug where your death is delayed
like, you fall a huge mountain but suffer no damage
I have MC on my PS3 and there are literally no servers 😭
a few minutes later, you're wandering then suddenly you die
one thing they do is they log every single packet that comes through
its filtered by default but still
a lot of overhead
talking about the above project
lmao
that just sounds like packet loss
does it also happen locally/offline?
it happens specifically offline
lmao
there are many other grotesque bugs, but this is one that happen relatively often
maybe, idk how they did it but they did somehow
also you don't get the best part of minecraft that is modding
have fun https://wiki.vg/Protocol
bro this is like the safe version of osdev
doesnt look all that bad at first glance
i might consider a terraria server tho
i see no one attempted to write one yet
but then terraria already has a server written in c# (vanilla) which is good enough
make a server in rust
maybe
im still looking for a good long project to work on in rust
god minecraft has a lot of shit
no wonder java is on life support when playing it on a medium spec pc
make a rust server in rust
theres also so many objects which are made then destroyed which makes the garbage collection of java a huge performance killer
that's why stuff like sodium exists
minecraft is like windows
never played rust
they have A LOT of legacy code that's strapped with duck tape
im running a purpur server and a fabric client filled with performance mods lol
don't, it's basically Arc but tenfold toxic
wish I could migrate to fabric, but most mods I use are still in forge
they're slowly moving to fabric tho
rip
i just start from scratch everytime we decide to play mc again
its like a periodic thing
lel
oof
An old men talking about minecraft
Things are going crazy if I can’t watch you guys
Yes I believe it’s undefined, but I’ll have to double check.
There’s some libs for it that are pretty cool. PrismarineJS made Minecraft-protocol and flying-squid
add a bunch of safety shit to it
i already have atomic operations since only one thing can happen at the same time when reading or writing
but how when you are inserting, deleting or updating records?
i know most would use a journal for that
but what would you store in that journal
for consistency you can try something like checksums before and after writing to confirm that the write succeded
for isolation i guess versioning
for durability also checksumming
once restarted, the checksum will fail and that write should be cleaned and invalidated
my idea would be write some data to the journal, do the operation, remove from journal
also ^ yes
Minecraft on mobile while driving?
lmao
but the same should be applied to the journal itself
if it crashes in the middle of writing to the journal
build a minecraft computer to drive for you
yeah crashes when writing to journal shouldnt be an issue

Tim always has the best ideas tho
lmao
for updating maybe delta differences are enough
for now ima focus on inserting
gets a bit complicated
so if anything happens ima just cancel and revert
thats fine
it gets complicated because i have strings and records in separate files
i enabled type checking for js in vsc and now all my shit is red
should each record contain a checksum
probably
the journal entry should contain the files affected, and the checksums expected for each one
hm ok i have thought of a potential solution now
when inserting, create a checksum of the whole record by adding all the values and strings into the checksum
then write the record location and checksum to the journal
actually no thats unnecessary
as soon as anything is found in the journal it will just clear the affected areas
reset them to nothing
it will step through the record to check for any string pointers and when one is found it will just clear it
or write a copy of the data itself to the journay, then write to disk, then read from disk, and check if it equals the data written in the journal
yeah but wouldnt it be easier to just cancel the entire write if its still present in the journal completed or not
the strings complicate things a lot
ah also
the journal would need to have a copy of the previous data
so that a rollback is possible
yeah thats what i was thinking too since in some occasions i will be overwriting old areas
for example writing a shorter length string to the dedicated string area instead of making a new one
i will probably have two journal files one for strings and one for the record
the journal will probably contain the locations of the affected areas in the actual data file(s) and then a copy of the old record
2x performance decrease but who cares about write perfomance
await schema.findOneAndUpdate({ userID: message.author.id }, { $inc: { quest: +1 } });
Why it's not adding 1 to current?
It's just setting it to 1
that query makes no sense for that data stucture?
quests is an array inside the progress object
which quest do you want to increment?
Oh sorry the quest is
let quest = data.progress.quests.find(x => x.id == 4).current;
With the id 4
so you need to create a query that increments the field "current" for the quest item with id 4, inside the progress object
My first though was it was recognizing +1 as normal 1
1 not working too
Yeah
the issue is that your query does not specify what you want it to do
Yeah
it cant guess what you want because you didnt specify its inside the progress object, and inside the quests array, and has the id 4, and the field that should be incremented is called "current"
But when i log the quest variable it logs the number
that has nothing to do with it?
Bro this is the full code
const schema = require('../../schema/Economy-Schema')
let data;
try{
data = await schema.findOne({
userID: message.author.id
})
if(!data) {
data = await schema.create({
userID: message.author.id
})
}
} catch(err) {
console.log(err)
}
let quest = data.progress.quests.find(x => x.id == 4).current;
await schema.findOneAndUpdate({ userID: message.author.id }, { $inc: { quest: +1 } });
But i don't see any wrong in it
i already told you whats wrong lol
await schema.findOneAndUpdate({ userID: message.author.id }, { $inc: { quest: +1 } });
^ this code has no idea that progress exists, that quests exists, that you want the quest item with id 4 and that the value you want to update is called current
"find and update what? object with userID X, yes, but that object does not have a quest field?"
thats what your database is thinking
await schema.findOneAndUpdate({ userID: message.author.id }, { $inc: { quest: +1 } });
^ this code would work if your schema was like this: ```js
{
userID: "...",
quest: 1
}
but your schema is not like that
your schema is like this: ```js
{
userID: "...",
progress: {
quests: [
{ id: 4, current: 1 }
]
}
}
do you understand the difference?
But how to make it work with this way?
you need to build a more specific query
i dont use mongo so i dont know the correct syntax, you need to check the docs
according to the docs you could use a positional operator
Link?
maybe something like this could work, i dont know ```js
await schema.findOneAndUpdate({ userID: "...", "progress.quests.id": 4 } , { $inc: { "progress.quests.$.current": 1 } });
@quartz kindle Yes it's working thank you
Best support 💯 ⭐ 
speedb better tho
bro c++ is confusing me
its calling the destructor for classes in my os in random places
idk if c++ treats using a reference to the class from a method as going out of scope
exec returns a reference to the class itself and i would assume the compiler is smart enough to know it isnt actually going out of scope
isn't c++ that one language you can do funky things with async?
I saw a snippet of code once where async was used at least 10 times in one line
im sorry for ur loss
lmao
I basically saw someone do async async async async async function
why tho
🤷♀️
public class var {
async async async(async async) => await async;
}
😔
when i put the exec on a line of its own it works fine
what da fuck
beats me
aight c++ lesson y'all
Give me something to read related to programming
I wanna learn and become smarter
day 5 of trying to get banned on this server /s
learn about how messagepack works
we usually wait for day 7 before fulfilling it
lmao
// this will be fine and will not call the destructor until the `value` call completes causing defined behaviour
auto task = async<string>(some_long_string_join_operation_function).exec("Speedy").await().value();
// This will unexpectedly destruct early causing undefined behaviour.
auto bad_task = async<string>(some_long_string_join_operation_function).exec("Speedy").await();
// the class has been released and destructed at this point and the below function call will result in undefined behaviour
bad_task.value();
weird
wow that's actually stupid
i think the compiler loses track of whether the class is still in scope or not as soon as you finish the chaining
something like
auto task = async<string>(some_long_string_join_operation_function);
task.exec("Speedy").await().value();
will be fine also
i think i just need to be careful about this behaviour
i wonder if i'll get any compiler warning about this
nope no warning even when all + extra enabled
why bother with trying to support async like that when you can modify your compiler to support async/await keywords :troll:
i'll just ignore that
that is odd
it calls the destructor twice
once after the chaining and second when the function ends
seems like a funny issue that rust would be good at solving
you use rust once and instantly become a fan boy
so was what I said sped
clang also has this issue
i would report this except these gcc/clang devs think they're too cool for public collaboration on github and only have public mirrors
so the issue reporting process is hard
Hm
You're based
Dumbass
pfft
What else to do I have 0 time to work on anything that takes a lot of effort
finals coming up
😔
Work on your finals
Is it worth learning how docker works
impress them with your amazing knowledge of pokemons
Never had to
No
Cause idk any pokemons beside Charizard, Pikachu, Squirtle, and that cat one
meowth thats right
Ain't no way Perl devs get paid more then everyone else as of 2020 (old report but that is insane to me)
Is anyone working on or planning to work on bots useful to medical students? I'm looking for general biology, A&P, microbiology and the like.
cant seem to find any other than "med-bot" which just links general info from wiki, but does not have full range of specific information.
I highly doubt it
med students don't have the time to chill on discord tbh 🥲
Yeah
but it's an original idea anyway, i've yet to see something like that
https://discordjs.guide/oauth2/#a-quick-example
i did this example but everytime i click auth button i am getting redirected without access token
Implicit grant or application code grant?
And...?
When i did that it says unauthorized code 40001
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="info">Hoi!</div>
<a id="login" style="display: none;"
href="https://discord.com/api/oauth2/authorize?client_id=848292306088230922&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2F&token=code&scope=identify">
Identify Yourself
</a>
<script src="scripts/script.js"></script>
</body>
</html>
window.onload = () => {
const fragment = new URLSearchParams(window.location.hash.slice(1));
console.log(fragment.toString())
const [accessToken, tokenType] = [
fragment.get("access_token"),
fragment.get("token_type"),
];
if (!accessToken) {
alert("Error");
return (document.getElementById("login").style.display = "block");
}
fetch("https://discord.com/api/users/@me", {
headers: {
authorization: `${tokenType} ${accessToken}`,
},
})
.then((result) => result.json())
.then((response) => {
alert(response)
const { username, discriminator } = response;
document.getElementById(
"info"
).innerText += ` ${username}#${discriminator}`;
})
.catch(console.error);
};
where did you get this from?
i just replaced response_type with token
......
then why does your code above have &token=code and doesnt have any response_type?
he replaced "response_type" with "token"
lmao
not response_type=token
what is happening here?
What's your folder structure?
Op sorry I didn't scroll down enough ^_^
Looks like you are requiring a directory? I dont think that works.
things inside
You're not requiring the things inside, just the directory itself.
playing around with dalle right now
this is so fucking funny
im looking into training the model locally
but my specs are uh
not really up for that
4chan has some leaks
so that's fun
I'm trying to create a proxy between two servers using minecraft-protocol. How I achieve this is relatively simple, but now I'm having trouble sending packets to the client. I get the error in Minecraft, "Malformed data: JSON". Code: https://sourceb.in/UdUFo9dt7n
Oh, I'm also working with Minecraft version 1.8 which is why client.write is a bit different from the example on GitHub.
does someone still play 1.8?
you can require a directory if the directory contains an index.js
ie, require("./folder") is a shortcut for require("./folder/index.js")
1.7.10 and 1.8.9 are the most popular mc versions
i believe
yeah
you can also hire some guy to train it for you
you really need powerful gpus to train a model in an okay amount of time
or rent out a Google cloud tpu/gpu
changing the status of a bot every 5 minutes
is it allowed or no?
read the pins and it kinda confuses me
probably not allowed, my bot was always going offline after a couple minutes
it sounds like broken code 💀
Exactly
😭 naa
I just had a timeout func and setStatus method inside of it
nothing could possibly be broken
yup, was looking into that
if gcp still has those free credits i might cop them with a new account
since i have a new ccn

