#development

1 messages ยท Page 1998 of 1

oblique flame
#

alr

copper cradle
#

yeah I figured as much

#

my c/c++ installation is a bit fucked tho

#

I guess imma wait till I switch to linux to start doing anything

neat ingot
#

I'm wondering what kind of structure folks database' have. Like, assuming you want to allow users to have different data saved for each guild - rather than having data only be global - do you:
A: use both user and guild id's to fetch the data object to be saved. eg: ```js
const user = db.fetch({user: 'some-id', guild:'some-id'});

**B:** have some user account that stores information for each guild that user is in. eg: ```js
const account = db.fetch({user: 'some-id'});
const user = account.getUserForGuild('some-guild-id');```
**C:** something else (please share)
sudden geyser
#

I'd prefer having the user settings be under the guild since it implies ownership, but if that isn't the case, then A.

#

By "implies ownership", I mean who really owns some dataโ€”the user, or the guild? If the guild is deleted, so should any data associated with it. Yet option B tries to own that data and leaks into guilds, which I don't like.

neat ingot
#

ahh yea, that is a pretty valid point

#

my main thinking was that, with option B, it would be much easier to manage both global and guild specific information. for example, a user might purchase credits that can then be redeemed on any guild, but they are then used

#

or perhaps they might set some reminder, which i would consider a user specific interaction more than a guild one

#

option B kind of feels more like how discord manages things internally too, with a user and member differentiations

#

balls out: i use option A and was thinking of switching to B ๐Ÿ˜„

void pier
#

How to get about me of the user?

neat ingot
#

Apparently bots arent allowed that info. idk if its now available or what

#

i know you can get a users banner now

sudden geyser
#

It's a hard problem for me to describe as it depends on what kind of database you're using. For example, if you're using MongoDB, I highly discourage B since it encourages a coupling of those documents that can be harder to manage later (http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/), although it concerns documents inside documents. If you're just dealing with users that have relations to guilds, it's not much of a problem to have guilds inside the user structure, but I'd still flip it since I think guilds should bridge to users rather than the opposite.

neat ingot
#

๐Ÿ˜“ I use mongodb for everything

#

but yea, i do see what you mean

#

so then how would you manage the global datas?

sudden geyser
#

Since global data is about the user, I'd just put it in the user

neat ingot
#

but if a user is specific to a guild, that cant work?

spark flint
#

Is there an event for Username changes? Djs

neat ingot
#

like, what if that user is in many guilds, which one stores the user with the global data?

spark flint
#

Thatโ€™s nickname tho

neat ingot
#

idk if thats only nickname in guild or real username, but i'd imagine when real username changes so does guild nick (if unset at least)?

spark flint
#

Iโ€™m trying to detect when an accounts name is changed to ModMail etc as Iโ€™m trying to stop scam accounts :)

neat ingot
#

use account id instead of name?

spark flint
#

Account ids donโ€™t change tho

neat ingot
#

exactly, then there is no need to even listen ๐Ÿ˜„

spark flint
#

Iโ€™m trying to make it auto kick them as they mass DM users, so I kind of need to check username changes tho

neat ingot
#

not sure, i'd try that event, and give yourself a nickname on some test server, change your username, and see if the event fires?

sudden geyser
neat ingot
#

ahh ok, so instead of storing the document internally, you would store the id and then get that data from another collection?

spark flint
#

// userUpdate
/* Emitted whenever a user's details (e.g. username) are changed.
PARAMETER TYPE DESCRIPTION
oldUser User The user before the update
newUser User The user after the update */
client.on("userUpdate", function(oldUser, newUser){

sudden geyser
#

Assuming you're referring to users, yeah. User is a reference here pointing to an actual user document. What's cool about this structure is the user does not concern itself with the guild, yet the guild gets to control the user however it feels.

neat ingot
#

so would this be a more accurate psuedocode for what your suggesting?: ```js
const user = db.fetch({user: 'some-id'});
const guild = db.fetch({guild: 'some-id'})
const member = guild.getDataForUser(user);

sudden geyser
#

Not exactly sure, but you could probably write it that way. The guild knows its members and it knows the users it refers to (guild -> members -> nth -> user (ref)). I'm thinking more from the schema side.

rose lance
#

can I use the js function getElementsByClassName() only onto the document, or also on an element I have in a variable?

neat ingot
#

still kind of have the whole subdocument issue though for guild's member data. ๐Ÿ˜„

sudden geyser
#

Yeah, but if you went on and fully separated all the documents and only provided references, you'd end up with some pseudo-SQL that's much harder to manage since MongoDB is not optimized for it. So, for now, I think it's fine.

neat ingot
#

lol yea, I do kind of like the ease of use mongo (mongoose.js) brings ๐Ÿ˜„

rose lance
# neat ingot

weird, cause I'm getting this error from my function

function show_info(e, a) {
    e.setAttribute('onclick', 'hide_info(this, ' + a + ')')
    e.setAttribute('class', e.getAttribute('class') + ' pressed');
    let parent_el = e.parentElement.parentElement.nextElementSibling
    let data_el = parent_el.getElementByClassName(a + '-data')[0]
    data_el.setAttribute('class', data_el.getAttribute('class').replace(' hidden', ''))
}```
neat ingot
#

are you sure that it is?

#

e.parentElement.parentElement.nextElementSibling seems... promiscuous...

rose lance
#

not sure what you mean

sudden geyser
#

My critiques on the user was just about separating two conceptually different documents. A member is bound to a guild, so it's not that bad if it's in the document for now.

#

But the underlying user should stay out of it

#

Cover in red tape

neat ingot
#

lol yea, you do make a fair argument ๐Ÿ™‚

neat ingot
#

eyy, happy cake day @quartz kindle

#

just spotted that lol

neat ingot
# rose lance

that looks bootstrappy. i like bootstrap ๐Ÿ™‚

#

idk, according to the docs that function can be called on any element

rose lance
#

almost, it's tailwind ๐Ÿ˜„

neat ingot
bright hornet
#

im using a discord-rpc package, i want to ask, why the buttons is not working?

neat ingot
#

ahh, i've heard of that, never tried it though ๐Ÿ˜„

#

discord-rpc never works for me ๐Ÿ˜ฆ

#

i think its cause i have nginx server running on my machine ๐Ÿ’”

bright hornet
wheat mesa
neat ingot
#

just never connects, disconnects immediately

wheat mesa
#

they work for everyone else looking at your profile though

neat ingot
#

i think nginx is like, restricting the port or something

rose lance
# neat ingot

ooh I found it, I wrote getElementByClassName instead of getElementsByClassName ๐Ÿคฆ

wheat mesa
bright hornet
#

Thats how i solve my problem about disconnections

neat ingot
wheat mesa
#

the websocket rpc has been broken for ages

#

you can only do it via ipc

bright hornet
#

^

wheat mesa
#

that's why you can't run it remotely

neat ingot
#

i tried both ipc and websocket i think?

#

tbf i didnt spend much time trying ๐Ÿ˜„

bright hornet
wheat mesa
#

ipc has to be run on the same machine that you're running discord on

neat ingot
#

yea it was

wheat mesa
#

not sure what your problem was with that then

#

personally I had no problems

bright hornet
#

Did you tried it too? The buttons? Is it working?

neat ingot
wheat mesa
#

were you trying to run an rpc on a bot..?

neat ingot
#

thats the error i get when trying to use some discord-rpc example project

#

no, its just a subfolder of my bots folder ๐Ÿ˜„

wheat mesa
#

did you set the clientId thing

#

also you need to have an application for it in the dev portal

neat ingot
#

yea, I tried both my bot application id and my user id lol (im nub, shh) ๐Ÿ˜„

wheat mesa
#

you can't do that

#

your bot application ID is not the same as your rpc application id

neat ingot
#

ahhh ok

wheat mesa
#

you need to create a separate application for the rpc on the portal and use that application id instead

neat ingot
#

so create a specific application for just the rpc?

wheat mesa
#

yes

neat ingot
#

done ๐Ÿ™‚

#

so i just use this application id? i dont have to set any configuration on the dev dashboard?

wheat mesa
#

yup

neat ingot
#

same error still ๐Ÿ˜„

wheat mesa
#

I'm not sure if you need to set this or not but I have this in mine

neat ingot
#

hmm

wheat mesa
#

also can you show the code you're using?

neat ingot
#

const clientId = 'xx';

const {Client} = require('discord-rpc');
const scopes = ['rpc', 'rpc.api', 'messages.read'];
const client = new Client({transport: 'ipc'});

client.on('ready', () => {
    console.log('Logged in as', client.application.name);
    console.log('Authed for user', client.user.username);
});

// Log in to RPC with client id
client.login({ clientId, scopes });
#

still same error with the redirect too

#

lemme stop docker/nginx for a minute

wheat mesa
#

I'm still confused, what do you need docker/nginx for

neat ingot
#

nah, same error lol

#

multiple bots, db, metrics, websites, etc

wheat mesa
#

yes but why would that change your rpc..?

#

try not using the scopes btw

neat ingot
#

rpc connects to the discord programs internal server (iirc), nginx restricts access to routes and ports

wheat mesa
#

I've never messed with rpc scopes or had the need to, so I'm not sure if those scopes are affecting it or not

neat ingot
#

idk, i got my example direct from the docs ๐Ÿ˜„

wheat mesa
#

don't follow those, extremely outdated

neat ingot
#

๐Ÿ˜“

rose lance
wheat mesa
#

I just do ```ts
import rpc from 'discord-rpc';

const client = new rpc.Client({ transport: 'ipc' });
// do stuff with client
await client.login({ clientId: 'client-id' }).catch(console.error);

#

no idea what the scopes would even do

copper cradle
#

ok i directly linked the dlls and the errors seem to have vanished, now I'm getting exit status 5 from ld

#

zamn

neat ingot
#

omfggg... i finally got it working (rpc) and it wasnt updating because i didnt have my status thing enabled lmao

feral stratus
#

can some teach me how to make a bot that returns gif

dry imp
#

returns gif from what

#

what language

earnest phoenix
#

We cannot teach you how to clone schizo bot

copper cradle
#

I hate cpp

#

the include path is right and everything is there

#

how can there be an undefined reference to a shitload of functions

#

idk what I'm doing wrong

#

at least it's not a segfault

rocky hearth
#

how do I stop a flex item, to grow, when its content changes.
I hv tried setting, flex: 0 0 100px.

rocky hearth
earnest phoenix
#

skill issue

rocky hearth
#

u can hover over, classes, to see its styles being applied

bright hornet
#
try{
        const com = client.commands.get(command) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(command));
        com.execute(message, args)
    } catch(err) {
        console.log(err)
    }``` why aliases is not working?
split hazel
earnest phoenix
split hazel
#

i dont think its an error

#

probably their aliases just not working

woeful pike
#

I HATE how javascript doesn't have a package private modifier OMG

earnest phoenix
woeful pike
#

you want to refactor a thing for better organization? no problem, just expose this function to be imported GLOBALLY by EVERY possible file in your entire project

crystal wigeon
#

hey so, how do I get my sharded discord bot app running after i compile the ts code with tsc? the file im trying to exec after compiling just ends without any logs

#
    execArgv: [ "-r", "ts-node/register" ],
    totalShards: "auto",
    token: DISCORD_TEST_BOT,
    respawn: true
});```

This is my shard manager for shard.ts
woeful pike
crystal wigeon
#

after running tsc, i removed the execArgc and changed the file to client.js

#

didnt work

woeful pike
#

in js you HAVE to export everything globally and it destroys intellisense

crystal wigeon
#

oh what

#

wym

woeful pike
#

not talking to you

crystal wigeon
#

lel

#

but yeah, help me out too if you can

woeful pike
#

dunno I don't make discord bots

crystal wigeon
#

no worries, i'll wait for someone else to reply

earnest phoenix
woeful pike
#

java uses the term package to refer to individual directories. In ESM's case I would expect a modifier that exposes an identifier only to the directory it's in (and above)

#

rust has this too

#

it makes organization sooooo much easier

earnest phoenix
#

Oh I see what you mean

woeful pike
#

with js I constantly have to think about is it worth to move this into a separate file and be forced to expose this small helper function to the ENTIRE WORLD vs just keeping it in the same file and taking the organizational L

earnest phoenix
#

Yeah that's not possible in JavaScript at all, although it doesn't really help organization much, but I see what you're talking about

woeful pike
#

there's absolutely 0 reason for this object to be used outside of the directory it's in, yet if I want better organization I have to litter the autocomplete of every other file with it

#

it absolutely helps organization

earnest phoenix
#

It does, I mean not too much but it helps the organization significantly if it's a large project, although I remember seeing a proposal to only export values to a certain set of directories or files, but I'm unsure what happened to it

#

It's like entirely gone

woeful pike
#

you can live without it but it's a net benefit with no downside

#

forces you to think about how you structure your folders and files which is not a downside in my book

earnest phoenix
#

Yeah, absolutely

#

And was only proposed to TypeScript

#

But the proposal for JavaScript is just poof

woeful pike
#

ye regular js doesn't matter I only use TS anyways

#

this needs to be enforced at the compiler level though. If I have to write comments I don't even want it

crystal wigeon
#

my man google

cinder patio
woeful pike
#

not the kind of thing you should have work with a linter since the idea is to scope available identifiers and not even have them be reachable instead of filtering "the entire world" essentially, by a comment

cinder patio
crystal wigeon
#

i ran tsc, changed the client.ts to client.js tried running it with node

#

it just finishes execution

earnest phoenix
crystal wigeon
#

also if this helps I use ts-node -r dotenv/config path/to/tsfile
To execute the shard.ts

stiff lynx
#

Why "messaggiPing": "Ei ${message.author}, per vedere la lista completa dei miei messaggi utilizza **/aiuto**."
message.author doesnt work as mention?

earnest phoenix
#

"..." -> `...`

stiff lynx
#

`

#

or I simply dont know how

earnest phoenix
#

Oh you're doing that in a JSON file, then you gotta evaluate them instead using something like the global eval() function after wrapping them in strings or replacing them yourself in a way that would match them using regex if you want, I recommend the first way

stiff lynx
#

eval() kinda run code?

#

If you construct an arithmetic expression as a string, you can use eval() to evaluate it at a later time.

#

google is my friend

earnest phoenix
#

For example:

const { messaggiPing } = /* JSON object here. */;

const wrappedValue = `\`${messaggiPing}\``;

// Where you have the `message` parameter/variable.
const evalutedValue = eval(wrappedValue);

And it should get replaced with the value in the current scope

#

Although you may need to inspect the string value with the inspect() method from the built-in util module if the strings in the JSON file are using different types of quotation marks that may interfere as you'll be evaluating it in this case

#

A different approach to this case is to make a helper function to replace given values in a string and return them

#

As this way can be better than evaluating

function replacePlaceholderString(str, ...values) {
  let i = 0;

  return str.replaceAll('{}', () => values[i++]);
}

// Here we have a string with placeholders.
const someStr = 'Hello there {}, {}';

const replacedString = replacePlaceholderString(
  someStr,
  'Alfred',
  'how was your day?'
);

console.log(replacedString);
// 'Hello there Alfred, how was your day?';
#

@stiff lynx ^

stiff lynx
earnest phoenix
#

You're welcome

spark flint
#

its ok now

#

i did sudo

atomic kindle
#

because you don't read errors

spark flint
#

Itโ€™s because I usually use root

earnest phoenix
#

Learn how to read errors

neat ingot
earnest phoenix
#

The terrible user for eval

neat ingot
#

that way, you can provide access to specific variables within the 'eval scope', but it stops reference to any object you havent explicity passed

#

use* lol

sudden geyser
#

is that actually safer nvm

earnest phoenix
#

Although, I suggested to use something else to use other than the global eval() function, which to use placeholder and replace them, which they went ahead and used

#

The eval() idea came to my mind first as if they might have something that actually needs it

neat ingot
#

^ from my game engine ๐Ÿ™‚

#

~shows how to define objects to be passed to the 'eval' function

cinder patio
#

eval and safe can't be used in the same sentance

neat ingot
#

:p

#

but yea, its not perfect. evaluating stuff on the fly just isnt.

#

at least my approach stops access to variables that arent defined within the function, such as process

cinder patio
#

errr you can access process after everything you're doing?

neat ingot
#
eval("a + b", null, true, {a:1, b: 2})```
#

how are you going to access process within that string?

earnest phoenix
#

The process object is global, it's accessible everywhere no matter what you do

cinder patio
#

within THAT string no but that's not the point

neat ingot
lyric mountain
#

cant u just create a new process that runs sandboxed from the rest of the bot?

cinder patio
#

you could just pass process.exit() as the string though, you aren't doing anything to stop that

lyric mountain
#

I mean, that's how I do

earnest phoenix
#

You can filter out some globals we've defined as an operation, but not things like eternal globals such as the process object (the process will still exist, although you have to access from an internal binding) mmLol

lyric mountain
#

despite my eval being limited to me only (gotta trust noone)

cinder patio
#

You could do

const __process = process;
process = undefined;
// eval stuff
process = __process;
#

and you'll have to do the same for eval, require, Function

lyric mountain
#

evalString.replace("process", "bingus")

cinder patio
#

and what if one of the strings inside the eval function contains "process"

#

Also you can access the process in other ways

#

globalThis.process

#

bad example

lyric mountain
#

it'd become globalThis.bingus

cinder patio
#

globalThis["pro" + "cess"]

lyric mountain
#

I believe making a sandboxed process would be the best option

#

no need to worry about globals, just deny any I/O perm

cinder patio
#

mhm

neat ingot
#

ok yea i did just double check and i was wrong, process is still available lol. I'm sure I tested that before and it just wasnt a thing ๐Ÿ˜ฆ

lyric mountain
#

skill issue

neat ingot
#

tbh, it does seem like just creating a vm sandbox process would be better

lyric mountain
#

ye, especially since creating new js processes is easy enough

neat ingot
#

but my game engine runs in browser - so not an option there ๐Ÿ˜›

lyric mountain
#

hm, that's tricky then

neat ingot
#

only thing that gets evaaluated is sprite position data though ๐Ÿ™‚

#

its not a major concern lol

lyric mountain
#

what if u send the eval code back to the server and create a new process there

cinder patio
#

if it runs on the browser then it doesn't really matter

lyric mountain
#

true, user will shoot in their feet

hybrid cargo
#

just remove eval, ez

earnest phoenix
#

Noted, removing the global eval() function from the V8 engine rn

cinder patio
earnest phoenix
#

y'all really not trust your own eval input

neat ingot
#

experience told me not to ๐Ÿ˜‚

earnest phoenix
#

Nowadays you can barely trust yourself

lyric mountain
#

never trust an user
if you're testing the software, you're the user
never trust yourself

lyric mountain
#

anuser

earnest phoenix
#

abuser

distant cobalt
#
client.on('messageCreate', message => {
    console.log("hi")
});``` it doesn't print "hi" did i do the `client.on` wrong??
earnest phoenix
#

did u send any messages?

distant cobalt
#

yeah

earnest phoenix
#

and are you on v13?

distant cobalt
#

im not sure

earnest phoenix
#

Well check cause iirc v13 is what made it so message -> messageCreate

spark flint
#

do you have message intents

earnest phoenix
#

iirc that doesn't matter

#

message intents is just for the content

spark flint
#

you still need message intents when defining client iirc

hybrid cargo
neat ingot
#

wait, you still get the message event without content if you dont have the intent?

spark flint
#

i made that mistake KEKW

neat ingot
#

do you get the user who messaged too? ๐Ÿ˜ฎ

hybrid cargo
earnest phoenix
#

You get everything on the message except the content of the message

neat ingot
#

ooohhh, snazzy! ty for the info โค๏ธ

earnest phoenix
#

Never knew npm ls was a thing

neat ingot
#

I removed access to those global objects during the eval process which works well enough for that use case, but im wondering how secure i can actually get it

earnest phoenix
#

Are you using this on a bot?

neat ingot
#

atm yes, but its a small class i pulled from my browser based game engine

#

^ full class

earnest phoenix
# neat ingot

global also exists, every global constructor can get access to the Function constructor easily

neat ingot
#

ooh yea good call ๐Ÿ˜„

earnest phoenix
#

Array.constructor and others mmLol

neat ingot
#

i mean, theres only so much i can restrict before there is no point in having such a thing ๐Ÿ˜„

compact pier
#

does nodejs have native fetch package?

sudden geyser
#

Not yet

compact pier
#

sad

sudden geyser
#

Is the input arbitrary data from the user or contained code only written by the dev

haughty bough
#

Hello. I'm trying to deploy some slash commands and I always get 'DiscordAPIError[50001]: Missing Access', even though I already put applications.commands in the URL scope. Any idea what it could be?

lyric mountain
haughty bough
#

Yes

lyric mountain
#

Are u sure the source of the exceptions is the deployment of slashes and not somewhere else?

haughty bough
left badger
#

So.. My bot got added to top.gg like 4 days ago and got 100 servers instant I asked for verification but here is the problem

#

I wanna stop my growth of bot untill it gets verified

marble juniper
#

lol

marble juniper
#

Cuz after that nobody can invite it anymore

#

unless it becomes verified

left badger
marble juniper
#

Oh wait u got suspicious growth

left badger
#

Yea

marble juniper
#

Its discords way of telling u "ur bot is on a botlist"

left badger
marble juniper
#

Well thats not the fault of top.gg lol

lyric mountain
#

You should verify THEN add to top.gg anyway

marble juniper
#

Yes

left badger
marble juniper
#

Yes

left badger
earnest phoenix
# left badger Mean?

A joke is a display of humour in which words are used within a specific and well-defined narrative structure to make people laugh and is usually not meant to be taken seriously. It takes the form of a story, usually with dialogue, and ends in a punch line. It is in the punch line that the audience becomes aware that the story contains a second, ...

lyric mountain
#

No no, the damage was already done

marble juniper
#

I think if it says suspicious growth u can't get verified

#

u need a whole new bot account and app lol

left badger
#

Oo lol

marble juniper
#

but I may be mistaken

lyric mountain
#

Not really, u can

earnest phoenix
lyric mountain
#

But that means removing a lot of guilds

marble juniper
#

Yeah

left badger
marble juniper
#

but hitting the same amount of guilds is not difficult

#

by any means

left badger
#

Like how much?

lyric mountain
#

Idk, many

left badger
#

Its current is 200 lel

marble juniper
#

you can lose at Max 250 cuz of ur suspicious growth thingy

earnest phoenix
lyric mountain
#

Then u need to get a steady amount of invites across a long period

#

Like 2-3 months

#

Instead of 100 guilds/week

left badger
#

Ok what if I let it grow till 250 and it will stop automatically and wait for verification

#

??

lyric mountain
#

No

#

You'll stay locked until they believe ur not sus

earnest phoenix
#

I remember someone I had never met before said I will help you grow ur bot and then they proceeded to make 17 guilds and invite my not

left badger
#

Hmm can I change my invite link on top.gg to other bot?

marble juniper
#

No

earnest phoenix
#

It didn't reach enough guilds for verification because I deleted it

marble juniper
#

it has to match the bot u see on the top.gg page

#

lol

left badger
#

Is it ok if I remove from top.gg for now and readd after verification

earnest phoenix
earnest phoenix
marble juniper
#

Imagine u were trying to invite mee6 but you get dank memer instead

#

how stupid would that be

earnest phoenix
marble juniper
left badger
#

K then ty for help I will remove bot from. Top.gg for now

#

Let's hope.for.best

marble juniper
#

๐Ÿ‘

#

Never had to deal with the suspicious growth stuff before so idk

#

lol

left badger
marble juniper
#

Yeee

left badger
#

Which bot?

marble juniper
#

and not because I specifically made a bot just to get it

earnest phoenix
marble juniper
#

Filters messages and stuff

#

with the power of ai

left badger
#

I seen name somewhere

#

I d k on top.gg or server but somewhere

marble juniper
#

I got a competitor with the same name

#

but they succccc

#

lol

earnest phoenix
#

Did you write the bot yourself?

marble juniper
#

Yes

left badger
#

Lol Lemme remove bot and come again

marble juniper
#

Fully

earnest phoenix
#

Your 20 stackoverflow tabs say otherwise

marble juniper
#

I also wrote the api my bot uses lol

rose warren
earnest phoenix
#

Hello cheese

marble juniper
earnest phoenix
#

sadge

rose warren
#

Yeah I know dog_Joy

sage bobcat
earnest phoenix
#

mac gib me your account for verfied deb badge i will give you 2||.||00000 btc

rose warren
#

2 btc? Fine

left badger
#

K I removed bot from top.gg I will reapply when it gets verified ok?Mac sir?

earnest phoenix
#

@rose warren sir ^

left badger
#

Feels bad when you remove bot and it gets removed from trending bot list page angeryBOYE

rose warren
#

Yeah that's fine

wheat mesa
sudden geyser
#

Mm, no early supporter badge

#

I'll buy it for -2 btc

wheat mesa
#

my account is almost 6 years old though!

cinder patio
#

What about early supporter AND verified dev :)

wheat mesa
#

everyone with these cool badges

quartz kindle
#

pshh what about verified AND top.gg certified :^)

wheat mesa
#

what about a 5 year 10 month 16 day and 23 hour old account :^)

#

with no badges

#

๐Ÿ˜‰

fair axle
#

slash commands become invalid in how many seconds?

quartz kindle
#

3

sudden geyser
#

While I'm here, what the fuck is it with websites adding tab bars

#

I expect that in apps, but I see it on sites like dev.to and it freaks me out

boreal iron
#

Whereโ€™s my without without badge badge?

earnest phoenix
#

My account is 4 years old am I special

wheat mesa
boreal iron
#

Yea, you are special!

#

Shut up it is!

wheat mesa
#

mine is 6 months older than yours mmLol

boreal iron
#

No no no must be a time zone issue

earnest phoenix
boreal iron
#

Very special!!1! KEKW

stiff lynx
#
      .setColor(config.colori.embed)
      .setTitle(
        `${config.emoji.persona} Server Totali: ${client.guilds.cache.size}`
      )
      .setDescription(
        client.guilds.cache
          .sort((a, b) => b.memberCount - a.memberCount)
          .map((r) => r)
          .map(
            (r, i) =>
              `**${i + 1}** - ${r.name} | ${r.memberCount} Membri\nID - ${r.id}`
          )
          .join("\n")
      )
      .setThumbnail(client.user.displayAvatarURL())
      .setFooter({
        text: `NOVABOT - Comando eseguito da ${interaction.user.tag}`,
      });

    interaction.followUp({ embeds: [embed] });```

No err in this code but I have a question.
For slice the list in more than one page, I have to map the servers, slice them and put them inside an embed?
lyric mountain
#

I hope that aint a public command

whole glen
#

what stats are posted to top.gg with auto poster

boreal iron
#

Your server count

whole glen
#

ok

boreal iron
#

(and shard count if there is some)

stiff lynx
#

How can I block interaction for buttons and select meno for users different from who used the slashcommand

whole glen
#

how many embeds can u send at once?

lyric mountain
lyric mountain
#

That's privacy breach

stiff lynx
stiff lynx
#

luckily never put that in /help

left badger
#

Hmm

left badger
#

I did as you told now let's wait and watch

lyric mountain
#

??

left badger
#

Removed bot from top.gg and I have maintained server count to 90 servers

cinder patio
left badger
#

How much time and I can reapply for top.gg?

lyric mountain
#

After u get verified

left badger
lyric mountain
#

Depends

#

I don't really have an ETA for how long will discord take to verify ur bot

spark flint
#

how can i get member count across all servers

#

discord.js

#

client.users.cache.size gets cached, i need theactual total

boreal iron
#

guild.memberCount

spark flint
#

i mean for all servers my bot is in

boreal iron
#

If you dont have the member intent, anything else wont be accurate anyways

spark flint
#

i have member intent

boreal iron
#

than, it's up to date

spark flint
#

ok

boreal iron
#

then use this guild property

#

client.guilds.cache.map((guild) => guild.memberCount);

#

even if FakE doesn't like map()

cinder patio
#

also reduce would be better

boreal iron
#

HE DIDN'T SAY HE WANTS THE COUNT OF EACH IN TOTAL

#

all the evil critics

cinder patio
#

member count across all servers

boreal iron
#

shhhh

spark flint
boreal iron
#

You didn't see anything

spark flint
#

it reutnred 365732 but that doesn't seem right, it used to be 500k+ when i used discord.py lol

cinder patio
#

ur bot must suck :c

spark flint
cinder patio
#

people are kicking it

spark flint
#

not left any servers for like 2 weeks lol

boreal iron
#

OK CRITICS ARE ESCALATING

#

/vote ban google evil crititcs

#

bot dead

cinder patio
#

get rekt

cinder patio
spark flint
#
var total = 0
client.guilds.cache.map((guild) => {total += guild.memberCount})

total```
#

am evalling so

lyric mountain
#

Cache

cinder patio
#

Try client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0) Though ur crooked code should also work

lyric mountain
#

Not all guilds are cached at all times

cinder patio
#

pretty sure discord.js caches all guilds

boreal iron
#

Of course they are

spark flint
#

client.users.cache.size gets cached, i need theactual total

lyric mountain
#

Why does it use ".cache" then?

#

Tf are those d.js dev decisions

boreal iron
#

bc they are cached?!

#

wtf

cinder patio
#

Though I am not sure if it updates .memberCount on guild join / leave

boreal iron
#

are you drunk again

lyric mountain
#

But if something is cached at all times, is it even a cache?

boreal iron
#

we had this a while ago

cinder patio
#

not having cache in there implies it's always getting fetched

boreal iron
#

@spark flint hey you got some py test environment to test something for me?

spark flint
#

its great for testing code without logging in

boreal iron
#

Not found error: This is not the page you're looking for.

spark flint
#

mb

boreal iron
#

nah need to get something to test from github

whole glen
#

Is there a good top.gg logo icon I could use for my bot top.gg command?

split hazel
whole glen
#

I mean a higher definition one and not just a screenshot of the server icon

cinder patio
sudden geyser
#

seems bright

cinder patio
#

That's the favicon for the website

split hazel
#

especially on a brother

#

that hurts

whole glen
#

Sry

split hazel
#

its ok

whole glen
split hazel
#

i have a fun project idea

#

since i used to be a mod bot reviewing is kinda lame

#

repetitive

#

i was thinking a bot that auto reviews

#

now most bots block other bots but

#

no one has to follow the rules:)

#

you can probably scrape the help command for commands with https://wit.ai but the hard part is probably the parameters

sudden geyser
#

Like for the submission process?

#

I think Xetera wrote some software to automate the process.

spark flint
sudden geyser
#

Yeah that

#

Though it's more specialized

woeful pike
#

to be fair I haven't finished this yet lol

#

most of the work is still manual

#

I had an amazing idea for this but it became completely unusable because of slash commands

sick agate
#

kekw

whole glen
#

how can i set thumnail to local file? vote.setThumbnail('./images/icon.jpeg')

sterile lantern
#

okay so i have a index.js file running 24/7 but it seems to run into some errors often (due to some web-fetching errors) and i do have it log the error but sometimes it just crashes and i have to manually restart it. how would i make it so it ignores these errors, and if it does encounter one, to ignore it? i would use the return function but that would just stop the file from running (its on a vps)

solemn latch
#

typically you want to catch the errors and handle them, not ignore them.

#

ignoring errors can lead to more errors

sterile lantern
#

well yes i have it catch and console.log

#

but then it still crashes

#
const logo1 = await axios.get(`https://thumbnails.roblox.com/v1/groups/icons?groupIds=${GROUP_ID}&size=150x150&format=Png&isCircular=false`).catch(async err => {
    console.log(err)
})
const logo = logo1.data.data[0].imageUrl
    let response = await axios.get(`https://groups.roblox.com/v1/groups/${GROUP_ID}/`).catch(async err => {
    console.log(err)
})```
solemn latch
#

and whats the actual error?

sterile lantern
#
status: 500,
statusText: 'Internal Server Error',```
#

it usually a bunch of lines with this

#

it restarts by itself but at some points it just crashes

solemn latch
sterile lantern
#

yeah but if i stopped the function it wouldnt run again

solemn latch
#

the function calls itself?

sterile lantern
#

hmm wait do you mean stopping w like return

#

the function is in a setInterval thing

#

every 40 seconds

solemn latch
#

you can return in a function in an interval

sterile lantern
#

so if there was an error, return it and then it'd run again in 30 secs right

#

i mean i have a return but it doesnt seem to work efficiently

#

ill test it out and monitor

quartz kindle
#

return doesnt stop any file from running

#

the only way for a return to exit a process is if the return prevents a long lasting function/listener/cycle/etc from ever starting

quartz kindle
#

when you use await together with .catch() the line will return the value that the .catch() function returns if an error happens

ancient nova
#

is it possible to do proxy rotation in one function? ๐Ÿ˜ซ

lyric mountain
#

continue = stop this iteration, go to next
break = stop this loop, go to next
return = stop this function (optionally: and return a value)

quartz kindle
#

meaning if axios.get causes an error here, it will run the .catch() function, and the .catch() function doesnt return anything, which makes logo1 become undefined ```js
const logo1 = await axios.get("url").catch(async err => {
console.log(err)
})

#

and then this const logo = logo1.data.data[0].imageUrl will throw an error because you cant read data of undefined

sterile lantern
#

o

quartz kindle
#

await something.catch() means return the value of something if it succeeds, or return the value of catch if it fails

sterile lantern
#

hmm so couldnt i just like return it there then

#

so it stops

#

cuz if catch doesnt give anything, it'd just return

quartz kindle
#

yes, you can make it return if logo1 is undefined

sterile lantern
#

alr

quartz kindle
#

if(!logo1) return

quartz kindle
lyric mountain
craggy pine
#

With axios I tend to await.then(response => {thing = response.data});

quartz kindle
#

i mean, it works, but thats kinda bad design

craggy pine
#

How so thinkLul

quartz kindle
#

if you ever forget await, thing will be undefined

craggy pine
#

Oh well.

#

I rarely forget to await my axios stuffz

#
    await axios.get("https://prices.runescape.wiki/api/v1/osrs/latest").then(p => {
      priceData = p.data
    })
quartz kindle
#

priceData = (await axios.get(url)).data

#

:^)

craggy pine
#

You know what.

#

You right ๐Ÿ˜›

quartz kindle
#

what you're doing is basically c/cpp style of referencing variables

craggy pine
#

Just how I learned using await and I kinda never tried anything differnet shrug

ancient nova
craggy pine
#
    let priceData
    await axios.get("https://prices.runescape.wiki/api/v1/osrs/latest").then(p => {
      priceData = p.data
    })

I've always done that not really thinking

ancient nova
#

request api rate limits you if you do it so much, proxy rotation changes IP every request so it avoids that

#

I NEED A SIMPLE WAY OF DOING THAT

quartz kindle
#
int a;
int b;
somefunc(args, &a, &b)


function somefunc(args, &a, &b) {
  a = someresult;
  b = someresult;
}
``` c/cpp is weird
lyric mountain
lyric mountain
craggy pine
#

Well apparentily it is weird according to Tim aswell. kittyLOL I'll change up my code to be a little neater knowing I can just priceData = (await axios.get(url)).data

quartz kindle
#

might be weird, but it is valid lel

sudden geyser
#

doesn't look weird to me

craggy pine
lyric mountain
#

you're weird

craggy pine
#

bonk tim Kappa

quartz kindle
#

the way to do it depends on what http lib you use

ancient nova
#

I know it's old but good

ancient nova
solemn latch
craggy pine
#

I may be new to JS and shit, but atleast I'm not asking "why not work!?!??!?!?!?!!?" kittyLOL

quartz kindle
craggy pine
# quartz kindle do you have a list/array of ip's? or do you have a reserved ip block?
        let item = (await axios.get("https://prices.runescape.wiki/api/v1/osrs/latest?id=" + itemIDFromIndex[0] + "/5m")).data
        let sellPrice = item.data[itemIDFromIndex].high
        let buyPrice = item.data[itemIDFromIndex].low;
        let potentialProfit = sellPrice - buyPrice;

Much better looking than wrapping everything in it's own {} appreciate the tip ๐Ÿ™‚

quartz kindle
#

xD

#

also ```js
https://prices.runescape.wiki/api/v1/osrs/latest?id=${itemIDFromIndex[0]}/5m

craggy pine
#

yaya I use ${} all the time.

#

This is like my oooolllddddd beginner stuff

quartz kindle
#

xD

craggy pine
#

b4 I knew about that

quartz kindle
#

i still used to prefer ""+"" for a long time

#

before i finally switched to `

craggy pine
#

I literally only use ` now for all my strings / urls, just at the time I made this command which was over a year ago, I didn't even know I could do that kittyLOL

#

Even some apis still recommend using the "" + "" stuff like this is just copy pasta code

            async function getCards() {
                const cards = await axios({
                    "method": "GET",
                    "url": "https://api.tcgplayer.com/catalog/products/" + response.data.results + "?getExtendedFields=true",
                    "headers": {
                        "Authorization": "bearer " + token,
                        "User-Agent": agent,
                        "Accept": "application/json"
                    },
                    "data": "grant_type=" + "client_credentials&client_id=" + publicKey + "&client_secret=" + privateKey
                });
                return cards.data.results
            }
#

tho either or work

quartz kindle
#

""+"" is better to show beginners how basic merging of variables works

craggy pine
#

ya I can agree with that for beginners

#

which btw, fuck html header stuff

#

learning that for my first time, aids.

#
                    "method": "GET",
                    "url": "https://api.tcgplayer.com/catalog/products/" + response.data.results + "?getExtendedFields=true",
                    "headers": {
                        "Authorization": "bearer " + token,
                        "User-Agent": agent,
                        "Accept": "application/json"
                    },
                    "data": "grant_type=" + "client_credentials&client_id=" + publicKey + "&client_secret=" + privateKey
                });
quartz kindle
#

xD

ancient nova
#

format will be IP:PORT

#

unless you need something different

#

I need it bad so what should I use?

craggy pine
#

idk if it's related, but a library I use that allows my to rotate ipv6's uses a thing like this

  if (options.IPv6Block) {
    options.requestOptions = Object.assign({}, options.requestOptions, {
      family: 6,
      localAddress: utils.getRandomIPv6(options.IPv6Block),
    });
  }

Obviously it's all coded for the library itself, but it does indeed rotate my ip however it works shrug you can look at the source code https://github.com/fent/node-ytdl-core/blob/master/lib/index.js

solemn latch
#

is random a good way of rotating? ๐Ÿ‘€

craggy pine
#

i mean with a ipv6 block with a billion ips, it does the job well

solemn latch
#

ah, ok that might be enough. I'm not sure

#

I think a few more billion might help

craggy pine
#
exports.getRandomIPv6 = ip => {
  // Start with a fast Regex-Check
  if (!isIPv6(ip)) throw Error('Invalid IPv6 format');
  // Start by splitting and normalizing addr and mask
  const [rawAddr, rawMask] = ip.split('/');
  let base10Mask = parseInt(rawMask);
  if (!base10Mask || base10Mask > 128 || base10Mask < 24) throw Error('Invalid IPv6 subnet');
  const base10addr = normalizeIP(rawAddr);
  // Get random addr to pad with
  // using Math.random since we're not requiring high level of randomness
  const randomAddr = new Array(8).fill(1).map(() => Math.floor(Math.random() * 0xffff));

  // Merge base10addr with randomAddr
  const mergedAddr = randomAddr.map((randomItem, idx) => {
    // Calculate the amount of static bits
    const staticBits = Math.min(base10Mask, 16);
    // Adjust the bitmask with the staticBits
    base10Mask -= staticBits;
    // Calculate the bitmask
    // lsb makes the calculation way more complicated
    const mask = 0xffff - ((2 ** (16 - staticBits)) - 1);
    // Combine base10addr and random
    return (base10addr[idx] & mask) + (randomItem & (mask ^ 0xffff));
  });
  // Return new addr
  return mergedAddr.map(x => x.toString('16')).join(':');
};


// eslint-disable-next-line max-len
const IPV6_REGEX = /^(([0-9a-f]{1,4}:)(:[0-9a-f]{1,4}){1,6}|([0-9a-f]{1,4}:){1,2}(:[0-9a-f]{1,4}){1,5}|([0-9a-f]{1,4}:){1,3}(:[0-9a-f]{1,4}){1,4}|([0-9a-f]{1,4}:){1,4}(:[0-9a-f]{1,4}){1,3}|([0-9a-f]{1,4}:){1,5}(:[0-9a-f]{1,4}){1,2}|([0-9a-f]{1,4}:){1,6}(:[0-9a-f]{1,4})|([0-9a-f]{1,4}:){1,7}(([0-9a-f]{1,4})|:))\/(1[0-1]\d|12[0-8]|\d{1,2})$/;
/**
 * Quick check for a valid IPv6
 * The Regex only accepts a subset of all IPv6 Addresses
 *
 * @param {string} ip the IPv6 block in CIDR-Notation to test
 * @returns {boolean} true if valid
 */
const isIPv6 = exports.isIPv6 = ip => IPV6_REGEX.test(ip);
#

how it works I guess

lyric mountain
#

I'm afraid of ipv6 if a regex to validate it is like that

spark flint
#

same

boreal iron
#

Whatโ€™s the benefit of that?

craggy pine
#

I only use it specifically for ratelimiting

solemn latch
#

I'm mostly just trying to figure out how much 1 billion ipv6 ip's costs

boreal iron
#

Your public IPv6 has a prefix

#

That can be banned anyways

#

No matter what your devices IPv6 is

#

The base is always the same

#

Which your ISP does assign to you

craggy pine
#

That is also true. Tho atleast for now it works shrug

sudden geyser
#

const IPV6_REGEX = /^...$/ bruhcat

craggy pine
#

not my code kittyLOL

lyric mountain
#

I feel there has to be a smaller regex for ipv6

sudden geyser
#

who's code be this

#

want to make a quick visit

craggy pine
#

a libs

boreal iron
#

Changing the IP is not the issue

craggy pine
#

i put the github above

sudden geyser
#

I have your IP laingroove

craggy pine
solemn latch
#

so ipv6 includes a device prefix? ๐Ÿ‘€

boreal iron
#

The issue is your public prefix, still and will ever be

ancient nova
boreal iron
#

The size differes from ISP to ISP

craggy pine
#

As the ipv6 block I'm using it from a proper server, so how many is the question. Regardless, Ill use it until it gets yeeted I suppose

boreal iron
#

For example I got a /56 block

boreal iron
#

Your block is public when fetching your IP

#

You know the base then and can ban the entire block

#

Thereโ€™s no way around that other than using different public IPs (better around the globe)

#

IPv6 is no solution for anything just a nightmare especially regarding tracking

lyric mountain
#

I fear a future, where nobody memorizes localhost's IP

boreal iron
#

I fear the future where any fucking device has an unique IPv6 and can be tracked down to hell

lyric mountain
#

imagine not being able to simply write 127.0.0.1

boreal iron
#

Thanks to any asshole out there thinking IoT is something useful

boreal iron
#

You gotta be more specific or nobody can help

lyric mountain
#

what kind?

boreal iron
#

You fetch a member if your library doesnโ€™t have him cached

#

Well and we canโ€™t help you without more details

#

If you got an error with your code just post it

#

If you have questions about what and how to do something then ask them as detailed as possible

quartz kindle
#

after testing a bunch of ways to grep files, including rigrep and ugrep

#

the normal grep is still the fastest

#

lmao

boreal iron
#

So worth the time you spent?

quartz kindle
#

nope

boreal iron
quartz kindle
#

totally not worth

#

i constantly get side tracked with these benchmarks lmao

boreal iron
#

Regarding your birthday thatโ€™s just another reason to drink

quartz kindle
#

if i make all my files lowercase, i can grep them all recursively in 5ms

#

so now the question is

#

grep ~15mb worth of files in 5ms, or turn them into a 200mb sqlite db to get 0.1ms response times

quartz kindle
#

i spent my bday coding mostly, and running these stupid benches

boreal iron
#

I personally would take the faster solution

#

As space isnโ€™t expensive anymore

quartz kindle
#

the only issue is that the index takes a long time to generate

#

well i didnt optimize it yet

#

also, i will make a cache for common queries

#

so in most cases neither grep nor the db will be hit

#

eh fuck it, i'll stick with grep for now

boreal iron
#

The 466GB index took around 13d

#

~19 when it wasnโ€™t optimized

#

You might remember my rsync screenshot

#

When transferring the database files was faster then regenerating it

hidden gorge
#

um my node modules keep doing this idk how to fix it

#
      const timeout = this.client.setTimeout(() => {
        this.client.removeListener(Events.GUILD_MEMBERS_CHUNK, handler);
        this.client.decrementMaxListeners();
        reject(new Error('GUILD_MEMBERS_TIMEOUT'));
      }, time);
      this.client.incrementMaxListeners();
      this.client.on(Events.GUILD_MEMBERS_CHUNK, handler);
    });
  }
#

i was told to comment it out but when i do it crashes

solemn latch
#

is this on startup?

spark flint
#

How can I make a div fit the page height wise

#

I'm making it start like half way through the page, and h-full makes it extend the page length

pearl trail
#

100vh?

spark flint
#

yep that worked

#

now new issue

#

on mobile view the right margin doesn't work

#
                <div class="article w-full rounded p-4 mb-4 text-white items-center justify-center w-1/2 md:w-3/6 m-auto ml-3 mr-3">
                    <div class="flex my-auto items-center">
                        <img src="img url" class="w-12" />
                        <span class="ml-3">How to setup ShareX</span>
                    </div>
                </div>```
quartz kindle
bright hornet
#

so i was trying to register aliases in my command handler but I keep getting error like this ```js
command.aliases.forEach(alias => {
^

TypeError: Cannot read properties of undefined (reading 'forEach')```

my code ```js
const fs = require('fs');
client.commands = new Collection();
client.aliases = new Collection();

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for(const file of commandFiles) {
const command = require(./commands/${file});
client.commands.set(command.name, command);

command.aliases.forEach(alias => {
    client.aliases.set(alias, command.name);
  });

}```

quartz kindle
#

one of your commands does not have aliases

bright hornet
quartz kindle
#

the code you showed expects all commands to have them

bright hornet
#

ohhhh

quartz kindle
#

otherwise you need to add a check to see if the current command has aliases or not

bright hornet
#

thanks thanks, this is my first time using normal handler, im done with slappey xd

bright hornet
quartz kindle
#

yes

bright hornet
#

alright

#

thanks!

quartz kindle
#

๐Ÿ‘

spark flint
atomic dagger
#

guys I need help/ a question

bright hornet
#

still same error

quartz kindle
#

show how you put them in your commands

bright hornet
bright hornet
atomic dagger
boreal iron
#

What do you mean by making the ID public?

quartz kindle
#

.forEach() does not work on text

#

"test".forEach() is not a thing

#

aliases has to be an array or a collection

boreal iron
quartz kindle
#

for example aliases: ["test"]

bright hornet
#

["test"]

#

aaaaaa

boreal iron
#

By selecting the element, then see itโ€™s CSS properties

#

Then rescale the window

bright hornet
#
client.on('messageCreate', message => {
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).trim().split(/ +/);
    const command = args.shift().toLowerCase();

    if(!client.commands.has(command)) return;

    try{
        client.commands.get(command).execute(message, args)
    } catch(err) {
        console.log(err)
    }
});``` or i need to call it here too?
quartz kindle
#

you put all aliases in client.aliases

#

so you need to check if the command exists there as well

bright hornet
#

should i do console.log?

quartz kindle
#

hmm?

#

no, you need to do the exact same thing you're doing with client.commands but with client.aliases

#

or change your file loader to put the aliases in client.commands as well, and get rid of client.aliases

bright hornet
#

i have client.aliases

boreal iron
#

Yeah but you dont check if your entered command may is an alias

#

if(!client.commands.has(โ€ฆ)) return

#

Doesnโ€™t check your client.aliases

bright hornet
#

ahhhh

#

ok ok

bright hornet
#
client.on('messageCreate', message => {
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).trim().split(/ +/);
    const command = args.shift().toLowerCase();

    if(!client.commands.has(command)) return;

    try{
        const cmd = client.commands.get(command) || client.commands.find(a => a.aliases && a.aliases.include(cmd))
        if(cmd) cmd.execute(message, args)
    } catch(err) {
        console.log(err)
    }
});``` changed code to this, still aliases cant be used
earnest phoenix
craggy pine
#

Ok so I suck at math so I want to see another opinion:
Lets say I have 10 pages and an array that displays 5 results per page.

If I were to select lets say, page 5, result 2, how would I math the index that result it on.

I've tried a few things like let input = page === 0 ? 0 : page + 6 but that's wrong and also let input = page === 0 ? 0 : page * 5 same for that one.

Page starts at 0 since array index 0 = 1
https://scs.twilightgamez.net/pFz1Y.png

boreal iron
#

if(!client.commands.has(โ€ฆ)) return

#

If the command wasnโ€™t found you return the event listener

bright hornet
#
if(!client.commands.has(aliases)) return;```?
boreal iron
#

Now this would only check the alias and not the command anymore

#

you need to check for both

#

If your entered command is not part your client command and not part of client aliases

#

Is what you need to check for

boreal iron
#

The sliced array with 5 results is the one you display

#

The index aka. offset is your current page number * number of results

#

Example:

bright hornet
#

hm

#

if i do this js if(!client.aliases.has(command)) return; both commands and aliases not working

craggy pine
#
if(!client.commands.has(command) && !client.commands.has(aliases))
#

is what he's getting at.

#

Or how ever you'd have to write it for your code

boreal iron
#

page 1: slice(0, 5)
page 2: slice(5, 5)
page 3: slice(10, 5)

The first argument of slice is your offset -> page * 5 = offset
The second argument stays 5 as you wanna display 5 results only

#

let limit = 5;
let offset = current_page * limit;

#

Only for page 1 you need to check manually as 0 * 5 would be 0

craggy pine
boreal iron
#

Thatโ€™s static not dynamic

craggy pine
#

if the page # === 0 then any * 0 === 0 so manually set the index as index 0 - 4

#

I may be miss understanding, but I get atleast what you're saying with slice

boreal iron
#

let limit = 5;
let offset = current_page * limit;

if current page == 1 then offset = 0

all_results.slice(offset, limit)

bright hornet
#

i got new error ```js
client.on('messageCreate', message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();

if(!client.commands.has(command) && !client.aliases.has(command)) return;


try{
    const cmd = client.commands.get(command) || client.commands.find(a => a.aliases && a.aliases.include(command))
    if(cmd) cmd.execute(message, args)
} catch(err) {
    console.log(err)
}

});```

a.aliases.include is not a function```
craggy pine
#

includes

#

not include

bright hornet
#

;-;

#

its working now

#

thanks @quartz kindle @boreal iron @craggy pine ^^

#

sorry for the ping, just wanted to thanks

#

XD

boreal iron
#

๐Ÿ‘

boreal iron
#

Not the count based on the start index

craggy pine
#

I realised quickly that it was backwards in ur thing ๐Ÿ˜›

boreal iron
#

Yeah itโ€™s differently in PHP

#

I forgot about that

neat ingot
#

thoughts on how best to handle 'reminders'? I am planning to save them in their own data collection, but would you periodically check that and then send out reminders, or would you set a timeout when registered (also after reboot if needed) and try to trigger at the exact time? (which is the route im considering)

boreal iron
craggy pine
bright hornet
#
if(message.member.roles.highest.comparePositionTo(target.roles.highest) > 1 ) return message.reply("I can't mute this person!")``` how can i use this properly? myself getting muted instead of the given person, then if i pinged the person its returning the command,

```js
if(target.roles.highest.comparePositionTo(message.member.roles.highest) > 1 ) return message.reply("I can't mute this person!")``` if i do this, even me and the bot has the same role, the bot still cant mute me
craggy pine
boreal iron
#

If you wanna display 1 result per page only then the var limit would need to be 1

craggy pine
#

I think we're confusing each other.

#

sec

fiery stream
#

Hii

boreal iron
#

got sorted out in dms

severe patio
#

Is it possible to fetch votes from server listings using webhook?? cause its not working

bright hornet
#
PrefixSchema.findOne({
                guildID: message.guild.id,
            }, async (err, data) => {
                if(data) {
                    data.newprefix
                    data.save()
                } else {
                    new PrefixSchema({
                        guildID: message.guild.id,
                        Prefix: newprefix
                    }).save()
                }
            })``` guildID and prefix is not saving :/ and this is the first time data not saving
austere surge
#

use findOneAndUpdate topggSunglasses

bright hornet
austere surge
#

you are trying to find and update

#

why not

bright hornet
#

im showing the pic cause when im saving new data, guildID and prefix are not saving

austere surge
#

i dont think that function is supposed to be in the findOne function

#

you could probably do it outside some other way

earnest phoenix
austere surge
#

i dont know if this is even possible, it looks very weird

earnest phoenix
#

I haven't used mongodb in ages so don't quote me on it

bright hornet
austere surge
#

i'd do it something like

  const data = await PrefixSchema.findOne({
    guildID: message.guild.id,
  });
  if(data) {
    data.newprefix;
    data.save();
  } else {
    new PrefixSchema({
      guildID: message.guild.id,
      Prefix: newprefix
    }).save();
  }
austere surge
#

ok

bright hornet
#

done trying that format

#

which is actually weird

austere surge
#

whatre you trying to do

bright hornet
bright hornet
austere surge
#

that couldve been one message but ok

#
schema.findOneAndUpdate({ guildID: message.guild.id }, { Prefix: prefix });

might do something

bright hornet
#

solved with { type: String }

#

lmao

#

I missed type like
{ Type: String }

royal herald
#

lmao

bright hornet
#

is it really required to use console.log everytime deleting data in mongoose discordjs

austere surge
#

what

dry imp
#

not really

wheat mesa
earnest phoenix
#

Can you use variables from an @each loop as selectors in sass?

#

nvm found it

bright hornet
earnest phoenix
#
 Property 'get' in type 'ApexApplication' is not assignable to the same property in base type 'BaseApplication'.
  Type '(data: ApexData) => Promise<void>' is not assignable to type '(data: FortniteData) => Promise<FortniteResult | null>'.
    Type 'Promise<void>' is not assignable to type 'Promise<FortniteResult | null>'.
      Type 'void' is not assignable to type 'FortniteResult | null'.

9     async get(data: ApexData){

So I haven't used classes in a while so I am unsure of how I can make BaseApplication being able to have its own methods and be usable as well as having the ability to extend it and overwrite methods

earnest phoenix
#

Wait could I just give ApexApplication get method its own return type and it'd work ๐Ÿค”

cinder patio
#

override*

earnest phoenix
#

I didn't know ts had that

#
TS2416: Property 'get' in type 'ApexApplication' is not assignable to the same property in base type 'BaseApplication'. ย ย Type '(data: ApexData) => Promise<ApexData>' is not assignable to type '(data: FortniteData) => Promise<void>'. ย ย ย ย Type 'Promise<ApexData>' is not assignable to type 'Promise<void>'. ย ย ย ย ย ย Type 'ApexData' is not assignable to type 'void'

Even when using override it still won't let me overwrite the return type and such of the methods

earnest phoenix
#

imagine using ts

sullen tartan
#
let test = "hello"
event.test(/*code*/)```What did I need to do that I can use event.hello and not event.test?
earnest phoenix
#

what

sullen tartan
#

what what

earnest phoenix
#

I did not understand your question

craggy pine
#

Only thing that comes to mind is that it would be an object

#

well no, that wouldn't make sense either.

craggy pine
sullen tartan
#

thanks

split hazel
#

is rust the future of low level programming

#

imo no because the syntax is like struct<'b> { name: &*:/'ted}
println!!!/??!! ((-/:' '("' hrllo world")

earnest phoenix
#

At this point use Malbolge

cinder patio
#

bruh

earnest phoenix
#

awesome language: exists
some random weeb: EWWW CRINGE SYNTAX
easy to use syntax language: exists
some random weeb: EWWW NOT COOL ENOUGH

earnest phoenix
#

this is a no irony conversation

split hazel
#

I don't think the syntax is cringe i just want it to be readable ๐Ÿ’€

cinder patio
#

but it is readable if you know what it means

#

you just don't know what it means

split hazel
#

I find c very readable

sudden geyser
#

what's your definition of readable anyway

#

is it "can I understand the general constructs applied" or "can I understand what the program is really trying to do"

#

how many braids do you have to twind before you can clearly see it

spark flint
#

text-overflow:ellipsis isn;t working

pearl trail
spark flint
#

Alrighty

boreal iron
#

That doesnโ€™t allow the text to wrap in a new line at all okeh

earnest phoenix
hoary apex
#

How to make a global announcement command?

#

Js !

cinder patio
#

what do you mean by that

#

like send a message to every guild?

sudden geyser
#

You could use an announcement channel in your support server.

#

Which would practically have the same effect.

wheat mesa
simple stump
#

I'm using SQLite3, but for some reason this method returns id and characters correctly:

async function info(id) {
    return new Promise(function (resolve, reject) {
        db.serialize(async function () {
            await db.get('SELECT * FROM daily WHERE id = ?', [id], function (err, rows, fields) {
                if (err) reject(err);
                if (!rows) {
                    reject(null);
                } else {
                    resolve({ "id": rows.id, "characters": rows.characters });
                }
            });
        });
    });
}

But this doesn't:

async function updateCharacters(id, character) {
    return new Promise(function (resolve, reject) {
        db.serialize(async function () {
            await db.get('SELECT * FROM daily WHERE id = ?', [id], function (err, rows, fields) {
                if (err) reject(err);
                if (!rows) {
                    reject(null);
                } else {
                    console.log("id: " + rows.id);
                    console.log(rows.characters);
                    resolve({ "id": rows.id, "characters": rows.characters });
                }
            });
        });
    });
}

ID is logged correctly, but rows returns undefined.

cinder patio
#

why are there two functions with the exact same body?

hoary apex
cinder patio
#

don't do that

hoary apex
hoary apex
cinder patio
#

still

sudden geyser
#

Then have them join and set up the announcement channel

cinder patio
#

Imagine having 2000+ servers, and sending a message to each one of them without their permission

sudden geyser
#

Much more natural than going through your idiosyncratic process

hoary apex
#

lol anyway can anyone help me to setup reply and typing thingy for my chatbot?

simple stump
#

The main purpose is to use update to update the user's characters column, but whenever I try to get data from the database rows is always undefined.

#

Which is strange since the info function works fine. I don't understand what the difference is.

lyric mountain
# hoary apex Yea

Have a command where they can define a channel to receive notifications, with default being none (no channel = no notifications)

#

Then use webhooks instead of normal messages, they're made for that

earnest phoenix
earnest phoenix
lyric mountain
#

Or have both

spark flint
# earnest phoenix show css pls
    .article {
        background: #2b2a2a;
        white-space: initial;
        overflow: hidden; 
        text-overflow: ellipsis;
        overflow-wrap: break-word;
        max-width:75vh;
        transition:0.3s;
    }```
#

i was told to try initial liek 2 mins ago

#

that made it use a new line

earnest phoenix
#

why do you have white-space inthe first place

spark flint
#

idk

earnest phoenix
#

try overflow-wrap: anywhere;

lyric mountain
#

I can't keep count of how many times people got lost af after I added new updates to my tcg, only to find out they didn't check the updates channel

delicate sky
#

@spark flint hi

spark flint
#

hi

#

idk why ur pinging but hi

delicate sky
#

Lol sorry

#

Btw

#

I like your portfolio

spark flint
#

thanks

#

am remaking it soon

delicate sky
#

And..... Hidemymail is just amazing thing

spark flint
#

thanks KEKW

delicate sky
#

Hah

spark flint
#

its the worlds simpelist thing

delicate sky
#

Nice to meet you

spark flint
#

nice to meet you too

delicate sky
#

;-;

#

I love hidemymail's ui

#

@gilded plank

spark flint
#

tyty

earnest phoenix
spark flint
earnest phoenix
#

i simp u

pearl trail
simple stump
#

How do you use SQLite's Blob data type? I want to store an array in the database and figured using Blob is the best option, but I'm not sure how it works.

modest maple
#

litterally just give it some bytes

lucid yarrow
#

can i iframe a website in overview ?

modest maple
#

not in the short desc but yes in the long desc

lucid yarrow
#

<iframe src=""

#

like this rite?

modest maple
#

that would be an iframe yes

lucid yarrow
#

it just add a big blank space..

runic depot
#

failed

lucid yarrow
#

y though..

#

i have ssl

spark flint
#

Have you closed the iframe

#

<iframe src=โ€œwebsite urlโ€>

lucid yarrow
#

i have

#

the console says it is not using https

rocky hearth
#

does breaking down long jsx react code into components, improves performance?

ancient nova
#

does anyone here know regex?

#

I need help

cinder patio
cinder patio