#development

1 messages · Page 1701 of 1

slender thistle
#

Not when your community is dumb and can't figure out 2+2 DeadInside

earnest phoenix
long crow
#

2+2 is 22

earnest phoenix
lament rock
#

> What is code for mathematical expressions when trying to calculate user money???

> Yes this is (insert lib name here) related. I'm using it

lament rock
#

what

earnest phoenix
lament rock
#

I don't actually need a math lib btw

#

I can do advanced expressions with the built in methods already

earnest phoenix
#
  if (!message.guild.me.hasPermission("EMBED_LINKS")) return message.author.send("I do not have permission to **Embed links **  in the guild!")

Is it wrong it doesn't sending any dm message just throwing erros missing perms

lusty quest
#

maybe the bot doesnt have permissions to send the DM

winged linden
lament rock
#

the author might have the bot blocked or the user has DMs turned off for shared servers

winged linden
#

True also

toxic jolt
#

what is this omg.

lament rock
#

Upgrade your Discord.js version to latest. Stage Channels are not added in older versions

toxic jolt
#

i upgraded

#

here

#

discord.js@12.5.1

lament rock
#

it doesn't seem like it because it's throwing type 13 for unknown channel

#

type 13 is Stage Channel

toxic jolt
#

what is this 13

lament rock
#

You need to npm install as well, then restart the bot

toxic jolt
#

okay

#

thanks

lament rock
#

StageChannel.type = 13

#

even though the last channel type before StageChannel is 6

toxic jolt
#

omg...

lament rock
#

Do you have Windows Build Tools installed

toxic jolt
#

i dont know

#

i will install it again

lament rock
#

You'll have to restart the terminal once it's installed

toxic jolt
#

My bot was very easy when not used much, now there is another error every day.

#

I am getting bored

cinder patio
#

Maybe it's time for a rewrite

waxen bough
#

is that win8

lament rock
#

errors help you understand what is flawed logic and what isn't. It's just to help you grow

long crow
lament ruin
#

what is going on here, why it returns undefined when channelId.profile clearly exists??????????? wtf

#

i even accessed channelId.ping and the others few lines above and it works just fine

green kestrel
#

morning all!

zenith terrace
#

hi brain

woeful pike
#

also you can see that it's undefined lol

lament ruin
#

it's more like channelsId

#

Like an object that contains multiple channels id's

woeful pike
#

just use a debugger stop putting console.log everywhere

lament ruin
lament ruin
earnest phoenix
#

why does discord instantly close the weebsocket connection for rate limits even tho i did nothing but CONNECT

#

no heartbeats

#

no identify

#

just connect

unreal estuary
#

thats weird

earnest phoenix
#

and it's been two days since i last ran my test script

#

discord doesnt bean you from api for that long

unreal estuary
#

it just closes instantly?

earnest phoenix
#

yup

#

error code 4008

unreal estuary
#

and doesnt send like an op hello code

earnest phoenix
#

nope

#

lemme try some console.logs

unreal estuary
#

IP addresses that make too many invalid HTTP requests are automatically and temporarily restricted from accessing the Discord API. Currently, this limit is 10,000 per 10 minutes. An invalid request is one that results in 401, 403, or 429 statuses.

#

@earnest phoenix maybe try use a vpn or something

earnest phoenix
unreal estuary
#

idk

earnest phoenix
#

also i got multiple hello messages

tidal nymph
#

is anyone here familiar with Twitter API ?

tidal nymph
#

fine bro

unreal estuary
#

then send an identify

earnest phoenix
pale hill
#

Привет всем

unreal estuary
#

maybe you should try contact discord

#

cuz thats weird

earnest phoenix
#

yeah

#

imma try running it on repl

pale hill
#

Im not English Im Russia

unreal estuary
#

yeah that should work

pale hill
#

Im not reads sms

#

English

earnest phoenix
pale hill
#

Кто по русски говорит

#

??

umbral zealot
earnest phoenix
pale hill
#

Yes

tidal nymph
#

As I understand Twitter API only counts "tweets" as the API usage so what If I retrieve the recent tweets of an user with "since_id" params and there are no newer tweets since that id then does my API usage increase ?

umbral zealot
#

that is an awesome question that isn't about development but rather about specific limitations of an API that can be resolved by reading docs and, failing the docs answering it, asking Twitter about it. The chances of someone knowing the answer to that question here is gonna be pretty small

tidal nymph
#

yea thats why I asked if anyone here is familiar with Twitter API at first but okay I might have to ask Twitter ig

#

assumed someone here did work with Twitter API

earnest phoenix
#

"im having problemo!"
"ye should read da docs"
da docs: reeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

unreal estuary
#

is php a good option for making discord bots with

earnest phoenix
unreal estuary
#

i have very few brain cells left

earnest phoenix
#

u might just die if you use php

#

also my problemo got fixed by the great bois at official unofficial discord api

umbral zealot
#

it mentions ratelimits on specific endpoints but nothing about a number of tweets.

tidal nymph
umbral zealot
#

it's not the amount of tweets

#

It the number of times you use an endpoint

tidal nymph
#

are you sure because I only called 60 times and it increases more than that

#

or im trippin

umbral zealot
#

are we talking about the same API here

#

because these are requests per 15 minutes

unreal estuary
tidal nymph
#

this is what i see when i hover on my api usage

umbral zealot
#

ok and when you click on "learn more"?

tidal nymph
#

im not talking about rate limit tho, its about the usage

#

when i click learn more it directs me to project overview

umbral zealot
tidal nymph
#

ye that

#

Tweets received from the following endpoints count towards this monthly Tweet cap:

umbral zealot
#

These pages are talking about 500k tweets / month and you're talking about 60 Thonk

tidal nymph
#

im talking about 60 times i call the api

#

its like 60 users

umbral zealot
#

yeah ok at this point it's clear that the question you're asking isn't going to be known by anyone here, this is really nitty-gritty stuff of a very specific usecase

#

people here make bots and can't even figure out webhooks usually, you're not going to find someone that's knowledgeable with bulk tweet parsing through special projects APIs.

tidal nymph
#

hmm okay i tried to asked Twitter anyway, thank for helping

umbral zealot
earnest phoenix
earnest phoenix
#

When trying to respond to an interaction I'm getting a 404 error
I'm sending the request using this:

let endpoint = `${client.endpoint}/interactions/${data.id}/${data.token}/callback`;
fetch(endpoint, {
    method: "POST",
    body: JSON.stringify({
        type: 4,
        data: {
            content: "poggers"
        }
    })
})
.then(resp => resp.json())
.then(console.log);

example url: (the token expired btw)

https://discord.com/api/v8/applications/829698249991782432/interactions/831129199309488149/aW50ZXJhY3Rpb246ODMxMTI5MTk5MzA5NDg4MTQ5OjNEMUF6VTdTODlhQmNiWHNzS1lLalRyOW5JVGxNcE1BdTQwVnY3WXJQWko4cjZiZ1U0c2tXWnpMdnY2VFd4UTRLcEdXUTZkelRHcnBLOWtsYUQ3R3d6VUJGQzhvTU9QYk9SQUhhTkEzVnFWdVZYYXZuR2RQWlFwV2VLUDd4V3Nm/callback
timber fractal
#

so i have this code to delete blacklisted word but it doesnt only delete the blacklisted words, it deletes everything, how can i fix it?

if(blacklistWords.words.some(word => message.content.toLowerCase().includes(word))){
        message.delete();
        message.channel.send(`${message.author}, watch your language`);
    }```
#

someone?

earnest phoenix
#

you have to delete the entire thing

timber fractal
#

it does message.delete();

earnest phoenix
#

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyeah

#

wtf my computer is drunk

#

anyways if you only want to delete the blacklisted word part youll have to edit the guys message, which you cant

timber fractal
#

i mean every message that is sent

#

it deletes every messages somebody sends

earnest phoenix
#

what

timber fractal
earnest phoenix
#

yeah

timber fractal
#

thats what i want

earnest phoenix
#

i dunno how arrays work

timber fractal
#

-_-

#

message.content.toLowerCase().includes(word)

earnest phoenix
#

includes on a string?

timber fractal
#

i didnt made the code

tacit sequoia
#

.has

timber fractal
#

its from stormbeatz dev

tacit sequoia
#

.includes is an array method

timber fractal
#

i asked help to him and he sent this

earnest phoenix
#

try message.stuff.morestuff.match(new RegExp(word, "i"))

tacit sequoia
timber fractal
tacit sequoia
#

He's trying to help you

timber fractal
#

but u did

#

and it didnt work

#

its not a function

timber fractal
earnest phoenix
#

also can ye guys help me with interactions api

#

When trying to respond to an interaction I'm getting a 404 error
I'm sending the request using this:

let endpoint = `${client.endpoint}/interactions/${data.id}/${data.token}/callback`;
fetch(endpoint, {
    method: "POST",
    body: JSON.stringify({
        type: 4,
        data: {
            content: "poggers"
        }
    })
})
.then(resp => resp.json())
.then(console.log);

example url: (the token expired btw)

https://discord.com/api/v8/applications/829698249991782432/interactions/831129199309488149/aW50ZXJhY3Rpb246ODMxMTI5MTk5MzA5NDg4MTQ5OjNEMUF6VTdTODlhQmNiWHNzS1lLalRyOW5JVGxNcE1BdTQwVnY3WXJQWko4cjZiZ1U0c2tXWnpMdnY2VFd4UTRLcEdXUTZkelRHcnBLOWtsYUQ3R3d6VUJGQzhvTU9QYk9SQUhhTkEzVnFWdVZYYXZuR2RQWlFwV2VLUDd4V3Nm/callback
#

dont ask how i typed all that so fast

timber fractal
#

copy paste

earnest phoenix
timber fractal
lone creek
#

Hi guys somebody can help me

(node:7092) UnhandledPromiseRejectionWarning: #<Response>
(Use node --trace-warnings ... to show where the warning was created)
(node:7092) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:7092) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

earnest phoenix
#

you're showing us the deprecation warning part of the error

lone creek
#

Hmm

earnest phoenix
#

When trying to respond to an interaction I'm getting a 404 error
I'm sending the request using this:

let endpoint = `${client.endpoint}/interactions/${data.id}/${data.token}/callback`;
fetch(endpoint, {
    method: "POST",
    body: JSON.stringify({
        type: 4,
        data: {
            content: "poggers"
        }
    })
})
.then(resp => resp.json())
.then(console.log);

example url: (the token expired btw)

https://discord.com/api/v8/applications/829698249991782432/interactions/831129199309488149/aW50ZXJhY3Rpb246ODMxMTI5MTk5MzA5NDg4MTQ5OjNEMUF6VTdTODlhQmNiWHNzS1lLalRyOW5JVGxNcE1BdTQwVnY3WXJQWko4cjZiZ1U0c2tXWnpMdnY2VFd4UTRLcEdXUTZkelRHcnBLOWtsYUQ3R3d6VUJGQzhvTU9QYk9SQUhhTkEzVnFWdVZYYXZuR2RQWlFwV2VLUDd4V3Nm/callback
#

@quartz kindle when in doubt ping tim

zenith terrace
#

or erwin

earnest phoenix
#

ye

zenith terrace
#

who is typing now

earnest phoenix
#

@opal plank

zenith terrace
#

@opal plank

opal plank
#

I would recommend installing ts and setting it to lax. It would be js with intellisence

#

Oh god wtd

earnest phoenix
#

how did you not notice us when typing that really long message

opal plank
#

Hello i guess everyone

#

Im on mobile

earnest phoenix
opal plank
#

I havent used slash commands

earnest phoenix
#

noob ok

zenith terrace
#

lol

earnest phoenix
#

ok i fixed it myself

#

there is no application/my_app_id in the url

pale vessel
tacit sequoia
#

Ah

earnest phoenix
#

WHO POSTED MEMES ON GENERAL?

zenith terrace
#

you

narrow roost
#

does anyone know how to do this, im trying to execute a function from a file by clicking a button, but it gets executed only when reloading

ejs

earnest phoenix
#
-Hey man, I'm gonna eat your GrIlFrIeNd
crimson vapor
#

@narrow roost you're setting the button to the action of the output of x()

narrow roost
#

i didnt see..

jovial elk
#

anyone knows how bots like carl-bot, can maintain messages with that wait for on_reaction_add for a long time? For me, the hosting service i use, has to restart the application every 24h. and so bot is restarted, there fore on_reaction_add stops working which makes sense. But i see many other bots that has same feature but keep functioning. Is it just they dont restart for a long time?

zenith terrace
#

you mean like reaction roles?

jovial elk
#

yeah for example, if i have a command that opens a menu, and you can navigate it through reactions

zenith terrace
#

oh like a help command

#

with reactions

narrow roost
jovial elk
#

what i have in mind, is an attendance system, where who react to a certain message, will be added to the message as "attending" but what if the bot restarts. therefore reacting to the message wont work anymore

zenith terrace
#

what language you use?

jovial elk
#

python

winged linden
#

Rewrites in it does

tacit sequoia
winged linden
#

😶

tidal nymph
#

thats what im doing

#

👀

lyric mountain
#

in my bot, I save this:

{
  "buttons": [
    {
      "channelId": "123456789",
      "buttons": [
        {"messageId": "987654321", "button": "😩", "role": "2545167152"},
        {"messageId": "987654321", "button": "😙", "role": "2545167152"},
        ...
      ]
    }
  ]
}

then after I restart her I just iterate over the buttons and re-create them

winged linden
#

If u wanna remove html put this in .htaccess

RewriteEngine on RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]RewriteRule ^ /%1 [NC,L,R] RewriteCond %{REQUEST_FILENAME}.html -fRewriteRule ^ %{REQUEST_URI}.html [NC,L]
lyric mountain
#

although there are multiple ways of approaching that issue

jovial elk
#

ok, thanks a lot ^^

winged linden
#

Np

left ore
#

I can use that for bot command

winged linden
#

What? Thats to remove .html from a link

tacit sequoia
#

You can also just make the desired slug a folder and put index.html in the folder

#

But can get messy quick

winged linden
#

Np

tacit sequoia
#

Yah

earnest phoenix
#

Who wants to get Demonetized?

narrow roost
#

why is this happening

#

is it even possible to call functions from ejs

#

or to pass a function with .render

slim heart
#

<%= %> essentially passes the string

#

it doesnt run on your backend

narrow roost
#

so forms then

#

wait it might work

#

nvm, back to cs

#

does replit allow socket connections?

#

like, can i connect with external app to it

cinder patio
#

why not

#

It supports HTTP servers

narrow roost
#

how..

#

i tried before

#

does it assign different ip to each project

cinder patio
#

oh wait, what exactly do you mean?

#

you can use the url

narrow roost
#

oh

#

smolbrain

#

bruh

#

how am i supposed to connect to it

earnest phoenix
#

@narrow roost what lib are you using for weebsocket

narrow roost
#

net

opal plank
#

weeb socket

narrow roost
#
const net = require("net");

const server = new net.Server();
server.listen(6661, "localhost");

server.on("connection", (client) => {
    console.log("pog");
})

const express = require('express')
const app = express()

app.get('/', (req, res) => {
  res.send('fuck you')
})

app.listen(8080, () => {
  console.log(`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`)
})
#

wait maybe im just dum

earnest phoenix
#

what the fuck is that code

narrow roost
#

its ujst test

cinder patio
#

you're missing the port

narrow roost
#

where

cinder patio
#

in the url

narrow roost
#

i tried even with ws://url:6661

cinder patio
#

there shouldn't be ws? You're not making a websocket server

#

that's a TCP server

narrow roost
#

so what do i put in

umbral zealot
#

First question: why are you making a TCP server

cinder patio
#

tcp

narrow roost
#

should be

#

they way i get hostname is by creating express server

umbral zealot
#

the hostname isn't created by the express server

narrow roost
cinder patio
#

I think repl requires a server to be listening on port 80 though

#

not sure

#

8080*

quartz kindle
#

i believe repl.it auto-assigns whatever port you use in your app

cinder patio
#

possibly

#

but what if you're using multiple ports like the guy above

quartz kindle
#

it will auto-assign the first one most likely

earnest phoenix
#

You cant use multiple ports

quartz kindle
#

all others will be ignored

narrow roost
#

man i cant open ports on my router, this is hell

earnest phoenix
quartz kindle
#

if you want multiple ports on repl.it, make multiple repls

earnest phoenix
#

i am trying to make a welcome message but its not working

quartz kindle
#

one for each webapp

earnest phoenix
#

or you can use almighty glitch

narrow roost
earnest phoenix
#

ping shivaco if you need help with py

quartz kindle
#

what about it is not working?

#

did you check if you are receiving the event at all by printing something in it?

#

if you're not receiving anything, you need to enable the SERVER MEMBERS intent

#

if you are reciving, then print the channel variable to see if it actually found a channel

narrow roost
#

can ports be opened on a mobile broadband 💩

earnest phoenix
narrow roost
#

like port forward

#

to public

earnest phoenix
#

ohhh

delicate shore
#

hey guys

#

how can I find if code is plagiarised

cinder patio
#

huh?

delicate shore
#

nvm

#

what is that

zenith terrace
#

plagiarize
verb
past tense: plagiarised; past participle: plagiarised
take (the work or an idea of someone else) and pass it off as one's own.
"he was fined $6,000 for having plagiarized the song"
take the work or an idea of (someone) and pass it off as one's own.
"the author claims she was plagiarized"

delicate shore
#

the previous version just used cleverbot's api

#

and he just outta no where said he rewrote it

#

but I think he did some clever thing which still uses something else

cinder patio
#

so he most likely didn't make the API, no

delicate shore
#

alright

#

Thanks

cinder patio
#

I mean, he could have made the api and he's making requests to it

#

Maybe the URL is so obfuscated so it's private, even though it can be figured out

delicate shore
#

This guy claimes that Cleverbot's team gave him perm

#

to use their api

#

which I doubt

cinder patio
#

Maybe they bought api calls

#

and that's why they're obfuscating the code which makes the call

delicate shore
#

that do makes sense

#

but why would cleverbot allow this guy to make it into npm package with 100k downloads

#

wouldn't this cause a loss to them?

cinder patio
#

I highly doubt cleverbot gave them api calls for free. They most likely brought them

earnest phoenix
cinder patio
#

or are scraping the cleverbot site which isn't very hard to do either

#

which by the way is against their ToS

delicate shore
#

he refuses

earnest phoenix
#

the website is ugly :C

delicate shore
#

and he says that Cleverbot gave him perm for free

cinder patio
#

I once made cleverbot talk to itself

#

shit got weird

pale vessel
#

check the source?

delicate shore
#

it's debsubsufvsaf

#

or whatever it's called

earnest phoenix
#

the code is quite small

cinder patio
#

obfuscated api call

delicate shore
#

this is simplified

#

version

earnest phoenix
#

file in utils folder :

    name: "utilsPanel",
    category: "Utils"
}```

help.js :
```client.commands.filter((command) => command.category === "Utils").map((command) => `\`${command.name}\``).join(', ')```

but my bot send empty field.. why?
delicate shore
#

This seems fully suspicious

cinder patio
#

Well they are definitely making a request to the official api

pale vessel
#

seeing obfuscated code makes me cringe

delicate shore
#

yes they are

earnest phoenix
#

but i want to check if command is in a category: 'utils' @umbral zealot

umbral zealot
#

yes

#

I know

delicate shore
#

but, I think he is not doing it the legal way
This npm package gets calls about 100k times every day
Why would cleverbot want to be in loss

umbral zealot
#

you're exporting an object called help so when you export it you have to use the help object first

earnest phoenix
#

ok i test

#

(node:11505) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'category' of undefined

delicate shore
earnest phoenix
#

.setDescription(client.commands.filter((command) => command.help.category === "Utils").map((command) => `\`${command.name}\``).join(', '))

@umbral zealot

#

(node:11505) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'category' of undefined

cinder patio
#

Do you hate that guy or something

umbral zealot
#

well clearly one of your command doesn't have a help object exported

delicate shore
#

I was just asking him if this is legal just in a friendly way and he cussed the heck out at me

#

and just kept saying I suck

#

but I still didn't cuss back

#

and maintained my same tone

umbral zealot
#

your code doesn't allow for files that dont' have it

cinder patio
#

If it's paid then I don't think it would be a problem, but if they gave it to him for free, for PERSONAL use

#

he's not using it very personally

narrow roost
#

js cringe

cinder patio
#

A light weight [asynchronous / promise] based Neural Network [Artificial Intelligence] in the github repo description... when all he's doing is a request to a service... cringe

umbral zealot
delicate shore
cinder patio
#

Let's steal that token :d

delicate shore
#

I wouldn't even be mad if it he was agreeing to use cleverbot api
but instead he bluntly claims that he coded everything

cinder patio
#

and report it to cleverbot ofc

#

nothing illegal

delicate shore
cinder patio
#

he can probably change it any time though

delicate shore
#

yes

#

he can

cinder patio
#

then that's kinda pointless

delicate shore
#

but still

narrow roost
#

what if he is reading this rn 😳

delicate shore
#

but we have the old source code

#

so

delicate shore
delicate shore
cinder patio
narrow roost
#

wtf is even happening here

delicate shore
#

eh

cinder patio
delicate shore
#

he is here

#

lol

#

he has sent no message tho

vivid fulcrum
#

just sniff traffic via wireshark

#

doesn't matter whether the code is obfuscated

#

the http request won't be

cinder patio
#

true

quartz kindle
#

heres a more partially decoded version

#

cookies is "XVIS=TEI939AFFIAGAYQZ;Path=/;Max-Age=31536000"

#

hash is

#

and to get cookies they do ```js
const _0x8d36x12 = await superagent.get("https://www.cleverbot.com/");
cookies = _0x8d36x12.header["set-cookie"];

#

so basically, they are scraping

opal plank
#

is tim legit manually decoding obfuscated code? or are my eyes decieving me?

vivid fulcrum
#

it's not hard

#

it's basically just a bunch of numbers in hex form

#

js-obfuscator can only do so much

quartz kindle
#

i felt like it

#

had to run the code because several values are obtained at runtime

cinder patio
#

I see

#

I wouldn't call that scraping, but knowing how the cleverbot website works, he must've done his research

quartz kindle
#

well they are setting cookies to pretend they are a browser

#

then requesting the page as text/plain

#

pretty sure thats considered scraping

severe mesa
#

i need help

cursive pulsar
cinder patio
#

I'm pretty sure the XVIS cookie is something like an API token which can be used

#

and they're getting that then using it

quartz kindle
#

they are getting that just from vising the main page tho

severe mesa
#

i dont know the command to translate the language

cinder patio
#

yeah, seems like cleverbot sends the cookie when a user visits the main page

#

cause the chatbot thing is on the main page

quartz kindle
#

those kinds of cookies are basically sessions cookies to prevent usage from non-browsers

cinder patio
#

yeah well... doesn't look like they're working

quartz kindle
#

everything can be spoofed

#

its just a layer of protection

#

not perfect but works for a lot of stuff like generalized scrapper bots

cinder patio
#

What the writer of the npm package did is pretty clever though, gotta give em that

quartz kindle
#

clever but not that special, but the fact they're hiding it does make them look shady

#

this kind of obfuscated code in an npm package caused serious issues before

#

remember that story when malicious code was injected into a crypto currency module by doing exactly this to one of its dependencies?

cinder patio
#

oh yeah definitely... I don't get the point of the obfuscation... just say that it uses the cleverbot api for free

#

does this break cleverbot's ToS?

#

It does use the official API

eternal osprey
#
  if (subcommand === 'ban'){
    let targetMember = message.mentions.members.first();
    console.log(targetMember.id)
    let test = JSON.parse(fs.readFileSync("./banned.json", "utf8"));
    config.userids.push(targetMember.id);
  

 

    fs.writeFileSync("./banned.json", JSON.stringify(test))
  }``` Hey why is thjs not writing anything to userids?
umbral zealot
#

because you're modifying config and not test

eternal osprey
#

but config is saved to require banned.json

pale vessel
#

man's still using the same json db

umbral zealot
#

ok but you're not modifying test which is the updated value

#

and config isn't being updated, probably because you're requiring it?

#

This is what you get for sticking with a shitty-ass json database, mate.

eternal osprey
#

how would i then use instead of require

umbral zealot
#

You'd already be done dealing with this shit if you were using a real db

#

let test = JSON.parse(fs.readFileSync("./banned.json", "utf8")); <----- what about this line? why not just use that?

#

you literally know how, just use that

cinder patio
#

What's crazy is that this guy's been asking questions regarding the json database for a few months already...

umbral zealot
#

I know right

#

"But it's easier"
It's been months

#

and you still can't read/write to one file!

#

August 2010. 6 months. SIX MONTH

#

how are you still sticking with "it's easier" ?

cinder patio
#

2010 KEKW Imagine

umbral zealot
#

errr yeah no 2020

#

same year, right?

#

my brain refuses to see decades

cinder patio
#

Trying to figure out how to make your json database to work for a whole decade

slim umbra
#

rewrite everyting to wasm perf™️

cinder patio
#

you'll barely get any performance out of that but ok

umbral zealot
quartz kindle
#

maybe they like torturing themselves, who are we to judge?

#

¯_(ツ)_/¯

umbral zealot
#

there are way too many masochists in the dev world. It's scary.

still umbra
#

Dev world

#

You mean virtual world

quiet topaz
#

Is there a way to store a java hashmap in mariaDB?

still umbra
#

You can find helpful people in development

quiet topaz
quartz kindle
#

lmao

blissful cliff
quartz kindle
still umbra
#

Oh i am drunk

#

Bye

blissful cliff
#

dyi homescrapped mongodb

quiet topaz
quartz kindle
#

or serialize it

quiet topaz
#

whats serializing

quartz kindle
#

convert it to a string of key-value

#

like json

#

could also serialize to a binary format

quiet topaz
#

hmm

quartz kindle
#

sql is based on tables and relational data, so you need to see how to best fit your hashmaps to it

#

since hashmaps are key-value only

#

if each of your groups is a row in your db, then serialize and insert in a column

eternal osprey
quartz kindle
#

if each of your groups is a table, then you could make rows for each entry in the hashmap

eternal osprey
#

Will be back within like 4 hours once everything is set

umbral zealot
#

You should be doing that for your own sanity, not just for me

#

I mean if you switched to quick.db or enmap you would actually be done in like 4 hours

umbral zealot
#

like actually, truly

quartz kindle
#

if your data is that big sure

#

but if your data is that big, you might wanna consider making a separate table for it

quiet topaz
#

like im writing a minecraft permission plugin

quartz kindle
#

also depends how you want to access it

#

because you cannot independently access the keys and values of a serialized hashmap, you have to parse the entire thing before

#

if its very large it will be costly

quiet topaz
#

hmm

opal plank
#

does minecraft have an auth api?

quartz kindle
#

a typical strategy for relational databases would be to make a new table and store keys and values there, along with a group id to connect it with the other tables

#

for example

opal plank
#

a public one, at that

quartz kindle
#

groupID, key, value
123, 1, "abc"

#

and put every entry of all your hashmaps there

zenith terrace
quartz kindle
#

because you're weird

#

:^)

zenith terrace
zenith terrace
quiet topaz
#

hmm

quartz kindle
#

yes

opal plank
#

welcome to relational databases

quartz kindle
#

that would be the most performant method

#

fast insert and read

#

but slightly more disk space consuming

opal plank
#

if you only using it for that why not use redis with keydb?

#

set the entry group as the key, and the hashes have their own values

#

so you would shrink all that under 1 "table"

quiet topaz
opal plank
#

even though redis doesnt work with tables

quartz kindle
#

more than enough

#

i mean, idk how big is your data

opal plank
#

Hset and Hget would be better imo

quartz kindle
#

but i have 20k rows and use like 20mb

opal plank
earnest phoenix
#

hello I have a problem. when I do the join command or a command that wants to join the bot in my channel I have an error

umbral zealot
#

Sounds like your hosting is too slow for a music bot and is timing out.

#

What is that, repl?

quartz kindle
opal plank
#

you can set redis to unload on disk instead of keeping it all on memory, along with clustering

quiet topaz
#

or i could have hashmap<groupdId, hashmap<key, value>>

opal plank
#

keydb

opal plank
opal plank
#

redis with hashes

#

@quartz kindle

quiet topaz
#

what the website of keydb

opal plank
quartz kindle
#

nor keydb nor redis are disk only

#

they are memory databases with disk snapshots

opal plank
#

which is still a good alternative

quartz kindle
#

the entire dataset is kept in memory at all times

unique panther
#

Syntax Error

umbral zealot
#

well then that host is too slow.

#

bad connection

unique panther
# unique panther Syntax Error

File "E:\lib\runpy.py", line 267, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "E:\lib\runpy.py", line 242, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
File "c:\Users\User\Desktop\Banking Bot Main File\mainFile.py", line 22
async def ban(ctx,member : discord.Member,*,reason = "No Reason has been provided"):
^
SyntaxError: invalid syntax
PS C:\Users\User\Desktop\Banking Bot Main File>

earnest phoenix
#

okay x)

#

thanks

opal plank
#

or what would happen if it hits maximum memory allocated

quartz kindle
#

it will use swap if possible, and then crash with OOM

opal plank
#

hmmmm

quartz kindle
#

The previous point means that you need to provision memory based on your peak memory usage. If your workload from time to time requires 10GB, even if most of the times 5GB could do, you need to provision for 10GB.

opal plank
#

yeah i read that part

#

though the question becomes, how many entries do you need to allocate that much

#

since they only have 10GB space, i assume they would have a good 4GB ram to abuse

#

and possibly a swap with the disk

#

If swap is possible its more of a win than anything

#

Normal dbs should also be reading from disk, so i dont assume it would be that much worse

#

You would gain from speed from the entries in ram, and not lose much with the ones in disk compared to others

#

But you would gain overall in size possibly

#

From 10gb to 10gb + some ram

quartz kindle
#

swap is slower than regular databases tho

#

at least it should be

#

there is a lot more work involved

opal plank
#

If it is that voids my other argument

quartz kindle
#

redis has a thing on that

#

Using as little memory as possible
An interesting setup to turn Redis into an on-disk DB with just keys in memory is setting vm-max-memory to 0. If you don't mind some latency more and poorer performance but want to use very little memory for very big values, this is a good setup.

In this setup you should first try setting the VM as blocking (vm-max-threads 0) as with this configuration and high traffic the number of swap in and swap out operations will be huge, and threading will consume a lot of resources compared to a simple blocking implementation.

earnest phoenix
#

Is it possible to import a module in a html tag?

#

a module like mongoose

#

for ex

quartz kindle
#

not exactly

#

modules for browsers are different than modules for node.js

#

you can load them with script tags or import them from js using es6 imports

#

but they must be compatible with browsers

earnest phoenix
#

so

quartz kindle
#

many modules out there are node.js-only unless they specifically state it works on browsers too

#

and i doubt mongoose is one of them

earnest phoenix
#

can you give me an example how could i import them?

quartz kindle
#

furthermore, you should never use a database module on the client side

lament rock
#

db connections shouldn't be available to clients anyways

earnest phoenix
#

i m new on web dev

#

so yea

green kestrel
#

ugh, valgrind is eating my dev box for breakfast

quartz kindle
#

well, its grinding your values

#

:^)

lament rock
#

9GB. Feels bad

green kestrel
#

lol yeah

#

its a profiler

#

so i got 600,000 users, 270,000 roles, and 7600 guilds in 325mb ram

#

but its flapping back and forth between 0 and 3.5% cpu

#

i want to check if thats acceptable or not, so profiler time

#

still a ton less CPU than the aegis lib, though

quartz kindle
#

not bad :)

lament rock
#

325MB seems a bit excessive for such a low size considering I was able to squish ~3.7k into 80MB or so

lean swan
#

Anyone have template of webhook receiver?

green kestrel
#

but were you caching everything?

#

and does that include the program code for the bot? ive never seen a node app take only 80mb in htop

lament rock
#

Okay no, not everything returned by socket, but I was caching all of the properties available to certain resources

#

stateless bots are cool :)

green kestrel
#

nah, node itself takes more than 80mb just to boot doesnt it?

lament rock
#

nah

quartz kindle
#

nah

#

it takes 30-50

green kestrel
#

after you load all the node_modules and stuff to make it do something

quartz kindle
#

if it idles a lot it will go down to ~25

#

probably because of swap

lament rock
#

Node can be pretty optimized depending on what modules you install and your own logic

#

such is the case with any language though

green kestrel
#

these are the figures im really proud of though

earnest phoenix
#

can someone help me with a nickname command

green kestrel
#
guild_member: 72
user: 72
channel: 160
role: 80
emoji: 64```
these are the sizes per item, in bytes, for cached objects 🙂
quartz kindle
#

these are my node apps:

lament rock
#

do you cache all properties for resources

green kestrel
#

there's overhead the minute you store them in an unordered_map though 😦

#

i cache all those types

quartz kindle
#

did you try the alternative map i suggested?

#

:^)

green kestrel
#

not messages... that would be silly

#

no, i dont want to introduce a dep

earnest phoenix
green kestrel
#

i'll look into it for other stuff

quartz kindle
#

its a header-only dep, but alright

lament rock
#

storing messages seems like a security concern regardless 👀

earnest phoenix
# earnest phoenix what have you tried?

`module.exports = {
name: 'nick',
group: 'Moderation',
description: 'Sets a users nickname.',
userPermissions: [
'MANAGE_NICKNAMES',
'CHANGE_NICKNAME'
],
clientPermissions: [
'MANAGE_NICKNAMES',
'CHANGE_NICKNAME',
],
argsType: 'multiple'
}

run: async = (message, args) => {
const target = message.mentions.users.first()
const member = message.guild.members.cache.get(target.id)

args.shift()
const nickname = args.join(' ')

member.setNickname(nickname)

message.reply('You changed the nickname!')
}`

green kestrel
#

header only, the bane of C++

quartz kindle
#

xD

green kestrel
#

how to bulk up your compile times in one easy step lol

quartz kindle
#

i made a pre-compiler to reduce build time

#

it simply copy pastes the contents of all files into a single file before build

latent heron
quartz kindle
#

xD

green kestrel
quartz kindle
#

200 by default

#

in discord.js

lament rock
#

Discord.js does yeah

#

some other libs don't cache as many

#

or none

green kestrel
quartz kindle
#

storing in-memory doesnt count as a security concern i believe since its part of the program's operations

green kestrel
#

e.g. make -j8 is nerfed

earnest phoenix
#

`module.exports = {
name: 'nick',
group: 'Moderation',
description: 'Sets a users nickname.',
userPermissions: [
'MANAGE_NICKNAMES',
'CHANGE_NICKNAME'
],
clientPermissions: [
'MANAGE_NICKNAMES',
'CHANGE_NICKNAME',
],
argsType: 'multiple'
}

run: async = (message, args) => {
const target = message.mentions.users.first()
const member = message.guild.members.cache.get(target.id)

args.shift()
const nickname = args.join(' ')

member.setNickname(nickname)

message.reply('You changed the nickname!')
}`

this is my nickname command what is wrong with it

quartz kindle
#

storing it off-memory would be another thing

quartz kindle
#

but my workload is waaay different

#

its about 90 files, and every single file needs a header which needs the full C library it requires

#

the old C lib i told you about, thats like 60k+ lines

green kestrel
#

ive been doing my best to do away with header only deps

opal plank
green kestrel
#

so i can compile my entire lib from clean in 4.5 mins

#

compiling triviabot from clean with aegis takes 22 mins 🤮

quartz kindle
#

thats kid of a lot

earnest phoenix
green kestrel
#

my dev box has old slow xeon

quartz kindle
#

my lib's compile time is like 20 seconds

green kestrel
#

lol

opal plank
green kestrel
#

thats pretty fast, but on what?

#

i should measure it on mine

quartz kindle
#

well, only tested on my pc

pale vessel
green kestrel
#

mines the acid test of if your process really is efficient 😉

quartz kindle
#

an i5 laptop

lament rock
#

was about to say, Erwin's at it again

opal plank
#

nono, actually

#

i dont think commando uses permissionsClient either

green kestrel
#

one sec

quartz kindle
#

but well, its a completely different library

green kestrel
#
vendor_id       : GenuineIntel
cpu family      : 6
model           : 30
model name      : Intel(R) Xeon(R) CPU           X3450  @ 2.67GHz
stepping        : 5
microcode       : 0x4
cpu MHz         : 2660.130
cache size      : 8192 KB
#

its really fast for db stuff

#

but really really slow for compilation

#

my production box is like 4x as fast

#

look up the X3450

earnest phoenix
#

`module.exports = {
name: 'nick',
group: 'Moderation',
description: 'Sets a users nickname.',
userPermissions: [
'MANAGE_NICKNAMES',
'CHANGE_NICKNAME'
],
clientPermissions: [
'MANAGE_NICKNAMES',
'CHANGE_NICKNAME',
],
argsType: 'multiple'
}

run: async = (message, args) => {
const target = message.mentions.users.first()
const member = message.guild.members.cache.get(target.id)

args.shift()
const nickname = args.join(' ')

member.setNickname(nickname)

message.reply('You changed the nickname!')
}`

this is my nickname command. when i run it it doesnt work! please help!

The error i get is: node:946) UnhandledPromiseRejectionWarning: TypeError: command.run is not a function
(node:946) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:946) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

green kestrel
#

its a good ten years old iirc

#

AAAAAAAAAAAAH

#

jesus stop pasting your entire code

#

use a pastebin like normal people

opal plank
#

or at least do this

quartz kindle
#

i5-7300HQ

opal plank
#
module.exports = {
      name: 'nick',
      group: 'Moderation',
      description: 'Sets a users nickname.',
      userPermissions: [
        'MANAGE_NICKNAMES',
        'CHANGE_NICKNAME'
      ],
      clientPermissions: [
        'MANAGE_NICKNAMES',
        'CHANGE_NICKNAME',
      ],
      argsType: 'multiple'
    }

run: async = (message, args) => {
  const target = message.mentions.users.first()
  const member = message.guild.members.cache.get(target.id)

  args.shift()
  const nickname = args.join(' ')

  member.setNickname(nickname)

  message.reply('You changed the nickname!')
  }```
quartz kindle
#

thats my cpu lul

lament rock
#

wish there was an option to collapse code blocks similar to *.txt embedding

opal plank
#

there is

#

but it needs to be big enough

green kestrel
#

it still beats my dev server

opal plank
quartz kindle
#

oh wow

green kestrel
#

hell, my AMD FX-6300 desktop beats my dev server

quartz kindle
#

thats a really old xeon

green kestrel
#

yup

earnest phoenix
#

you will have a recommendation in host for bot radio and music?

green kestrel
#

it was refurb enterprise server

opal plank
#

@earnest phoenix theres plenty of issues in ur code btw

earnest phoenix
lament rock
earnest phoenix
earnest phoenix
#

what s your error

#

?

#

The error i get is: node:946) UnhandledPromiseRejectionWarning: TypeError: command.run is not a function
(node:946) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:946) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

opal plank
#

first, you dont check if you have a target, you might try to cache.get(undefined.id) which will error
second, nickname can be empty
third, member might be null/undefined
fourth, you dont check for 32 max size thats allowed to edit nicknames

theres plenty of errors here in a 6 line code on ur run() function

unique panther
#

My ban command is having a syntax error (discord.py)
@client.command(aliases = ["b"])
@commands.has_permissions(ban_members = True)
async def ban(ctx,member : discord.Member,*,reason = "No Reason Provided"):
await ctx.send(member.name + "Has been banned")
await member.ban(reason = reason)

pale vessel
#

What's the error?

earnest phoenix
#

@unique panther check your dms

#
module.exports = {
    name: 'nickname',
    description: "nickname",
    async run(message, args, client){
        const target = message.mentions.users.first()
        const member = message.guild.members.cache.get(target.id)

        args.shift()
        const nickname = args.join(' ')

        console.log(nickname)

        message.reply('You changed the nickname!')
    }
}
#

try it like that

unique panther
opal plank
#

literally t33o

earnest phoenix
#

idk what s your command handler

opal plank
#

did you bother reading what i sent?

earnest phoenix
#

nope

#

:)))

opal plank
#

amazing

earnest phoenix
#

tbh

umbral zealot
#

noted

unique panther
#

Im having a syntax error

#

@client.command(aliases = ["b"])
@commands.has_permissions(ban_members = True)
async def ban(ctx,member : discord.Member,*,reason = "No Reason Provided"):
await ctx.send(member.name + "Has been banned")
await member.ban(reason = reason)

opal plank
#

whats best is that cammy is likely trying to ask electro for js help in dms

pale vessel
#

Yes you said that already

opal plank
#

called it

pale vessel
#

But what error?

earnest phoenix
opal plank
#

wdym why

#

even if his function works

#

it'll likely error

#

that code is as stable as a cards tower

earnest phoenix
#

ik

opal plank
#

one wrong blow and it all falls

unique panther
#

So can anyone help it shows syntax error in this line
async def ban(ctx,member : discord.Member,*,reason = "No Reason Provided"):

earnest phoenix
#

i saw that

#

but the most important thing is to fix his command handler

opal plank
#

but yeah, his error is what you said, he's not including the function inside the exports module

earnest phoenix
# earnest phoenix ``` module.exports = { name: 'nickname', description: "nickname", as...

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'users' of undefined
at Object.run (/home/runner/CAMS-bOT/commands/Moderation/nickname.js:5:41)
at Client.<anonymous> (/home/runner/CAMS-bOT/index.js:44:25)
at Client.emit (events.js:314:20)
at Client.EventEmitter.emit (domain.js:483:12)
at MessageCreateAction.handle (/home/runner/CAMS-bOT/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/runner/CAMS-bOT/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/runner/CAMS-bOT/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/runner/CAMS-bOT/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/runner/CAMS-bOT/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/runner/CAMS-bOT/node_modules/ws/lib/event-target.js:132:16)
(node:1018) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1018) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit cod

opal plank
#

i literally

#

JUST

earnest phoenix
#

thats my error

opal plank
#

FUCKING

#

SAISD IT

pale vessel
opal plank
#

AAAAH

pale vessel
#

and nothing else?

opal plank
unique panther
# pale vessel Does it literally just say syntax error?

File "E:\lib\runpy.py", line 267, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "E:\lib\runpy.py", line 242, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
File "c:\Users\User\Desktop\Banking Bot Main File\mainFile.py", line 22
async def ban(ctx,member : discord.Member,*,reason = "No Reason Provided"):
^
SyntaxError: invalid syntax
PS C:\Users\User\Desktop\Banking Bot Main File>

opal plank
#

then learn js

#

@earnest phoenix Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!

opal plank
#

but you using javascript

#

not java

earnest phoenix
unique panther
#

ok

earnest phoenix
#

just asking

earnest phoenix
opal plank
#

if you know java, that should give you a decent head-start

earnest phoenix
#

that s why u got this error

opal plank
#

at this point you just copy pasting random stuff

earnest phoenix
opal plank
#

again

earnest phoenix
#

u didn t mention anybody

opal plank
#

learn javascript

earnest phoenix
opal plank
#

you shouldnt be coding a bot with 0 knownledge of code

#

im willing to bet you took that command from someone

earnest phoenix
#

try ?nickname @short wraith blah blah

#

and send the error

earnest phoenix
#

yea try that

#

oh

#

oops

#

srry

unique panther
# pale vessel Remove `*, ` before `reason`

Same error
File "E:\lib\runpy.py", line 267, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "E:\lib\runpy.py", line 242, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
File "c:\Users\User\Desktop\Banking Bot Main File\mainFile.py", line 22
async def ban(ctx,member : discord.Member,reason = "No Reason Provided"):
^
SyntaxError: invalid syntax
PS C:\Users\User\Desktop\Banking Bot Main File>

earnest phoenix
#

i m blind

opal plank
#

i give up

#

good luck spoonfeeding them t33o

earnest phoenix
#

xd

onyx hare
#

my showroles command is bust idk why i cant get it to pick up the name err TypeError: Cannot read property 'name' of undefined

const Discord = require("discord.js");

exports.run = async (client, message) => {
    var guildRoles = message.guild

    for (var i = 0; i < guildRoles.length; i++) {
        var nowRole = guildRoles[i];   
    }
let embed = new Discord.MessageEmbed()
.setTitle("ROLES")
.setColor("GREEN")
.setDescription("Name" + `${nowRole.name}` + "\nPosition: " + `${nowRole.position}` + "\nMentionable: " + `${nowRole.mentionable}`  + "\nColor: " + `${nowRole.color}`)
.setFooter("Server Roles")
    message.channel.sendEmbed(embed);
    }

earnest phoenix
earnest phoenix
#

to see error?

#

yep

opal plank
earnest phoenix
#

do you want to move this conv in dm?

earnest phoenix
opal plank
#

also that code wont work

onyx hare
#

is there a shorter way i can grab a servers role list

opal plank
unique panther
#

Hey @pale vessel it shows same error\

vivid fulcrum
#

also also

#

you're trying to access newRole where it doesn't exist

#

newRole only exists in the for loop

#

nowRole*

pale vessel
opal plank
#
message.reply({embed: {title: "ROLES", color: 'GREEN',, footer:{ text: 'Server Roles'}, description: [...message.guild.roles.cache.values()].map((role) => `Name: ${role.name}\nPosition: ${role.position}\nMentionable:${role.mentionable}\nColor:${role.color}`).join('\n').slice(0, 1990),},})

i cant think of a safer way than this

#

nor smaller

hidden hedge
#

Is the discord TestFlight full

unique panther
# pale vessel Show your code

@client.command(aliases = ["b"])
@commands.has_permissions(ban_members = True)
async def ban(ctx,member : discord.Member,reason = "No Reason Provided"):
await ctx.send(member.name + "Has been banned")
await member.ban(reason = reason)

opal plank
#

@onyx hare im feeling charitable, enjoy

unique panther
#

Traceback (most recent call last):
File "E:\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "E:\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "c:\Users\Sameer Khan.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\lib\python\debugpy_main
.py", line 45, in <module>
cli.main()
File "c:\Users\Sameer Khan.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\Sameer Khan.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("main"))
File "E:\lib\runpy.py", line 267, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "E:\lib\runpy.py", line 242, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
File "c:\Users\Sameer Khan\Desktop\Banking Bot Main File\mainFile.py", line 22
async def ban(ctx,member : discord.Member,*,reason = "No Reason Provided"):
^
SyntaxError: invalid syntax
PS C:\Users\Sameer Khan\Desktop\Banking Bot Main File>

opal plank
#

aaaah headaches

unique panther
earnest phoenix
#

py

#

aaaaaaaa

wooden thunder
pale vessel
earnest phoenix
#

That's not even a valid invite link 5head

opal plank
#

imagine thinking you can share other servers links

earnest phoenix
#

anyways let's continue our python rant

unique panther
green kestrel
#

i think an hour of this craziness is more than enough lol

opal plank
#

idk what that is, but its fancy and i like it

green kestrel
#

its profiler output

#

on the left hand side is a relative chart of how long the processor spent in each part of the code

opal plank
#

my profile outputs is a lot less fancy

green kestrel
#

the boxes within boxes is a graphical representation of the same

#

clicking the chart lets you drill down

#

so you can see what parts of your code are computationally expensive

#

and which bits to work on

#

rather than just clutching at straws and optimising needless things

pale vessel
green kestrel
#

get hold of something called qcachegrind then @opal plank

pale vessel
#

what python version are you using by the way?

green kestrel
#

dont know if node can output a callgrind.out file though that it needs

opal plank
#

@green kestrel

lament rock
#

Chrome's Heap inspector is not beginner friendly

earnest phoenix
opal plank
#

its quite handy

lament rock
#

I've gotten my app to the point where strings of imported modules are the Objects which occupy the most memory

lament rock
#

why does axios have to be so chomk

earnest phoenix
#

aaaaaa

opal plank
lament rock
#

no

opal plank
#

axios pog tho

lament rock
#

I moved all my libs to centra because I dislike axios

opal plank
#

i love axios

lament rock
#

LOL

opal plank
#

the one i've yet to try is GOT

lament rock
#

ew got

opal plank
#

also, i saw that

#

have you tried it?

#

tim talked about it quite a few times, but i've never tried it myself

lament rock
#

yeah. Kinda bad imo. Tried it while I was trying other http libs for my rest only lib

green kestrel
#

😢

earnest phoenix
#

now shut

opal plank
#

you want basic shit?

lament rock
#

wish I knew cpp

opal plank
#

curl

#

just curl it

green kestrel
#

cpp-httplib isnt basic 😄

lament rock
#

make a module to wrap around the curl cli

#

huge brain

green kestrel
#

lol ew

earnest phoenix
#

what's the difference between a full virtual machine and a container

opal plank
#

the name

#

clearly

green kestrel
#
  1. makes a module that wraps curl cli
  2. puts it in production bot
opal plank
#

i've had the brilliant idea of doing something similar before

lament rock
#

Next thing you know: out of memory because of how many child processes are being spawned

opal plank
#

with exec() module and capturing stdout

#

and parsing it to js

green kestrel
#

a container doesnt emulate the cpu, in short

#

or the hardware

#

a container is basically like an advanced chroot with some other stuff on top

#

to contain the network portions

onyx hare
#

how would i make a global cooldown instead of just for that one person

green kestrel
#

unless youre running a linux container on windows, in which case yes... theres really no difference between the two terms under the hood 😄

#

at least on docker

#

with wsl2 containers

#

@onyx hare key the cooldown to the guild id

#

in a dict

opal plank
#

brain

#

here

#
import {exec};
let output= await exec('CURL https://google.com'), parsed;
if(output) parsed = JSON.parse(output);

gg ez

#

just require promisify and make exec await/async

#

big brain

#

parsing stdout from exec

unique panther
lament rock
#

That's fucking cursed

opal plank
#

actually

#

you can already await it i think

earnest phoenix
#

@opal plank mf why you name your error as er not err

opal plank
#

cuz theres 2 errors

#

(error, stdout, stderr)

lament rock
#

I thought exec didn't return a Promise

earnest phoenix
#

well

opal plank
#

me neither, but it does

earnest phoenix
#

name the second error as stderr

lament rock
#

Returns: ChildProcess

#

what

opal plank
#

ignore that

lament rock
#

time to look at child_process's api docs

opal plank
#

its the docs under child process

#

happily executing lots of childs

lament rock
#

tfw devs talk about masters and slaves

opal plank
#

thats the terminology i still use

#

fuck everyone else who dislikes it

#

not my problem

lament rock
#

omg!!!!1! b-b-but racial connotations

#

Ur getting cancelled on twitter

opal plank
#

what is this i hear?

#

is it a mosquito?

#

weird

earnest phoenix
lament rock
#

Damn. Thought we were closer than that animePensive

opal plank
#

didnt block you, just referring that theres a block button

lament rock
#

ik. I'm memeing

opal plank
#

its quite hard to piss me off to the point of blocking

#

but i still use that terminology

#

okay

#

there might be some false positivies here

#

but gives you an idea

lament rock
#

I still do as well even for git branches, but if I made a new branch and intended it to be the default branch, I would still probably call it main since all new repos are having that enforced

#

or I'd just meme and name the branch index

opal plank
#

i'll literally host my shit on hastebin if they dont allow my repos to use master terminology

lament rock
#

You can still make a branch with the name master then set it as default and delete main

opal plank
#

well fair

earnest phoenix
#

How can I make the bot ask to repeat the value of the variable arg but leave two letters of error

lament rock
#

string.repeat is a method

#

if you're trying to output something multiple times to a string that is

steep drum
#

I think they're talking about fuzzy string matching, but it's unclear what they're saying

lament rock
#

ah

earnest phoenix
opal plank
#

fuzzy string search

#

fuzzyset, fuse or some other module for it

#

or you can use some pre-made algorithms

violet haven
#

hello! can u help me with reaction collector discord?js

#
  '🟢'  => <ref *1> MessageReaction {```
#

how do i use this array ?

opal plank
#

thats a map

#

not an array

violet haven
#

ah yes sry

opal plank
#

well

#

technically its a Collection

#

but that extends map