#development

1 messages · Page 1630 of 1

snow niche
#

I get this error after running

#

lmao dm (id) (message)

sage bobcat
#

One message removed from a suspended account.

snow niche
#

let dUser = message.guild.member(message.mentions.users.first() || await client.users.fetch(args[1]));

sage bobcat
#

One message removed from a suspended account.

snow niche
#

yes

sage bobcat
#

One message removed from a suspended account.

river panther
#

^

snow niche
#

ik so my var is not right

river panther
#

can you explain my command handler to me in dms?

warm marsh
#

I have DMs turned off.

river panther
#

so explain it to me here?

warm marsh
#

What don't you understand about it?

river panther
#

the last 3-4 lines

sage bobcat
#

One message removed from a suspended account.

river panther
static trench
#

is it normal that "async def" is an invalid syntax?

snow niche
#
let dUser = message.guild.member(message.mentions.users.first() || await client.users.fetch(args[1]));``` This doesnt work the mention works, I think the .fetch part is wrong. Idk what to put their tho.
river panther
#

did you read your error?

snow niche
#

yes

river panther
#

bruh, ok, tell me what was the error

snow niche
#

here

sterile lantern
#

why can i do
;ping
;ping
;ping

three times yet the bot still responds after the 3 times

#

and the ping is 102, 79, 293

#

so idk why it takes thatlong

#

that long*

#

nvm ill use cooldowns

#

that helps

warm marsh
#

Firstly, it iterates over the commands folder that returns an array. You then .map over that array. Once that is done you loop over each sub dir inside of commands and it returns the file.js or whatever. You then require the file, most likely the file is using module.exports = { } so it returns an object. You console log the file is loaded or something. You then set that file in commands map or collection and then if it has any aliases you iterate over them and add them also.

umbral zealot
quartz kindle
snow niche
#

wdym

warm marsh
#

message.guild.member

snow niche
#

Well im gonna make it only take ids from now on

quartz kindle
#

message.guild.member() tries to convert whatever is inside to a guild member

snow niche
umbral zealot
#

uhhhh

#

console.log can't give that error

snow niche
#

ye ik thats the error when I run the comand

#

it doesnt even log the values

#
let dUser = message.member(message.mentions.users.first() || await client.users.fetch(args[1]));```
#

Tim does that seem better?

#

Im just gonna make it acceot only ids

umbral zealot
#

don't you even know how to use console.log

snow niche
#

. ido

umbral zealot
#

console.log(args)

#

log that BEFORE the error

snow niche
#

console.log(args[0]);

#

or that

umbral zealot
#

just args

snow niche
#

ok\

umbral zealot
#

so you know the entire array

#

and then you can see if it's 0 or 1

#

instead of guessing

snow niche
#

ok

#

@umbral zealot

#

I cant see it until this error is gone

umbral zealot
#

... you need to log before the error happens

#

like, at the top

snow niche
#

ok

#

@umbral zealot

#

Ok

#

so

#

Idk which arg that is

umbral zealot
#

Ok so clearly it's [0]

#

because arrays start at 0

snow niche
#

oh

#

ok

#

let dUser = (await client.users.fetch(args[0]));

#

i want it to only take ids

#

let dUser = message.guild.member(await client.users.fetch(args[0]));

#

but I dont want it to be inna guild

#

so

#

now back to my main question

umbral zealot
#

... why are you still using member then

#

smh

snow niche
#

would this work
let dUser = (await client.users.fetch(args[0]));

umbral zealot
#

Try it and see !

snow niche
#

Ok It said it sent message im asking my friend if ikt sent

#

ty

wise umbra
#

bruh
i try to do node-gyp and instead nodejs pops up

outer zenith
#

i mean someone has to be

#

because all websites arent ugly

warm marsh
#

😐

snow niche
#

one word. bootstrap

#

c:< jkjk

outer zenith
#

cause like i got a web dev for me

#

but he not good at desgin

sterile lantern
#

i want 'fishing pole' to be an acceptable args. rn i have args[0] to check if it's a valid item, how would i make fishing pole acceptable

#

i think args.split

#

not too sure

cinder patio
#

you could make fishing_pole acceptable instead

#

if you want two words to be one arg then you'll need to change the way you parse args

sterile lantern
#

o

#

trim the content?

#

message.content.trim()

earnest phoenix
#

maybe substring

cinder patio
#

no

earnest phoenix
#

and get 2 args [0] [1]

sterile lantern
#

hm

cinder patio
#

trimming removes unnecessary whitespace

sterile lantern
#

well some of the items are one word, some are two

#

so ill just use a _

cinder patio
#

using a _ is the easiest way out

earnest phoenix
#

what if reply doesnt contain _ 🤠

sterile lantern
#

then it tells them to contain it

latent heron
#

that just replaces the old problem with a new one

#

it's horribly inefficient

sterile lantern
#

not really

cinder patio
#

but if you want fishing rod to be accepted and do not want to change the way you parse things, you could do this, I'd do something like this:

const combos = {
  fishing: "rod"
}

const realArgs = [];
if (combos[arg[0]] && arg[1] === combos[arg[0]]) realArgs[0] = `${arg[0]} ${arg[1]}`

sterile lantern
#

yeah uh

#

i think it'll be fine

latent heron
#

you could just tokenize it instead

sterile lantern
#

i mean

#

its not like a public bot

#

its just a bot for friends

#

so it doesnt really matter

latent heron
#

you need a favicon.ico

#

thats just metadata

#

you need an actual favicon

earnest phoenix
#

wouldnt that save icon to bookmark only

latent heron
#

no

#

Favicon is a website standard for browser implementations introduced by the W3C back in 1994

#

Like I said

#

it's metadata

#

okay let's say for instance

#

you go into google and you search up the website

#

or you have a query result that pops it up

#

that's what it's used for

#

it's very similar to why opengraph tags are used in <head> contents.

#

also

#

you're calling image/x-icon with a png type, you can't do that

#

you need to have it as one of these

#

have you tried them

crimson vapor
#

@quartz kindle js { id: '0', shards: { '0': { ping: '66', guilds: 79, channels: 2507, roles: 8555 } }, memory: { rss: '78.7MB', heapTotal: '30.6MB', heapUsed: '21.8MB', external: '18.9MB', arrayBuffers: '17.5MB' }, guilds: 79, channels: 2507, roles: 8555 } this is the memory stats for my bot on d-rose, its pretty decent right, considering it was ~240 on task manager for you?

quartz kindle
#

yeah

latent heron
#

also something to note is that

#

if you're doing this on a website, it needs to take time to register and be cached

crimson vapor
#

if there is cf caching, that would be the case

#

my site without caching updates immediately

#

right chrome does cache for a while

latent heron
#

looks fine to me

cinder patio
#

Do CTRL + F5

crimson vapor
#

chrome caching prolly

old cliff
#

Use incognito

sterile lantern
#

for quick.db,

db.push('userInfo.items', 'Watch')
db.get(user.Info.items)```

after fetching, how do i check if `Watch` is included in `user.Info.items`
#

db.has(user.Info.items.Watch) i presume

crimson vapor
#

depends on what you purpose is but yeah that would probaly work

sterile lantern
#

alr

earnest phoenix
#

uhoh i made this trash, is it gonna be a problem if it requires a file many times

#

or is it released when cmd ends

sudden geyser
#

require caches any files you require more than once, but if you do another side effect (like adding it to a collection), you're responsible for handling duplicates.

#

You should also rely on proper argument handling (msg.content.split(...) is probably not enough) and use the async version of readdir so you aren't blocking.

earnest phoenix
#

wym not enough

#

it grabs cmd name, runs the file

#

im just worried its gonna grow in size (ram) after many events

sudden geyser
#

Let's say my prefix is ! and I run a command called !load prefix. By that logic, cmd will be !load.js

earnest phoenix
#

nah ill fix it

#

its just a test

sudden geyser
#

ah okay

earnest phoenix
#

damn command handelrs epic

sudden geyser
#

wait until you touch frameworks

crimson vapor
#

frameworks are ehh

#

lots of bloat often

earnest phoenix
#

isnt djs a framework

sudden geyser
#

It's a library.

earnest phoenix
#

why is djs any different

sudden geyser
#

wdym

boreal iron
#

What’s the issue with the command handler of djs?

latent heron
#

what command handler?

earnest phoenix
#

djs has command handelrs?

latent heron
boreal iron
#

The one you can create KEKW

cinder patio
#

d.js has d.js-commando

crimson vapor
#

isnt djs commando deprecated?

sudden geyser
#

yeah but commando kinda sucks

cinder patio
#

it does

sudden geyser
#

It's not deprecated

boreal iron
#

Ehm I really required to write it down oof

#

Where are all the weird people and trolls today? 👀

earnest phoenix
#

turks?

earnest phoenix
#

djs has frameworks like discord.js-commando and discord-akairo

#

probs even more

crimson vapor
#

there is klasa

#

djs-light is kinda a framework

#

even though its not

lyric mountain
#

djs is more of a wrapper if anything

earnest phoenix
#

oh yeah and sapphire (framework)

quartz kindle
#

the whole world is frameworks on top of frameworks

#

if you think about it

crimson vapor
#

yeah, objects are just extensions of molecules which implement atoms in different ways

fair swan
#

hey guys, I have a weird issue... when running my project locally it finds the data in my mongoDB, when running it on my vps it only gives the first response of looking trough the database, no errrors... anyone have an idea of what could be going on?

waxen snow
#

Bruh someone is hacking into my bot

earnest phoenix
#

reset token?

waxen snow
#

Yea I reset token

#

Then it dint work

earnest phoenix
#

must be russians then

lyric mountain
#

that's the most cringey convo I've ever seen

waxen snow
#

Yep Becuz they are drinking vodka

cinder patio
#

It's not hacked

#

it must be haunted

earnest phoenix
#

elp

#

whats the problem here

#

the if part doesnt work

cinder patio
#

you should really use a variable for the msg.content.split

earnest phoenix
#

it works just fine

#

just the if part doesnt

cinder patio
#

console.log cmd

earnest phoenix
#

i did

cinder patio
#

debug your code

earnest phoenix
#

its clean

boreal iron
#

God damn... why would you include you file over and over again?

earnest phoenix
#

is it gonna be a problem

fair swan
#

hey guys, I have a weird issue... when running my project locally it finds the data in my mongoDB, when running it on my vps it only gives the first response of looking trough the database, no errrors... anyone have an idea of what could be going on?

boreal iron
#

Sure... just load all command files on the initialization of the bot and that’s it.

earnest phoenix
#

readdir part?

#

im shit at js

#

nvm its working

boreal iron
#

You gonna create a directory for your command files - using exports in there, read the dir and include all files saving them in a collection.

lusty quest
boreal iron
#

Inside your messasge event check if your command got found inside the collection based on specific key and pass your args to it and execute the code.

cinder patio
boreal iron
#

There's a guide of how to handle command files... gonna post it as soon as I can find it.

#

@earnest phoenix

slim heart
#

is there a way to let users to direct install from github on typescript

lyric mountain
#

so it doesn't work at all

slim heart
#

cuz like i gitignore dist/ and npmignore src/

#

so if i npm i the github it just wont download either of the folders

crimson vapor
#

ping erwin

#

he might know

slim heart
#

weary its impossible to ping erwin

#

@not erwin

#

h

crimson vapor
#

188836645670223872

slim heart
#

@opal plank ponk

sterile lantern
#
if(db.has(`${user.id}.items`, 'thief_outfit'))```
#

this doesnt work

slim heart
#

await?

sterile lantern
#

it just checks the first part

#

?

slim heart
#

do u have to await db.has

sterile lantern
#

o

cinder patio
#

you don't

#

it's quick.db

sterile lantern
#

how would i check the item array for that item

#

userid{"items":["fishing_pole"]}

#

thats how it prints

#

i have fishing pole, but it tells me i already have thief outfit when i dont

warm mulch
#

i cant seem to vote for bots and the server told me to go here?

cinder patio
#

get the array and then use includes

boreal iron
#

huh what's the sense of saving an array in a database?

sterile lantern
#

because its id-specific?

#

its an inventory

#

for a user

boreal iron
#

hmm that's no answer... go on KEKW

sterile lantern
#

what?

#

usually id do

#

db.set("itemname_user.id", "purchased")

#

but pushing to an array is easier

#

const inv = db.get(${user.id}.items)

cinder patio
#

Just get the whole array

sterile lantern
#

yeah

cinder patio
#

and then use includes

sterile lantern
#

inv prints out

#

the whole array

#

db.includes?

cinder patio
#

no

sterile lantern
#

nvm that doesnt exist

cinder patio
#

use the includes() method on the array you got

#

arrayYouGotFromDb.includes("fishing_rod");

cinder patio
sterile lantern
#

if(inv.includes("fishing_rod"));

#

doesn't work

cinder patio
#

what's inv

sterile lantern
#

defined as an array

#

one sec

#

ah nvm

#

it works now

#

thanks

agile lance
#

I did provide a valid youtube url as seen here

boreal iron
cinder patio
#

postgresql can store arrays

#

and mongodb ofc but it's not a relational db

boreal iron
#

but it doesn't explain why to save an array instead of creating a structure but hey... it's not my db ^^

#

huh

#

alright... it's never to late to learn something new

cinder patio
#

Cause it's made to be easy

#

and that's why quickdb sucks

earnest phoenix
signal wagon
#

Like 2

#

Or 3

cinder patio
#

Theoretically it's how much disk space you have available

sterile lantern
#
(node:2140) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of null
    at```

i get this error if the user's inv is null, how would i prevent this error
earnest phoenix
#

Oh

#

Okay thanks guys

agile lance
#

as long as u have storage/disk space and ram/memory to handle it

sterile lantern
#

because it needs to check if they have the item or not

agile lance
#

or do

cinder patio
# earnest phoenix Okay thanks guys

but json databases are prone to corruption, and also harder to work with than databases, I recommend using an actual database instead of json

agile lance
#

return message.reply("You have no items!")

sterile lantern
#

what?

#

but

earnest phoenix
#

okay thanks bro

sterile lantern
#

ah

#

wait lemme try null

agile lance
#

if its nullt just do

#

if(!db.inventory) return message.reply("You have no items")

cinder patio
#

just do

const arr = ...;
if (!arr) return;
// Arr is guaranteed to not be a falsey value
sterile lantern
#

but

agile lance
#

Idk how you do your db so

sterile lantern
#

the array is

#

empty

#

if they have no items

#

the command is buying an item

agile lance
#

then do if(arr.length == 0)

cinder patio
#

You wouldn't be getting that error if the array was empty

sterile lantern
#
if(args[0].toLowerCase() === "premium") {
if(bal < 17000) return message.channel.send(pm)
if(inv.includes("premium")) return message.channel.send("You already own premium!")
db.subtract(`money_${user.id}`, 17000)
db.push(`${user.id}.items`, 'premium')
return message.channel.send("Successfully purchased premium! You now have access to premium features!")```
agile lance
#

or if(!arr.length)

cinder patio
#

the error means that the array column is null

agile lance
#

if(!inv.includes("premium"))

#

if thay fails do this

sterile lantern
#

what?

#

that means if they dont have premium

agile lance
#

if(inv.includes("premium") == null)

sterile lantern
#

i want to check if they have premium or not

agile lance
#

that is checking

#

dude do u know basic js?

sterile lantern
#

yes...

#

!inv.includes means if they don't

#

i am checking if they do

agile lance
#

ill fix ur command for u

sterile lantern
#

if they do, send the message

#

if they don't, then allow them to buy it

#

because then, it just does the regular process of buying

agile lance
#
if(args[0].toLowerCase() === "premium") {
if(bal < 17000) return message.channel.send(pm)
if(!inv.includes("premium")) {
db.subtract(`money_${user.id}`, 17000)
db.push(`${user.id}.items`, 'premium')
return message.channel.send("Successfully purchased premium! You now have access to premium features!")
} else {
message.channel.send("You already own premium!") 
}```
sterile lantern
#

hmm

#

oh

#

else

#

alr

agile lance
#

so if they dont have premium

#

it proceeds

#

if they dont it sends a message

sterile lantern
#

yea

#

lol i misunderstood what u said

#

thanks

agile lance
#

np

sterile lantern
#

except

#

the error

#

happens

#

still

agile lance
#

Hmm

#

I can try to help again

sterile lantern
#

the issue is that it cannot do inv.includes on null

agile lance
#

hold on

#

is ur bot a Global economy?

sterile lantern
#

yes

#

it doesnt save via guild

#

just with user id

agile lance
#

ok

#

i can fix it easier knowing that

#
if(args[0].toLowerCase() === "premium") {
let prem = db.fetch(`${user.id}.items.premium`) || false
if(bal < 17000) return message.channel.send(pm)
if(prem) {
db.subtract(`money_${user.id}`, 17000)
db.push(`${user.id}.items`, 'premium')
return message.channel.send("Successfully purchased premium! You now have access to premium features!")
}```
#

try that

#

and also inventory can be alot easier if you do it like this

sterile lantern
#

the issue is

#

user.id.items.premium

#

does not work

agile lance
#

db.fetch("premium."+user.id) instead of all the extras

sterile lantern
#

the reason why

#

im using .includes

#

is because its an array

agile lance
#

uh

#

quick.db returns a object

#

🤔

sterile lantern
#

what?

#

isnt it an array

agile lance
#

The way you’re fetching stuff

sterile lantern
#

oh

#

object

#

yeah

agile lance
#

It returns a object like this

sterile lantern
#

it returns

#

['fishing_pole']

#

and if null

#

['']

agile lance
#

{
ID: "items.userID",
data: {Item1, item2 item3}
}

sterile lantern
#

wh

#

i printed

#

the inv

#

and it just prints

#

['item']

agile lance
#

the easiest way to fix your problem is fetching from db.all();

#

and using object.entries

sterile lantern
#

why would i db.all

agile lance
#

Sorting it, finding the item

sterile lantern
#

hm

agile lance
#

Bc the object wont have the item if the user doesnt have it

sterile lantern
#

ngl i might just push a empty space into their inventory

pale vessel
sterile lantern
#

' '

agile lance
#

So you can always check through the object, which I used to do

#

just change the inventory system

#

doing db.fetch("PREMIUM"+user.id) is easier than all the extrra

sterile lantern
#

then i have to save each item individually

#

which i dont want to do

#

but i may have to

#

sad

#

ill just use ternary operators for their profile

agile lance
#

Its alot less complicated i’ll tell you that

sterile lantern
#

so it isnt like 500 lines

agile lance
#

I made a function that helps me out

#

I do dbF("premium", false) and it fetches -> user -> premium

#

or i do

#

dbF("item1", true) and it fetches -> guild -> user -> item

restive current
#

hey is it a server for developers or gamers

agile lance
#

developers

#

and also #support when asking questions like thet :p

restive current
#

Can u tell me where to play epic rpg game

agile lance
#

developers and gamers tbh

#

and go to Get Support and join there and play it there

restive current
#

I am new discord thing

#

where should i search that

lyric mountain
green kestrel
#

lol well this escalated quickly

#

wanted to make a function to strip certain punctuation from a string including speech marks

#

someone pointed out that iphones use 'smart' punctuation like ms word

#

not a problem, went to look up the unicode values

#

then i went right down a rabbit hole of i18n

#

ended up with this

#
        for (std::wstring::const_iterator c = str.begin(); c != str.end(); ++c) {
                if (!
                        (*c == L',' || *c == L'.'   || *c == L':'  || *c == L'/'  ||
                         *c == L';' || *c == L'!'   || *c == L'?'  || *c == L'('  ||
                         *c == L'‘' || *c == L'’'   || *c == L'“'  || *c == L'”'  ||
                         *c == L'«' || *c == L'»'   || *c == L'‹'  || *c == L'›'  ||
                         *c == L'「' || *c == L'」' || *c == L'﹁' || *c == L'﹂' ||
                         *c == L'『' || *c == L'』' || *c == L'﹃' || *c == L'﹄' ||
                         *c == L'《' || *c == L'》' || *c == L'〈' || *c == L'〉' ||
                         *c == L')' || *c == L'-'   || *c == L'"'  || *c == L'\'' ||
                         *c == L'„' || *c == L'\r'  || *c == L'\n' || *c == L'\t' ||
                         *c == L'\v')
                ) {
                        out += *c;
                }
        }
#

🤣

#

most of that is half the world's oddball ways of representing " and '

#

at this point im probably better comparing against a std::map

lyric mountain
#

wtf is that?

green kestrel
#

its C++, @lyric mountain

lyric mountain
#

but like, can't u just compare unicode codepoints?

green kestrel
#

i started off with just the first eight comparisons in the if, and it became a moster real quick

lyric mountain
#

are those sequential?

green kestrel
#

no, they arent sequential

lyric mountain
#

meh

green kestrel
#

theyre scattered all over the unicode space

#

each is a different cultures way of representing various quote symbols

lyric mountain
#

TIL 《 is a quote

green kestrel
#

doesnt help that unicode and especially utf8 are afterthoughts in C++ until recent anyway

#

yup

#

its tibetan, mongolian and north korean

lyric mountain
#

wasn't unicode supposed to be...yk...unified? KEKW

green kestrel
#

the smaller one, tons of arabic, some geerman, catalan

#

bulgarian has an upside down "

#

traditional chinese has 「…」

#

danish has this

»…«
lyric mountain
#

that's a shy uwu face

green kestrel
#

norwegian the same but the other way around

cinder patio
#

we do have upside down double quotes lmao

green kestrel
#

Quotation marks, also known as quotes, quote marks, speech marks, inverted commas, or talking marks, are punctuation marks used in pairs in various writing systems to set off direct speech, a quotation, or a phrase. The pair consists of an opening quotation mark and a closing quotation mark, which may or may not be the same character.Quotation m...

#

yes

lyric mountain
#

unicode: unified codepoints but each one chooses their own place to put accents

green kestrel
#

thing is, some of those comparisons in my loop arent even quote symbols

#

for some languages i filter out ?, !, -, . but not for others

#

depends on whats casually typed when answering questions

modest maple
#

use that sweet sweet nlp

green kestrel
#

lmao

#

nlp on every input message

#

can you say "massive cpu usage"

modest maple
#

honestly its pretty cheap

green kestrel
#

not as cheap as a unicode parse

modest maple
#

pre-trained models are incredibly optimised now

green kestrel
#

plus can you imagine

#

question "what has four legs and goes woof"

modest maple
#

i think it takes my python instance 5micros or smth stupid like that to search bloblul

green kestrel
#

user answers "cat"

#

neural network says "four legs. eval true. probability 80%. it'll do"

#

"CORRECT CF8 YOU SAID CAT!"

#

😂

#

yeah theres just a hint of sarcasm in there

#

but ive seen such stupidity from google's image recognition ai

#

and theyre supposed to have the mega bucks

lyric mountain
green kestrel
#

exactly

solemn latch
#

i like monkeys

lyric mountain
misty sigil
#

yo pog

green kestrel
#

that pattern isnt invisible

#

i can see it

misty sigil
#

thats my favourite animal

green kestrel
#

it looks like a way to munt up a GAN

misty sigil
#

ykow what im seeing somethin

latent heron
#

pog

#

Discord added a new UI for showing when commands are loading

sterile lantern
#
Math.floor(Math.random() * 11) + 10;```

does this return a random integer from 10-20
pale vessel
#

Math.floor(Math.random() * (max - min)) + min;

sterile lantern
#

so 10 instead

lyric mountain
#

you need to subtract min from both value and maximum bound

#

that's why flaz added that - min

sterile lantern
#

max: 20
min: 10
20-10 = 10

pale vessel
#

Wait, shouldn't it be Math.ceil()?

#

I forgot

lyric mountain
#

well, it should be round actually

modest maple
#
nlp = load("en_core_web_lg")

doc1 = nlp("what has four legs and goes woof")

doc2 = nlp("cat")
doc3 = nlp("go goes woof")

print(doc1.similarity(doc2), doc1.similarity(doc3))
>>> 0.46622830520584546 0.7362269570225349

@green kestrel 1 DonT kNow WhAt YoU mEan

pale vessel
#

Ah

lyric mountain
#

here one more since yall like AI domination examples

modest maple
#
>>> 0.46622830520584546 0.7362269570225349
>>> Took: 0.1782999999999646ms

Still pretty quick

#

it may be wrong

#

but it detects cat does not really go woof

green kestrel
modest maple
#

tbf though @green kestrel are you fuzzy / tokenising the text in anyway to make it a lil more lenient to things like spelling?

latent heron
#

it's so bad lmao

lyric mountain
#

are you two using levenshtein distance to get text similarity?

green kestrel
#

i do use levenshtein edit distance for part of it yeah

#

with matricies to make the performance not suck ass

#

thats part of the lienience

#

first it passes the answer through a filter like the one i pasted above to strip punctuation

#

then it uses levenshtein on it and allows answers with an edit distance <= 1

#

so you can be one letter out or one letter transposed

lyric mountain
#

I see

stable nimbus
#

How would I get the aliases of a command that is cached?

grizzled raven
#

are these mongoose connection errors normal?

crimson vapor
#

not normally

lyric mountain
grizzled raven
#

what do i do about them then

stable nimbus
#

Or would I be able to pull the physical aliases?

earnest phoenix
#

Hey, I have a error to my event.
Its a event to when my bot joins/leaves a server:

const Discord = require('discord.js')
const { MessageEmbed } = require('discord.js')
const logsChannel = '815953311614107709'
module.exports = async (client, message) => {

client.on('guildCreate', (guild) => {
  client.channels.cache.get(logsChannel).send(
  new MessageEmbed()
    .setTitle(`Omg, je viens de rejoindre un nouveau serveur !`)
    .addField(`Serveur`, `${guild.name}`)
    .addField(`Nombre de membres`, `${guild.memberCount}`)
    .addField(`Fondateur`, `<@${guild.owner.id}>`)
    .setFooter(`Je suis actuellement sur ${client.guilds.cache.size} serveurs !`)
    .setTimestamp()
    .setColor("GREEN")
  )
})

client.on('guildDelete', (guild) => {
  client.channels.cache.get(logsChannel).send(
  new MessageEmbed()
    .setTitle(`Oh nan, je viens de quitter un serveur :/`)
    .addField(`Serveur`, `${guild.name}`)
    .addField(`Nombre de membres`, `${guild.memberCount}`)
    .addField(`Fondateur`, `<@${guild.owner.id}>`)
    .setFooter(`Je suis actuellement sur ${client.guilds.cache.size} serveurs !`)
    .setTimestamp()
    .setColor("RED")
  )
})}

The bot dosen't send the message in the channel, and any error in the console

solemn latch
#

any error? as in no error, or there is an error?

stable nimbus
#

There isn't.

lyric mountain
#

is the id right?

boreal iron
#

.send(new MessageEmbed() why don't you simly use an object?

simple zodiac
#

Hey, does someone know how I can set my bots status to like "Watching (servers its in) servers and (total members it has in those servers) members"? (I'm using discord.js)

earnest phoenix
earnest phoenix
#

it is possible to update the user's username, avatar, guilds etc with passport-discord without relogin ?

boreal iron
#
...send(embed: { title: "Oh nan, je viens de quitter un serveur :/", color: 0xff0000, ... }```
#

aye just more useless text instead of using the object stlye

earnest phoenix
#

yes but

#

its works with this too

boreal iron
#

Didn't say it wouldn't. But it's not efficient.

earnest phoenix
#

try loging a word

boreal iron
#

You try to send a simple text message.

earnest phoenix
#

yes

lyric mountain
#

just console.log("working")

boreal iron
#

And make sure client.channels.cache.get(logsChannel) is cached

earnest phoenix
#

oki

#

I will test tommorow, I need to sleep

#

:/

#

gn

#

:))

#

does someone know how passport-discord module works?

umbral zealot
#

Sure

solemn latch
#

a lot of people do here

earnest phoenix
#

ok

solemn latch
#

i know some of it

solemn latch
#

as in refreshing the user data?

earnest phoenix
#

yea

solemn latch
carmine furnace
#

How do I check networth

simple zodiac
#

Hey, does someone know how I can set my bots status to like "Watching (servers its in) servers and (total members it has in those servers) members"? (in discord.js?)

lyric mountain
simple zodiac
#

the what

lyric mountain
#

disclaimer: it'll be slow and heavy

simple zodiac
#

i dont mind that

#

i just want to know how to do it lol

umbral zealot
#

try this : ```js
client.guilds.cache.reduce((x, y) => x + y.memberCount, 0)

simple zodiac
#

where do i put this

umbral zealot
#

anywhere you need the total member count

simple zodiac
#

or are you not talking to me lol

#

oh ok

umbral zealot
#

that returns what you need.

simple zodiac
#

okay ill need a second

#

I have the set activity code, not sure if im doing it wrong, but it says "Type Error: Cannot read property 'set activity' of null"

client.user.setActivity(`client.guilds.cache.reduce((x, y) => x + y.memberCount, 0)`), {
  type: "WATCHING"
}
``` Heres the code i have
earnest phoenix
#

remove the temperate literals

umbral zealot
#

Well first, that needs to be in your ready event

simple zodiac
#

oh

umbral zealot
#

Second, yeah that's a string basically, it shouldn't be a string

simple zodiac
#

oh

#

so wait i put it on the client.on('ready') thing

earnest phoenix
#

in the ready event

umbral zealot
#

inside, yes

simple zodiac
#

oh wow i just got a massive error lol

#

is type: "WATCHING" invalid?

umbral zealot
#

shouldn't be, no

simple zodiac
#

thats what it looks like the error is

#

weird

umbral zealot
#

What exactly are you getting

simple zodiac
#

UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied name is not a string.

#

its referencing the line that type: "WATCHING" is on

earnest phoenix
#

idk why

#

but

#

if it s help

#

that s my code for that

#
client.user.setActivity(`${client.guilds.cache.size} servers!`, { type: "WATCHING"});
simple zodiac
#

i will try this

boreal iron
#

That's the issue.

simple zodiac
#

where would i put it?

boreal iron
#

client.user.setActivity(`client.guilds.cache.reduce((x, y) => x + y.memberCount, 0)`), { type: "WATCHING" }
client.user.setActivity(`client.guilds.cache.reduce((x, y) => x + y.memberCount, 0)`, { type: "WATCHING" });

simple zodiac
#

do i need the 2nd one

boreal iron
#

Of course.

simple zodiac
#

okay

#

TypeError [INVALID_TYPE]: Supplied name is not a string.

boreal iron
#

Keep in mind what Hindsight#undefined told you about it.

simple zodiac
#

wdym

boreal iron
#

Convert your result to a string using toString()

simple zodiac
#

ok

#

wait the watching thing?

boreal iron
#

That's a string already.

simple zodiac
#

yea

blissful coral
#

is required:true a valid option on making a schema variable?

gleaming umbra
#

yes

blissful coral
#

Thought so

gleaming umbra
#

vscode does not suggest it though which is weird

blissful coral
#

Yeah

#

Typings are probably messed up

#

I cba to fix it

crimson vapor
#

yeah required is a real thing

#

so is unique

#

which is pogging

visual rover
#

hi, i did not played OW for long - has been solved issue with public and not public IP?

pale vessel
#

Overwatch?

visual rover
#

sorry wrong discord

crimson vapor
boreal pewter
#

Quick question for ppl with bigger bots,
from when would you recommend to start sharding

#

im currently at almost 1200 servers

scenic forge
#

Hi

#

I like potatoes bye

boreal pewter
#

ok

#

understandable have a nice day

solemn tangle
#

Hi guys can someone help me I want to add our discord server in top gg discord server I invited the bot then it tells it will appear in your profile when I click that it tell your server will show up here but it does not show

lyric mountain
#

they're having issues with @pliant gorge

solemn tangle
#

Ok

boreal pewter
#

on shiro

lyric mountain
#

yep

boreal pewter
#

how many

lyric mountain
#

2 KEKW

boreal pewter
#

expected

lyric mountain
#

but 1500-2000 is discord's recommended amount

boreal pewter
#

and what server to shard ratio would you say

lyric mountain
#

2000 is a must

boreal pewter
#

i c

lyric mountain
boreal pewter
#

it can? without restart?

#

its written on python

lyric mountain
#

well, no, it'll only load shards on restart

boreal pewter
#

using raw client, not bot

lyric mountain
#

raw client?

#

like, http requests?

boreal pewter
#

i mean

#

well not that raw

#

i mis typed it

crystal wigeon
#

fkin hell

boreal pewter
#

it uses client events i meant

#

not bot commands

crystal wigeon
#

permissions array 200K+ in memory wtf

lyric mountain
#

didn't understood, how you have a bot without commands?

modest maple
boreal pewter
#

when you write a bot (at-least in python) you can either take the regular approach and use the built in bot class

#

then just listen to commands

#

and u can install / remove sections with cogs

lyric mountain
#

ahhhh

modest maple
#

well you have the base Client class and then you have the commands framework

boreal pewter
#

however because of the nature of my bot

crystal wigeon
boreal pewter
#

i just listen to raw client events

lyric mountain
#

so you're using the peanut butter option instead of the nutella one

#

that's kinda fine ig

#

like, you're supposed to make your own command handler anyway sometime

modest maple
#

but then you dont get these puppies 😔

boreal pewter
#

its because my bot comes with 0 commands out of the box

#

and 100% customize it on the web dashboard

lyric mountain
#

you'll become chunky

quartz kindle
#

permissions are attached to roles, the library needs roles to be cached to be able to offer permission-checking functions

gilded ice
#

hey nerds

#

does anyone know how i can resize the partition that root is mounted to on ubuntu

#

ive tried gparted but it doesnt wanna work

lyric mountain
#

have you tried r̴̎̀e̷͋̃s̶̉͝i̵͗̅z̶̽̒i̴̿̕ṅ̸͝g̵̑̂ it?

solemn latch
#

yes try r̴̎̀e̷͋̃s̶̉͝i̵͗̅z̶̽̒i̴̿̕ṅ̸͝g̵̑̂ it.

blissful coral
#

oh my

lyric mountain
#

doinkythederp typing since 01/01/1970

hallow shell
#

hey could someone help me with some regex?

#

i'm trying to find template literal expressions for js in a string

gilded ice
#

The filesystem is already 25600000 (4k) blocks long. but its not ggggggggggg

boreal iron
#

Sure what do you need.

gilded ice
#

pensive

hallow shell
#

but if i have multiple, it'll see them as one thing, lemme show you

boreal iron
#

Just for matching or do you need to work with the match groups?

gilded ice
#

wait i could just unmount root and then resize it

#

fuck

#

i am a dumbass

hallow shell
#

I'm going to be using it with a JS string.matchAll

#

here's what it's doing right now: input: "fshfiuhsdufh${hmm}siufhdsiuhdf${test}fdjskhfjskfh" output: "${hmm}siufhdsiuhdf${test}"

#

instead of returning 2 things, it sees them as 1

#

here's the regex: /(#{.+})/g

#

how would i make it stop at the first } it sees?

lyric mountain
hallow shell
#

sure

pale vessel
#

string.match(/\$\{(.+?)\}/g)

#

Use (.+?)

hallow shell
#

Cool, lemme try that

pale vessel
#

That looks for the earliest }

gilded ice
#

cant you just anchor the } with an $

boreal iron
#

Just want to work with the first found match?

lyric mountain
#

string.match(/(?=\$\{).+(?<=\})/g)

#

will match everything inside ${...}

gilded ice
#

(#{.+}$)

#

this will too

lyric mountain
#

but not $ nor {}

gilded ice
#

oh you're just stinky

#

nerddd

lyric mountain
#

😙

hallow shell
#

nice, that worked real well

#

thanks!

gilded ice
#

whos did you use

hallow shell
#

it's perfect for my purposes

gilded ice
#

but it could have been made a lot shorter also flazepe is a dumbass

earnest phoenix
#

@solemn latch

solemn latch
#

hi

lyric mountain
#

did u just Wooping?

earnest phoenix
#

i installed passport-oauth2-refresh

#

and i got this error Error: Strategy was not registered to refresh a token

#

what should i do

solemn latch
#

whats your strategy

gilded ice
#

i cant resize anything

#

140gb i cant use

#

should i just reinstall ubuntu lol

lyric mountain
#

but my strategy has a problem

earnest phoenix
#

i tried this

#
refresh.requestNewAccessToken('discord', rfrsh.dRTOKEN, function(err) {
  if(err){
    console.log(err)
  }
    console.log(refresh)
  });
#

i didn't do anything else with it

#

i'm just testing it

#

and btw

#

i logged rfrsh.dRTOKEN and i got the token

#

so

#

that s not the problem

solemn latch
#

the problem is the strategy looking at the error

drifting shell
#

Am I just being dumb here, for some reason the value of XP never changes

    public static int getLevel(long xp) {
        if (xp < getLevelXp(1)) return 0;

        int level = 0;
        while(xp > 0) {
            System.out.println("xp before: " + xp);
            if (xp > getLevelXp(level + 1)) {
                level++;
            }
            xp -= getLevelXp(level);
            System.out.println("xp after: " + xp);
        }

        return level;
    }
lyric mountain
#

use an aux variable

earnest phoenix
#

i m a dummy

drifting shell
#

Oh wait

#

I'm missing an =

lyric mountain
#

no ur not

drifting shell
#

should be >= not >

solemn latch
drifting shell
lyric mountain
#

nvm, it's actually fine because it's a primitive

drifting shell
#

yeah KEKW

lyric mountain
#

btw, wouldn't it be better to instead of subtracting xp just using a formula to calculate level?

drifting shell
#

It was never changing because the result of getLevelXp was basically 0 as it started at 0

#

I couldn't work out a formula

#

that's why I did that

lyric mountain
#

like, mine is xp = level ^ 2 * 100

#

that's the required xp for level X

#

to get level I just do level = √(xp / 100)

drifting shell
#

The XP works like this

xp = Math.round((100 * Math.pow(level, 1.4)));
then each level adds on their current XP plus ALL the xp of their previous levels

#

so level 1 is level 1

#

level 2 is level 1 xp + level 2 xp

#

level 3 is level 1 xp + level 2 xp + level 3 xp

solemn latch
#

my leveling system was based on runescape 😳

drifting shell
solemn latch
#

the math for it was super complex

#

took me a few hours to understand it completely

drifting shell
#

And I'm completely shite at math, so I genuinely don't know the formula to reverse it @lyric mountain

solemn latch
#

👀

drifting shell
#

Those look like squiggles to me KEKW

solemn latch
#

me too

lyric mountain
#

your formula is very similar to mine

#

so reversing should be the same

drifting shell
#

Huh,

lyric mountain
#

but not square root

drifting shell
#

Thats....made life a lot simpler

#

LOL

opal plank
lyric mountain
#

mine is xp = level ^ 2 * 100
yours is xp = level ^ 1.4 * 100

slim heart
#

how to make it possible to install ts source from git with npm

#

when i npmignore src/ and gitignore dist/

lyric mountain
#

my reversing calc is level = (int) Math.ceil(Math.sqrt(xp / 100f))
your will be level = (int) Math.ceil(Math.sqrt(xp / 100f, 1.4));

drifting shell
#

Uhhh, the downside is I can't use that tho because I need to get level from XP, not XP from level

lyric mountain
#

look above

#

level from xp

pallid quail
#

when in doubt, I end up plugging numbers for levels into excel, drawing a trend line and selecting "Display equation on chart" 😄

opal plank
drifting shell
#

oh

slim heart
#

wdym --dev

lyric mountain
#

level = 1.4√(xp / 100)

opal plank
#

add a dev version to the project

#

npm has a --dev flag

slim heart
#

how can that affect .gitignore

opal plank
#

use branches, it'll eb easier

#

you dont affect gitignore

#

whats in there, its there

opal plank
#

it'll ignore everything

drifting shell
#

sqrt takes 1 argument not 2

opal plank
#

branch it

torpid crown
#

All modrate commands scripts contains $onlyAdmin is this allowed?

lyric mountain
#

ah, mb

lyric mountain
umbral zealot
#

What is "$onlyAdmin" in context, what are you talking about

#

What language?

opal plank
#

dbm prob

torpid crown
#

BDscript

opal plank
#

told ya

lyric mountain
#

ew

modest maple
#

yikers

umbral zealot
#

Eww.

umbral zealot
#

But like, asking users to be admin isn't a problem at all

#

your bot shouldn't require admin though

lyric mountain
#

forgot java doesn't have a Nth root method by default

drifting shell
#

I knew there was a way to do it, just didn't have the math knowledge to work it out lol

lyric mountain
#

Math.pow(x, 1 / N) does the job

#

oh, dax

#

you're the dude from yesterday who was afraid of ending in hospital because of JS ain't u?

torpid crown
#

I still have to test it to make sure it works mods too that have permission to ban kick users and edit

safe creek
lyric mountain
lyric mountain
#

yeah it's u

drifting shell
#

@lyric mountain The function doesn't work 😔 , each level is the sum of all their previous levels XP

safe creek
#

like code my bot in 2 languages at one time so its part python and part js

#

is it possible

opal plank
#

yeah, but why

wicked pivot
#

Hi, i'm developing something i'm using fs, axios, node-fetch the problem is i need to find a way to use more mod that can help me?

safe creek
#

just curious is all

drifting shell
#

That's just a plain fori loop

opal plank
#

basically every language out there has json support

#

you could talk to eachother with json

safe creek
#

i guess so

opal plank
#

but its plain retarded to do such

pale vessel
#

json bot

#

cross languages

drifting shell
#

for (int i = 1; i < 100; i++) System.out.println(getLevel(getTotalLevelXp(i)));

safe creek
#

but i could do it correct?

opal plank
#

like i said, yes, but its idiotic

safe creek
#

mmmk

#

thanks

opal plank
#

if you plan to showing off by doing that, the opposite will happen

safe creek
#

no im just curious

#

tbh

opal plank
#

just a headsup lol

lyric mountain
safe creek
#

lol ik dw

#

just was curious

drifting shell
#
    /**
     * Calculates the required amount of XP to level up based on level.
     *
     * @param level The level to calculate the XP of.
     *
     * @return The amount of XP required for level up.
     */
    public static long getLevelXp(final int level) {
        return Math.round((100 * Math.pow(level, 1.4)));
    }

    /**
     * Calculates the total amount of XP required to reach a level.
     *
     * @param level The level to calculate the XP of.
     *
     * @return The total amount of XP required to reach that level.
     */
    public static long getTotalLevelXp(final int level) {
        long total = 0;
        for (int i = 0; i <= level; i++) {
            total = total + getLevelXp(i);
        }

        return total;
    }
lyric mountain
#

no no

#

not Math.pow(level, 1.4)

#

Math.pow(level, 1 / 1.4)

drifting shell
#

You want me to change my getLevelXp logic?

modest maple
#

I mean parts of my bot are in Rust and Python bloblul

drifting shell
#

or the getLevel logic?

lyric mountain
#

oh nvm

modest maple
#

but thats pretty easy todo cuz C api

lyric mountain
#

forget forget

drifting shell
lyric mountain
#

where's getLevel?

drifting shell
#
    public static int getLevel(long xp) {
        return (int) Math.ceil(Math.pow(xp / 100f, 1 / 1.4));
    }
onyx hare
#

is this the right way to grab the PNG (never grabbed a local img in that hasnt been in the same are than index
attachment://../Images../Star_Wars_As_ASCII.png

pale vessel
#

no

#

you have to attach the file with the filename and use attachment://name.extension

lyric mountain
#

like, that calc won't work if there's a loop involved

#

would need to figure out a way without one

earnest phoenix
#

Who wants the code to my bot?

lyric mountain
#

and it enters in, caham, logarithmic

modest maple
pale vessel
earnest phoenix
#

i said who wants it

pale vessel
#

nobody

earnest phoenix
#

ok

lyric mountain
#

@drifting shell could u give me a sheet of 5 results returned by getTotalLevelXp?

modest maple
#

Intersting seeing the patterns that most bots follow with their short descriptions

drifting shell
#

Which level?

lyric mountain
#

1 to 5

drifting shell
#

1-5, 5-10?

#
100
364
830
1526
lyric mountain
#

desmos time

cinder patio
#

bruh

#

my galaxygate order was held for a manual review and I need the vps asap

solemn latch
#

tag dragon, hes always on point

onyx hare
#

damn it didnt go as planned but looks alright

modest maple
lyric mountain
#

@drifting shell where did that 830 come from?

#

I almost matched it

drifting shell
#

level 3 is level 1 + level 2 + Math.round((100 * Math.pow(3, 1.4))

lyric mountain
#

ah ok

#

level 2 is level 1 + Math.round((100 * Math.pow(2, 1.4)) right?

drifting shell
#

yea

lyric mountain
#

so level 3 would be level 2 + Math.round((100 * Math.pow(3, 1.4))

drifting shell
#

the Math.round(blah) is what completing level 2 would put you at

#

yeah

lyric mountain
#

because level 2 is already a sum of 1 and 2

drifting shell
#

the total XP is a sum of all the previous levels + Math.round((100 * Math.pow(level, 1.4)))

lyric mountain
#

nope, can't figure out a way to keep all previous values without loop

#

my formula basically ended as a fibonacci series

drifting shell
#

Fair enough

#

I guess my way is the best for now anyway

lyric mountain
#

sure

#

the probably is a way to revert it using loops

#

I'm really dumb

#

boi

#

just subtract and increase a level variable

drifting shell
#

It gets added using a foreach so my thought was to reverse the foreach

#

yeah thats what I did KEKW

lyric mountain
#

yeah, I guess that'll be the only way

#

start with loop - end with loop

drifting shell
#

this is the way

lyric mountain
#

do you now da wae

drifting shell
#

that was a mandalorian reference, im very sorry

umbral zealot
#

Do you know the way to san jose?

lyric mountain
#

that was a dead meme reference, didn't watch mandalorian

#

only know what reddit posts tell me about it

drifting shell
#

give or take a hundred miles in either direction

umbral zealot
#

heh

drifting shell
boreal iron
sterile lantern
#

how do you display the amount of users in the guild

#

message.guild.members.size?

nimble kiln
#

<guild>.memberCount

sterile lantern
#

ty

shy turret
#

excuse me wtf

umbral zealot
#

makes perfect sense for javascript

#

Those 2 arrays are not the same array

#

They're 2 different arrays with the same values. So no, they're not equal.

shy turret
#
let test = [false, false, false, false, false];
let test2 = test;
test == test2;

well this works

umbral zealot
#

{} == {} is also false, because one object is not the same as the other - they're 2 different memory references.

shy turret
#

ig that makes sense

umbral zealot
#

Yes that works because it is the same array, since you made both variables point to the same memory reference.

opaque jungle
#

hey anyone have a legion reveant bot that picks up and turns in quest without me manuallly doing it?

umbral zealot
#

That sounds like cheating in games and we can't help you with that.

boreal iron
#

Imagine multiplayer game servers ... 554/1000 players AI vs AI

#

Screaming, rage quitting and cheating AI ... that’s the future I guess

proven lantern
#

that should be a game. build your own ai and have it take over the world

solemn latch
#

plauge inc, but with an ai taking over computers

boreal iron
#

lmao

#

_now we’re laughing _

safe creek
#

is the discordpy extension "Jishaku" good? it appears it shortens stuff like ctx.guild down to _guild etc and is described as "A discord.py extension including useful tools for bot development and debugging."

slender thistle
#

It's quite helpful, yes

lyric mountain
safe creek
earnest phoenix
#

dms open

safe creek
#

ok?

midnight blaze
#

is there a way to access the dhcp server somehow? Or is there like a way to scan messages like "DHCPDISCOVER" from your own simple homework? I know it is easy in windows server, but how to do that in windows 10? When I go to configuration in Windows 10 all you can do is activate DHCP but DHCP is a server that runs on port 57, how to access that server(ik, you can not access it like a vps with a distro, but there must be something one can do)?

nimble kiln
#

I dont think the DCHP server is available on clients

#

(Through windows features)

earnest phoenix
#

can someone please explain how to make a whitelist and restrict people from using this bot? I brought it in my server and cant stop people from sniping XD

nimble kiln
earnest phoenix
#

?_?

#

oh god

#

thanks

nimble kiln
#

Click "Get Support" in the bottom right of the bot page

#

🙂

earnest phoenix
#

😊 thank you