#development

1 messages · Page 1917 of 1

earnest phoenix
#

ye i also think that only

royal pawn
earnest phoenix
#

Discord.js

royal pawn
#

I'm asking for discord.py

earnest phoenix
#

You didnt specify language

#

so how we can do it?

#

Show me a database set example

royal pawn
#

Oh You can identify it by looking my example code

finite quiver
#

Your cmd clears reactions that might be the prob

earnest phoenix
royal pawn
finite quiver
earnest phoenix
#

You should decorate your command with

@commands.cooldown(1, 30, commands.BucketType.user)

#

checking that only

royal pawn
earnest phoenix
#

Use syntax

#

And add member's id

#

Easy

#

Idk python...

royal pawn
earnest phoenix
#

Just googled for you

#

it is

#

i confirm @carmine topaz

#

but there isnt a fix

#

so it removes the reactions

#

and doesnt requires manage perms

#

@clear marlin

finite quiver
earnest phoenix
#

If you do that your help command wont work and topgg wont accept your bot

#

ok

#

It happened to me

earnest phoenix
#

Use buttons more faster

#

You dont need to wait until bot react all emojis

#

😢

finite quiver
earnest phoenix
#

ye thats y

#

Then you need to use another lib

earnest phoenix
#

Or just shut down bot

earnest phoenix
finite quiver
earnest phoenix
#

ye

hybrid cargo
earnest phoenix
#

well i think i need to use another lib

#

Yes

#

Or learn js

#

Actually discord js isnt hard that

hybrid cargo
#

Either rewrite in js or other lang, or just fork any custom dpy libs if there are any

finite quiver
hybrid cargo
finite quiver
#

True

earnest phoenix
hybrid cargo
#

Everyone was a noob at some point, what matters is how fast and how good you develop your skills

proven lantern
#

my slash commands are hosted on serverless

#

i win

earnest phoenix
#

?

#

So they are application command?

eternal furnace
#

I was thinking about using multiple hosts... can someone explain me what problems do you face?

earnest phoenix
#

Itsnt hard code bot with all features in the same code

proven lantern
#

use aws lambda. it'll be free

worn sonnet
hasty mulch
#

How do I use SQLite as an if statement?

What I want to do

async with aiosqlite.connect('D:\Room_Sealer\db\quests.db') as db:
  if ctx.author.id == "USER ID IN DB":
    #execute code
  else:
    #raise custom error (Already know what to say for the custom error

Language is Python
Here is the DB data:

loud ore
loud ore
earnest phoenix
#

💀

loud ore
#

What this chendge? On end of the day your code compiled runs on hosting and works faster

loud ore
surreal sage
#

can you content.includes(array)?

#

like one item of the array matches and it becomes positive?

clear marlin
# earnest phoenix <@!749936830098571335>

A help command shouldn't require permissions. Now, if you're talking about a help menu, each time the user reacts to a certain reaction it edits the page that was sent by the bot. The bot doesn't need permissions to edit it's own message.

prime glacier
#

getting err while installing chalk

#

can someone help

smoky bolt
#

Hello guys, have you ever faced this problem when you invite Plasma to your Discord server?

"This bot can't join more servers as it has not been verified or is requesting gateway intents it has not been verified for. Ask the bot's developer about https://dis.gd/bot-verification so you can add it to your server!"

proven lantern
#

they need to verify their bot

proven lantern
#

lol

smoky bolt
#

Plasma is such a popular Discord bot; however, I can't add it to my server. Is this related to developers, right?

proven lantern
#

it must not be that popular yet

jolly notch
proven lantern
#

i think it's limited to 100 servers until its verified

jolly notch
prime glacier
prime glacier
prime glacier
jolly notch
prime glacier
smoky bolt
#

Okay, thank you. I'll find another bot that creates giveaways that by user' levels

pale vessel
#

Plasma was recently unverified due to our invite requirement giveaways and server requirement giveaways, this is due to our outdated docs which say we still have server requirements

Plasma does not allow advertisement with the bot. We removed server requirements months ago, and to comply with Discord’s rules we will be removing invite requirement giveaways

We have been unverified mainly due to a misunderstanding and lack of communication

Thanks for understanding, Plasma management

jolly notch
#

what does invite requirement giveaways even do?

prime glacier
split hazel
#

for guild requirement you need to be in said server to be able to enter

split hazel
#

advertising

#

discord doesn't really want servers to grow like that

proven lantern
#

found this

prime glacier
#

yes

split hazel
#

i like how it says stop it right now

#

something a femboy would say

whole surge
#

guys rate this website

spark flint
#

Needs fixing a bit

jolly notch
spark flint
#

The positioning at the footer too

whole surge
#

its not responsive for mobile yet

vivid fulcrum
#

it's horrid

spark flint
#

Work on the colour scheme

#

The icons are really similar colours to the background

jolly notch
#

fucking hell

#

this websites worse than a 1980's website

whole surge
#

um ok

jolly notch
#

navbar looks like a w3schools navbar but with some animations

vivid fulcrum
#

font doesn't match the aesthetic you're going for, the colors don't match, you don't have a palette at all, nothing is pleasing to look at and everything has attention, i don't know where to look at first

#

also statements like these are cheesy and annoying

spark flint
#

Please please please fix the text sizes

jolly notch
#

pleaase fix the images

vivid fulcrum
#

because this is horrid and it looks like a 5 minute project

spark flint
#

^

jolly notch
#

^^

nimble kiln
spark flint
vivid fulcrum
#

escape it with a backslash

#

\`

#

what are you confused about

#

literally just insert it into your string

#

lol

#

...inside of the string

#

where you want the codeblock to appear

#

you didn't escape the second backtick

dusty wave
#

Peope quick question do you know how to get a emoji as a image file using a bot??

vivid fulcrum
#

a custom emoji or a unicode emoji

dusty wave
vivid fulcrum
#

https://cdn.discordapp.com/emojis/emoji_id.png

muted halo
#

hi

frigid grail
#

Oe mp stp

spark flint
#

I'm working on a domain parking system, where you just point the nameservers and it shows a really simple coming soon page.

which is better for my usecase:
apache or nginx

split hazel
#

domain parking doesnt sound very ethical

spark flint
#

well its just a landing page

split hazel
#

i meant parking as in buying tons of domains and selling them at a higher price

spark flint
#

ah no i don't do that

split hazel
#

nice

spark flint
#

well this domain i might eventually sell

#

myparked.site KEKW

timber fractal
#

why does this error occur and how can i fix it?

...\node_modules\canvas\build\Release\canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).```
spark flint
#

do npm rebuild

timber fractal
#

alr did that

spark flint
#

try deleting the node_modules folder

split hazel
#

oh god fucking canvas errors

#

i hated that shit so much

timber fractal
#

and then

spark flint
#

npm i

split hazel
#

their native code is so sloppy it requires a very specific environment otherwise it will not compile

timber fractal
#

my vsc is dying

split hazel
#

oh dear

#

compiling is cpu and disk heavy

#

but yeah uninstalling and reinstalling everything should work

timber fractal
#

bruh moment

#

so true

split hazel
timber fractal
#

at least it worked

split hazel
#

and bro your pc is about to fry

#

you are saved by that ssd

#

try compiling with a hdd

timber fractal
#

yes it is

timber fractal
split hazel
#

with a hard disk drive

timber fractal
#

like

#

uh

#

pc building?

split hazel
#

right there are two types of disks yes

timber fractal
#

yeah

#

ssd (slow spinny disk) and hdd

split hazel
#

i was saying that compiling with a hard disk drive would be very slow

timber fractal
#

oh

split hazel
#

i dont think it stands for slow spinny disk lmao

timber fractal
#

no it doesnt

split hazel
#

solid state drive

#

no moving parts

#

veri fast

earnest phoenix
#

Msg.reply() replies mention on how can i turn it off

timber fractal
split hazel
#

yeah

split hazel
earnest phoenix
#

Like define it in client

split hazel
boreal iron
#

As client option, yes

split hazel
#

new Client({ allowedMentions: { repliedUser: false } });

#

for once discord js got something right

earnest phoenix
#

This red area was making me crazy

#

can anyone help me

#

in making a music bot

earnest phoenix
#

yes pls

zenith terrace
#

"reference"

earnest phoenix
#

I think he doesnt care how trash is it lol

lean sinew
#
        const ticks = loadJSON("/home/runner/Bot2/Handlers/ticks.json")
        console.log(ticks)
        var objIndex = ticks.findIndex((obj => obj.userid == message.author.id && obj.closed == false));
        if (ticks[objIndex].userid == message.author.id && ticks[objIndex].closed == false) {
            return message.reply("You already have an active modmail. Do ?mmclose to close your modmail.")
        }
        console.log(ticks[objIndex])

why does it says cannot read property userid of undefined

#
[
    {
        "userid": "testid123",
        "closed": true
    }
]

this is the ticks.json

earnest phoenix
#

obj.userId

lean sinew
#

bruh what

#

its userid

earnest phoenix
#

Oh mb i didnt see second msg

lean sinew
#

lol

earnest phoenix
#

Try to console it

#

console.log(obj.userid)

lean sinew
#

wait

#

bruh it worked now

#

nvm i put the json upside down

#

its supposed to be

[
    {
        "closed": false,
        "userid": "testid123"
    }
]
earnest phoenix
#

Whats different?

lean sinew
#

idk

#

it worked like this

#

tho

lean sinew
hushed estuary
#

hey

#

i want to learn to develop a bot

#

problem is i dont know what is javascript

#

i dont have knowledge about it

#

so should i learn java script first

#

?

boreal iron
#

I wonder if that's a question or not...
Might make sense to learn driving a car, before driving it.

#

common sense freerealestate

coral sigil
#

:D

lyric mountain
hushed estuary
#

but like some websites saying install node.js

#

and any other coding apps

#

my friend used

#

repl

#

so is repl better

#

i made node.js repl

#

of replit

#

uh

#

no

#

my friend used itt

#

to make

#

first created node.js

#

there

#

something like this

#

um

#

idk

#

my friends all made

#

bot

#

in 2 to 3 days

#

someone made songs

#

with mini games

#

my friend made a mod bot

#

like carl bot

#

with repl

#

no

#

hm ok thanks

#

thanks

lyric mountain
#

Token leak

#

Refresh it asap

hushed estuary
#

i cutted the

#

token

#

little bit

lyric mountain
#

You cut the start

#

The start is the bot id

hushed estuary
#

like to show the ss

#

i cutted some

lyric mountain
#

So if anyone get the bot Id they can fill the missing part

hushed estuary
#

token letters

hushed estuary
#

but it is a test

#

bot

#

i am learning currently how to make

#

i am new to discord.js and node

lyric mountain
#

Still, people can wreck havoc even with a testing bot

#

Better be safe than sorry

hushed estuary
#

hm

#

ok

#

what is const client = new Discord.Client();

lyric mountain
#

And yes, invest time in learning JS first, then Node.JS and only then bot devving

vital void
#

it has both, Online IDE and code hosting

hushed estuary
#

let me get a good course of it

#

js

lyric mountain
#

There are some steps you can't skip else you end up with a broken and unfixable bot

lyric mountain
#

Can't get any better

hushed estuary
#

w3schools

#

hm

#

i dont have any

#

i am in 8th grade

#

i only learnt html little bit

#

like to create webpages and forms

vital void
#

umm isn't it still kinda hard if u sum up all stuff in just 2 hours?

hushed estuary
#

uh

#
#

this website good for java?

#

js

#

java script

#

it is like this

#

oh ok

#

for java script should we know

#

html

#

and css

vital void
#

yeah, but as of he/she said he/she hasn't tried other languages too

otherwise 2 hours are kinda ok to start

hushed estuary
#

python

#

css

#

i havent learnt any language yet

vital void
#

that's what she said

hushed estuary
#

i am not she

#

i am he

wheat mesa
#

you don't need to know html and css for js

#

that's just if you're making websites/frontend stuff

#

js is primarily used for web development, that's why it's trying to teach you that

#

but for discord bots you don't need to know and html or css

#

(Unless you plan on making a website for your bot, but that can be done later on)

slender wagon
#
author: {
           name: `${req.user.username}`
         },

i am passing a embed through a webhook and whenever i pass something like req.user.username inside a embed it doesn't work but as a message it works

#

i've also logged it and it is just fine

#

it just doesn't send

wet fog
#

Because the context isn’t the same for embed and message

slender wagon
#

wym

wet fog
#

You should be sending the embed as a embed not a message

slender wagon
#

if i do name: `Grainger`` it will go through

wet fog
#

They aren’t the same code

slender wagon
#

u don't get what i mean

wet fog
#

Explain

slender wagon
#

but if instead of req.user.username i put my username "grainger"

#

it works

#

as an embed

wet fog
#

Js

#

?

slender wagon
#

yes

wet fog
#

Not my cup of tea

slender wagon
#

rip

#

fixed

subtle kiln
#

Do anybody here already applied for a gateway intent and know how long it takes. Because you just send the form and that's it... there isn't any mail or DM confirmation that would give an estimate

wheat mesa
#

Usually takes about 5 business days

#

Might take a little longer though because of message intent requests coming in at a high rate

subtle kiln
#

Nice, I sent it the last week. It should be approved soon 🤞

wheat mesa
#

Gl!

subtle kiln
#

thx

earnest phoenix
#

I hosted localhost 3000 with my pc but i cant connect it with my phone they are connected to same wifi

boreal iron
#

well then add a firewall rule to allow incoming requests on port 3000

quartz kindle
#

you likely need to port forward your router

earnest phoenix
#

I though local is meaning wifi not device MegaThonk

#

Using online editors more easy

#

Or just ctrl+f12 and mobile mod

quartz kindle
#

localhost = this pc
from the phone you should connect to PCs_Local_IP:3000
the phone will ask the router to find the local IP of your pc

#

which might need port forwarding so the router knows what to do with it, as most block incoming requests by default

#

you can use cmd ipconfig to find your local IP

earnest phoenix
#

Okay thanks

quartz kindle
#

usually they are something like 192.168.1.5 or 10.1.1.5

#

the first 3 numbers are the local network, the last number is the device id in the network

earnest phoenix
#

Can i ask you another question (i ll want to you to check my code (is it good coded or no))

quartz kindle
#

if your local network is 192.168.1 then your devices will be:
192.168.1.1 (router)
192.168.1.2 (pc)
192.168.1.3 (phone)
etc

boreal iron
pale vessel
#

You were right about it having no sign of confirmation, it straight up just redirects you back to the bot page after you submit the form, which wasn't very reassuring

earnest phoenix
frigid grail
boreal iron
#

Might take a while

split hazel
#

why did you censor 83% of the screenshot

earnest phoenix
#

maybe his user name or private infos

quartz kindle
#

nobody cares about that crap

boreal iron
#

because mysterious language

earnest phoenix
boreal iron
#

Anybody knows a PCI-E m.2 adapter card with 2x M-key support?

#

I can't fucking find one on mobile

#

Or B+M key support on one or both

boreal iron
#

nvm

quartz kindle
#

node version manager

split hazel
#

tim you're such a comedian

jolly notch
#

lmao

#

just noticed

quartz kindle
#

:^)

boreal iron
#

Yeah well trying to update my home server

#

Proxmox doesn’t support hardware RAID

#

So the mainboard has only limited SATA ports

#

Means I need a PCIE adapter card for one or better two m2 drives

jolly notch
boreal iron
#

Since Proxmox is heavily writing the drive I necessarily need a second one for the OS as soft RAID

#

Yeah but I need two m.2 drives

#

In one PCIE slot

#

8x for 2x 4x NVME

jolly notch
boreal iron
#

Well it’s not an issue at all just need an adapter specially made for this

jolly notch
#

yes

#

or apply the human logic

boreal iron
#

That’s not so easy than you might think

#

I’m limited with x8 slots

#

The RAID controller also needs a slot

#

I could technically fit all 3 in but unfortunately the place between RAID controller and 2nd adapter card is not enough

#

I’m already thinking about just putting in 1 NVME drive instead of a RAID

#

And taking the risk

#

But since I’m already upgrading again I hoped for a solution which lasts for some years

split hazel
#

raid shadow legends

boreal iron
quartz kindle
#

watashi wa ingurishu wakarimasen

boreal iron
boreal iron
quartz kindle
#

baka

simple stump
#

What does this error mean and how do I fix it?

event: exit
Error: exit
/home/container/node_modules/discord.js/src/structures/VoiceState.js:158
    return this.member?.edit({ channel }, reason) ?? Promise.reject(new Error('VOICE_STATE_UNCACHED_MEMBER'));
                                                                    ^

Error [VOICE_STATE_UNCACHED_MEMBER]: The member of this voice state is uncached.
    at VoiceState.setChannel (/home/container/node_modules/discord.js/src/structures/VoiceState.js:158:69)
    at VoiceState.disconnect (/home/container/node_modules/discord.js/src/structures/VoiceState.js:147:17)
    at Query.<anonymous> (/home/container/index.js:1317:18)
    at Query.<anonymous> (/home/container/node_modules/mysql/lib/Connection.js:526:10)
    at Query._callback (/home/container/node_modules/mysql/lib/Connection.js:488:16)
    at Query.Sequence.end (/home/container/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
    at Query._handleFinalResultPacket (/home/container/node_modules/mysql/lib/protocol/sequences/Query.js:149:8)
    at Query.EofPacket (/home/container/node_modules/mysql/lib/protocol/sequences/Query.js:133:8)
    at Protocol._parsePacket (/home/container/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/home/container/node_modules/mysql/lib/protocol/Parser.js:433:10) {
  [Symbol(code)]: 'VOICE_STATE_UNCACHED_MEMBER'
}
/entrypoint.sh: line 106: output: not found

Line 1317 is newState.disconnect(); Would this:

        if (!newState) {
          if (!oldState) {
            newState.disconnect();
            return;
          } else {
            oldState.disconnect();
          }
          return;
        }

Work?

quartz kindle
#

The member of this voice state is uncached.

#

fetch the member

simple stump
#

ah

#

okay

split hazel
#

discord js relies on cache to the point where it shits itself if cache isnt present

quartz kindle
#

at least now it gives you a proper error

#

v12 was "cant read x of undefined" left and right if you had missing caches

split hazel
#

nice

#

think of the wasted cpu cycles checking if the cache is okay

#

sorry os development makes you go insane

quartz kindle
#

thats nothing compared to the gazillion checks v8 does on every single js value

#

besides, thats the entire point of a cache, checking if its there lmao

earnest phoenix
#

Whenever I start my bot I get this error.

this.Promise = options.Promise || Promise;
boreal iron
#

You might wanna post the actual error then

earnest phoenix
#

oh yeah

#

xd

#
  this.Promise = options.Promise || Promise;
                         ^

TypeError: Cannot read properties of undefined (reading 'Promise')
#

nevermind I fixed it <o/

green kestrel
#

i just found out something surprising

#

github actions has full access to the internet for an action.... and lets you run a discord bot.

#

im using it for a unit test of my lib

#

im able to connect to discord websocket, run REST requests, connect to a VC and send audio...

#

yeah would have expected just a few more restrictions than that though

#

and apparently the instance can run for up to 72 hours before github yoinks it

#

so you could have a cron job to run every 72h if you wanted to relaunch it lol

quartz kindle
green kestrel
#

lol

#

how well did that work

#

i mean the vps is tiny, its like 3gb

quartz kindle
#

apparently well enough for him not to need a vps

green kestrel
#

so i guess a D++ bot wouldnt even tickle it

quartz kindle
#

but from what i've read, github action max runtime is 6 hours

green kestrel
#

i could practically run triviabot in it if not for the lack of a db lol

quartz kindle
#

so his bot would probably restart every 6 hours

green kestrel
#

lol true

#

but im really liking how i can do proper unit tests in it

#

i havent seen any other lib running unit tests in gh actions

#

not sure why

quartz kindle
#

most dont even have them

#

too much work to setup

green kestrel
#

but these projects are years old, you'd have thought they'd have had time

quartz kindle
#

they have a few independent tests and stuff

#

but i dont think anyone has a full online test

green kestrel
#

ive managed to get it all up and running in 6 months with auto packing and all sorts, its not that complex 🙂

quartz kindle
#

but you're a genius with 160 iq

#

lmao

green kestrel
#

lmao, i sure am not

#

im more like one of these people who has 60 iq when it comes to anything not a computer

quartz kindle
#

well i admire how much effort you put into things and how fast you made D++

#

i run out of energy super quickly, so i develop very slowly

#

im finding it hard to concentrate these days idk why

#

maybe im just burned out

green kestrel
#

yeah

quartz kindle
#

a few months ago i started working on an independent discord lib in js

#

and found out that the ws package is pretty terrible

#

i rolled my own custom websockets and they are like 20x faster lol

quartz kindle
#

yup

#

idk

#

its like

#

the stuff i have in my todo list is not exciting anymore

boreal iron
#

API v2 est. 2031

quartz kindle
#

it just feels like a chore

green kestrel
#

whats up with the ws module

boreal iron
#

Yeah got so many small project I always delay

#

Because they can delayed

quartz kindle
#

but to be fair they go very far to support the entire spec

green kestrel
#

weird

#

youd think something so well tested and highly relied upon would be optimised

quartz kindle
#

i wrote a websocket for just the subset of the spec that discord uses

green kestrel
#

i found another discord ws quirk today

#

if your lib talks ETF, then a shard websocket must be binary, if it talks json, a shard socket can be EITHER binary or text frames, but in either instance, a VOICE websocket can ONLY EVER be text frames, or your frames are.... silently ignored

quartz kindle
#

i measured the time spent processing websocket messages from tcp reception until json parsing, and over 2000 messages, ws spent full 6 seconds processing them

green kestrel
#

ick

green kestrel
#

tbh

#

voice was the one set of tests i expected to fail on gh actions

#

i'd have expected udp to be firewalled except port 52

quartz kindle
#

i also rolled out my own ETF in pure js, which turned out faster than discord's official ETF package lol

green kestrel
#

lol

#

discords package is ass

#

its supposed to be heavily optimised, is it bob

#

the code that builds a buffer uses C malloc, and uses it badly

#

i changed it to use a vector and reserve(), its a ton faster

quartz kindle
#

nice

#

im going for pure js so i cant do that

#

but i got a pretty nice 30-50% performance boost

green kestrel
#

also

#

it uses recursive descent to build a js v8 object

#

Local<> type or something

#

those are shit slow in comparison to nlohmann::json containers

quartz kindle
#

can you do direct conversion between nlohmann and v8 tho?

green kestrel
#

no

quartz kindle
#

im pretty sure you always need transversals

green kestrel
#

but i dont need to, i needed nlohmann

quartz kindle
#

ah well yes

#

v8 objects cant be converted from anything, they always need to be built from scratch

#

kind of a bummer

green kestrel
#

from what i hear the discord team hates ERL/ETF

#

i heard they'd love to get rid of it

#

but too many bots use it

quartz kindle
#

they should just do it

green kestrel
#

iirc the official client uses it too

quartz kindle
#

they never cared about that for any other update they made

#

why care about this

green kestrel
#

other updates dont generally remove anything

quartz kindle
#

just make it a semver major api version and deprecate etf

green kestrel
#

they just change things

quartz kindle
#

etf vs json makes lietrally 10% difference in message size

green kestrel
#

i bet some massive bot devs would kick up a stink

quartz kindle
#

in exchange for 50% more cpu usage in most cases

green kestrel
#

its not about difference in message size

#

if you parse json, you have to deal with indentation, character encoding, etc

#

basically build a recursive descent parser

quartz kindle
#

if anything, they should use messagepack

green kestrel
#

and all your numbers, you have to read from strings

#

with a binary protocol all your numbers come packed as binary

quartz kindle
#

there are plenty of better binary protocols to chose from

green kestrel
#

no stoull()

#

sure

#

id never heard of etf

#

and its used by what

quartz kindle
#

also, ETF stores boolean and null and strings lol

green kestrel
#

two kinda esoteric languages

#

yeah true false and null can be identified quickly though

#

theyre an atom type

#

strings are not

#

you just look for an atom being used as a value whos first char is one of: n, t, f

quartz kindle
#

yeah but they cost the same amount of bytes as strings

green kestrel
#

they are O(1) to parse

#

at least if you do it in C++

#

you can make a safe assumption, discord only ever uses an atom as a value in the case of null, or boolean

#

any other time it uses a utf8 string type

#

so if you have a value that is atom, you know its one of those two types and just check the first char 😄

#

(erlpack doesnt do this)

quartz kindle
#

im pretty sure they use atoms for other things

green kestrel
#

key names

#

but never values iirc

#

oh oh, in etf, an object key can also itself be a complex object or array type

#

but youll never see it in anything discord sends you

#

as it mimics json, and json can only have a string as a key

#

or number

quartz kindle
#

im using the same code to parse both keys and values

#

so im not really taking that advantage

green kestrel
#

yeah

#

but json cant represent this legally:

#
{[1,2,3]: [5,6,7]}
#

etf can, i suppose C++ could (but why)

quartz kindle
#

ye

#

another buffer quirk in js is that depending on the buffer length, its faster to loop over it rather than use the built in latin/utfslice functions

green kestrel
#

lol really?

quartz kindle
#

ye

#

generally if a string is shorter than 20-30 characters, looping is faster

#

a lot of my performance improvements came from this lol

#

same for utf

stark pawn
quartz kindle
#

thats like default vsc?

#

ah

#

it was an extension, but now its built in

#

you have to enable it in the vsc settings

#

👍

quartz kindle
#

for example how UTF8 works, how text is represented in binary

green kestrel
#

cant you just manipulate it as a raw byte array

#

why a string

quartz kindle
#

wdym

#

its decoding a string from the etf buffer

#

to build the js object

green kestrel
#

sure

#

but a binary buffer is not a string

#

having it as a string means youre stuck with string methods

#

having it as byte array would be more practical

quartz kindle
#

but it is a string?

green kestrel
#

kinda?

quartz kindle
#

its a string value received from discord

#

i have to give it to the user as a string

green kestrel
#

i mean a jpeg file can be held in a string too

quartz kindle
#

well discord doesnt send you jpegs

green kestrel
#

it can

quartz kindle
#

since when

green kestrel
#

webhook endpoint, encoded as base64

#

for the pfp

#

you can send them like that too

quartz kindle
#

only if you use the cdn

green kestrel
#

nope, this isnt for cdn

quartz kindle
#

they dont send that via websocket

#

never seen that

green kestrel
#

unless you mean a REST endpoint

lament rock
#

Why does the typescript enum type suck

#
enum SomeEnum {
  some, // 0
  thing // 1
}
type SomeEnumType = keyof SomeEnum; // "some" | "thing"

const anotherOne: SomeEnumType = SomeEnum[0]; // type string is not assignable to type SomeEnumType
#

It doesn't even offer suggestions for the inverse of the enum definition

#

Some DBs offer expression evaluation like simple math. SQL for example allows for instance: UPDATE table SET column = column + 1;

#

That's exponentional, not linear

#

linear would be a static value

wheat mesa
#

Adding to the previous value

green kestrel
#

xp gaining should not be linear

#

the more xp you gain, the harder it should be

#

it should be somewhat exponential

lament rock
#

Then you should be careful with your multiplier because too much or too little is disheartening

green kestrel
#

last time i did this i drew a curve into a paint program

#

and then i would read from the curve

lament rock
green kestrel
#

level across X axis XP across the Y

#

convered the curve to a spline in a draw package

lament rock
#

You can statically create a curve with some coordinate and spline logic vs reading pixels

green kestrel
#

this meant that if i wanted to change the levelling i could edit the curve visually

wheat mesa
#

Logarithmic-ish level gain?

green kestrel
#

no dont read the pixels

#

convert it to a spline and save that

#

then read a position

lament rock
#

Okay. You didn't mention that, so it was kinda ambiguous. Just want to make sure people are still sane

green kestrel
#

but im not a maths/stats guy, i did this via a pregenerated table

#

you only need precalculated points for each level number vs xp value

#

hmmm, ^2 can get out of control quickly

#

In mathematics, a parabola is a plane curve which is mirror-symmetrical and is approximately U-shaped. It fits several superficially different mathematical descriptions, which can all be proved to define exactly the same curves.
One description of a parabola involves a point (the focus) and a line (the directrix). The focus does not lie on the d...

#

something like this perhaps

#

its not exponential, but becomes more difficult to level up the more you go up the scale

#

and lol, rectum

quartz kindle
#

access how? list or find? find based on what input?

lament rock
#

You could have a static amount of xp required per level, but have a 📉 so that it gets harder to reach a level each time. If you use math to figure out what level someone is based off xp instead of incrementing a level field, you're saving some storage space, albeit a little amount, and you won't have to deal with BigInts as soon

quartz kindle
#

arr.find(item => typeof item[key] !== "undefined")

green kestrel
#

imagine using a language where bigints are a problem kekek

lament rock
#

I fucked myself because I use BigInts for currency but can't mix with floats

quartz kindle
#

just keep your ints below 53 bits :^)

green kestrel
#

lol

#

not that simple

#

iirc my snowflake id is below 53 bits

lament rock
#

Someone is already at something something quintillion

green kestrel
#

but just you try and store it in a js number

#

it'll round it to the nearest 10k

#

lol

quartz kindle
#

its not below 53 bits lol

green kestrel
#

it'll do the same to a 53 bit number

quartz kindle
#

your id is 58 bits

#

have a lastgained timestamp

green kestrel
#

gain xp based on if they were active during a 1 hour window

#

so no matter how much you spam, you can only gain xp once per hour

#

or per 15 min

#

or 5 min

#

whatever you choose

lament rock
#

That name is horrifying

green kestrel
#

all my homies love mee6.

quartz kindle
#

chose one

#
function xpNeededForLevel(lvl) {
  const base = 7.5;
  return (lvl * base) ** 2 - base ** 2;
}

just adjust the base to match the curve you want (taken from some random stackoverflows)

#

another question is if the xp is cumulative or if it resets on every level

#

if its cumulative you may want a much higher curve

slender thistle
#

I agree, Tim is hot

quartz kindle
high crown
#

My bot is in 98 servers but it is unable to join any further

#

...

#

I have counted by printing guild array in console

#

And they are 98

#

But it is showing that bot has reached the limit

hybrid cargo
#

Just import the json using require()

#

umm .arrayName ?
Depends on your json's structure

earnest phoenix
#

how to get mongo db url

#

@drowsy crag

#

oops

earnest phoenix
#

from where do i create one

#

@marble juniper

marble juniper
#

I gave you the format

#

you can make the url yourself

#

using that format

earnest phoenix
#

ok

marble juniper
#

just put the respective values into place

high crown
#

guys guys

#
HMM();``` is it wrong?
#

(top-gg is a filename here)

hybrid cargo
#

What does the import return?

#

If its anything other than a function, then yes it is wrong

high crown
hybrid cargo
#

What do u export in the js file?

high crown
#

i'll try doing it in main file

hybrid cargo
high crown
#

I'm also confused...I'm stupid

earnest phoenix
#

how define bot Library in -botinfo ?

pale vessel
#

you can't anymore; the option is deprecated

devout hare
#

Does anyone here know how to do vote events in DBM? It runs up until the first send message to console, and sends with the right id, but doesnt control the member data or send messages when i had them there

frozen sundial
#

dbm sucks tho

woeful pike
#

lol this is still just writing code at the end of the day, just not inside an editor. Why not just learn how to write code and pick up a super useful skill while you're at it

split hazel
#

don't blame them

woeful pike
#

idk this looks like a lot of work

spark flint
#

horrible fonts

#

and oversized components

whole surge
#

:/

spark flint
#

its not toxic

#

you wanted reviews on it

#

you've picked horrible fonts

#

and all the buttons are massivw

marble juniper
#

could've said it in a nicer way though

#

like

#

"those fonts don't look good maybe you should try different fonts"

#

whatever doesn't matter

sly sierra
#

no offence, but looks horrible

whole surge
#

stop rating the song

#

i didnt made the song

spark flint
#

still the layout isn't very good

whole surge
#

ok

spark flint
#

design nowadays is about simplicity and ease of use - prioritise that

sly sierra
#

i literally said 3 other things

earnest phoenix
whole surge
#

you have domains?

spark flint
#

many

#

MANY

hybrid cargo
whole surge
spark flint
#

35+ atm i ithink

hybrid cargo
spark flint
whole surge
#

why?

sly sierra
#

WDYM WHY

hybrid cargo
#

Bro he literally pays for em

sly sierra
#

ITS HIS OWN MONEY AND PRIORITY

#

LMAO

#

"can i have a free car?" "no" "why?"

whole surge
#

lol

whole surge
sly sierra
#

and you call him, rude and also an addict

#

why would he give it to you, he doesnt even know you lmao

#

anyways

whole surge
sly sierra
#

yews you did

whole surge
#

i expected his reply "No"

#

and i asked for fun

whole surge
sly sierra
woven anchor
#

how do i send a message in a specific channel when someone votes on my bot? i have tried using the on_dbl_vote but i dident get any outputs when someone voted

whole surge
whole surge
#

and i am not good at designing

sly sierra
#

you asked for opinions

whole surge
#

yea

#

k fine

#

@spark flint I am really so sorry please forgive me for what i did i really didnt meant to hurt your feelings

#

done!

#

@sly sierra

sly sierra
#

was just stating osmething

#

anywas

whole surge
earnest phoenix
#

So I have this welcoming message and it doesn't want to send. Am I doing something wrong? It doesn't send any errors upon launch nor when a member joins.

marble juniper
#

maybe its ur return statement

earnest phoenix
#

Maybe what I have watched is old or smth

rose warren
earnest phoenix
#

Figured it out myself somewhat

rose warren
#

That's v12 code

earnest phoenix
#

Well I noticed something was wrong when the video was 2020

rose warren
#

You should upgrade to v13 if you haven't yet done so

earnest phoenix
#

Probably have, if not, how so?

rose warren
#

Check your djs package version

earnest phoenix
#

I guess it's like this?

rose warren
#

Yeah that's why then. You're trying to run v12 code on v13.

earnest phoenix
#

Well I'm not surprised that it didn't work

#

The video was from 2020

rose warren
#

That'd be why then

earnest phoenix
#

What I have done now "works"

woeful pike
#

what's the max amount of servers you can have on an unverified bot again? is it 100 or 75?

rose warren
#

100

#

Verification is possible at 75

woeful pike
#

ah, that makes sense then. My old bot shows at exactly 100 servers and isn't verified. Thanks

rose warren
earnest phoenix
#

I guess this is the problem I have ran into (I had a previous way more simpler more than this)

#

so I am literally that dumb

#

quite*

#

😛

#

We both dumb then huh

#

cheers

#

just rename it

jolly notch
#

^

#

Yes

#

Use phpMyAdmin

#

you don't use php...

split hazel
#

and dead

#

even though it powers more than half of the web in total

earnest phoenix
#

turns out you are a lie

woeful pike
#

would rather use php than go

split hazel
# woeful pike would rather use php than go

i was watching a fireship video about go and went "oh this language looks pretty good especially since its compiled!" but once i saw the lua-like if statement without braces i immediately said no

modest maple
modest maple
split hazel
#

isnt simplicity supposed to be an aim for all modern languages

#

after all as times goes on coding is supposed to get easier and more powerful

wheat mesa
#

The easier the language the less control over smaller things you have

#

There’s a lot of room for optimization in js for example, but not nearly as much optimization as would be possible with C++

#

But maybe there should be a language that offers control over tiny things and allows you to make small optimizations like C++, but allows you to write compact code if you don’t want to optimize

modest maple
#

002_sip have i introduced you to rust

wheat mesa
#

Haven’t really looked much at rust, all I really know about it is that it’s similar to C++

earnest phoenix
#

it was smth like welcome.send{( embeds : [welcm])}

radiant geode
#

who knows how to check the guild scopes on djs v13?

split hazel
green kestrel
#

the design philisophy of both is completely the opposite

split hazel
#

did you know javascript was inspired by java

#

fun fact of the day

green kestrel
#

the philisophy of rust is like... um.... imagine you have a self driving car, that is fast, but wont ever break the speed limit, wont let you drive it unless theres an emergency, and will never crash, but you cant push it to its limits

#

and the philosophy of C++ instead is like a kit car, you made yourself and can do 200mph, but you could crash it horribly

#

one of them tries to guide you towards its model of "code safety"

#

the other doesnt get in your way, gives you a hammer and some nails and says "go build house"

#

😉

#

@wheat mesa ^

split hazel
#

ironic

green kestrel
#

rust has a pre-parser thingy thats part of the compiler and checks for thread safety and race conditions, illegal memory accesses etc. C++ doesnt care.

C++: "the programmer knows what they are doing"
Rust: "the programmer needs to be brow beaten to do it right"
JavaScript: "HERP derp me make progrum"

#

sorry couldnt resist 😄

#

^ both rust and C++ ideals have their flaws. sometimes the programmer does know what theyre doing, but maybe half the time, rust is right and they dont 😄

split hazel
#

no?

green kestrel
#

no he isnt, it was

#

when js was made, there were only web browser java applets

#

and they wanted to make something that people who were into making applets could quickly pick up

split hazel
#

java embedded in websites oh dear

#

didnt browsers drop support for java a few years ago

green kestrel
#

java applets sucked big hairy ones.

#

it was a horriffic mess

#

yeah they dropped support for it a loooong time ago

#

not only were applets bloaty, but every one that wanted to run prompted you with a security cert prompt

#

they'd take ages to load up

vivid fulcrum
#

oh the good old times when you'd get greeted with you have to install Java Runtime Environment

green kestrel
#

and every week you'd have to update java runtime, like updating flash player

#

as they were about as secure as a cardboard bank vault

#

in the end the approach of java applets was just to 'enterprisey' for web dev

#

too bloated, slow, and not the right tech stack

#

flash player filled that niche for a long while though

split hazel
#

then html5 killed it

#

well not initially

#

though sucks how browsers dont let people choose if they still want to run flash or not

#

many old game websites host flash games you cant run

#

java applets is a different story

vivid fulcrum
#

there are flash forks

#

luckily

split hazel
#

didnt flash hard-code a kill switch which triggers after a specific date

#

i saw some guy modify the binary to change that date to still be able to run flash

vivid fulcrum
#

my bad, it's an emulator

#

not a fork

split hazel
#

wust

#

i tried some flash browser extensions but they run only on some games

green kestrel
#

its like asking if you still want to be at risk of catching the plague 😄

split hazel
#

yes

#

vulnerabilities are overrated

cinder patio
#

Except that rust is as fast as C++ 😛

split hazel
#

you're lucky i wont ping brain for that one

boreal iron
stuck mulch
#

Does anybody know how I’d go about showing how many servers my bots in on my website?

boreal iron
#

Save the data in your database frequently and fetch it from you side

split hazel
#

i'd only say do that if you already do that for some other reason

#

i'd probably just setup a server on the bot side where you can query it for data

boreal iron
#

Well since it's static, irrelevant data about the bots status it can easily be written into a JSON file.

#

(instead of a database)

#

And yes, a database only makes sense if you already have one set up.

earnest phoenix
#

In Apache, I am trying to run 2 express app on the same server !
I am not sure,if this is even possible
Beta Web Server

<VirtualHost *:80>
  ServerName beta.domain.com

  ProxyPreserveHost  On
  ProxyPass /  http://ip:3000/ retry=0
  ProxyPassReverse /  http://ip:3000/
</VirtualHost>

<VirtualHost *:443>
  ServerName beta.domain.com

  ProxyPreserveHost  On
  ProxyPass /  http://ip:3000/ retry=0
  ProxyPassReverse /  http://ip:3000/
</VirtualHost>

Main Web server

<VirtualHost *:80>
  ServerName domain.com

  ProxyPreserveHost  On
  ProxyPass /  http://ip:3001/ retry=0
  ProxyPassReverse /  http://ip:3001/
</VirtualHost>

<VirtualHost *:443>
  ServerName domain.com

  ProxyPreserveHost  On
  ProxyPass /  http://ip:3001/ retry=0
  ProxyPassReverse /  http://ip:3001/
</VirtualHost>

As soon i enable the beta web server none of them works anymore
The conf's are simplified (ssl removed, rewrite rule removed)

#

@rustic nova

azure lark
#

how do i find a channel using its name with djs?

#

ty

#

how do i set an embeds image to a deleted images image?

spark flint
#

profile pic changes etc?

azure lark
#

no,

#

someone send a picture in a channel, they deleted it, the bot sends an embed with the embeds image being the image that was unsent

spark flint
#

you could save that image and upload to a file storage system etc

#

on message delete get the image id, save to vps/pc, upload via ftp and get link, delete from vps/pc, log the url

lament rock
#

The baseline is that once the message is deleted, the media can no longer be fetched

#

so you have to dupe save it elsewhere which is super inefficient and expensive to do

spark flint
#

So you don’t have to store anywhere

royal portal
#

is it possible to have unflattened cnames?!?!1

spark flint
#

Just unflatten it 🙄

royal portal
#

how tf

spark flint
#

Unflatten it

royal portal
#

but cloudflare doesnt have that!!1

lyric mountain
#

what's a flattened cname?

spark flint
#

Cname at root

#

CNAME flattening allows you to create a CNAME record at the root of your domain without violating RFC's (the rules that govern the Internet).

earnest phoenix
#

You have to be a pro member to use it

jolly notch
earnest phoenix
#

*in cloudfare

royal portal
#

not even possible in cloudflare

#

you can flatten all cnames or flatten cname at root

lament rock
spark flint
#

I thought it cached for like 15-20 mins

lament rock
#

That's the client pretty sure

#

maybe cf does, but doubtful

spark flint
#

I can access via url for a while after

lyric mountain
#

just download all attachments sent and save in memo /s

lament rock
#

time to send a ton of 8k images

wheat mesa
#

what

errant perch
#

deferring replies now crash my bot

#

i changed nothing

#

worked fine for about 10 hours then it took my bot down for the rest of the day

#

actually

#

whenever my bot does anything it crashes

#

such as responding to a slash command

#

shitty ass fucking api if you ask me

vivid fulcrum
#

seems like a you problem rather than an api problem

#

you badly designed your code

#

an api error shouldn't cause the app to crash

errant perch
#

nah

#

not a me problem

#

maybe if discord fixed their shit my code wouldnt break in the middle of the day for no apparent reason?

vivid fulcrum
#

not a me problem
whenever my bot does anything it crashes

errant perch
#

thanks for the help headass

vivid fulcrum
#

no problem! anytime

nova basin
#

how we make it ?

vivid fulcrum
nova basin
#

thx

wheat mesa
wheat mesa
#

I will disagree with that statement

#

But it definitely functions

split hazel
#

can js add operator overloading

wheat mesa
#

Yes please

#

Operator overloading makes life so much easier

split hazel
#

and its so cool

proven lantern
#

why doesn't this work when i type it, but it works for my bot.
(Helllo)[https://top.gg]

solemn latch
#

that only works in embeds right?

proven lantern
#

😦

boreal iron
proven lantern
proven lantern
#

that's so kind of you

#

anyways, static types shouldn't be used in application languages

vast cedar
#

Hello,

I would know if it's possible to create a sub-function, like the toLocaleString function.

var number = '45000'

console.log(number.toLocaleString('en-US'))

// 45,000

I want to remove toLocaleString(), and create a new function "format", to do the same thing as toLocaleString but like that number.format() it is possible and if yes how can i do this

lyric mountain
#

var

#

I don't get why ALL people that appear here for the first time use vars

#

is it some kind of starterpack?

lyric mountain
#

HOWEVER be warned that modifying it usually lead to VERY grotesque errors

quartz kindle
#
String.prototype.format = function() {
  return this.toLocaleString("en-US");
}

console.log("45000".format()) // 45,000
boreal iron
#

Isn’t there a static var you can set to define the locale?

#

(in JS)

#

Wouldn’t that be easier?!

errant perch
#

i changed nothing

#

works now

wheat mesa
#

Probably user error regardless

quartz kindle
wheat mesa
#

If your bot crashes then you should catch the error 😛

hybrid cargo
solemn latch
#

../../exp.db

#

or actually just ../exp.db

quartz kindle
#

dont open the db multiple times