#development

1 messages Ā· Page 1970 of 1

lyric mountain
#

no, someone from top.gg had to make it

#

and that person either no longer contributes to top.gg or does not work on that lib anymore

marble juniper
#

shiv maintained it but now doesn't lol

#

If you really need it use python v3.9 ig

#

or don't use the lib and do all the stuff manually cuz thats not that hard either

#

if you really need or want to use v3.10

lyric mountain
#

shouldn't be too hard to compile it yourself to 3.10 too

#

like, what could break in 0.1 versions

boreal iron
#

you never know

pale vessel
modest maple
#

No reason to really with slash commands

#

People just need to learn to do it themselves, there's nothing to it

modest maple
#

Alsp python isnt semver

boreal iron
#

I guess that will never happen

#

To be really honest

modest maple
#

Python 4 will basically never happen

boreal iron
#

Each generation gets worse in terms of laziness and stupidity

earnest phoenix
#
let tup: (i8, &str, bool) = (3,"123",false);
``` why does rust make you have to use a reference when making a string type variable?
wheat mesa
#

because a string literal can be stored on the stack as a reference

#

otherwise you have to use String::from() to dynamically allocate memory for a string on the heap afaik

#

for example, this compiles: ```rs
let tup: (i8, String, bool) = (5, String::from("test"), false);

faint pasture
#

how do i fix this

#

nvm

earnest phoenix
#

I understood half of that

#

So essentially that is just making a reference to the string itself?

wheat mesa
#

a string literal is a pointer to the stack

earnest phoenix
#

Ah

wheat mesa
#

String::from() instead allocates it on the heap

#

there's some stuff about ownership and stuff too but I'm too stupid to explain it and understand it myself

earnest phoenix
quartz kindle
#

strings are not primitives in low level langs, like they are in high level langs like js

#

in low level langs, strings are basically just an array of bytes

#

which require pointers

wheat mesa
#

I think str in rust is basically just a buffer of u8's

quartz kindle
#

yeah same in c/c++

#

when you work with strings, you're basically working with a pointer that points to the first byte of an array of bytes

tawny lava
#

there's &str which is just "some text" and there's String

#

u can't have a str that's not behind some sort of pointer like a & or Box

lyric mountain
#

Like in c++ where strings don't even exist?

#

They're just fancy char arrays

tawny lava
#

strs are sort of like an array of unsigned 8 bit integers [u8]

lyric mountain
#

Ye, char array then

tawny lava
#

mhm

earnest phoenix
#

isnt that what waffle said lizard

tawny lava
#

he suggested using the String type tho 😩

wheat mesa
#

I didn't suggest, just explained why it was like that

tawny lava
#

aah ye mb

wheat mesa
#

I'm by no means a rust expert or intermediate even

#

I just happen to know a little about rust strings

earnest phoenix
#

I just so happen to be learning rust as a side hobby

wheat mesa
#

There's benefits and losses to using either type, I'm pretty sure there's some weird ownership and borrowing rules depending on which type you use

#

thankfully rust holds your hand with errors

earnest phoenix
#

ikr

#

if js could find a way to implement how rust handles errors I feel shit would be 100x easier ngl

violet storm
#

Hey, while my bot is unverified, can people still invite it or will it have to wait until its verified?

dry imp
#

ppl can still invite it but not through your bot page

violet storm
#

ah alright

pale oasis
#

Is it risky to allow users to access Redis through custom commands?
They will have a limit of 500 bytes.

#

They also won’t be able to access other keys.

lyric mountain
#

Yes, never allow user access to db

#

Or cache, in this case

#

You can't know if there's an exploit somewhere that could allow someone to take control over ur data

pale oasis
#

Good point, I just want my users to make the most of my bot with all of its features.

lyric mountain
#

If anything make a huge framework that abstracts anything regarding the database

#

And allow only functions that YOU created

#

No language features, no native methods, nothing, only things explicitly allowed by you

#

Most bots that allow custom commands do this to sandbox the user

#

They make their own language

pale oasis
#

So far, that’s what i’ve been doing.

lyric mountain
#

You need to abstract anything related to database, and sanitize all input

pale oasis
lyric mountain
#

Just be careful, users can be creative

#

Remember someone discovered a way to hack into windows pcs by using notepad

pale oasis
#

When did this happen? I’ve never heard of that incident.

lyric mountain
wheat mesa
#

wtf is this website

pine nova
#

digitaltrends

earnest phoenix
high crown
#

Damn

pale vessel
#

Daniel

slender thistle
#

Dana

marble juniper
#

hi

#

lol wrong channel whatever

earnest phoenix
#

Js
I have promise.allSettled to check all urls in db
fetching urls
Promise.all
Send status but when it get a error it stops

earnest phoenix
#

aslong you don't have bitlocker,everybody can hack your pc in ease

pale oasis
#

I love how I forget to type return, so some other random code executes.

Javascript should just know wether or not to return. It should read our minds, shake my head.

dry imp
#

smh programs are so lazy, i literally had to add the code myself to function. why cant they do it themselves

marble juniper
vast ice
#

why cant i make tables with html in description? I tried this but it shows weird ```html
<html><body>
<table>
<thead>
<th>
Name
</th>
<th>
Command Usage
</th>
<th>
Description
</th>

                            </thead>
                            <tbody>
                            
                            <tr>
                                <td>/help</td>
                                <td><code>/help [command]</code></td>
                                <td>Shows all available bot commands.</td>
                                
                            </tr>
                            
                            <tr>
                                <td>/ping</td>
                                <td><code>/ping </code></td>
                                <td>returns websocket ping</td>
                                
                            </tr>
                            
                            <tr>
                                <td>/stats</td>
                                <td><code>/stats </code></td>
                                <td>Shows the bot's status and info.</td>
                                
                            </tr>
                            
                            </tbody>
                        </table>

</body></html>```

bronze socket
#

Hey, I just want to make command like if someone votes the bot then he can use the command and i got a issue help me..

boreal iron
bronze socket
bronze socket
earnest phoenix
#

wtf do i do?

#

i was forced to change to manifest 3 and this error occurred

dry imp
#

read the error

earnest phoenix
dry imp
#

read docs

earnest phoenix
#

Okay

dry imp
#

gimme link

earnest phoenix
#

Okay, one second

#

ohhh, i found it actually

#

it's under the manifest v3 section

dry imp
#

bruh

earnest phoenix
#

lmao

dry imp
#

just abt to say

earnest phoenix
#

xd

earnest phoenix
slender thistle
modest maple
#

I think you mean you dont need to explicitly put return at the end of a block

#

a colon ins't really appart of that

wheat mesa
pale oasis
surreal knoll
#

nvm i got it

grim aspen
#

Looks like it can’t find something related to xp.ha

grim aspen
#

Js*

slender thistle
#

Fair

#

Right

#

That's my cue to go back to watching videos

pale oasis
#

I just looked at the code: ā€˜MODULE_NOT_FOUND’

stray hound
#

Y'all, where are the best sources for learning Javascript/Python advanced? If you know, pls let me know

lyric mountain
#

what do you consider "advanced"?

stray hound
#

Like not basics of basics like "what is a variable", something more than that

lyric mountain
#

there's not really a tutorial where things are considered "advanced"

stray hound
#

and what about normal ones, you got any?

lyric mountain
#

I mean, for c++ probably, but definitely not for ultra high level languages like js or python

#

you can only go so deep with them

#

after you learn the basic stuff (syntax, how code flow works, *async, etc) all that's left is learning new frameworks, libs and general optimization

grim aspen
#

I know a few programs that do full courses for those coding programs

lyric mountain
#
  • async might not apply in the literal sense for some languages
stray hound
#

Well I guess it's learning new frameworks

#

Lmao, but there is 100% something basic about python I don't know KEK

#

Class attributes, had to look it up KEKBOOM

#

This confused me lmao

#

Whelp

lyric mountain
#

that's basic OOP ain't it?

#

well, you could start there

#

run a couple OOP courses with python

stray hound
#

I guess so

#

I sometimes wonder how I got a general purpose bot topgg-approved and discord-verified soonTM if I don't know some stuff that is basic after all

lyric mountain
#

you wouldn't believe if I told you are a lesser critical case

#

I saw...cases...that one might wonder how they even turned on the pc

stray hound
#

Lmfao

lyric mountain
#

at least you're self aware (which is the first step to improve)

#

there are people who try to bend the language to their own will

stray hound
stray hound
lyric mountain
#

kekw

split hazel
wheat mesa
#

That’s advanced torture

split hazel
#

I tried it and I really don't like it

#

talking about the excel variant (vba)

#

there's no continue statement in for loops, no easy way to return objects, subroutines/functions, vague errors, multiple weird ways of referencing/calling functions etc

#

the biggest shock is you don't need brackets to call a function

#

one thing I like though is you can make labels and easily jump to them kind of like assembly

cinder patio
#

how's that good

#

labels have no place in any high-level programming language like VB

spark flint
#

ok community opinion time

wheat mesa
#

uh oh

spark flint
#

is that too sensitive?

wheat mesa
#

I think the server icon being flagged is too harsh

spark flint
#

True

split hazel
#

I guess comes down to preference but I like that

spark flint
#

i'll add a checker for things like "bot list" or "bots" in the name

cinder patio
#

It makes ur code less readable, and generally you'd never really have the need to use it

wheat mesa
#

I think it’s also too much to automatically report via the api

#

Just flag the guild with some info and review it manually

spark flint
#

It would require me to manually review from the API report

#

to do something

wheat mesa
#

Ah

spark flint
#

The API is mine and Scoopy's

wheat mesa
#

Makes sense

spark flint
#

its gonna have an api checker above it too to check that first

#

actually after probably

#

check without any api requests first, if it passes everything else then make an api request

wheat mesa
#

I suppose that it’s also a good idea to send a message to the guild saying why your bot is leaving btw

#

So people aren’t just confused

#

And leave a tag to be contacted if they believe it’s a mistake

spark flint
#

so i'll make it return a response

#

return {"flagPoints":flagPoints, "rulesBroken":rulesBroken} etc

wheat mesa
#

I see

spark flint
#

API: stores KNOWN bot farms
Module: checks for bot farms and also checks api for known bot farms

slender wagon
#

pug or ejs which 1 would u guys rather work with

round cove
#

React/Angular

#

(:

slender wagon
#

those 2 aside

#

i can't move on to those yet

wheat mesa
#

ejs

slender wagon
#

ightys ty

tawny lava
round cove
tawny lava
#

react angular

round cove
#

Little weirdchamp.

slender wagon
#

same tbh

cinder patio
#

Why does borderRadius="50px" in charka-ui do nothing? šŸ¤” I can only use values like lg, xl, md, etc.

#

using style also doesn't work which is even weirder

#

Actually, it's always set to md, even if I put 2xl

earnest phoenix
#

When I try to create an Invite for a server, it always works when I start the bot on my server. But when I start the SAME files on my PC, it always exits out with

Uncaught TypeError: Cannot read properties of undefined (reading 'createInvite')

why's that?

wheat mesa
#

can you try showing some of your code..?

lyric mountain
wheat mesa
#

that probably

lyric mountain
#

but yes, show some code

wheat mesa
#

Not to mention createInvite() isn't a method on a Guild or Channel object, so now I'm just more confused

#

Ah wait nevermind it's a thing on GuildChannel

earnest phoenix
#

Yeah

wheat mesa
#

that's why

lyric mountain
#

that smells privacy breach

wheat mesa
#

also I'm like 95% sure that's not allowed

lyric mountain
#

add +4% to that

wheat mesa
#

unless you have specific permission from the guild owners

earnest phoenix
#

bot is not on top.gg chill its a private bot

lyric mountain
#

tos break is still tos break

wheat mesa
#

private bot... added by other servers...

earnest phoenix
#

its on 4 servers

#

of mine

lyric mountain
#

it's like saying that you stole a car but there was no cop nearby

wheat mesa
#

regardless I don't think that you're allowed to create invites like that

earnest phoenix
#

hmjm

wheat mesa
#

tbh sometimes I wonder why it's in the api

earnest phoenix
#

Okay yeah I can create the invites line by line

lyric mountain
wheat mesa
#

I suppose

#

I feel like it's used for more harm than good

lyric mountain
#

I use invite generation on my on-site support command, but the user must agree with it before I even create the invite

wheat mesa
#

opens up opportunities to turn normal bots into dm bots

lyric mountain
#

like, there's a whole "I will create a one-time invite so I can bring my supports here, do you agree?"

lyric mountain
#

like, can be used for both good and bad

wheat mesa
#

What framework should I make my website in

#

preferably a js/ts framework of some sort

#

(Just a general personal website, not a bot website/dashboard)

earnest phoenix
#

I would say Angular or React

#

but its just my opinion

split hazel
#

i would say javascript

earnest phoenix
lyric mountain
#

what about: english?

quartz kindle
#

javascuriputooooo

lyric mountain
#

tim you weeb

quartz kindle
#

yamete kudasai

modest maple
#

you ever just ngram bro

quartz kindle
#

n gram or ng ram?

modest maple
#

i always say n gram

quartz kindle
#

ng ram sounds nice tho, next gen ram

modest maple
#

sure but this is text XD

sharp saddle
#

Java, TS, PYTHON or Golang?

modest maple
#

neither

#

haskell or broke

quartz kindle
#

java = old man
python = snake
ts = clusterfuck
go = weirdo

sharp saddle
#

ok, but...

#

hmmmm

proven lantern
#

Is it possible to do optional chaining using brackets instead of dots?
x.?y
x[y]

#

Look at this magic.
console.log(adventurer.someNonExistentMethod?.())

#
obj.val?.[expr]
obj.arr?.[index]
obj.func?.(args)```
quartz kindle
#

magick

lyric mountain
#

like obj?.func(args)

proven lantern
#

And in-between the func and args

lyric mountain
#

tf

split hazel
#

ops on fetch being integrated into node?

proven lantern
#

Isn't fetch like 8mb?

#

The latest version

split hazel
#

what

proven lantern
split hazel
#

not node fetch

#

the actual browser fetch module

proven lantern
#

Ah

split hazel
#

dont know how it differs performance wise though

#

@quartz kindle ?

#

youre the kind of person that would know

#

node fetch be gone die

quartz kindle
#

it think its a good idea, so people stop using crappy third part libs

split hazel
#

looks cool

quartz kindle
#

undici is an experimental replacement for node's http, and it has proven itself to be much better and faster than http

split hazel
#

how well does nodejs handle incoming data like http anyways

quartz kindle
#

its not the best, everything relies on its net and tls modules

#

but its what we have

stiff lynx
#

functions must be delcared at the end of the code?

quartz kindle
#

not really

#

they can be declared anywhere

split hazel
#

but i am happy crap http libs are being replaced like node fetch

#

since its not the best

#

very popular nevertheless

quartz kindle
#

i just use http

#

but yeah if they integrate undici, i will start using it

split hazel
#

undici does use zlib

#

isnt zlib slow

#

since its the javascript version

quartz kindle
#

its not js

#

zlib is native

split hazel
#

fuck true

#

just saw the file

quartz kindle
#

the problem with node's zlib is that its async

#

its good for large data, but terrible for small data

modest maple
#

I mean that do be alot about compression

#

compressing tiny payloads will likely be larger overhead than not compressing it in the first place

quartz kindle
#

compressing small data is amazing when usinn a shared context tho

wheat mesa
#

should I use ts for my react website or js

quartz kindle
#

discord packets can get up to 90% smaller with it

stiff lynx
#

Can I create functions in a file only for them and call them wherever I want?

quartz kindle
#

yes, you just need to export them

stiff lynx
quartz kindle
#

node.js or browser?

stiff lynx
#

node.js

#

for a discord bot

#

but this is the way I've learned JS

quartz kindle
#

for a single function you can do this: ```js
// functions.js
function abc(a,b,c) {
return something;
}

module.exports = abc
js
// other file
const abc = require("./functions.js")

#

for multiple functions you can do this ```js
module.exports = {
abc,
xyz
}

or ```js
exports.abc = abc;
exports.xyz = xyz;

or even ```js
exports.abc = function(a,b,c) {
return smething;
}

#

and then import them like this js const { abc } = require("./functions.js") or ```js
const functions = require("./functions.js");
const abc = functions.abc;

stiff lynx
#

in this case I want to start doing a Function in this file to create a profile inside mongodb

#

Is this possible?

#

I prefer doing stupid questions now lmao

stiff lynx
round cove
#

Correct.

#

You don't need to return in a function.

stiff lynx
#

ty Tim and Dylan (I'm not gonna ping)

#
  const addUser = sistemaMonete.create({
    userID: interaction.user.id,
    serverID: interaction.server.id,
    coins: 0,
    bank: 10,
    tier: 0,
  });
  profile.save();
}

module.exports = { creaProfilo };
#

this can work?

round cove
#

Looks fine. Though I don't know why you gave it a parameter and don't use it. Also where's the interaction coming from?

stiff lynx
#

oh

#

I got it

#

u right

#

I've copied it from an actual command

quartz kindle
#

also shouldnt it be addUser.save()?

stiff lynx
round cove
#

No.

stiff lynx
#
  const sistemaMonete = require("./models/profileSchema");
  const addUser = sistemaMonete.create({
    userID: idUtente,
    serverID: idServer,
    coins: 0,
    bank: 10,
    tier: 0,
  });
  addUser.save();
}

module.exports = { creaProfilo };```
round cove
#

That looks fine.

stiff lynx
#

last thing, I've added the require

#

this works, isnt it?

round cove
#

I would require it a single time outside the function.

quartz kindle
#

its works yes, and its fine, but requires are usually put at the top of the file

#

it doesnt really affect performance since requires are cached, but its standard practice

round cove
#

Oh are they?

quartz kindle
#

ye

round cove
#

TIL.

stiff lynx
stiff lynx
#

damn

round cove
#

Because it's in scope.

stiff lynx
#

a new wonderfull world

quartz kindle
#

anything that is outside the function can be used inside the function

#

unless they are inside something else

#

its like layers

stiff lynx
#

and whats inside the functions cant be used outside

quartz kindle
#

the outside layers can always be accessed from the inside layers

#

yup

stiff lynx
#

thanks to W3school lmao

#

I have a general doubt about NaN

#

I know that the return is a boolean, but how I check a numero

#

if(number.isNan)

#
  if (number <= 0)
    return interaction.followUp({
      content: "Il numero inserito in questo comando non può essere negativo",
    });
}```

And this can work with this type of return?
round cove
#
if (Number.isNaN(Number(number)))```
quartz kindle
#

there are many ways to check

round cove
#

I don't think isNaN does implicit conversions.

quartz kindle
#

each one has different edge cases

stiff lynx
#

but I'm not understanding

quartz kindle
#

typeof val === "number"
Number.isInteger(val)
Number.isFinite(val)
isNaN(val)
Number.isNaN(val)
Number(val)

#

all of those do slightly different things, but mostly the same thing

#

NaN is a special value that doesnt make much sense, but it exists for some reason

#

it represents a number that is not a number

#

its easier if you explain which numbers should be valid, instead of which numbers should be invalid

#

it easier to narrow it down that way

stiff lynx
#

and how can I avoid using this for an Input String?

round cove
#

You should be smart and convert it to a number and check if it's a number or not.

#

And if it's above whatever value you want.

stiff lynx
quartz kindle
#

Number(string) works for most cases, parseInt(string) if you want strictly integers (no decimals)

#

the NaN value is falsy, so you can "if" it

#
const number = Number(value);
if(!number) { not a valid number }
modest maple
stiff lynx
quartz kindle
#

< + + doesnt make sense

stiff lynx
#

++ is not 1 + number?

quartz kindle
#

you mean if(number < ++number)?

stiff lynx
#

yup

round cove
#

God that stack overflow is so good lol

#

while (0 <-- x) "I'm using the x goes to 0 operator..."

quartz kindle
#

i mean, if(number < ++number) will always be true

#

because ++number will always be 1 more than number

stiff lynx
#

yeah

#

my point is

#

I cant add 1 to a string

round cove
#

Don't do it

#

Be smart

#

Check if it's a number.

stiff lynx
round cove
#

It validates the string.

stiff lynx
#

so became "string1"?

#

like Java's string + "1"?

spark flint
round cove
#

šŸ˜”

quartz kindle
#

iit also errors

stiff lynx
#

I'm trash

quartz kindle
#

which numbers do you want to be valid?

#

any number at all? including negtives and decimals?

stiff lynx
stiff lynx
#

I dont need it

quartz kindle
#

ah

#

because the best solution is different depending on the purpose

#

for example, if i want only whole numbers, no decimals, i would do this

const number = Number(value)
if(!Number.isInteger(number)) { invalid number }
stiff lynx
#

crazy questions, if we talk about a double how can be the check?

quartz kindle
#

Number.isInteger() checks if the value is an integer

#

if its not an integer, it can be a double or infinity

#

there is no Number.isFloat or Number.isDouble

#

so you have to combine both

#

i do it like this

#

Number.isFinite(value) && !Number.isInteger(value)

stiff lynx
#

a double can be infinite?

#

I thought they where like x.00

#

and stopping

quartz kindle
#

just like NaN is a special value, Infinity is also a special value

#

Number.isInteger(Infinity) returns false

#

its an extremely edge case tho

stiff lynx
#

I hope never need this explanation lmao

#

back to my errors, how can I require the interaction inside the function file?

quartz kindle
#

you have to pass it as an argument

stiff lynx
#

function numberCheck(number, interaction) {

#

like this?

lyric mountain
stiff lynx
lyric mountain
#

cuz everything in JS is either a potato or a non-potato

#

no in-between

stiff lynx
dry imp
#

potato

quartz kindle
#

lmao

lyric mountain
#

js doesn't have types, it doesn't have anything at all

#

if you believe it exists it exists

quartz kindle
#

everything in js is objects with labels for type

lyric mountain
#

btw, parseInt(0.000005) == 5 is true

stiff lynx
quartz kindle
wheat mesa
round cove
#

who are you trying to gaslight here

quartz kindle
#

what would be better?
use 1 byte to store numbers until 63, and 2 bytes to store numbers until 255, and 3 bytes to 64k?
or 1 byte to 31, 2 bytes to 4k, 3 bytes to 512k

stiff lynx
#

const randomNumber = Math.floor(Math.random() * 50);
with this I get a number from 0 to 49?

quartz kindle
#

yes

stiff lynx
#

const randomNumber = Math.floor(Math.random() * 50) + 1;
1 - 50

quartz kindle
#

yes

stiff lynx
#
  const random = Math.floor(Math.random() * max) + min;
  return random;
}
// code use example
const number = randomNumber(mini, maxi);```

This assignment could give err?
quartz kindle
#

nope

#

unless maxi or mini are not numbers

stiff lynx
#

It seems to me like I'm not a newbie anymore

#

finally thanks to you I've learned something

quartz kindle
#

np

stiff lynx
#

tysm, I'll do more questions if I need šŸ™‚

lyric mountain
#

Damn, 1 more zero

quartz kindle
#

also 0.1 + 0.2 does not equal 0.3

stiff lynx
#

This is really funny or maybe not.

Function:function numberCheck(number, interaction) { if (number <= 0) return interaction.followUp({ content: ":x: Il numero inserito in questo comando non può essere negativo.", }); } module.exports = numberCheck;

code:``` numberCheck(somma, interaction);


err: ```  numberCheck(somma, interaction);
  ^

TypeError: numberCheck is not a function
  at Object.run (C:\Users\Utente\Documents\Progetti Cri\NOVABOT\novabot update\SlashCommands\monete\newAzzardo.js:29:5)
  at Client.<anonymous> (C:\Users\Utente\Documents\Progetti Cri\NOVABOT\novabot update\events\interactionCreate.js:31:9)
  at processTicksAndRejections (node:internal/process/task_queues:96:5) ```
quartz kindle
#

and NaN never equals another NaN no matter what

#

even if its the exact same var

stiff lynx
quartz kindle
#

meaning NaN does not equal itself

stiff lynx
#

alway or it is this way for err in memory?

quartz kindle
#

always

quartz kindle
stiff lynx
#
  creaProfilo,
  numberCheck,
  netWorth,
  randomNumber,
} = require("../../functions");
quartz kindle
#

module.exports = numberCheck; can only export 1 thing

#

if you want to export multiple like you are importing, you have to use module.exports = { creaProfilo, numberCheck, etc }

#

or use exports.numberCheck = numberCheck; on each function

#

module.exports is the final value, you can only use it once, as it replaces all other exports every time you use it

stiff lynx
#

I have something like module.exports = numberCheck; for every function :KEKW:

quartz kindle
#

yeah, everytime you use it, it replaces the previous

stiff lynx
#

ah

lyric mountain
quartz kindle
#

yes banana

stiff lynx
#

last question, then I go to sleep 'cause is 2.26 AM

#

err: ```const IDutente = interaction.user.id;
const IDServer = interaction.guild.id;

  const ricerca = await sistemaMonete.findOne({
    userID: interaction.user.id,
  });

  if (!ricerca) {
    creaProfilo(IDutente, IDServer);
  }
  const valore = await sistemaMonete.findOne({
    userID: interaction.user.id,
  });
  let valoreTotale = ricerca.coins + ricerca.bank;
  console.log(valoreTotale);```

console.log:TypeError: Cannot read properties of null (reading 'coins') at Object.run (C:\Users\Utente\Documents\Progetti Cri\NOVABOT\novabot update\SlashCommands\monete\newAzzardo.js:62:34) at processTicksAndRejections (node:internal/process/task_queues:96:5) 10

#

the null came because data doesnt exist inside the database, and the '10' after the 2nd use of the command

#

Can I get directly the 10 without using a second time the command?

#

idk, maybe something like .then

quartz kindle
#

but you need to modify creaProfilo to return it

pale vessel
#

dang what's that language

quartz kindle
#

italian probably

stiff lynx
pale vessel
#

that's very patriotic of you to code in your native language (I assume)

#

now that I think of it it's pretty common for people to do that even in professional levels

quartz kindle
#

also, you can remove the valore line, its not doing anything

quartz kindle
quartz kindle
#

guess whats my favorite italian word

#

:^)

crimson vapor
#

what

quartz kindle
#

vaffanculo!

#

xD

crimson vapor
#

what do it mean

stiff lynx
stiff lynx
crimson vapor
#

thats now my favorite word too

#

thanks tim

stiff lynx
#

You never heard about Italian blasphemy?

pale vessel
#

"go fuck yourself" is one word in Italian? that's pretty neat

boreal iron
#

Aye saves a lot of time

drowsy flume
#

Hey, so I have this data, and im trying to print out them individually in a for loop, but it only prints the first number

{358670711109320705: Decimal('303576'), 383287544336613385: Decimal('135500')}```
```py
data = dict(data)
    print(data)
    for i in data:
        print(i)```
quartz kindle
#

it only prints 358670711109320705 or does it print 358670711109320705 and 383287544336613385?

drowsy flume
#

it prints 358670711109320705 and 383287544336613385

boreal iron
#

The object keys

quartz kindle
#

yup

boreal iron
#

Dunno about the syntax in py

quartz kindle
#

for something in dict iterates over the dict's keys

drowsy flume
#

ah

quartz kindle
#

you can do this instead:

#

for i in data.items()

#

that should iterate over its entries, in key value pairs

drowsy flume
#

oh yeah that works, ty peepoLove

boreal iron
#

Tim knows py

#

What a shame

crimson vapor
#

you can't do for e of data?

pale vessel
#

for of isn't a thing

crimson vapor
#

thats stupid

#

I don't like it

quartz kindle
#

lmao

boreal iron
#

your excuses Sir, no no

quartz kindle
#

i dont have any ex named cuses

boreal iron
#

Tim googling stuff to prevent others from googling stuff freerealestate

boreal iron
sharp saddle
#

ok

worn sonnet
lyric mountain
#

"vsf"

quartz kindle
#

fdp

#

tnc

#

krl

quartz kindle
worn sonnet
#

Alr in a min

worn sonnet
#

might just give it a try with their provided example code first

quartz kindle
#

how about this

#
files={"file": ("example.png", open("attachment.png", "rb")}
worn sonnet
quartz kindle
#

multipart is complicated because there are multiple "file names"

#

each entry counts as a file, and each file needs its own file name as well

#

so its confusing which one they are talking about

#

according to the requests docs, the files option basically works like this:
files={entryname: (filename, data, type, headers), ...}

#

you can try this lol```js
files={"attachment": ("attachment", open("attachment.png", "rb")), "filename": ("filename", "example.png")}

worn sonnet
#

just tried their given code example

#

I think the problem lies in this particular thing
open("attachment.png", "rb")

#

cs
Doesn't work

values = f"""
attachment: {(open("attachment.png", "rb")).read()}
filename: example.png (string)""".encode("utf-8")

Doesn't work either

values = f"""
attachment: {(open("attachment.png", "rb"))}
filename: example.png (string)""".encode("utf-8")
quartz kindle
#

the attachment should be raw data, it cant be utf8 encoded

worn sonnet
#

but it showed error saying it should be bytes

#

TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str.

#

this is what it said

quartz kindle
#

yeah that example just feels wrong

#

doesnt look like urllib2.Request handles multipart separators and headers, which is required

earnest phoenix
#

error:0308010C:digital envelope routines::unsupported hmmm

#

Apparently on stackoverflow I was supposed to do --openssl-legacy-provider on NODE_OPTIONS but that didn't work so idk

gleaming solar
#

Anyone know how to get the total guild member with shards in discord.js

earnest phoenix
#

is it possible to display the bots server count on a html page?

lament rock
#

not without javascript

#

Well. Actually, it is possible if you make an image and then link an api to generate that image and display it

cinder patio
#

either way you'll need a HTTP server

earnest phoenix
#

so transfer my website scripts to my bot script

lament rock
#

You can communicate with your website via a websocket

#

just request a guild count from all shards then combine the result.
You'd need too look into thread base replying since the same operation could be sent at the same time and lead to result precision errors

cinder patio
#

you'll still need an HTTP server

spark flint
#

yet i defined it

#
async function setPoints(userid) {

  // code

}```
pale vessel
#

where

spark flint
#

just before </body>

pale vessel
#

can you show the whole code?

spark flint
#

ah i've fixed it

#

it was me being retarded and spelling script wrong on the bottom tag

slender wagon
#

shitt how do i turn pug js into ejs js

#

L

cinder patio
slender wagon
#

i am using js

cinder patio
#

yeah well gl

slender wagon
#

wat

spark flint
#

from there turn into ej

#

s

slender wagon
#

that's what i am doing rn

#

but the problem is with the js

spark flint
#

oh

slender wagon
#
<!-- include ./header.pug-->
<div class="container">
  <section class="slider">
    <div class="row">
      <div class="col-md-4">
        <!-- each val, i in highlighted
        if i < 2
          each articleVal, i in articles
            if articleVal._id == val.article_id 
              a(href=`/article/${articleVal.num}`)
                .article
                  each catVal, i in category
                    each subcat, i in subCategory
                      if articleVal.category_id == subcat._id
                        p.category-label= subcat.name
                    if articleVal.category_id == catVal._id
                        p.category-label= catVal.name
                  img.img-thumbnail(src= `/uploads/${articleVal.image}` alt='image')
                  h5= `${articleVal.title.substring(0, 60)}...`
                    p= `${new Date(articleVal.date).getDate()}, ${new Date(articleVal.date).getMonth()+1}, ${new Date(articleVal.date).getFullYear()} `
                      span.fa.fa-clock
        -->
      </div>
      <div class="col-md-4">

i've currently comented the js

#

and the includes

#

the includes part is easy

#

the issue is with the js

stiff lynx
#
      const IDServer = interaction.guild.id;

      let ricerca = await sistemaMonete.findOne({
        userID: interaction.user.id,
      });

      if (!ricerca) {
        creaProfilo(IDutente, IDServer);
      }

      let valoreTotale = await ricerca.coins + ricerca.bank;
      console.log(valoreTotale);```

problem: If there is no user profile inside the database, the conole.log gives err 'cause doesnt find the user profile in the database. How can I make the valoreTotale be executed after the creation of the profile?
slender wagon
#

instead of console.log add the function to create the profile

#

oh

#

nvm

boreal iron
slender wagon
#

async isn't the same as await

#

async is made so await can be used

boreal iron
#

Just do it and see the magic

#

Also remove the await within your valoreTotale, it doesn’t make sense here

#

You need to consider that after creating your profile, your var ricerca is still null
Either you send a request to the database again (after creating the profile) or manually declare the var ricerca

#

You can also return your database user when executing your creaProfilo() function
That would be the easiest solution

lyric mountain
#

try alt-tab twice, sometimes some programs get stuck in an "alt mode" where u can't select anything

stiff lynx
#

name.toInt()

#

converts a string into an Int?

boreal iron
#

parseInt()

#

with the value to convert as argument

stiff lynx
#

somma = somma.parseInt();

boreal iron
#

call function(argument1, argument2, ...)

stiff lynx
#

somma = parseInt(somma)

#

like this?

boreal iron
#

Yes

stiff lynx
#

ty

boreal iron
#

It's not needed to define a var here

#

But it's up to you

stiff lynx
boreal iron
#

Sure

earnest phoenix
stiff lynx
#

Is it possible to call functions inside other functions?

split hazel
stiff lynx
#

After that when I call It in another file, I must call both?

wheat mesa
#

Huh

#

If you’re calling a function that calls a function, you don’t need to call the other function too

#
function doSomething() {
  console.log('did something');
  doSomething2();
}

function doSomething2() {
  console.log('did something 2');
}

doSomething();
lyric mountain
#

it'd not even make sense the other way

stiff lynx
#

If I have a negative const and a positive one, for example: const name = -10 const name2 = 20; There is a fast way to move from the second 10 for getting 0 in the first one?

#

In this case I assume I know both the numbers, but I wont ever know the numbers, so I need an univoque way

boreal iron
#

There is a fast way to move from the second 10 for getting 0 in the first one?

Wut?

stiff lynx
#

and in the end have two variables with 0 and 10

#

It's hard to explain with my english knowledge

boreal iron
#

Yeah I see, I still didn't get what you wanna do

stiff lynx
#

I'll try better

#

start: let name = - 10; let name2 = 20;

Objective: //NO NEGATIVE NUMBER name; //contains 0 name2; //contains 10

#

I need an english course lmao

quartz kindle
#

i mean

#

if you know that name will always be negative

stiff lynx
quartz kindle
#

just do
name3 = name2 + name

stiff lynx
#

this is for explanation purpose declared

#

I'll try explaining the context.
In my economy system there is a command that can send your balance under 0.

#

And there is bank and wallet

#

So I want to move from bank to wallet and vice versa

#
  const ricerca = await sistemaMonete.findOne({ userID: idUtente });

  if (ricerca.coins < 0) {
    if (ricerca.banca > 0) {
      let pareggioN = ricerca.coins;
      let pareggioP = pareggioN * -1;

      if (ricerca.bank > pareggioP) {
        variazioneMonetePortafoglio(idUtente, pareggioP);
        variazioneMoneteBanca(idUtente, pareggioN);
      }
    }
  }

  if (ricerca.bank < 0) {
    if (ricerca.coins > 0) {
      let pareggioN = ricerca.bank;
      let pareggioP = pareggioN * -1;

      if (ricerca.coins > pareggioP) {
        variazioneMonetePortafoglio(idUtente, pareggioP);
        variazioneMoneteBanca(idUtente, pareggioN);
      }
    }
  }
} ```

This is the function that I did
quartz kindle
#
if(wallet < 0) {
  bank += wallet;
  wallet = 0;
}
#

technically you need to know how much you want to pay first

#

if you need to pay 20, you need to check if both wallet and bank combined have enough to pay 20

stiff lynx
quartz kindle
#

where is the sum you have to pay?

stiff lynx
#

bot for example if I have 2 in wallet and 20 in bank and I pay 5, I have -3 in wallet

#

and for this I want to move that 3 from bank ti wallet

quartz kindle
#

and what do you do if in the end you have negative in the bank?

pale vessel
#

debt

stiff lynx
#

u have to use the earn command

quartz kindle
#

but in your code, the user can have negative in the bank?

#

and still pay?

stiff lynx
#

nope, cause if u have to pay 20 and bank + wallet Is less than 20, send a message where says that the user Is too broke for the action

quartz kindle
#

and where do you do that check?

stiff lynx
#

let valoreTotale = ricerca.coins + ricerca.bank;

  if (somma > valoreTotale)
    return interaction.followUp({
      content: `${frasiSoldiInsufficienti[sceltaFrase]}`,
    });
quartz kindle
#

ok, so all you need to do after that, is just ```js
ricerca.coins -= valoreTotale;
if(ricerca.coins < 0) {
ricerca.banca += ricerca.coins;
ricerca.coins = 0;
}

stiff lynx
quartz kindle
#

you probably just need to do ricerca.save() at the end

sharp saddle
#

is this mongoose?

boreal iron
eternal osprey
#
let re;
if(status1.status.yes === 'no'){
  async function startLunar(){
    // some embeds etc etc
    re = Math.floor(Math.random() * 5000) + 10000;
    //some other unimportant info

  }
  ps = setTimeout(startLunar, re);
} else {clearTimeout(ps) };
``` why is this function only running once?
earnest phoenix
#

So I’m stuck with making my status in my bot showing up. Any help?

#

Idk if I did anything wrong

#

Do I need to add something

pale vessel
#

what library is this?

round cove
#

Looks like python.

earnest phoenix
#

Python

pale vessel
#

fuck off Dylan :)

round cove
#

(:

earnest phoenix
#

Sheesh so any ideas

pale vessel
#

so the library is python. what's the programming language?

earnest phoenix
#

Python

#

Lol

pale vessel
#

cya

eternal osprey
#

flaz you are good with js ain't you?

earnest phoenix
#

:,((

pale vessel
#

I'm ok at it

pale vessel
eternal osprey
earnest phoenix
#

Yer

pale vessel
#

it runs once because it's a timeout?

eternal osprey
#

Wait omg

#

So it should be an interval

#

wtf am i doing

#

with the setTimeout nested right

raw nest
#

If I have a token which expires after some time, how can I like iterate over the table and delete all of the expired ones? I mean I can do like an automation but let's say you have 10k data records.. to iterate over all of them would be absolutely trash

modest maple
#

I mean...

#

most of them you can just invalidate when you ned check them if they're over

#

and then just occasionally do a purge

raw nest
#

true šŸ¤” thanks :)

eternal osprey
#
let re;
if(status1.status.yes === 'no'){
  async function startLunar(){
    console.log("test")
    re = Math.floor(Math.random() * 5000) + 10000;
    //some other unimportant info

  }
  ps = setInterval(startLunar, re);
} else {clearInterval(ps) };```new issue lmao. Why is this code not setting the interval named re?
#

it just sends a fuckton of "test" logs

pale vessel
#

re is a number

#

ps is an interval that runs every re milliseconds, and that value is the first evaluated value, not the one you modified inside the interval

earnest phoenix
earnest phoenix
#

do I have to put my Server's IP with the port in here?

#

I'm using top.gg's official sdk with the webhook server

lyric mountain
#

yes

spark flint
#

Update: ditched Scaleway, Backblaze and google cloud storage, using DigitalOcean spaces as it speedy as fuck

#

And cdn included

#

Plus fast to upload and easy to use with Nodejs

solemn latch
#

šŸ‘€

spark flint
#

yes

lyric mountain
raw nest
#

I'm generating tokens for login and I want that you have different tokens on every device so if you use my thing on the computer often it can re-set the expiration date of the token but f.e. on the mobile device it expires after some time because you don't use it anymore... I was thinking about using ip adress of the device but that's quite complicated... idk

boreal iron
#

Quite complicated especially for mobile devices as the IP can change each standby-wake up cycle or each time the device changes its connection point

#

If this login is about a website then your best choice are cookies

#

As you can also set expiration dates and change/expand/revoke them if needed

#

Also as those are essential cookies you won’t have to bother with a privacy policy

raw nest
#

but let's say if there's no token, I will create one and send it to the client side. Now when I login on an other device I either need to create a new token or send it the current one which won't expire if you login on any device where the token is in the cookies

boreal iron
#

Well you can store the cookie hash in your database associated with the IP if you like to identify different devices in the same network

#

Once one device is logged in another one automatically receives the cookie

#

But this is a huge security gab

#

As Publix networks also exist

lament rock
#

In your login flow, you should have the device send its cookies and you check if the token exists. If not, create a new one and send a Set-Cookie and then proceed with login. It's not uncommon for a "per device basis" website to do this

#

no need to store IP

#

Just store the relation between the cookie and the user

#

persistent IP based logic can fall apart pretty easily and require re-logins quite frequently considering EU most commonly does not have static IPs

boreal iron
#

I don’t know which country has either

raw nest
boreal iron
#

Why do both devices need the same token?

lament rock
#

Technically, the way I'm describing it is per browser

boreal iron
#

You associate your cookie with an unique user

lament rock
#

there is no real per device unless its a native app

boreal iron
#

In your case multiple cookies are associated with one user then

raw nest
lament rock
#

yup

#

If you want each browser or "device" to have its own token, that's how

boreal iron
#

The cookie is always locally set on the clients device

lament rock
#

Each browser has its own cookie jar

raw nest
#

and what if you paste the "browser-cookie" into the cookie of an other device manually? Then it counts as 1 "device" again

lament rock
#

I don't think you can tamper with cookies, but I may be wrong

boreal iron
#

It technically would but you could at least detect the user agent and notice it’s different

raw nest
lament rock
#

Something you'd just have to cope with

boreal iron
#

Of course you can copy your cookie and recreate it in a different browser

boreal iron
#

The client can, not the server

#

But even that can be faked

lament rock
#

I don't see why a unique token per device is desirable

lyric mountain
#

there's nothing at all preventing the user from fudging with everything on their client-side

boreal iron
#

That’s why you never store user associated informations in cookies but instead using hashed or anon IDs

raw nest
lament rock
#

you just tell the client to set the token already created as a cookie

#

every device can share the same token

boreal iron
#

Do you wanna associate different cookies - devices - to one account?

raw nest
boreal iron
#

Or can each be login unique?

lament rock
#

You can handle the cookie expiring on your side

#

the client doesnt have to

boreal iron
#

I somehow feel like he wants to auth a client on one device and wants to detect the same client on a different device

#

That doesn’t work or let’s say it’s not really accurate

lament rock
#

You have to track every small detail you possibly can and check for differences

raw nest
#

Quick side question. Let's say you login f.e. at GitHub. If I copy every single cookie of you, would I get access to your account? Like technically..

boreal iron
#

Which can be faked on the client side

#

In theory yes

lament rock
#

You would get access, but in most sites, tokens expire

boreal iron
#

But they might also check the last user agent as it could be associated with the cookie

raw nest
#

yeah that's what I mean... so it's impossible to completely hide a way to the user data for others. (Doesn't even make sense xD)

lament rock
#

I'm still lost at what you're trying to get at

boreal iron
#

Dito

lament rock
#

Pikachu, I choose you

boreal iron
lament rock
#

Oh wait that's Ditto

spark flint
#

https://uwu.solutions/ZsVxzpmp for anyone good at s3 lib

   const file = await fs.readFileSync(`${adID}.png`);
    await s3.putObject({Bucket: "vertexnodes", Key: `${adID}.png`, Body: file, ACL: "public"}, (err, data) => {
        if (err) return console.log(err);
        console.log("Your file has been uploaded successfully!", data);
    });```
boreal iron
lament rock
#

no. The PokƩmon's name is Ditto

boreal iron
#

smh

lament rock
#

ah. The agreement statement is also spelled Ditto

#

im dumb

boreal iron
lament rock
raw nest
#

Let me try to explain it with an example:
Device 1:
Login -> Create token if doesn't exist, otherwise send it to you -> Access

Device 2:
Login -> Create token if doesn't exist, otherwise send it to you -> Access

Both devices loggedin with the same account so that means:
Device 1:
Creates token xy

Device 2:
Get's created token

In this case both have the same token. If I create a new token on every login there would be many many tokens which only expire after 7 day. This means even if you got a new token the old one is still active.

(If I think about it now, I could just generate a new one every time and delete the old one completely because I just found out that it get's sent with it too xD oh man)

#

Wait nvm it doesn't get sent with it on login...

spark flint
boreal iron
#

You somehow mix tokens, cookies and actual account data

#

I don’t get your term token here at all

#

You basically create a simple login system, e.g. username and password and save an associated hash in a cookie on the clients device

#

That allows the client to enter the site without a new login

#

Once the client uses a different device he needs to login again using your login system, which will also save a cookie on his device with the associated account

#

You can control all cookies however you want

#

Set a max lifetime, expand it, revoke it etc

raw nest
boreal iron
#

The hash of my user cookie I place are stored in my database
So Once a client enters the site the database is being queried to check if the cookie ID (hash) is still valid or if for example I revoked the access

#

Since I can’t manipulate the clients cookie if he’s not on my site, this system makes sure I can revoke access at any time

spark flint
#
const bodyParser = require("body-parser")
app.use(bodyParser.urlencoded({ extended: true}));
app.use(bodyParser.json());
app.use(bodyParser.raw());

app.post('/approveAd', checkAuth, async function(req, res) {
    const ad = await ads.find({adID:req.body.adID}).toArray()
    if (!ad.length > 0) { return res.json({error: "true"}) }
    const msg = new webhook.MessageBuilder()
        .setName("VertexNodes | Ads")
        .setColor("#aabbcc")
        .setTitle('Ad Approved!')
        .setDescription(`Approved by ${req.user.username}#${req.user.discriminator} (${req.user.id})`)
        .addField(`Ad ID`, `${req.body.adID} (${ad[0].name})`)
    Hook.send(msg);

    await ads.updateOne({adID:req.body.adID}, { $set: {state:"approved"} })
    res.json({ error: "false" })

})``` why does this return undefined
#

well req.body.adID

#

                $.ajax({
                    url: "/approveAd",
                    type: "post",
                    dataType: 'application/json',
                    data: JSON.stringify({adID:ad}),
                    success: (res) => {
                        console.log(res.error)
                        if (res.error == "true") return Swal.fire('Error!', `Invalid ad`, 'error');
                        Swal.fire({
                            title: 'Ad approved!',
                            text:`You approved "${ad}"`,
                            icon: "success"
                        })
                    }
                })```
boreal iron
#

This one does never change

raw nest
#

oh wait I think we might misunderstand the "token". It's just a generated, unique string like the discord's access_token

boreal iron
#

In very simple words, you save the username of the account in your cookie once you logged in to identify the client and it’s account

boreal iron
raw nest
#

my token is like your hash

boreal iron
#

You also receive specific account informations from Discord based on an access token exactly like you would identify a client based on his saved cookie

#

gtg anyways

raw nest
#

thanks man

spark flint
#

hello developers

#

i have returned

#

basically,

    async function declineAd(ad) {
        const { value: reason } = await Swal.fire({
            title: 'Enter your reason',
            input: 'text',
            inputLabel: 'Decline reason',
            showCancelButton: true,
            inputValidator: (value) => {
                if (!value) {
                    return 'You need to write something!'
                }
            }
        })

        if (reason) {
            $.ajax({
                    url: "/declineAd",
                    type: "post",
                    dataType: 'json',
                    data: {adID:ad, reason:reason},
                    success: (res) => {
                        console.log(res.error)
                        if (res.error == "true") return Swal.fire('Error!', `Invalid ad`, 'error');
                        Swal.fire({
                            title: 'Ad declined!',
                            text:`You declined "${ad}" for "${reason}"`,
                            icon: "success"
                        })
                    }
                })
        }

    }```

when doing `console.log(req.body)` returns `{ '{"adID":"7jJ6WnzI","reason":"test"}': '' }`
#

why not {adID:"7jJ6WnzI", reason:"test"}

faint pasture
#

anyone know how I can make code that invites a person to a random 2 servers with the bot in it, done with a command and not by random choice in discord.py?

#

I have a command that invites me to all guilds but I want it changed for users

#

and only looking for 2 servers to be invited to

winter pasture
#

Have the two servers agreed to you creating invites for you to join?

#

It is a massive privacy concern if you are creating and logging invites for you to use as a backdoor to invite yourself onto servers.
Any bot with that type of functionality will get declined on Top.gg, unless the server opts into that functionality or is given clear warning

Just wanted to ask before someone is helping you with privacy breaching functionality

faint pasture
#

it would be done by the user not by me

#

wait I didnt read your message right

faint pasture
#

just not sure how I could do random servers with the bot in it instead of certain servers everytime

winter pasture
#

I am not familiar with discord.py so I'll let someone else answer
But as mentioned before, make sure all servers agree and that there is a clear disclaimer that when someone use the bot random people may join or have it as opt-in

faint pasture
faint pasture
#

seemed like a cool idea im just not experienced enough for it lol my friend prolly gonna end up helpin anyways

sharp saddle
#
index.ts:28:3 - error TS2531: Object is possibly 'null'.

28   bot.user.setActivity("Use {help for more info");
     ~~~~~~~~

index.ts:29:3 - error TS2531: Object is possibly 'null'.

29   bot.user.setStatus("dnd")
     ~~~~~~~~


Found 2 errors.```

wtf is this error?
wheat mesa
#

It's because bot.user is nullable

#

turn it to bot.user?.whatever

sharp saddle
#

ok

boreal iron
#

Is { in front of help a typo or your actual command prefix?

sharp saddle
#

is a command prefix

sharp saddle
boreal iron
warm swan
#

bruh

#

what

sharp saddle
#
commands/timeout.ts:14:63 - error TS2554: Expected 1 arguments, but got 2.

14     e.message.reply("Do you want add or remove the timeout?", {embeds: [embed]})
                                                                 ~~~~~~~~~~~~~~~~~


Found 1 error.``` @wheat mesa
#

help here

#

pls

#

?

wheat mesa
#

seems to me like that's not a typescript issue

#

you're passing in 2 parameters into the reply function when it's only expecting one

#

look at the docs for whatever lib you're using

boreal iron
#

The option name looks like djs pandasad

#

If so, it’s { content: "…", embeds: […] }

sharp saddle
#

i saw

#

someone helped me

boreal iron
#

You can only reply without arguments in an object if you just wanna reply with the content only

#

reply("content");

cosmic forum
#

Hello, I was wondering what you all thought about the design of my API's documentation. Is it too cluttered, and is there anything I could improve on?

https://ffa.aakhilv.me

sharp saddle
#
commands/timeout.ts:12:29 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(value: number, options?: { long: boolean; } | undefined): string', gave the following error.
    Argument of type 'string[]' is not assignable to parameter of type 'number'.
  Overload 2 of 2, '(value: string): number', gave the following error.
    Argument of type 'string[]' is not assignable to parameter of type 'string'.

12    member.timeout(Number(ms(e.args.slice(1))), "Timeouted by " + message.member)
                               ~~~~~~~~~~~~~~~



Found 1 error.```

What is wrong?
#

@boreal iron

#

@wheat mesa

earnest phoenix
#

It seems like you are giving ms a string[] and not a string

round cove
#

Lol really dude?

sharp saddle
earnest phoenix
#

You are giving it something it can't use

round cove
#

(:

earnest phoenix
#

So don't give it a fucking array of strings

#

what you want me to tell ya

sharp saddle
#

Ok

earnest phoenix
#

slice returns a new array with that element missing btw

#

If what you were trying to do was get something from the array then this is basic js arr[index]

wheat mesa
#

you should probably learn more about statically typed languages before moving on with typescript

#

that'll help you with a lot of the errors that come with typescript

sharp saddle
#

Ok

#

Bye

round cove
#

I hate C# !

sharp saddle
#

Everybody hates

#

Except Parm

#

Parm loves C#

wheat mesa
#

no

#

C# is an amazing language

#

it's like java except it has none of the flaws of java

round cove
#

Oh yeah? Riddle me this batman

#

Program does not contain a static 'Main' method suitable for an entry point

wheat mesa
#

in .NET 6 you don't even need a main method

dry imp
boreal iron
boreal iron
wheat mesa
#

unless you're doing machine learning

#

that's about the only thing I condone

#

but even then

dry imp
#

use py

#

js sucks

#

never use js

wheat mesa
#

he's using ts

#

which is much better

#

py sucks balls imo

#

everything is so counterintuitive

#

js was thrown together in a week but python feels like it was thrown together in an hour

dry imp
#

imagine getting confused when programming

#

couldnt be me

round cove
#

and yeah I'm using .net 6

feral aspen
#

How do I get the current shard no. that my guild is currently in?

pulsar bone
#

hey guys please tell me some free hosting sites , because replit keep on getting me temp banned ;-;

earnest phoenix
#

There really is no free hosting for a discord bot

#

You really just gotta suck it up and either buy a vps or use an old laptop and run the bot on it. But you gotta make sure it is constantly connected to wifi and doesn't go to sleep

pulsar bone
woeful pike
#

people will jump through a million hoops in order to not pay for products they want to use lol

dry imp
#

also nice mentionable name

pulsar bone
woeful pike
#

replit allows 24/7 hosting from what I remember. If you're getting banned you must be doing something else shady

dry imp
#

replit is just that shitty

woeful pike
#

a scaleway Starburst instance costs $2/month. Just pay for things you need to use jesus

pulsar bone
woeful pike
#

no you're dumb

dry imp
#

there is actually a lot of free hosting but its not as good and free as the paid ones

woeful pike
#

people pay for things they use

#

that's how the world works

#

you're trying to abuse products, that's not a coder thing that's a you wanting to abuse stuff thing

pulsar bone
dry imp
#

good for you

woeful pike
#

if you don't need premium you don't pay for it. Clearly what you need here is a VPS so go pay for it

feral aspen
onyx socket
#

Whats up with the bot getting banned temporarily from accessing the api...?
I searched it up on the internet and it says, the problem may be with error messages that flood up the api and trigger the limit..?
Any idea, this happen everytime i go to sleep smh, at the morning, there is just a error messge saying bot is temp banned from api bcz it hit the limit many times...

feral aspen
woeful pike
#

the only legitimate free host I've seen is oracles free tier

dry imp
onyx socket
dry imp
#

discord api or what api?

onyx socket
#

discord api

dry imp
#

well its in your code

pulsar bone
dry imp
#

database.txt

feral aspen
#

database.json

onyx socket
pulsar bone
onyx socket
#

it says someting like errors are flooding up the api

feral aspen
dry imp
#

dont know what you are abusing and dont want to know

onyx socket
pulsar bone
feral aspen
slender thistle
feral aspen
dry imp
#

credit card

feral aspen
#

Ohh.

#

Well.. that's your last option, then.

woeful pike
#

pretty sure if your code is ultra shitty and runs on near 100% cpu usage on a free tier instance replit will ban you to kill bitcoin miners

#

though I doubt that'd be the case

feral aspen
dry imp
#

replit is super buggy thats just how it is

#

you may get ratelimited easily and you may not

#

depends on your container

pulsar bone
#

how about these

dry imp
#

true

woeful pike
#

replit is actually great for its real purpose

dry imp
pulsar bone
dry imp
#

not really

#

they all use shared ips

woeful pike
#

🄺 how can I abuse a service without facing consequences

dry imp
#

and dsc rate limit ip

#

depends on your nodes

dry imp
#

well if you can abuse it without facing consequences then that is great

#

but likely not gonna happen