#development

1 messages · Page 2050 of 1

solemn latch
#

any user can invite the bot and access that info

ancient nova
#

spare me the suffering

#

😭

sharp geyser
ancient nova
#

😭

pale lily
#

Guys anyone developer of bots can help me with something?

sharp geyser
#

Mmm, at this point I do see where you are going with it

sharp geyser
#

Don't ask 2 ask

#

simply state the issue, provide the relevant code and error

#

someone who can answer will eventually answer

real rose
sharp geyser
#

kek

spark flint
#

proceeds to dm me

pale lily
sharp geyser
#

@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

sharp geyser
pale lily
#

To put token bot and host it

solemn latch
#

you write the code yourself

pale lily
#

But i have it in file?

sharp geyser
#

Visual studios is not a hosting service

pale lily
#

node?

sharp geyser
#

node is also not a hosting service

#

it is a runtime

solemn latch
#

visual studio is a text editor

pale lily
#

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

sharp geyser
#

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

pale lily
#

but listen what site i have to put the code of bot?

sharp geyser
#

You dont...?

pale lily
#

Dont what

sharp geyser
#

You can simply run the bot as it says from your pc

#

run.bat

pale lily
#

whats run.bat?

#

Is a program or what

sharp geyser
#

👀

#

This kids is why we don't grab stuff from github

pale lily
#

bruh

#

Tell me

sharp geyser
#

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

solemn latch
#

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

quartz kindle
sharp geyser
#

hi tim

#

qt

quartz kindle
#

h

sharp geyser
#

h

pale lily
#

@quartz kindle

ancient nova
quartz kindle
#

also that looks old and outdated

#

why are you hiding the link?

pale lily
#

i cant run it?

quartz kindle
#

and why not?

pale lily
#

so how pls

quartz kindle
#

answer my question?

#

why cant you run it?

pale lily
#

because you said its old?

#

im new

#

in github

#

i wanna make bot

ancient nova
#

make a bot by learning js not stealing someone's code lol

quartz kindle
#

oh, i thought that was a rethoric, you saying that "i cant run it because it doesnt work"

pale lily
#

🔝 @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

quartz kindle
#

if its a genuine question, yes you can run it, even if its old, but some things might not work anymore

pale lily
#

what is this

quartz kindle
#

the commands that are executed

pale lily
#

where i have to put this?

ancient nova
#

just doing npm i would install everything

pale lily
#

cmd?

ancient nova
solemn latch
#

why is it installing fs though

#

and path

ancient nova
#

make sure the cmd is cd'd to the same file path the json file is in

quartz kindle
#

and it runs them for you

pale lily
#

what is that

ancient nova
#

what it says, it can't install cause there is no package.json

quartz kindle
#

where is package.json?

ancient nova
#

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

pale lily
#

I can't understand

pale lily
quartz kindle
#

did you double click the bat file?

pale lily
ancient nova
quartz kindle
#

and why not?

pale lily
#

double click in which one?

ancient nova
#

open file explorer and copy the file path of the folder u downloaded

quartz kindle
#

like the instructions say?

pale lily
#

Can i stream for you guys?

quartz kindle
#

whats so hard about following instructions? >.>

pale lily
#

how to following them

pale lily
#

Screenshot or something

ancient nova
#
  1. download folder from github by doing git url
#
  1. extract folder using winrar
quartz kindle
ancient nova
#
  1. run the bat file
#

it's 3 steps

quartz kindle
#

what is so hard about "run install.bat"

#

like how can you not understand what that means?

pale lily
wheat mesa
#

bottum compress

ancient nova
pale lily
#

Then how

ancient nova
#

I JUST TOLD U HOW TO

quartz kindle
#

you didnt even extract the zip?

#

LOL

pale lily
#

Ok i need to download winrar

quartz kindle
#

no you dont

#

windows has zip support built in

spark flint
ancient nova
#

mine didn't

spark flint
#

is 50ms a good response time for an api

quartz kindle
#

network included?

spark flint
#

yeah

quartz kindle
#

then yes its good

spark flint
#

ok good

quartz kindle
#

but a better metric would be to measure the api performance without network

#

since network is 90% latency caused by distance

pale lily
#

@ancient nova

quartz kindle
#

as i said, you didnt need winrar, but you didnt listen so whatever.

#

anyway extract everything into a folder

pale lily
#

i did?

quartz kindle
#

then you can close winrar

pale lily
#

ok

quartz kindle
#

and open the folder where you extracted everything to and double click install.bat

pale lily
#

when i double click on install cmd says global or local and close

quartz kindle
#

um wat

#

show pic

pale lily
quartz kindle
#

that means its installing

pale lily
#

ok what next

quartz kindle
#

did it create a "node_modules" folder?

pale lily
#

i got this file

quartz kindle
#

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"

pale lily
#

i cant

#

im in rdp from my phone

quartz kindle
#

then run cmd and navigate to your folder

pale lily
#

what i have to do in cmd

#

what command

quartz kindle
#

do you know the cd command?

ancient nova
#

I have a little batch script I wrote I can give it to u

pale lily
#

nothing happen

quartz kindle
#

i asked if you know it

#

could have just answered "no"

ancient nova
#

cause u aren't forwarding it to a filepath...

quartz kindle
#

you see how it says C:/Users/liyass?

pale lily
ancient nova
quartz kindle
#

thats the folder where your current cmd is right now

ancient nova
#

replace the index.js with your main file

quartz kindle
#

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

pale lily
#

i have to do cd my folder name?

ancient nova
#

you can also use push and popd if u are 1 folder below ur filepath

quartz kindle
ancient nova
#

do pushd foldername

wheat mesa
#

wtf are these checkmarks

quartz kindle
#

what you type in the cd command depends on what your folder is named, where your folder is, and which folder cmd currently is

quartz kindle
wheat mesa
#

they just appeared randomly

ancient nova
wheat mesa
#

I looked it up and it says something about onedrive, but I have never used onedrive

#

and my onedrive is empty

spark flint
#

but the icon looks different

#

right click --> properties

#

should say

pale lily
quartz kindle
quartz kindle
ancient nova
#

it's quite useful

quartz kindle
spark flint
#

sharex my beloved

#

theres lightshot too

ancient nova
wheat mesa
spark flint
#

lol

pale lily
#

@quartz kindle this is so hard thank you for helping

#

I cant do this

#

@ancient nova thank you too

ancient nova
#

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

lyric mountain
#

Basically you split the list into smaller lists

ancient nova
lyric mountain
#

Are u using buttons?

ancient nova
#

nope

#

I'm old fashioned lol

#

I can use reactions

lyric mountain
#

...that's still buttons for this matter

ancient nova
#

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?

lyric mountain
#

Doesn't matter, there are 2 ways of doing it: either buttons or index specification

ancient nova
#

that seems easy enougb but not quite sure how to convert it

lyric mountain
#

It doesn't matter if u use actual buttons or reactions

#

Or pepperoni

ancient nova
#

any way to do it the way I suggested?

lyric mountain
#

No, that's pretty bad since you'd be re-fetching the ban list each time the user wants to change the page

ancient nova
#

and slice only based on input?

#

still, that sounds quite complicated

lyric mountain
ancient nova
lyric mountain
#

You'd take a single page and discard the rest, inefficient

ancient nova
#

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?

lyric mountain
#

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

ancient nova
#

I'm still not quite sure how to chunky it

#

I never actually done that

lyric mountain
#

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

ancient nova
#

that seems quite confusing, I wish you'd add comments to that lol

#

how do I integrate that into the list?

lyric mountain
#

This is just an example to understand the concept

ancient nova
#

I see

lyric mountain
#

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

ancient nova
#

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

lyric mountain
#

Forget slice

ancient nova
#

bannedList[args[0]]

#

args[0] being the page number or something like that

lyric mountain
#

Don't send a single page

#

Use reactions/buttons to allow navigation

ancient nova
#

single page is fine, really

lyric mountain
#

By not overcomplicating you'll be doing a lot of unnecessary api calls

ancient nova
#

however I'm still not quite sure how the Chunkify function would fully work

ancient nova
lyric mountain
#

You don't need to chunkify if you'll be sending a single page

ancient nova
#

plus the command is only restricted to server owners

lyric mountain
ancient nova
lyric mountain
#

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

ancient nova
lyric mountain
ancient nova
lyric mountain
#

You set them to whatever u want

ancient nova
#

max 100

#

?

#

no?

ancient nova
#

let me see though

lyric mountain
#

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

ancient nova
lyric mountain
#

And you'll be fetching every single user in that list every time someone runs that command

#

Then discarding it the very next moment

ancient nova
#

okay what is the pages and page variables supposed to signify

lyric mountain
#

The page number

ancient nova
#

which one is the page number

#

and what does pages do?

lyric mountain
#

Whatever you pass as argument

lyric mountain
lyric mountain
ancient nova
#
            bannedEmbed.setDescription(bannedList.slice(10 * (args[0] || 0), 10 * (args[0] + 10 || 0)).join("\n"));
#

so

lyric mountain
#

You can't do math operations with strings

ancient nova
#

...um is that good enough

ancient nova
lyric mountain
lyric mountain
#

Is there any way to get ban number on discord without resorting to eval?

lyric mountain
# ancient nova 😭

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

ancient nova
lyric mountain
ancient nova
#

well

ancient nova
wheat mesa
#

I thought something happened to the bans endpoint didn’t it?

ancient nova
#

if not, then eval may be the only way

wheat mesa
#

Didn’t they take down the ban fetching endpoint or was that something else?

ancient nova
wheat mesa
#

No not djs

ancient nova
#

so I think it's something else

lyric mountain
#

No ban number on mobile, but whatever, here's only 5 raid reports from my antiraid system on that server

ancient nova
#
            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
lyric mountain
#

Those 5 alone are almost a thousand banned users

wheat mesa
#

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

ancient nova
#

oh how to limit???

#

that'd be amazing if the guilds have too many bans

#

I can limit it to 100

wheat mesa
#

This was a while ago

ancient nova
#

:c

#

dang

wheat mesa
#

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 KEKW

lyric mountain
#

Future itsokaybee

ancient nova
lyric mountain
wheat mesa
ancient nova
lyric mountain
#

Ban lists can become huge, it's a serious issue if u fetch it every time a command is ran

ancient nova
# lyric mountain Ban lists can become huge, it's a serious issue if u fetch it every time a comma...
    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

lyric mountain
#

Why are u adding 10 to pagenumber?

#

You want to get 10 pages at once?

ancient nova
#

huh no I thought it was how many people are showed per page

lyric mountain
#

That's the number before multiplication

ancient nova
#

then

#

I'm confused

#

if I remove it it will be the same as the first one

#

so nothing will fetch anyway

lyric mountain
#

No it wont

ancient nova
#

??? wdym it will not

lyric mountain
#

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

ancient nova
#

still doesn't work

#

is my maths bugging out or what

lyric mountain
#

Because your code is broken

ancient nova
#

how

lyric mountain
#

!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

ancient nova
#

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

lyric mountain
#

const page = (args[0] ?? 1) - 1

#

Show error if user supplies page smaller than 1

ancient nova
#

what does ?? do?

#

never heard of that

lyric mountain
#

coalescing operator

#

If the first value is null/undefined, return the second value

#

Else return itself

ancient nova
#

my syntax highlight is buggin out when I paste ur code

#

u sure it's correct?

lyric mountain
ancient nova
#

thanks for da help

lyric mountain
#

There's also elvis, which is similar to coalescing operator

ancient nova
#

how does it look and what does it do?

#

seems there is plenty I don't know about JS yet

lyric mountain
#

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

ancient nova
#

okay now I kinda wish it would've existed in JS

#

but we can't have everything

lyric mountain
#

It's the same as js' ??

ancient nova
#

😭

ancient nova
quartz kindle
#

i wish js had a ?? that could be used in place of !

#

something like if(??variable) { do something }

lyric mountain
#

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

ancient nova
quartz kindle
#

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

ancient nova
#

so what you're saying ?? always returns some value?

quartz kindle
#

no

#

0 ?? 10 = 0
0 || 10 = 10

#

|| considers 0 as a false value

#

?? only considers null and undefined as false values

ancient nova
#

const hi = !("hi" ?? false);
hi

#

why not do this then?

wheat mesa
#

wha

ancient nova
#

! is gonna reverse whatever output ?? gives

wheat mesa
#

! is going to implicitly convert to boolean

#

Am I understanding something wrong

ancient nova
sharp geyser
#

it is pointless

wheat mesa
#

except that brick wall is a walking living javascript spec book

quartz kindle
#

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

sharp geyser
#

and a walking living genius

#

nvm he used var /s

ancient nova
#

I was thinking you were talking about something completely different

sharp geyser
#

isn't it, if the left hand is null/undefined it will use the right hand?

#

??=

quartz kindle
#

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 ""

quartz kindle
sharp geyser
#

Waffle just showed me this 😔

#

this looks horrid to me

quartz kindle
#

double negative with bitwise NOT lmao

sharp geyser
#

looks weird

quartz kindle
#

ever seen how to remove a flag from a bitfield?

sharp geyser
#

👀

#

no

quartz kindle
#

bitfield &= ~flag

sharp geyser
#

yes lets not

quartz kindle
#

djs does that

#

xd

sharp geyser
quartz kindle
#

??= was already in node 16+ i believe

sharp geyser
#

Yea but ts didn't add support for it until 4.0

quartz kindle
#

eslint still doesnt support static methods on classes

sharp geyser
#

👀

#

I am thinking I should read the typescript handbook to learn more about the language I constantly use but who cares mmLol

quartz kindle
#

theres like a several years old issue about it and they just tell you to use a plugin

sharp geyser
#

kek

quartz kindle
#

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

quartz kindle
#

gn!

sharp geyser
#

gn kek

wheat mesa
#

ok

ancient nova
#

phishing scam don't click link

manic basin
#

very sus link

#

it's more than likely a phishing scam link

rustic nova
#

-b 526435656482684948 compromised account

gilded plankBOT
#

upvote Glare#3843 was successfully banned.

sharp geyser
#

Seems like that is a webhook or smth

rigid maple
#

this is not webhook

earnest phoenix
#

That's just a codeblock with the ANSI language, you can color anything you want

rigid maple
#

Is there a source where I can look at examples or features?

earnest phoenix
rigid maple
#

#
\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

earnest phoenix
#

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

rigid maple
#

oh thanks now i understand

upper current
#

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.

earnest phoenix
#

They have to go to the website

upper current
#

thanks

winter pasture
upper current
boreal iron
#

That’s all you can do, yes

upper current
#

yeah, i gathered that, thanks

earnest phoenix
#

Just force your users to listen to BTS until they go to the website and vote for the bot

boreal iron
#

You could remind them to do so every 12h if they want to

#

lol

winter pasture
#

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

split hazel
earnest phoenix
upper current
#

None of it will be locked due to that, lmao.

boreal iron
#

We don’t need to be educated

upper current
#

However, i do see a blacklist feature coming soon™️ if they don't vote. it's a win/win, really.

boreal iron
#

Aye

#

Require administrator permissions then force them to vote or delete one channel every hour

#

Sounds about right

earnest phoenix
#

Threaten the users to nuke the server if they don't vote, problem solved

upper current
#

if (!vote) yeetus deletus command.guild

#

else have a wonderful day; i love you;

boreal iron
upper current
#

!pay theMan already

boreal iron
#

Support has been going on for 5 mins, means you gotta pay 1 hour

earnest phoenix
#

FakE with their FakE payment request

upper current
#

buh duh tss

boreal iron
upper current
#

if, clearly he hasn't been paid his dues from his toe pics yet this month

boreal iron
upper current
#
if (!toePics) force vote();
if (!vote) force unfriend();
if (unfriend) force block;
#

exactly

#

i forgot one

#

if (blocked) insert lul;

upper current
#

alright, i got my answer a while back. i'm out. lol. thanks for the entertainment and information

#

entermation

#

or infortainment

split hazel
#

last time I asked him about programming the ACPI I was rather disappointed

boreal iron
#

He’s just trolling on a level we don’t understand because he’s bored of us plebs

split hazel
#

how old is tim

#

he's like 50 by now

#

you can't be wise and young

earnest phoenix
#

I'm pretty sure Tim is around his 30s

split hazel
#

people in Brazil age 2x faster so

#

hes around 15

boreal iron
#

lmao

boreal iron
still storm
#

Is it possible to change that embed that shows from link using description CSS??

boreal iron
#

No

indigo kindle
#

What programming language can I use to code discord bot? Can I use C#?

boreal iron
still storm
#

Can you tell me how, me stupid

split hazel
#

never knew Facebook had its own tag

still storm
#

Thx

indigo kindle
#

What programming language can I use to code discord bot? Can I use C#?

stable eagle
split hazel
#

discord.asm

indigo kindle
#

I thought I can use only Python

#

Or js

wheat mesa
#

You can make discord bots with basically any language

indigo kindle
#

Nice

pine nova
#

😔

carmine talon
#

Can anyone help me with this error?
This is when i write git init on the visual studio terminal :/

vivid fulcrum
#

...install git?

carmine talon
#

that's what i thought it was but i have it already installed i guess

pine nova
#

💀

carmine talon
#

ohhh...

#

thx 😅

pine nova
#

np

carmine talon
#

its saying the same after the installation

pine nova
pine nova
#

no, in the system path variable

carmine talon
#

yeah it was installed there

pine nova
#

hmm

#

try restarting ur computer if that doesnt work idk then or maybe u installed it incorrectly weirdsip

split hazel
#

restart it again

eternal osprey
#

hey guys is it possible to specify am/pm in node-cron?
Like: 9:00am

split hazel
#

no

lyric mountain
#

just add 12 when dealing with pm

boreal iron
#

Imagine not using 24h or the metric system or anything else that’s cool

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

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

pine nova
jovial sparrow
#

hello

fossil crater
#

How do you paginate through the /users/@me/guilds endpoint?

Cant seem to find solid documentation

solemn latch
#

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

Discord Developer Portal

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

fossil crater
#

Gotcha, well im hitting the endpoint for the bot user

solemn latch
#

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*

fossil crater
#

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

lyric mountain
#

you could just make an endpoint for ur bot and request guild info from it

fossil crater
#

Very true....

lyric mountain
#

that also doubles as an online status checker

#

if the api stops answering, the bot is off

quartz kindle
#

are you not running a websocket or you have guild cache disabled?

split hazel
#

thanks oracle

#

I mean I can use another card but aa

boreal iron
#

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 angeryBOYE

boreal iron
#

1000 Indian Rupees?

split hazel
#

no

#

im gonna troll them

#

pretend like they replied with something else

boreal iron
#

lmao

#

Do what’s needed!

#

To get what you want.

split hazel
#

i changed the quoted reply to this

spark flint
#

lol

split hazel
#

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"

pine nova
#

💀

quartz kindle
#

jesus

#

send them an envelope with the money by mail

simple stump
#

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?

quartz kindle
#

and include a letter with your account info

quartz kindle
simple stump
quartz kindle
#

if the current instance is unmodified, you cant

simple stump
#

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?

quartz kindle
#

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

simple stump
#

ah ic. so the best solution would be to modify any current instance the user has open via a mod or smth?

quartz kindle
#

something like that yeah

#

maybe this would help

simple stump
#

dang it okay. thanks

simple stump
cloud bough
#

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

#

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

fossil crater
lyric mountain
#

nice

viral spade
#

Is it true that discord.js is bad when it comes to scaling?

split hazel
#

"can i send the dollar via mail?"

split hazel
#

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

fossil crater
woeful pike
scenic kelp
split hazel
simple stump
#

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.

opaque acorn
#

embeds have been changed in v13?

quartz kindle
#

on both bridge and client

split hazel
#

wait can you make a minecraft server in node

#

if not someone needs to make that

#

native node

quartz kindle
#

technically you can, but good luck doing that

split hazel
#

cut out the heavy java

#

might start a small project for that just for fun

quartz kindle
#

i mean, there are many alternative minecraft servers, like paper, pufferfish, purpur

#

pretty sure they are open source

split hazel
#

but nodejs

quartz kindle
#

so you could remake them in node

split hazel
#

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

quartz kindle
#

there is a nodejs server for bedrock edition

#

its still on v1.16 tho

cinder patio
#

Isn't a minecraft server just a TCP server?

quartz kindle
#

well yes, but it does need to control every aspect of the game

#

like chunk generation and sync, entities, etc

cinder patio
#

I'm surprised nobody has made a framework for node.js yet

wheat mesa
#

probably just too much of a pain

quartz kindle
#

apparently there is a big difference between java and bedrock editions of the game

#

such as that even their servers are entirely separate projects

cinder patio
#

who plays bedrock

lyric mountain
quartz kindle
#

people who play on xbox and playstation

#

or buy the game from ms store

#

lel

cinder patio
#

and mobile too

split hazel
lyric mountain
#

in bugrock there's a common bug where your death is delayed

#

like, you fall a huge mountain but suffer no damage

cinder patio
#

I have MC on my PS3 and there are literally no servers 😭

lyric mountain
#

a few minutes later, you're wandering then suddenly you die

split hazel
#

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

quartz kindle
#

that just sounds like packet loss

#

does it also happen locally/offline?

lyric mountain
#

it happens specifically offline

quartz kindle
#

lmao

lyric mountain
#

there are many other grotesque bugs, but this is one that happen relatively often

quartz kindle
#

some async function getting stuck somewhere?

#

or a hanged thread?

#

a deadlock?

lyric mountain
#

maybe, idk how they did it but they did somehow

#

also you don't get the best part of minecraft that is modding

split hazel
#

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

quartz kindle
#

make a server in rust

split hazel
#

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

lyric mountain
split hazel
#

theres also so many objects which are made then destroyed which makes the garbage collection of java a huge performance killer

lyric mountain
#

minecraft is like windows

quartz kindle
lyric mountain
#

they have A LOT of legacy code that's strapped with duck tape

quartz kindle
#

im running a purpur server and a fabric client filled with performance mods lol

lyric mountain
quartz kindle
#

TAIWAN NUMBER ONE

#

that was from another game tho lel

lyric mountain
#

they're slowly moving to fabric tho

quartz kindle
#

rip

#

i just start from scratch everytime we decide to play mc again

#

its like a periodic thing

#

lel

boreal iron
#

oof

#

An old men talking about minecraft

#

Things are going crazy if I can’t watch you guys

quartz kindle
#

an old man watching another old man?

#

stop pretending and come play with us

simple stump
split hazel
#

guys

#

how tf do i add acid compliance to my db

simple stump
quartz kindle
split hazel
#

i already have atomic operations since only one thing can happen at the same time when reading or writing

split hazel
#

i know most would use a journal for that

#

but what would you store in that journal

quartz kindle
#

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

split hazel
#

what if its in the middle of a power failure

#

and it writes like 50% of the bytes

quartz kindle
#

once restarted, the checksum will fail and that write should be cleaned and invalidated

split hazel
#

my idea would be write some data to the journal, do the operation, remove from journal

quartz kindle
#

also ^ yes

boreal iron
#

lmao

quartz kindle
#

but the same should be applied to the journal itself

#

if it crashes in the middle of writing to the journal

quartz kindle
split hazel
#

yeah crashes when writing to journal shouldnt be an issue

boreal iron
split hazel
#

what should i store in the journal when writing/updating?

#

the values?

boreal iron
#

Tim always has the best ideas tho

quartz kindle
#

lmao

quartz kindle
split hazel
#

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

quartz kindle
#

i enabled type checking for js in vsc and now all my shit is red

split hazel
#

should each record contain a checksum

quartz kindle
#

probably

#

the journal entry should contain the files affected, and the checksums expected for each one

split hazel
#

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

quartz kindle
#

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

split hazel
#

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

quartz kindle
#

ah also

#

the journal would need to have a copy of the previous data

#

so that a rollback is possible

split hazel
#

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

slow terrace
#
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

quartz kindle
#

quests is an array inside the progress object

#

which quest do you want to increment?

slow terrace
#

Oh sorry the quest is

let quest = data.progress.quests.find(x => x.id == 4).current;
slow terrace
quartz kindle
#

so you need to create a query that increments the field "current" for the quest item with id 4, inside the progress object

sick agate
slow terrace
quartz kindle
#

yeah +1 and 1 are the same thing

#

but thats not the issue

sick agate
#

Yeah

quartz kindle
#

the issue is that your query does not specify what you want it to do

sick agate
#

Yeah

quartz kindle
#

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"

slow terrace
quartz kindle
#

that has nothing to do with it?

slow terrace
# quartz kindle it cant guess what you want because you didnt specify its inside the progress ob...

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

quartz kindle
#

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?

slow terrace
#

Oh

#

yea

slow terrace
quartz kindle
#

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

quartz kindle
#

maybe something like this could work, i dont know ```js
await schema.findOneAndUpdate({ userID: "...", "progress.quests.id": 4 } , { $inc: { "progress.quests.$.current": 1 } });

slow terrace
#

Best support 💯 ⭐ sworddance

split hazel
#

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

quartz kindle
split hazel
#

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

sharp geyser
#

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

split hazel
#

i wrote my own async :o

#

and idk what you mean

sharp geyser
#

im sorry for ur loss

quartz kindle
#

lmao

sharp geyser
split hazel
#

why tho

sharp geyser
#

🤷‍♀️

quartz kindle
#
public class var {
    async async async(async async) => await async;
}
sharp geyser
#

😔

split hazel
quartz kindle
sharp geyser
#

what da fuck

quartz kindle
#

beats me

split hazel
#

aight c++ lesson y'all

sharp geyser
#

no thx

#

Teach me C instead mmLol

sharp geyser
#

I wanna learn and become smarter

dusk vault
#

day 5 of trying to get banned on this server /s

quartz kindle
sharp geyser
dusk vault
#

lmao

split hazel
#
// 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();
dusk vault
#

ah yes

#

C++

#

readable 100

sharp geyser
#

message pack eh

#

Looks interesting actually

split hazel
#

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

wheat mesa
#

why bother with trying to support async like that when you can modify your compiler to support async/await keywords :troll:

split hazel
#

i'll just ignore that

#

that is odd

#

it calls the destructor twice

#

once after the chaining and second when the function ends

wheat mesa
#

seems like a funny issue that rust would be good at solving

sharp geyser
#

you use rust once and instantly become a fan boy

wheat mesa
#

because rust is great

#

and it was a joke dummy

sharp geyser
#

so was what I said sped

split hazel
#

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

earnest phoenix
#

Hm

slender thistle
sharp geyser
#

sky is typing

#

I got bored and looked at php

slender thistle
#

I have arrived to praise our lord and savior

#

Ferris

slender thistle
sharp geyser
#

pfft

#

What else to do I have 0 time to work on anything that takes a lot of effort

#

finals coming up

#

😔

slender thistle
#

Work on your finals

sharp geyser
#

Idk what the finals are until the day of the finals

sharp geyser
slender thistle
#

Don't know

#

Never used it

quartz kindle
slender thistle
#

Never had to

sharp geyser
#

Cause idk any pokemons beside Charizard, Pikachu, Squirtle, and that cat one

quartz kindle
#

meowth thats right

sharp geyser
#

Ain't no way Perl devs get paid more then everyone else as of 2020 (old report but that is insane to me)

tropic swift
#

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.

slender thistle
#

I highly doubt it

vivid fulcrum
#

med students don't have the time to chill on discord tbh 🥲

sick agate
#

Yeah

vivid fulcrum
#

but it's an original idea anyway, i've yet to see something like that

slender thistle
#

This

#

Nothing really dedicated to medicine on Discord that I've seen

earnest phoenix
solemn latch
quartz kindle
earnest phoenix
quartz kindle
#

then youre doing something wrong

#

show full code

earnest phoenix
#
<!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);
};
quartz kindle
#

where did you get this from?

near stratus
#

......

quartz kindle
#

then why does your code above have &token=code and doesnt have any response_type?

near stratus
quartz kindle
#

lmao

near stratus
#

not response_type=token

earnest phoenix
#

oh

#

i didnt understand this and used translate

#

thanks for helping

opaque acorn
#

what is happening here?

solemn latch
opaque acorn
#

or outside

solemn latch
#

Op sorry I didn't scroll down enough ^_^

Looks like you are requiring a directory? I dont think that works.

solemn latch
#

You're not requiring the things inside, just the directory itself.

vivid fulcrum
#

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

simple stump
#

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.

lyric mountain
#

does someone still play 1.8?

simple stump
#

its the most popular for competitive atm

#

one of the largets player bases

quartz kindle
#

ie, require("./folder") is a shortcut for require("./folder/index.js")

earnest phoenix
#

i believe

simple stump
#

yeah

split hazel
#

you really need powerful gpus to train a model in an okay amount of time

#

or rent out a Google cloud tpu/gpu

earnest phoenix
#

changing the status of a bot every 5 minutes

#

is it allowed or no?

#

read the pins and it kinda confuses me

ancient nova
earnest phoenix
#

?

#

your bot was going offline because of you changing the status?

ancient nova
#

most likely

#

after I increased the time it stopped going offline

slender thistle
#

Sounds like unoptimized code

#

5 minutes is fine

split hazel
#

it sounds like broken code 💀

slender thistle
#

Exactly

ancient nova
#

I just had a timeout func and setStatus method inside of it

#

nothing could possibly be broken

vivid fulcrum
#

if gcp still has those free credits i might cop them with a new account

#

since i have a new ccn

split hazel
#

if you can go for a TPU instead of a gpu

#

its googles proprietary machine learning alternative to a gpu