#development

1 messages · Page 167 of 1

warm surge
#

If your support server is on topgg you need put your server id but this is optional

carmine wave
#

Adding slashcommand support to all of my current commands

#

( knowing that I used msg.channel.send for all of them, and slashcommands wants a response )
( and I still want my "old" commands to msg.channel.send )

warm surge
#

so

#

i have both

#

i got 2 folders for slashcommands and commands

carmine wave
#

i didn't wanted that

warm surge
#

Hm?

carmine wave
#

I didn't wanted to have 2 folders

#
const { Message, ChatInputCommandInteraction } = require("discord.js");

async function send(context, content){
  if(context.constructor.name === Message.name)
    return context.channel.send(content);
  else if(context.constructor.name === ChatInputCommandInteraction.name)
    return context.reply(content);
  else
    throw new Error("context is not a message or command interaction");
}
#

I just went for a, what I call, "repliesHandler"

warm surge
#

Ah.

earnest phoenix
carmine wave
#

very true, i'll update it

#

thanks

earnest phoenix
#

You're welcome

carmine wave
#

new annoying task unlocked : handle arguments in "sub commands"

carmine wave
#

pov you're too lazy but that makes you a good dev

// function to convert commands to slash commands, skip if already slash commands
function convertToSlashCommands(arr) {
  let newArr = [];

  for (const entry of arr) {
    let data;
    if (!entry.data)
      data = {
        name: entry.name,
        description: entry.description.en,
      };
    else data = entry.data.toJSON();
    newArr.push(data);
  }

  return newArr;
}
wheat mesa
#

That… doesn’t make any sense

#

ignore that my brain is sleep deprived

#

Inner of that loop could be replaced with a one liner tho

quartz kindle
#

hell no, i test locally, if it works i push to main/master

neon leaf
#

I spent around 16.2% time of the year coding

quartz kindle
#

nice

neon leaf
#

not nice

#

also is there any speed difference between buffers and arraybuffers

quartz kindle
#

arraybuffer = raw data, no methods to read/write
typedarrays = read/write byte data to/from an arraybuffer
dataview = read/write numerical data to/from an arraybuffer
textencoder/textdecoder = read/write string data to/from an arraybuffer
nodejs buffer = basically typedarray+dataview+textencoder+textdecoder

#

typedarrays and dataview is usually faster than buffer, but for strings, buffer is usually faster than textencoder/textdecoder

neon leaf
#

mhm okay

#

what do you think about how im redesigning my lib?

import { Cookie, Server, Channel } from "rjweb-server"
import { Runtime } from "@rjweb/runtime-bun"

const server = new Server(Runtime, {
    port: 8000,
    version: true
})

const chatChannel = new Channel<string>(),
    history: string[] = []

chatChannel.listen((message) => {
    history.push(message)
})

server.path('/', (path) => path
    .static('./public', {
        rewriteHtml: true
    })
    .path('api', (path) => path
        .path('messages', (path) => path
            .http('GET', '/last', (http) => http
                .onRequest((ctr) => {
                    ctr.print({ success: true, message: chatChannel.last() })
                })
            )
            .http('GET', '/history', (http) => http
                .onRequest((ctr) => {
                    ctr.print({
                        success: true,
                        history
                    })
                })
            )
        )
        .ws<{ username: string }>('/', (ws) => ws
            .onConnect((ctr) => {
                ctr["@"].username = ctr.queries.get('username', 'Anonymous')

                ctr.subscribe(chatChannel)
            })
            .onMessage((ctr) => {
                chatChannel.send(`${ctr["@"].username}: ${ctr.rawMessage()}`)
            })
        )
    )
)```
this is how I want it to look (and am about 40% done), should I keep it like this? (just a code example)
radiant kraken
neon leaf
#

webserver

radiant kraken
#

ooo damn pog

#

very impressive

neon leaf
#

I had that style for minecraft plugin development and just continued it

#

I dont like it anymore

radiant kraken
#

i thought it was automated at first

radiant kraken
neon leaf
#

I mean the other way of defining route is through file based routing, so you have a file for a route / multiple routes and the path gets inferred from the file location

radiant kraken
#

i hate it how you have to .http(..., ..., cb => cb.onRequest(x => ...))

#

like why not just .http(..., ..., x => ...)

neon leaf
#

because callback has multiple methods

#

context and onRawBodyChunk

radiant kraken
#

what is context for

neon leaf
neon leaf
radiant kraken
#

imo

neon leaf
#

I use it for authentication, because theres a special method on a path that lets you validate the request before continuing to the handlers, I just set stuff like ctr["@"].user to user infos so I know the authenticated user easily in every handler

radiant kraken
#

is this @ a special key assigned by the lib

neon leaf
#

I call it context

#

I set it to {}

radiant kraken
#

looks weird

neon leaf
#

users can just add shit to it that stays through the request

#

(or websocket)

radiant kraken
#

just make it obvious

#

that it is context

neon leaf
#

eh I wanted something short

radiant kraken
#

yeah but you dont have to make things short for your lib users

#

im sure they are fine with typing seven characters

neon leaf
radiant kraken
#

a bit unintuitive to make your users use ["@"] all the time, no?

neon leaf
#

is it?

radiant kraken
#

yes

neon leaf
#

I mean you could just import your stuff too

#

just doing ctr.whatever = 1234 should work too, just isnt automatically typed

radiant kraken
#

oh alright

neon leaf
#

actually

#

I could just add an option to set the name of that property

radiant kraken
#

but a bit weird to use it as an example in your docs

neon leaf
radiant kraken
#

what

#

why not like .ctx or .context

#

or .data

neon leaf
#

you could with that

#

just do

new Server(Runtime, {
  context: 'data'
})

or something

radiant kraken
#

nah

#

just make it a constant

neon leaf
#

nah

radiant kraken
#

i've never seen a lib done that lmao

#

you dont have to customize everything

neon leaf
#

nah, this lib is made for customization

radiant kraken
#

but not to the point of object attribute names

neon leaf
#

I mean you can already do that with middlewares anyway

radiant kraken
#

my point is you should prioritize simplicity over complexity

neon leaf
#

if you want simplicity use express 🤷🏾‍♂️

radiant kraken
#

fairs

neon leaf
#

I mean I originally made the lib to be a backend for my apis

#

which always end up complex

#

so I added a ton of stuff to help with that

radiant kraken
neon leaf
#

its so the server can run on bun, node (with uws or http) and deno

#

theres no way I can do that in the same package without injections

#

I mean sure

#

technically all support the http lib

#

but its shit

radiant kraken
#

bruh

#

you want to support bun and deno too

neon leaf
#

on bun I use Bun.serve
on node I use custom uWebsockets.js
on deno I use Deno.serve

radiant kraken
#

why not just use node's APIs since i'm sure bun and deno support them to an extent

neon leaf
#

they are quite slow

#

like 4x slower

radiant kraken
#

alright

#

i used to make my library portable to deno and bun too but as the hype died down i was like fuck it iara_ded_lost

neon leaf
#

main reason is so that people can (if they want) have a completely custom low-level http server and still same features / apis

radiant kraken
#

at this point just go libless if you want low-level mmLol

neon leaf
#

this is how the runtime that was imported looks

import { version as packageVersion } from "package.json"
export const version: string = packageVersion

import { Implementation, ImplementationHandleRecord } from "rjweb-server"
import { HttpContext } from "@/contexts/http"
import { Server } from "bun"

export class Runtime extends Implementation {
    private server: Server | null = null

    public port(): number {
        return this.server?.port ?? 0
    }

    public start(): Promise<void> {
        return new Promise((resolve) => {
            this.server = Bun.serve({
                port: this.options.port,
                fetch: () => undefined,
                websocket: {
                    message: () => undefined
                }
            })

            resolve()
        })
    }

    public stop(): void {
        this.server!.stop(true)
        this.server = null
    }

    public handle<Type extends keyof ImplementationHandleRecord>(type: Type, fn: (context: ImplementationHandleRecord[Type]) => any): void {
        if (!this.server) return

        switch (type) {
            case "http": {
                this.server.reload({
                    async fetch(request) {
                        const context = new HttpContext(request, this)

                        await Promise.resolve(fn(context))

                        return new Response(context.responseContent, context.responseInit)
                    }
                })
            }
        }
    }

    public wsPublish(id: number, data: ArrayBuffer): void {
        this.server!.publish(id.toString(), data)
    }
}```
quartz kindle
#

using separate webservers for deno and bun is very smart

#

but you could add some autodetection

#

so the user doesnt need to specify the runtime

neon leaf
#

const platform = typeof Bun === 'undefined' ? typeof Deno === 'undefined' ? 'node' : 'deno' : 'bun' 🧌

#

reason I dont do this is (1) to just allow users to use their own runtimes

#

(2) because stuff like the nodejs uws runtime is 100mb

radiant kraken
#

why would you create your own runtime

radiant kraken
neon leaf
#

or that uses the nginx api

quartz kindle
#

its good to have customizability, but its also good to have smart defaults in place that makes the initial setup easier for the user

#

also why is uws 100mb wtf

neon leaf
#

I include the binaries because building them in a build script never works as intended

rustic nova
#

making html emails is fun ngl

radiant kraken
#

thats a lot of js

#

what does it depend on

neon leaf
#

its just binaries

#

uws is c++

radiant kraken
#

yeah but how can it be so big

neon leaf
#

binaries for each platform and 3 node versions

radiant kraken
#

c++ moment

earnest phoenix
#

Why are you using uWebsockets anyway?

radiant kraken
#

for the rocket emoji

#

🚀

neon leaf
#

frfr

earnest phoenix
#

ws > *

radiant kraken
neon leaf
radiant kraken
#

why care about size when its blazingly fast

earnest phoenix
#

Technically it's not really faster, I'm not sure how it differs in terms of API, what does it provide that ws doesn't?

radiant kraken
#

its written in c++

neon leaf
#

💯

radiant kraken
#

so idk native speed or something

earnest phoenix
radiant kraken
#

it can be a problem when you use node-gyp

earnest phoenix
#

Rust produces binaries much larger than C++, if that was your initial argument

radiant kraken
#

the user installing it must have a working c++ compiler

#

thats not my point

neon leaf
earnest phoenix
#

It's also very easy to install as well

radiant kraken
#

imo i like napi-rs' approach to installing better

radiant kraken
earnest phoenix
#

It all depends on the implementation

earnest phoenix
#

Or simply make pre-built binaries, nothing hard/complex

neon leaf
#

just require users to download the binaries from a server on mars

#

ez

radiant kraken
#

making pre-built binaries for lots of OSes and architectures ain't easy

neon leaf
#

it is with gh actions

#

just arm being arm (slow af)

radiant kraken
earnest phoenix
#

CI/CD is a thing, and whatever you're doing, the packager manager will first attempt to look for pre-built binaries and download them, if not, build from source

neon leaf
earnest phoenix
radiant kraken
#

how

earnest phoenix
#

Cross-compilation is a thing, all you do is to define the target OS and architecture

#

Through environment variables, or use node-pre-gyp

earnest phoenix
carmine wave
quartz kindle
neon leaf
#

yeah I thought about that

#

those are like 5 months old now

quartz kindle
#

yeah like

#

a lot of people do worry about package size on npm

#

they may not want to download a package that big

#

why dont you just make uws an optional dependency?

neon leaf
#

isnt it anyway the way im doing it sir

quartz kindle
#

for the user to turn it on, they need to install it themselves

carmine wave
#

Is there a way to have to choose between these two options ? and not have them both

#

on the slashcommandbuilder

quartz kindle
#

which shows up as if it were two separate commands

#

/help category
/help command

carmine wave
#

so i just push 2 seperated slashcommandbuilder into my app ?

pale vessel
#

no, because they're under the same one command

quartz kindle
#

a subcommand is counted as command option

pale vessel
#

isn't there a function to add a subcommand for the builder?

quartz kindle
#

or something like that

carmine wave
#

yup, found it, thanks !

wheat mesa
#

it's in the builders package, you were looking at the main package

carmine wave
#

oooooh !

#

new skill unlocked

#

okay, got it, thanks to u all

carmine wave
#

Trying to dynamically map choices to stringoption (from slashcommandbuilder)
Tells me that they don't want an array

Am I missing missing somethin ?

const categories = [
  "chatbot",
  "all",
  "fun",
  "interactions",
  "configurations",
  "mic",
]
...
// slash command builder...
           option
            .setName("category")
            .setDescription("Category to get help from")
            .addChoices(categories.map((category) => ({name:category, value:category})))
            .setRequired(false),
0,
      ValidationError: Expected the value to not be an array
          ... {
        validator: 's.object(T)',
        given: [
          { name: 'chatbot', value: 'chatbot' },
          { name: 'all', value: 'all' },
          { name: 'fun', value: 'fun' },
          { name: 'interactions', value: 'interactions' },
          { name: 'configurations', value: 'configurations' },
          { name: 'mic', value: 'mic' }
        ]
neon leaf
#

you need to spread your array

#

.addChoices(...categories.map((category) => ({name:category, value:category})))

carmine wave
#

oow... thanks crying

neon leaf
#

@quartz kindle lets say I want to replace all e, a, o and x in a string. would for .. of each char be faster than String.prototype.replace with a regex like /e|a|o|x/g

tulip ledge
#

Even if it was wouldn’t this be an optimization of like .00001 ms

#

Also iirc string.replace is linear time

#

So O(n) which is the same as looping over each char

wheat mesa
#

you're not factoring in regex compile times and such, it's probably pretty optimized anyways but a traditional loop is almost always faster than a regex for anything

#

it's probably a tiny difference though so it likely doesn't matter

carmine wave
#

my bot knows I'm breaking every part of him, calling for help slup2 (resolved btw)

quartz kindle
#

iterating char by char is very slow once you go past 15-20 iterations

#

also one replace with regex should be faster than multiple replaces with one letter each

crystal wigeon
#

hey anyone know how to draw gifs on node canvas?

quartz kindle
crystal wigeon
#

and then use discord attachment to send it? i noticed webp works but its not showing on the embed

crystal wigeon
quartz kindle
#

a gif is basically multiple images in one file

#

so you need to decode it and get all the frames

#

then pick one frame to draw on canvas

lyric mountain
crystal wigeon
#

more like i want to add the gif on top of an image so like it sits in the bg and gif on top, im looking into some encoders EMJ_think2

lyric mountain
#

cuz the frames aren't guaranteed to be the same dimension as the gif

quartz kindle
#

yeah thats why a decoder is needed, the gif format is not as straight forward

#

the decoder should take care of that

quartz kindle
crystal wigeon
quartz kindle
#

if you want the final result to be animated, then you need to encode it back into a gif

lyric mountain
#

webp can be animated yeah, but discord doesn't support it

quartz kindle
#

so you have to decode the animation and get frames, for each frame you draw the bg + frame on canvas then save the canvas as the new frame

#

once done use the encoder to put all the new frames togther again into a new gif file

crystal wigeon
#

damn i have to draw the bg on each frame? isnt there an easier way like, if you use canvas context draw image multiple times it keeps adding layers, so i thought maybe i'll add animation on top of those?

#

i have a transparent bg gif,

#

png can also be animated right

lyric mountain
#

that's the only way

#

yes, but not for discord

#

also a little thing to note, remember ur limited to 254+1 colors for gif

#

the +1 being color 0, which is transparent

#

the more detailed an element is, the less colors u get to use on the final image

#

this is even worse if you have semi-transparent elements

crystal wigeon
#

ic

quartz kindle
#

what you can do tho is having two canvases

#

one will have the bg drawn

#

then for each frame you create another canvas, and copy the bg from the bg canvas

#

copying from canvas to canvas is much faster than drawing from image to canvas

crystal wigeon
#

i assume the gif encoder will take care of the copying

quartz kindle
#

you can also test what is faster, to create a new canvas or to erase it by drawing a rectangle

crystal wigeon
#

i found a package i'll probably try it tomorrow

#

erasing is faster yeah

quartz kindle
#

so two canvases, one with the bg, another for the frame, then erase frame, copy bg, draw new frame, erase frame, copy bg, draw new frame, etc..

limpid rain
#

Hi

surreal sage
#

hi just a nice developing related question
how would you fork a package, modify it, and then test it in another project or sorts

#

publish it to e.g your own npm org?

#

what do people do

#

npm link

quartz kindle
#

no need to publish anywhere

#

npm i githubusername/packagename

surreal sage
#

oo

frosty gale
quartz kindle
#

singlehandedly ruined the ecosystem

#

smh

frosty gale
#

probably part of the reason

#

and taking up good names for packages

quartz kindle
#

inb4 npm package names start being bought and sold like domain names

#

with people hoarding all 2-3 letter names for money

frosty gale
#

hopefully not 💀

#

though i would imagine it would be similar to githubs username system

#

if an accounts inactive for a while you can request to claim the username

#

or if theres a good reason to have a package name and its not being occupied by anything useful

radiant kraken
topaz lynx
#

What's a feature in bot? Like that differs from commands

bitter granite
#

@upbeat forge please dont ghost ping

upbeat forge
bitter granite
#

will check in a bit

neon leaf
#

now I just need to finish decompress for binary

rustic nova
#

Did I hear compression?

#

🗜️

#

boat compression pls ping moderators to uncompress

quartz kindle
#

using RLE and lookup tables?

neon leaf
#

im just doing something that I think works

#

hold on Ill send it when I fix my bad decompression

quartz kindle
#

xD

rustic nova
# topaz lynx

a feature can either be a significant command that is itself considered a feature

or a set of commands associated to one feature

topaz lynx
#

Would tickets be considered a feature?

rustic nova
#

if you're referring to tickets to something like creating a way to setup a ticket channel, have a command or a button to create a ticket

#

then yes something like that is considered a feature

topaz lynx
#

Oh ok, ty!

neon leaf
#

ok nvm my compressor is broken

#

ok its layer 8 issue

#

works with split = 4 fine

#
const startByteSplit = Buffer.from([ 0x69, 0x68, 0x67, 0x69 ]),
  endByteSplit = Buffer.from([ 0x69, 0x69, 0x67, 0x68, 0x69 ])

export async function compressFileBin(content: Buffer, splits: number, callback?: (progress: Progress) => any) {
  const outStart: Buffer[] = [], outEnd: Buffer[] = []
  const total = Math.ceil(content.byteLength / splits)

  const mapping = new Map<string, Buffer>()

  for (let i = 0; i < content.byteLength; i += splits) {
    const bytes = content.subarray(i, i + splits)

    mapping.set(bytes.toString('hex'), bytes)
    outStart.push(Buffer.from([ mapping.size - 1 ]))

    callback({
      text: `Processing Bytes ${i}-${i + splits}`,
      current: Math.floor(i / splits),
      from: total
    })
  }

  let i = 0
  for (const [ _, value ] of mapping) {
    outEnd.push(Buffer.from([ i, ...value.values() ]))

    i++
  }

  return Buffer.concat([ Buffer.from([ splits ]), startByteSplit, ...outStart, endByteSplit, ...outEnd ])
}

export async function decompressFileBin(content: Buffer, callback?: (progress: Progress) => any) {
  const splits = content[0], tempBytes: number[] = [], mapping = new Map<number, Buffer>()
  let rawContent: Buffer

  for (let i = 1 + startByteSplit.byteLength; i < content.byteLength; i++) {
    if (endByteSplit.every((value, index) => content[i + index] === value)) {
      rawContent = Buffer.from(tempBytes)
      tempBytes.length = 0

      break
    }

    tempBytes.push(content[i])
  }

  for (let i = 1 + startByteSplit.byteLength + rawContent.byteLength + endByteSplit.byteLength; i < content.byteLength; i += 1 + splits) {
    const bytes = content.subarray(i + 1, i + 1 + splits)

    mapping.set(content[i], bytes)
  }

  for (const byte of rawContent) {
    tempBytes.push(...mapping.get(byte).values())
  }

  return Buffer.from(tempBytes)
}```
#

ok it still breaks on images

#

m

radiant kraken
#

how does the compression process work

neon leaf
#

the code is in front of you sir

radiant kraken
#

yeah i know

#

i still dont understand

neon leaf
#

it just looks at each {splits} bytes, adds their hex value to a map as key and their values as value, decompress just reverses that

lyric mountain
#

honestly, that doesn't look efficient at all

#

does it even reduce data size?

neon leaf
#

ye

neon leaf
#

it breaks alot though

lyric mountain
#

if ur using the hash as a key it'll ofc break as identical segments will overwrite eachother

neon leaf
#

sir thats the point

#

identical segments dont need to be repeated

lyric mountain
#

but then how'd you uncompress it?

#

as ur not storing the repeat count nor positions

neon leaf
#

I am

lyric mountain
#

where

neon leaf
lyric mountain
#

?

neon leaf
#

??

#

thats the order

#

and repeat count

#

technically

#

could def be optimized

lyric mountain
#

that's not what I meant, besides I dont know what to look at in that image

quartz kindle
#

from what i understand, that will only work while you have less than 256 keys

lyric mountain
#

consider lol abc lol

lyric mountain
#

how would you uncompress it to that instead of lol lol abc

neon leaf
#

lo = 0
l = 1
ab = 2
c = 3
l = 4

#

00 01 02 03 00 04

quartz kindle
#

so if i understand correctly

#

splits defines the size of the chunks

neon leaf
#

yes

#

splits is also always first byte in compressed result

quartz kindle
#

so the compression efficiency relies entirely with how compatible the split size is with the size of repeating data in the file

neon leaf
#

basically

quartz kindle
#

i mean, its a good attempt, but its not very good for general purpose usage, one needs to know how the data looks like before compressing it

lyric mountain
#

ur attempting lzma basically, but with size limit

neon leaf
#

ye I just remembered this project today and that kuuhaku told me to try it with binary (it was fully text based before)

lyric mountain
#

I remember it yes

neon leaf
#

its the same concept I had with text

quartz kindle
#

also

#

from a performance standpoint its pretty terrible xDDD

#

was it like 13ms to compress that txt?

neon leaf
#

from a working standpoint it is too

lyric mountain
neon leaf
#

read and write is included

#

I mean I could make this use streams but not like ill ever use this project for something anyway

quartz kindle
#

streams would be worse

#

unless it for huge files

neon leaf
quartz kindle
#

64k is still very small

#

id only use streams when you're at 1mb+

#

streaming doesnt make anything faster, its just a way to split the job into chunks so the user can save them more efficiently

#

otherwise streaming actually makes the job itself slower, since it has more work to do

neon leaf
#

should I try compressing a 10gb file with the current state

quartz kindle
#

lmao

#

i think your pc would freeze for like an hour

neon leaf
#

gimme a split number

quartz kindle
#

23

neon leaf
quartz kindle
#

xDDD

neon leaf
#

ok Ill do 1gb

quartz kindle
#

your current code needs the entire file in memory right?

neon leaf
#

ye

quartz kindle
#

so it will use several gb of memory to perform that

neon leaf
#

should be fine as long as node survives it

quartz kindle
#

xD

neon leaf
#

its not that slow tbh

quartz kindle
#

pretty good

neon leaf
#

smhsmh

#
⚡  [BAD COMPRESS]: ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒░░░░░ 1m39s Processing Bytes 915380289-915380312
<--- Last few GCs --->

[1587285:0x5d25320]    98701 ms: Mark-Compact 4049.9 (4130.9) -> 4035.2 (4132.1) MB, 1654.43 / 0.00 ms  (average mu = 0.130, current d
[1587285:0x5d25320]    99942 ms: Mark-Compact 4051.1 (4132.1) -> 4036.3 (4133.1) MB, 1219.77 / 0.00 ms  (average mu = 0.084, current d


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xc7d530 node::Abort() [node]
 2: 0xb638e8  [node]
 3: 0xe8ee70 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 4: 0xe8f157 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 5: 0x10a07c5  [node]
 6: 0x10a0d54 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
 7: 0x10b7c44 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, cha]
 8: 0x10b845c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallback]
 9: 0x108e761 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::Allocat]
10: 0x108f8f5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::Alloca]
11: 0x106ce66 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::intern]
12: 0x14c7c36 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
13: 0x7fe3df699ef6 
Aborted (core dumped)```
quartz kindle
#

:^):^):^)

#

how much ram you have?

neon leaf
#
            .-/+oossssoo+/-.
        `:+ssssssssssssssssss+:`
      -+ssssssssssssssssssyyssss+-
    .ossssssssssssssssssdMMMNysssso.
   /ssssssssssshdmmNNmmyNMMMMhssssss/
  +ssssssssshmydMMMMMMMNddddyssssssss+
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   vscode@DE-01 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   ------------ 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   OS: Ubuntu 22.04.3 LTS x86_64 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Host: KVM/QEMU (Standard PC (Q35 + ICH9, 2009) pc-q35-7.2) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Kernel: 5.15.0-84-generic 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Uptime: 7 days, 1 hour, 59 mins 
  +sssssssssdmydMMMMMMMMddddyssssssss+     Packages: 769 (dpkg), 4 (snap) 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      Shell: bash 5.1.16 
    .ossssssssssssssssssdMMMNysssso.       Terminal: node 
      -+sssssssssssssssssyyyssss+-         CPU: Intel i9-9900K (10) @ 3.599GHz 
        `:+ssssssssssssssssss+:`           Memory: 19655MiB / 52204MiB 
            .-/+oossssoo+/-.
                                                                   
                                                                 ```
quartz kindle
#

run it with the max old size option

#

node --max-old-space-size=8192 file.js

neon leaf
quartz kindle
#

nice :^)

#

now try zipping/raring/7zipping it instead

#

just for comparison

neon leaf
#

it would probably be possible to compress that file to like 500bytes

#

its just zeroes

quartz kindle
#

xD

#

theorically, the maximum possible compression for 1gb of zeroes is 5-6 bytes, and its very easy to make

#

but of course, that would only work with a very specific compression method, and not a general purpose one

rustic nova
#

cant you theoretically do something like telling a decompressor to just repeat sections of bytes?

#

such as :

00 00 00 00 f3 fb c3 55

to

00 04 f3 fb c3 55
#

04 being the indicator of length of hexadecimal sections

#

though there would need to be some sort of indication that the decompressor should read that as such

quartz kindle
#

RLE = run length encoding

#

most compression algorithms implement a form of RLE together with other methods like lookup tables

radiant kraken
neon leaf
#

because thats not fun

radiant kraken
#

so you love pain

neon leaf
#

yes

radiant kraken
#

i used to work with buffers a lot in the past and the process is definitely not fun mimu_thisisfine

radiant kraken
#

thats what i would do

quartz kindle
radiant kraken
#

they are fun only if it works mmLol

#

which takes about a few days

neon leaf
#

ArrayBuffers are pain

quartz kindle
#

i like them xD

radiant kraken
#

JS bit-shifting operators are pain

neon leaf
#

binary arrays are fun

quartz kindle
#

thats what i do to shift numbers bigger than 32bit

radiant kraken
#

i wonder if there is a convenient npm package for that mmLol

neon leaf
#

I think tim made one

#
radiant kraken
#

insane

quartz kindle
#

lmao yup

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

radiant kraken
#

run

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

radiant kraken
#

yes

karmic parrot
#

Ew rust

wheat mesa
#

Don’t you dare slander rust like that

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

radiant kraken
#

the rust game is bad

pale vessel
#

he's a certified karat dev KEKW

carmine wave
#

People so mad about C#, a great language tho

spark pebble
#

discord.errors.HTTPException: 429 Too Many Requests (error code: 30046): Maximum number of edits to messages older than 1 hour reached.

Is this new?

spark pebble
#

Aye, but hasn't happeneed in 8 months, so was curious

lyric mountain
#

likely many users using the same command in the same channel

#

also remember message sends/edits share the same ratelimit

marsh lark
#

It specifies older than 1 hour tho

lyric mountain
#

still

spark pebble
#

Im just confused as i've not had this issue eveer before, and the bot isn't being used and more or less then it has since 8 months ago. Idk why it's only happening now

lyric mountain
#

because users

#

also, it's dangerous that you hit a 429 at all, most reputable libraries would have an internal bucket

spark pebble
#

and the bot isn't being used and more or less then it has before

lyric mountain
#

did you check if it wasn't added to a botfarm?

spark pebble
#

it's private

#

in 1 server

lyric mountain
#

welp, idk then

#

didn't u happen to leak your token?

spark pebble
#

Nope, i'll try change it anyway, but 99.9% sure I didntt

lyric mountain
#

those are the only possible reasons for that error

#

a - many users using commands that edit a message in the same channel at once
b - automatic message editing snowballing
c - token leak

marsh lark
#

Where is the error triggering? That should give you an idea

tulip ledge
#

SyntaxError: Cannot use import statement outside a module

???

#
{
  "compilerOptions": {
    "target": "ES6",
    "outDir": "./build",
    "moduleResolution": "node",
    "rootDir": "./src",
    "resolveJsonModule": true,
    "downlevelIteration": true,
    "module": "CommonJS",
    "skipLibCheck": true
  },
  "exclude": ["node_modules"],
  "include": ["src/**/*.json", "src/**/*"],
}
pale vessel
#

use NodeNext instead?

#

oh hmm u want to use cjs?

#

where are you getting that error

tulip ledge
#
import * as fs from "fs";
import * as path from "path";

function main() {
  let file = process.argv.slice(5)[0];
  fs.readFile(path.join(), console.log);
}

main();
#

index file

#

it's weird cuz my other project has the exact same settings and there it works

pale vessel
#

try checking your package.json

#

maybe u accidentally declared it as a module

#

although it shouldn't be a problem if TS transpiled it to require()

#

but I'm guessing it doesn't if you look inside your dist folder?

tulip ledge
#
{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "src/index.ts",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "node ./src/index.ts -e ts --dev main.vig"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@types/node": "^20.8.1"
  },
  "dependencies": {
    "typescript": "^5.2.2"
  }
}
wheat mesa
#

Uh why not tsc && node dist/index.js

pale vessel
#

is that tsnode?

#

nm I don't think so

wheat mesa
tulip ledge
wheat mesa
#

Easy to follow and usually doesn’t cause many issues

pale vessel
#

your folder is build, not dist

#

but same error?

wheat mesa
#

Yeah it depends on your setup, I usually name it dist

tulip ledge
pale vessel
#

ah

#

lol

#

what was that dev script though

tulip ledge
#

well I copied it from my bot where i used nodemon

#

guess it's late and forgot I should've changed that too

neon leaf
slender wagon
#

Nahh the real crime is using whatsapp for that kinda stuff 😂

lyric mountain
#

better than our team that insists on skype

neon leaf
#

mine is on discord poggythumbsup

slender wagon
#

My team is currently on google chat

#

Which is fine

lyric mountain
#

discord would literally fit like a glove for us, but they refuse because reasons

slender wagon
#

I'd like to get the core team in discord

#

But implementation team will prolly cry about it

lyric mountain
#

why?

slender wagon
#

Cuz they suck

lyric mountain
slender wagon
#

Implementation team is so fkn lazy i swear

#

We do more customization for them than the clients

neon leaf
#

my entire team is lazy

lyric mountain
#

our database triggers and ERP are built around not letting the support team fck up the client's database

slender wagon
#

Right

#

Idiotproof as if a 13 yo kid is gonna use it

earnest phoenix
#

A developer should always try for every edge case or hire people to test their program to see how they can break it

slender wagon
#

Yes we have lots of those too

#

They make the job easier

#

But sometimes report random shot

#

Shit

lyric mountain
#

I mean, we could use user accounts for the support team instead of root access (database), but they also refuse to setup it

earnest phoenix
#

Reminds me of this

In 1985, a state-of-the-art radiation therapy device called the THERAC-25 started blasting holes through patients' bodies, leading to the world’s first death by radiation treatment overdose. It killed two more people before anyone knew what was going wrong. Why?

💪 JOIN [THE FACILITY] for members-only live streams, behind-the-scenes posts, and t...

▶ Play video
lyric mountain
#

we could also not use a damn archaic database in a EoL release

#

but they also refuse to update

slender wagon
#

They wanted to run the project on docker containers on their machine while requesting realtime updates within 30 seconds

earnest phoenix
lyric mountain
#

we're managing to get them to update it to at least the LTS release after 3 years of discussion

lyric mountain
earnest phoenix
#

WHAT

lyric mountain
#

FIREBIRD

neon leaf
#

bruh what fucking companies are u even in

earnest phoenix
#

No fucking way

slender wagon
#

Lol

lyric mountain
#

lmao yes, we tried to convince the head to switch to postgres or any other decent database

#

but they think migrating would be more work than it's worth

#

btw we cant use functions because the database doesn't support them

slender wagon
#

I started migrating from aws to gcloud within 2 weeks of joining

slender wagon
#

We are using a very outdated version of prisma

#

So we are completely switching up

marsh lark
#

Prisma works with firebird?

slender wagon
marsh lark
#

oh yeah

neon leaf
#

"""Firebird technology has been in use for 30 years, which makes it a very mature and stable product."""

marsh lark
#

i forgot theres a lot of people here

lyric mountain
#

you cant even fathom how hard it is to have row_number() but without that function

neon leaf
blazing forge
#

I haven't done it yet so don't attack me for it but is it a bad thing if I was to make an owner only command to make an invite to a server its in. This would be used for bug reports or when I detect bad use of the bot (trying to break the bot on purpose) or sum like that?

rustic nova
#

If you dont disclose that in your privacy policy that you might do that, then yes

quartz kindle
#

yes its bad

rustic nova
#

if you do declare that, you aight

earnest phoenix
#

There's no concrete answer and others might have different answers but from my perspective, if the staff of the server you're joining to knows that you'll join then there shouldn't be a problem, otherwise it's bad

Also yeah, better to explicitly mention that in your Privacy Policy

blazing forge
#

Alright thanks. Just was checking to see if possible before I do anything like that

wheat mesa
#

Is there a proper way to fetch data from an API and convert it into a list of model objects in dart @lyric mountain? I'm using this right now but it's obviously not going to work since it doesn't know how to serialize into a Category object by default right? ```dart
late Future<List<Category>> _future;

Future<List<Category>> fetchCategories() async {
var data = await http.get(Uri.parse('http://10.0.2.2:8080/categories'));
if (data.statusCode == 200) {
return List.from(jsonDecode(data.body)['data']);
} else {
throw Exception('Failed to load menu categories');
}
}

@override
void initState() {
super.initState();
_future = fetchCategories();
}

#

Sample response: ```json
{
"status": 200,
"message": "success",
"data": [
{
"id": "CWEFCTHAZ723G",
"name": "A - Category 1",
"items": [
"Q636YGQ4B1NKA",
"9GGQYZEHEEN10"
]
}
]
}

#

Found this, I suppose it should work fine ```dart
var list = List.from(jsonDecode(data.body)['data']);
var newList = list.map((x) => Category.fromJson(x)).toList();
return newList;

lyric mountain
wheat mesa
#

Yeah but I'm not sure if that'll work to do jsonDecode() as List<ModelObject>

lyric mountain
#

maybe it does, never tried

rustic nova
#

I hate docker and ufw

#

well I dont hate themselves

#

but I hate trying to make both work

slender wagon
#

I have something very similar to this. He is working on a big project but knows nothing about scaling

deft wolf
#

Ben is a fivehead

grim aspen
grim aspen
#

therac-25 i remember reading about that

earnest phoenix
#

Though it goes into a lot more detail than the others

grim aspen
#

sad thing was it went through two software errors, i think the third one they found the original (albeit not the root cause) problem. first one was a race condition that went unnoticed during development and review. if a user misstyped the character, the machine would default but the safety system would fail to catch up. the second error was arithmetic overflow which was the machine exceeding memory

earnest phoenix
#

Yep, this is why you thoroughly test software before going live

#

And hire people to test it to see how they can break it

old sonnet
tulip ledge
#

When a user selects something from a select menu can I remove the selection? So it goes back to the place holder

spark flint
#

lemme grab the code rq

#
await interaction.update({ });```
#

then js await interaction.followUp({ content: "hi" }); to reply after

tulip ledge
#

Alright it works, thank you!

cerulean anchor
#

Hey there, can anyone help with how to embed our website on the bot page?

deft wolf
cerulean anchor
#

Yep

deft wolf
#
cerulean anchor
#

Ah, it just didn't work in the preview

tulip ledge
#

is it possible to just edit the css custom properties from topgg?

deft wolf
#

I guess

#

But you can't edit it too much

#

Like everything related to ads can't be changed

north whale
#
for (const guild of client.guilds.cache.values()) {
        console.log(`we in ${guild.name}`)
    }

Why is guild.name undefined for all guilds my bot is in

#

do i need these?

warm surge
#

try that

north whale
#
const guildNames = client.guilds.cache.map(guild => guild.name);
console.log(guildNames);
quartz kindle
north whale
#

i put it inside

client.once('ready', async () => {
///
})
#

and even surrounded it with a setTimeout(..., 4000 ) inside the client.once('ready')

quartz kindle
#

show your client options

north whale
quartz kindle
#

uncomment that

north whale
#

ok

#

that was the reason

#

thank you

quartz kindle
#

👍

proven lantern
#

is there a way to sell apps on the app directory or is it still in alpha/beta?

spark flint
#

but thats for subscriptions on bots only, i.e. premium

pale vessel
#

discord takes a huge cut though, it is so not worth it at the moment

spark flint
#

30%

#

fucking hell

brave geode
#

Hello I'm new in nextJs, I get this error:

TypeError: Invalid value for schema path `id`, got value "null"
    at Schema.add (C:\my-data\dbl\node_modules\mongoose\lib\schema.js:680:13)
    at new Schema (C:\my-data\dbl\node_modules\mongoose\lib\schema.js:137:10)
    at eval (webpack-internal:///./src/app/model/botsDb.js:7:16)
    at ./src/app/model/botsDb.js (C:\my-data\dbl\.next\server\pages\add\bot.js:55:1)
    at __webpack_require__ (C:\my-data\dbl\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///./pages/add/bot/index.js:19:75)
    at ./pages/add/bot/index.js (C:\my-data\dbl\.next\server\pages\add\bot.js:33:1)
    at __webpack_require__ (C:\my-data\dbl\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///./node_modules/next/dist/build/webpack/loaders/next-route-loader/index.js?kind=PAGES&page=%2Fadd%2Fbot&preferredRegion=&absolutePagePath=.%2Fpages%5Cadd%5Cbot%5Cindex.js&absoluteAppPath=private-next-pages%2F_app&absoluteDocumentPath=private-next-pages%2F_document&middlewareConfigBase64=e30%3D!:24:81)
    at ./node_modules/next/dist/build/webpack/loaders/next-route-loader/index.js?kind=PAGES&page=%2Fadd%2Fbot&preferredRegion=&absolutePagePath=.%2Fpages%5Cadd%5Cbot%5Cindex.js&absoluteAppPath=private-next-pages%2F_app&absoluteDocumentPath=private-next-pages%2F_document&middlewareConfigBase64=e30%3D! (C:\my-data\dbl\.next\server\pages\add\bot.js:22:1)
    at __webpack_require__ (C:\my-data\dbl\.next\server\webpack-runtime.js:33:42)
    at __webpack_exec__ (C:\my-data\dbl\.next\server\pages\add\bot.js:227:39)
    at C:\my-data\dbl\.next\server\pages\add\bot.js:228:104
    at __webpack_require__.X (C:\my-data\dbl\.next\server\webpack-runtime.js:116:21)
    at C:\my-data\dbl\.next\server\pages\add\bot.js:228:47 {
  page: '/beta/auth'
}

even tho i have just imported schema but havent accessed it

import schema from '@/app/model/botsDb';
earnest phoenix
brave geode
# earnest phoenix Show your `src/app/model/botsDb.js` file
import mongoose from 'mongoose';

const schema = new mongoose.Schema({
    id: null,
    data: {
        user: {
            id: null,
            botName: null,
            avatar: null,
            prefix: null,
            serverCount: 0,
            shardCound: 0,
        },
        webInfo: {
            title: null,
            shortDes: null,
            longDes: null,
            inviteUrl: null,
            supportServer: null,
            website: null,
            github: null,
            tags: [],
            owners: [],
            votes: 0,
            webhoook: {
                url: null,
                pass: null,
            },
        }
    },
    token: null,
    aproved: false,
});

const Model = mongoose.model('bots', schema);

export default Model;
#

if i do id: String still same error

#

i havent accessed schema yet but just imported

earnest phoenix
brave geode
#

I used String to but same error

earnest phoenix
#

Then you're most likely not saving the file, if you're saving it, show the new error that you get

civic scroll
#

send error

neon leaf
wheat mesa
#

Does anyone know how to get VSC to output “Segmentation Fault” when running C++ using CMake? Instead of outputting when I segfault, the program just stops entirely and outputs nothing, and it’s really fucking annoying

#

Never thought I’d be asking to see a segfault, but here I am

radiant kraken
#

welcome to the real world of C++

radiant kraken
radiant kraken
#

@wheat mesa

wheat mesa
#

I think it's just the way that windows handles it

#

I'm capable of debugging it, it's just annoying that I don't even see any output whatsoever

#

even just seeing like "program exited with code -127892348762348763247823648732658325498734698217346659783426" would be more useful

radiant kraken
#

if not then try debuggers like gdb

proven lantern
#

Nm I found it! Thanks for letting me know! They finally released it!

pale vessel
#

doesn't mean you should use it

deft wolf
#

Premium features? Ewww

delicate depot
#

Wait cut is 30%?

#

That's criminal

neon leaf
#

its fine if thats the total

#

so payment processor fees included

#

but probably not

spark flint
#

not included

#

6% + 30%

#
  • any transaction fees
radiant kraken
#

then make your own premium features

#

ezpz

deft wolf
#

Disadvantages of free hosting

spice hare
#

yup guess ima switch to paid one and make my client pay

#

any cheap one u suggest?

deft wolf
#

Depends on what you mean by "cheap". For some people $1 is cheap, for others it's $20

earnest phoenix
#

hello

#

anyone can help ?

deft wolf
#

With what?

earnest phoenix
#

i cant start bot

#

can you come dm?

deft wolf
#

Describe your problem here

earnest phoenix
#

my first bot

#

i cant develop it

#

i need really serious help bout that

#

@deft wolf

#

can you help me?

deft wolf
#

Maybe if you gave more details. "I can't start it" doesn't give me any leverage since I don't know what programming language you're using

earnest phoenix
# deft wolf Maybe if you gave more details. "I can't start it" doesn't give me any leverage ...

C:\Users\Administrator\Desktop\Örnek Bot>node index.js
node:internal/modules/cjs/loader:1051
throw err;
^

Error: Cannot find module 'C:\Users\Administrator\Desktop\Örnek Bot\index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
at Module._load (node:internal/modules/cjs/loader:901:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_ma
in:83:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Node.js v20.8.0

C:\Users\Administrator\Desktop\Örnek Bot>

#

i got this error

#

and i am using js

deft wolf
#

There is apparently no index.js file there

grim aspen
#

seems like it can't find the main module which is the file index.js

grim aspen
earnest phoenix
deft wolf
#

Nah, dude

#

Npm is for instaling packages

grim aspen
#

that's not the point

deft wolf
#

Like discord.js

earnest phoenix
#

can i share screen to you?

grim aspen
#

so the problem is, in the file path, it can't find that index.js file

earnest phoenix
#

creeper can you come to dm?

grim aspen
#

C:\Users\Administrator\DesktopÖrnek Bot\ index.js isn't found in that file path

earnest phoenix
#

check your dm

tulip ledge
#

type ls and show us what it prints to the console

deft wolf
#

ls works on windows?

earnest phoenix
#

i dont think so

grim aspen
#

please do node index.js

tulip ledge
#

no, but I'm assuming they use vsc or something

#

vscode has wsl

grim aspen
#

npm i is an installer, not an initializer

earnest phoenix
#

i cant use vsc in windows 2012 r2

earnest phoenix
tulip ledge
#

bro

#

just create an index.js file

#

if you use node <file> and the file doesn't exist it can't do much right

earnest phoenix
grim aspen
#

what is nodemon

earnest phoenix
#

with start.bat

civic scroll
grim aspen
#

that's something i'm not familiar with

#

oh

civic scroll
#

also

#

why are you running the shell as admin 💀

earnest phoenix
#

its opening on admin auto

#

shift right click

civic scroll
#

it never does that

earnest phoenix
#

i can show you

civic scroll
#

at least in my case, it doesn't

#

i have to explicitly start admin shell via start menu

earnest phoenix
#

its komut penceresi mean (cmd)

grim aspen
#

why is index.js a folder

civic scroll
#

translate the whole phrase

earnest phoenix
#

open the cmd on here

grim aspen
#

unless i can't see that well

civic scroll
earnest phoenix
grim aspen
#

is index.js a folder or a file?

civic scroll
#

also index.js should be a file

grim aspen
#

on that screen

civic scroll
#

you created it as a folder, so node index.js won't start

earnest phoenix
#

removed folder and

civic scroll
#

ye

grim aspen
#

because index.js is supposed to be a file, node index.js is looking for the file index.js in your bot's folder. it won't use a folder

earnest phoenix
#

let me start it again

#

it always starting with administrator

#

not starting

#

@civic scroll

civic scroll
#

don't do nodemon

#

just node

#

also

#

what is the code of index.js

earnest phoenix
#

i need show my screen

#

@civic scroll dm

#

here have a problem

#

and i cant add you

civic scroll
#

just screenshot the code

earnest phoenix
#

cant bcuz when i start it

#

its closing

civic scroll
#

huh

earnest phoenix
#

yeah

civic scroll
#

wym

#

you open notepad++ with the file

#

not run it

earnest phoenix
#

yeah i did it node.js

#

index.js*

#

node index.js

#

not nodemon

grim aspen
#

'nodemon index.js'

earnest phoenix
#

i deleted nodemon and did node

grim aspen
#

oh

earnest phoenix
#

creeper

#

can you come to dm?

civic scroll
#

open the file

earnest phoenix
#

yeah

civic scroll
#

in notepad++

#

i need to see the content of the file

#

not you running it

earnest phoenix
#

yeah

civic scroll
#

literally paste the code in here

earnest phoenix
#

the start command or index.js ?

#

which

#

baslat.bat or index.js

civic scroll
#

THE CONTENT OF THE FILE NAMED index.js

#

sorry i had caps lock on

earnest phoenix
#

no prob

#

i opened

#

var fs = require('fs'),
path = require('path');

var exports = module.exports = function(dir, options) {
var modules = {};
options = merge(options || {}, {
lazy: true
});

fs.readdirSync(dir).forEach(function(filename) {
    // filter index and dotfiles
    if (filename !== 'index.js' && filename[0] !== '.') {
        var moduleName = path.basename(filename, path.extname(filename));
        var modulePath = path.join(dir, moduleName);
        // lazy load
        if (options.lazy) {
            Object.defineProperty(modules, moduleName, {
                get: function() {
                    return require(modulePath);
                }
            });
        } else {
            modules[moduleName] = require(modulePath);
        }
    }
});

return modules;

};

function merge(obj, src) {
for (var key in src) {
if (src.hasOwnProperty(key) && obj[key] === undefined) {
obj[key] = src[key];
}
}
return obj;
}

#

now like that

grim aspen
#
    path = require('path');

var exports = module.exports = function(dir, options) {
    var modules = {};
    options = merge(options || {}, {
        lazy: true
    });

    fs.readdirSync(dir).forEach(function(filename) {
        // filter index and dotfiles
        if (filename !== 'index.js' && filename[0] !== '.') {
            var moduleName = path.basename(filename, path.extname(filename));
            var modulePath = path.join(dir, moduleName);
            // lazy load
            if (options.lazy) {
                Object.defineProperty(modules, moduleName, {
                    get: function() {
                        return require(modulePath);
                    }
                });
            } else {
                modules[moduleName] = require(modulePath);
            }
        }
    });

    return modules;
};

function merge(obj, src) {
    for (var key in src) {
        if (src.hasOwnProperty(key) && obj[key] === undefined) {
            obj[key] = src[key];
        }
    }
    return obj;
}``` made it easier to read
civic scroll
#

var

#

don't use var

#

also

earnest phoenix
#

what should i do to var

civic scroll
#

did you... copy-pasted this code from somewhere

earnest phoenix
#

nah i am buyed a vps and they gived it to me

#

i buyed hosting*

civic scroll
#

i'd recommend you rewrite the bot from scratch

#

that way you will understand what the code does

#

using existing code won't help

#

also i'd recommend you update the vps to latest version of windows or install linux, if possible
since it's easier to get access to latest technologies

grim aspen
#

'provides a function for loading all modules in a given directory into an object'

civic scroll
grim aspen
#

fair

grim aspen
#

` key three times at beginning and end

#

above the tab key

earnest phoenix
#

'''
C:\Users\Administrator\Desktop\discordJS-V14-main>node index.js
(node:6500) ExperimentalWarning: stream/web is an experimental feature. This fea
ture could change at any time
(Use node --trace-warnings ... to show where the warning was created)
token
'''

#

@grim aspen

frank cove
#

no not single quotes

#

backticks

#
C:\Users\Administrator\Desktop\discordJS-V14-main>node index.js
(node:6500) ExperimentalWarning: stream/web is an experimental feature. This fea
ture could change at any time
(Use node --trace-warnings ... to show where the warning was created)
token```
#

like that

earnest phoenix
#

dude how

frank cove
#

Ok are you on windows

earnest phoenix
#

yeah

frank cove
#

what keyboard layout do you have? US?

earnest phoenix
#

turkish qwerty keyboard

lyric mountain
#

` here, copy this

frank cove
#

`

#

copy this

#

and then put 3 at the front and 3 at the back

#

but it looks like its right next to the 1 key on your keyboard

grim aspen
#

Just paste six times

frank cove
#

to the left

lyric mountain
#

some keyboards are diff

earnest phoenix
#
(node:6500) ExperimentalWarning: stream/web is an experimental feature. This fea
ture could change at any time
(Use node --trace-warnings ... to show where the warning was created)
token```
#

okey did

grim aspen
#

There we go

lyric mountain
#

for example backtick isn't above tab for me

frank cove
earnest phoenix
#

what is this error

frank cove
#

right there

lyric mountain
#

it's right to P

earnest phoenix
#

understood

frank cove
#

yes thats why i asked what layout they have

earnest phoenix
#

what should i do now?

frank cove
#

it's just a warning

earnest phoenix
#

about this error

#

but bot not online

frank cove
#

it's not an error

lyric mountain
#

it's a warning that stream/web could change at any update or break dependant code entirely

#

if the bot isn't online then it's another issue entirely

frank cove
#

^

#

if the bot isn't online then it's not having to do with that

earnest phoenix
#

kuuhaku should i stream to you?

#

or coconut

#

can i stream to you?

frank cove
#

i mean, do you get any other errors?

earnest phoenix
#

nah only that

lyric mountain
#

show your code

#

hide the token ofc

frank cove
#

upload your code to like pastebin

#

(remove your bot token)

earnest phoenix
lyric mountain
#

hatebin

#

pastebin has too many ads

frank cove
#

ok github gist

earnest phoenix
#

pastebin removed on my country

frank cove
#

whatever

earnest phoenix
#

kuuhaku dm

lyric mountain
#

...

slim void
#

Never had ads on pastebin tbh

lyric mountain
#

adblocker likely

frank cove
# lyric mountain ...

i mean does it really matter what they use? github gist, hastebin, pastebin, it's all the same in the end

earnest phoenix
#

kuuhaku r u coming to my stream?

dull storm
#

Yoo

lyric mountain
#

no, but u can paste the code directly if u want

#

I dont join streams usually

earnest phoenix
#

let me send what i using

frank cove
#

i can't right now, im waiting for a tow truck to come

#

lol

earnest phoenix
#

i send

lyric mountain
earnest phoenix
#

@lyric mountain i seng github link

#

send*

lyric mountain
earnest phoenix
#

yeah i put my bot token to token and prefix to .

lyric mountain
#

ok, just checking

dusk halo
#

Abi

#

Adam bana Amerika diyor

frank cove
#

are you sure you dont have any other errors

dusk halo
#

Ban turkish

#

Benn

#

Türk abi türk

frank cove
#

@rustic nova

lyric mountain
#

could u show the full log please?

#

like, what appears after you start the bot

earnest phoenix
#

hold on

lyric mountain
#

oh wait

#

did you enable this on discord developer panel?

frank cove
#

they said it wasn't coming online

lyric mountain
#

yes

frank cove
#

not that it wasn't responding

lyric mountain
#

if it isn't enabled you wont be able to login

earnest phoenix
lyric mountain
#

because their code uses it

earnest phoenix
#

i am not using vsc

frank cove
#

that... has nothing to do with vsc

lyric mountain
earnest phoenix
#

i am not using vsc

lyric mountain
#

dont think ur understanding

earnest phoenix
#

how do i open developer panel

#

enable*

frank cove
#

it looks like you're blocking out some stuff here

#

or is that your token

earnest phoenix
lyric mountain
#

those two lines cannot exist if they aren't enabled on discord dev panel

earnest phoenix
#

bot's token

frank cove
#

why're you logging the token

earnest phoenix
#

let me open

lyric mountain
frank cove
#

why're you console.logging the token tho

lyric mountain
#

either remove those lines or enable the intent on dev panel

earnest phoenix
#

i did

lyric mountain
#

did enable them?

earnest phoenix
#

YEAH

#

GOD BELSS YOU MY DUDE

#

BLESS*

lyric mountain
#

yw, but do note that you wont be able to use them after being approved by discord

#

unless you find an actual reason to use them

frank cove
#

the message content shit is the dumbest thing discord ever did

lyric mountain
#

honestly, I do see their point

frank cove
#

i mean yeah but its still dumb

#

there was other ways they could've gone about it

rustic nova
earnest phoenix
#

@lyric mountain

#

i did whatever you say

#

but

#

when i open the bot

#

works like 1 min

#

and its closing

frank cove
deft wolf
earnest phoenix
#

terminal is closing automaticlly

#
C:\Users\Administrator\Desktop\discordJS-V14-main>node index.js
(node:6900) ExperimentalWarning: stream/web is an experimental feature. This fea
ture could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
?????????????????? SuperVisor#9244 Bot Online!```
#

says this

#

and terminal closing

dull storm
#

I see it

coral ridge
#

hi iam new to here

earnest phoenix
#

what should i do?

deft wolf
#

You need to find the reason why your terminal is closing automatically

warm surge
warm surge
slim void
#

ngl thats never worked for me 😦

warm surge
#

it’s works for me

slim void
#

When I do the command it shows nothing which is weird

earnest phoenix
#

it says this

#

@slim void

#

@warm surge

lyric mountain
#

you have a circular dependency

earnest phoenix
#

what is that mean?

lyric mountain
#

file A depends on file B that depends on file A

earnest phoenix
#

what should i do?

#

about that

lyric mountain
#

but well, it's hard to give any concrete answer without seeing the actual post-crash log

earnest phoenix
#

what is folder name for errors?

lyric mountain
#

instead of running the bot directly, open a command prompt and call the script from inside it

#

this will prevent the terminal from closing after exiting

#

node index.js is the command

#

and please indent your files

#

having everything aligned to the left isn't readable

earnest phoenix
#

how to indent

lyric mountain
#

tab key

#

or 4 spaces, whatever you prefer

earnest phoenix
#

@lyric mountain

#

cant index

lyric mountain
#

...what?

earnest phoenix
#

i cant index

deft wolf
#

What is that

lyric mountain
#

indent is simply

function abc(param) {
if (param == something) {
doThing();
}
}

doing this

function abc(param) {
  if (param == something) {
    doThing();
  }
}
#

from this

#

to this

earnest phoenix
#

where sohuld i paste it

lyric mountain
#

it's not something you install

#

you dont paste anything, you just press this

#

to align things

earnest phoenix
#

naaah terminal is closing on second

#

i cant

lyric mountain
#

sigh ok, let's ignore the indentation thing for a moment

quartz kindle
#

what did i walk into

lyric mountain
#

open a terminal through win + R an then type cmd

earnest phoenix
#

did

lyric mountain
#

after that cd into your bot's folder

#

cd the\path\to\your\bot

earnest phoenix
#

like this?

#

C:\Users\Administrator\Desktop\discordJS-V14-main

#

??

lyric mountain
#

yes

#

then type node index.js

#

it'll execute the code and then exit, as normal

#

BUT the terminal wont close this time

#

so you can simply show what appeared on the terminal

#

so we can know the crash cause

earnest phoenix
#

^

    at C:\Users\Administrator\Desktop\discordJS-V14-main\events\ready.js:17:27
    at Array.forEach (<anonymous>)
    at C:\Users\Administrator\Desktop\discordJS-V14-main\events\ready.js:14:7
    at FSReqCallback.oncomplete (node:fs:188:23)

C:\Users\Administrator\Desktop\discordJS-V14-main>```
#

@lyric mountain

lyric mountain
#

there it is

deft wolf
#

Now go to 'events/ready.js' and show us what's on line 14

lyric mountain
#

likely on this line

deft wolf
#

Oh, ok

lyric mountain
#

tho the line numbers dont match

#

ah nvm, it's actually 17

#

14 is a forEach loop

earnest phoenix
lyric mountain
#

already told u which line it is

#

props.help is null

earnest phoenix
#

should i delete props

#

and change it to null?