#development

1 messages ยท Page 1804 of 1

opal plank
#

it works on my rig fine

cinder patio
#

when you set _index to 26

opal plank
#

well of course

thick gull
#

well yeah

#

thats alot

opal plank
#

thats 26 ^ 26 entries

cinder patio
#

well that's what they want

opal plank
#

try with 5

cinder patio
#

lmao

opal plank
#

just 3 is enough for 18k entries

orchid vortex
#

wrong server sorry

cinder patio
#

I know but that's what wulfey wants

opal plank
#

you need to increase the 4gb limit node has

wheat mesa
#

I don't think it's reasonable to do that quite honestly

thick gull
#

i would just use some other language

cinder patio
#

yeah an array can't fit that much elements

opal plank
#

i could use Set() instead

thick gull
#

i dont think js can do it

cinder patio
#

sets can't either

#

not possible in js

opal plank
#

not for that

#

just to optimize a bit

thick gull
#

you should do it by hand in a .txt /j

opal plank
#

sets might be less hungry than maps

cinder patio
#

Why are you even using a map

wheat mesa
thick gull
#

exactly

sudden geyser
#

The point is that constructing a collection of every combination ahead of time is unrealistic

cinder patio
#

Here's my solution

function populate(letters = []) {
    const res = [...letters];
    let lastInd = 0;
    const len = letters.length - 1;
    for (let i=0; i < len; i++) {
        const temp = lastInd;
        lastInd = res.length;
        for (const letter of letters) {
        for (let j = temp; j < lastInd; j++) {
            res.push(letter + res[j]);
        } 
    }
    }
    return res;
}

opal plank
#

actually

#

i wonder if redis can store that many

#

i doubt i'd be able to retrieve it though

#

or postgres

#

keydb for sure can

cinder patio
#

I'll try to make this using rust

#

but tomorrow

sudden geyser
#

masochism

opal plank
#

thank you, u bunch of dicks

#

i now wasted 30 minutes on this

#

when i should've been working

cinder patio
#

๐Ÿ˜ฉ

#

same

#

but sleeping

sudden geyser
#

could've spent that 30 learning clojure

cinder patio
#

Tim is probably still trying to do it

#

someone should tell him

opal plank
#

PurFormEncE

cinder patio
#

lmao

#

you can actually do it in JS if you chunk it

#

buut why bother this is so pointless why would you ever need this

#

what the fuck

quartz kindle
#

lmao

#

im multitasking so its taking a while

#

still thinking about how to approach it

#

trying to avoid array spreads

cinder patio
#

You'll definitely have to it in chunks because an array cannot fit 26 ^ 26 elements

opal plank
#

make 2 arrays

cinder patio
#

or create a S T R E A M

thick gull
#

or just dont do it

#

<3

cinder patio
#

that's the right answer

opal plank
#

but we dont do that here

#

we need a daily topic where #development bonds together to write some dumb ass code or performance test some useless shit nobody will ever, ever, use

wheat mesa
#

Great idea

thick gull
#

i mean i used it

#

i just gave up when it came to database shit

#

cause i hate optimizing stuff

#

fuyck the db servers

cinder patio
#

I might try making it work tomorrow with streams

#

or just switching to rust

#

but that kinda kills the fun doesn't it

opal plank
#

indeed

#

just make an array of arrays

#

each array can only be 50k long

#

ggez

thick gull
#

where did i get 500K from

cinder patio
#

plausible

opal plank
quartz kindle
#

why do you want stupidly large arrays tho

opal plank
#

cuz uselessness

thick gull
cinder patio
#

The input is the entire alphabet

quartz kindle
#

what

#

why

opal plank
#

why not?

quartz kindle
#

lmao

opal plank
thick gull
#

i am mildly confused and will go back to sleep

#

goodbye

opal plank
#

it scales

#

and fast

wheat mesa
#

multidimensional array mindfuck solution

opal plank
#

thats what im suggesting

cinder patio
#

permutations go brrrrrrrr

wheat mesa
#

that's what we need

thick gull
#

do it in scratch

#

smh

cinder patio
#

it's really not you can do it using child processes

slender thistle
opal plank
#

scarcth is just js with a shitty UI in all honesty

latent heron
#

@earnest phoenix I have finally achieved the impossible, the shortest fibonacci code in PHP

function f(...$v){for(;;){$v[0]=$v[1];$v[1]=$x;$x=$v[0]+$v[1];echo$x;}}f(0,1);
opal plank
#

hence why its the best lang

slender thistle
#

What the fuck flow

wheat mesa
#

I love the readability on that snippet

latent heron
#

LMAO

#

it's so condensed it might crash some IDEs

opal plank
#

starting a blackhole in IDE 101

latent heron
#

im psychologically insane

opal plank
#

shit's so dense it sucks up the nearby code

thick gull
#

can you condense it more

latent heron
#

i can

thick gull
#

do it

quartz kindle
#

lol

thick gull
#

come back when its 1 letter ๐Ÿ˜ค

opal plank
#

an array with that many entries

#

that'll be fun

quartz kindle
#

thats not a js problem

latent heron
#
function f(...$v){(1)?$v[0]=$v[1];$v[1]=$x;$x=$v[0]+$v[1];echo$x;:1;}f(0,1);
quartz kindle
#

you need a super computer for that no matter your lang

opal plank
#

not even counting the amount of time it'd take to compute that

#

fuck, u typed faster

latent heron
#

it shortens it a tiny bit

thick gull
#

get the user in cache celestequestiongif
idk im not really sure

slender thistle
latent heron
#

lmaoo

#

i've been coding a lot in java lately

#

so it feels refreshing to be back in PHP

slender thistle
#

He's a lost cause

latent heron
#

lmao

thick gull
#

idk

opal plank
#

lang? lib? social security card? hotel? trivago

latent heron
#

i made a meme really similar to that

#

i have to find it

wheat mesa
#

Pretty sure I found that image in the #memes-and-media channel here a little while ago

thick gull
opal plank
#

im on on a motivational dip too

latent heron
#

wait that's the wrong meme

opal plank
#

define member tag

wheat mesa
#

lmaoooooo

opal plank
#

you mean their user tag or the member nickname?

slender thistle
#

Trivago

opal plank
#

<user>.tag and user.username i think

opal plank
latent heron
#

i think this was it

opal plank
#

what?

latent heron
#

errors in PHP are a whole different realm of nightmare

opal plank
#

no <> means a class most of the times

#

so you need to retrieve a user

wheat mesa
#

Speaking of which, how do I make VSC yell at me when I don't use semicolons? I forget them a lot, even though it's not necessary

opal plank
#

thats exactly what i mean

#

you asked how to get a user tag

sudden geyser
#

probably some plugin

opal plank
#

you need to get a user obejct first

#

aka <user>

sudden geyser
#

e.g. eslint

opal plank
#

client.users.cache.get(id)?.username

#

that should do the trick

#

you really need tolearn the basics of js then

sudden geyser
#

though there's probably a built-in setting for it

wheat mesa
#

capitalized Console

sudden geyser
#

yes trust me don't go further

opal plank
#

by the time you've been waiting for an answere here, you'd have already read the docs, written your code, and started something else

#

powercord

#

๐Ÿ‘€

thick gull
wheat mesa
#

'Console' only refers to a type, but is being used as a value here.

latent heron
#

has to be lowercase console mmLol

thick gull
#

no

latent heron
#

Lolno

opal plank
#

yikes

wheat mesa
#

not how it works!

latent heron
#

inb4

latent heron
#
exec("require('console');");
#

Some abhorrent shit pseudocode

opal plank
wheat mesa
#

Javascript is not supported by your browser.

opal plank
thick gull
wheat mesa
#

reuqire

thick gull
#

ignore my typo

#

you could do that

latent heron
#

Oh thats so painful to look at

thick gull
#

<3

opal plank
#

actually

#

imma bigbrain that even further

long cipher
# thick gull

Why is that a function when it already is a function?

thick gull
#

what

long cipher
#

You are defining a function to call a function

wheat mesa
#

we're messing around

thick gull
#

yeah

#

its cause Console is undefined

long cipher
#

Oh oops my bad haha

thick gull
#

case-sensitive

wheat mesa
#

We must define Console!

opal plank
latent heron
#

Ugh

thick gull
wheat mesa
opal plank
#

^^^^^^^^^^^^^^^^^^

thick gull
opal plank
latent heron
#

I mean

#

Php is good

#

Whatever you wrote wasn't

opal plank
#

so is concussions

latent heron
#

Trueee

opal plank
quartz kindle
thick gull
#

my favorite language is chicken<3

#

hello world

wheat mesa
#

I prefer COW

boreal iron
wheat mesa
#
 MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
 MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
 MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO
 MoO MoO MoO MoO MoO Moo Moo MoO MoO MoO Moo OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
 MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
 MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
 MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO
 MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MOo
 MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo
 MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo MoO MoO MoO Moo MOo MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo
 OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo 
#

hello world

thick gull
#

chicken is the only symbol allowed

#

no clue how it works

pale vessel
#

It uses newlines as delimiter I guess

wheat mesa
#

I feel personally attacked that discord doesn't support syntax highlighting for chicken and COW

#

Nobody

#

But that's not the point!

tribal crow
#

Hey! When trying to add 2 numbers together it just adds the second number to the end of the first number. Example:

What i get:
1 + 1 = 11

What i want:
1 + 1 = 2

#

Huh?

earnest phoenix
#

Concat moment

wheat mesa
boreal iron
pale vessel
#

+num + +num

tribal crow
#

+1 + +1?

pale vessel
#

Yeah

earnest phoenix
#

That casts it to an integer? Interesting

pale vessel
#

Ig

#

Same as Number()

wheat mesa
#

Shouldn't (1 + 1) also get the same result?

pale vessel
#

Don't know the context

wheat mesa
#

Me neither

latent heron
#

as long as you handle the integers as literals

tribal crow
copper cradle
#

you probably should tell them why it happens before that solution turns into a standard for them

boreal iron
#

Well if he would log the var once he would probably see itโ€™s a string

strange lichen
#

How to make a topgg api

earnest phoenix
#

It's already made, wdym

boreal iron
#

lmao

quiet pawn
#
const translate = require('@iamtraction/google-translate');

module.exports= {
    name: 'emoji',
    async execute(client, message, args, command, Discord){

         if(!args[0]) return message.channel.send('Plead pick the words you want to translate');
         if(!args[1]) return message.channel.send('Enter a language');
        //ั ั‚ั€ะฐั…ะฝัƒะป ัะฟะธะฝ
        translate(`${args[0]}`, { to: `${args[1]}` }).then(res => {
            const user = message.author;

         const embed = new Discord.MessageEmbed()
         .setColor('#FFE082')
         .addFields(
              { name: 'Message', value: `${args[0]}` },
          { name: 'Translates to', value: `${res.text}` },
         )
         message.channel.send(`${user}`,embed)

            //(res.text); // OUTPUT: You are amazing!

          }).catch(err => {

            return message.channel.send('Please  Enter Text to Translate to English (example: n.translate ะŸั€ะธะฒะตั‚ en to translate to english) all language codes https://cloud.google.com/translate/docs/languages');
          });
    }
}
#

im trying to make a translate command that translate more then just <language> to english

#

but whenever theres 2 words in the sentance your trying to translate it picks that up as the language instead of the actual language provided

#

is there a way to make it so it only picks up certain word as the second args

digital ibex
#

all thats doing is translating the first word you type

#

hence the args[0]

#

it would be better to enter the language first, so [language] [message]

#

but if u wanna do it ur way, u can check for a character like | or something.

#

to differentiate languague frommessage, so french | i am 5 years old

#

@quiet pawn

quiet pawn
#

o

#

smart

#

im dumb for that one

#

thank you

digital ibex
#

yw

heavy marsh
#

in d.js v12

I have a small question
var botName = config.botName; //This is alpha

So in my mongooes DB I am trying to get the prefix saved in a filed by doing this ...
data.guild.prefix.botName //where botName === alpha

Can someone tell me how to fix this?

digital ibex
#

what

#

give more context this doesn't help much

heavy marsh
#

Basically I am trying to do this
data.guild.prefix.alpha

#

but by using
var botName = config.botName; //This is alpha

digital ibex
#

what

heavy marsh
#

...

#

Of ...
I am trying to get the value stored in
data.guild.prefix.alpha

#

but I am trying to get the name of the bot from the config

digital ibex
#

what is data.guild.prefix.alpha

heavy marsh
#

this has the prefix of one of my bots

#

hold on

#
var botName = config.botName; //This is alpha
data.guild.prefix.botName //where botName === alpha
digital ibex
#

so just

#

data.guild.prefix.alpha ?

heavy marsh
#

Nope cause I am having 4 bots

#

I will have to change that in 4 places

#

so I am trying to make it simple

digital ibex
#

but i mean

#

theres no other way

earnest phoenix
#

on the "user" page it would be necessary to add a <br> because it is too close to the navbar

digital ibex
#

if u want it to be all the same, u can create a function and then it'll kinda do it at once?

rose warren
heavy marsh
#

Should there not be a .

digital ibex
#

thats not doing anything

digital ibex
heavy marsh
#
data.guild.prefix.[botName]```
#

like this?

digital ibex
digital ibex
#
data.guild.prefix[botName]
// is the same as 
data.guild.prefix.botName
pale vessel
#

No, it's not

rose warren
#

It isn't

heavy marsh
#

๐Ÿ‘€

digital ibex
#

prefix is an array?

sudden geyser
#

depends

pale vessel
heavy marsh
#

This is how it is

rose warren
sudden geyser
#

then you probably want the bracket notation solution

pale vessel
#

That's like saying { [key]: "value" } is the same as { key: value } which isn't true

proven lantern
digital ibex
#

how is it different?

proven lantern
#

and {["key"]:"value"}

#

is the same as { "key": "value" }

pale vessel
#

Then your point would be data.guild.prefix["botName"] is the same as data.guild.prefix."botName"

proven lantern
#

botName can be a string

heavy marsh
rose warren
#

botName is a string. But searching for

data.guild.prefix.botName

means searching for the botName key, not the botName variable.

#

That's why you do

data.guild.prefix[botName] 
proven lantern
#

oh yeah

rose warren
digital ibex
#

then theres me thinkin prefix is an array for whatever reason

proven lantern
#

it would only be the same if const botName = "botName"

heavy marsh
#

Thank you ๐Ÿ™‚

rose warren
#

You'd still have to do it that way

heavy marsh
proven lantern
#

wouldn't data.guild.prefix.botName === data.guild.prefix[botName] if const botName = "botName"?

pale vessel
#

Are you trolling

Edit: I'm just stupid, yes, that's correct

rose warren
#

Yeah but why bother with the const then? That's a pointless argument.

pale vessel
#

botName in data.guild.prefix.botName doesn't refer to a variable, but a property inside data.guild.prefix

rose warren
#
var banana = "botName";
data.guild.prefix.botName === data.guild.prefix[banana]
proven lantern
proven lantern
rose warren
#

No it shouldn't

proven lantern
#

?

#

it's okay

heavy marsh
#

hmm

rose warren
#

Anyway it's 1am and I don't have the energy to explain ๐Ÿ˜‚ go read the docs

rose warren
#

Yes

heavy marsh
#

ahh ok

heavy marsh
pale vessel
proven lantern
#

data.guild.prefix.botName = "botName" would also need to be true

rose warren
rose warren
proven lantern
#

it is the 4th of july right?

#

i got one thing right?

pale vessel
#

It's the 5th

proven lantern
#

dang

wheat mesa
#

5th depending on timezone

rose warren
#

The guy wanted the value of the alpha key and had "alpha" stored in the botName variable.

proven lantern
rose warren
#

It's correct in that example, but change the value of the botName const and it immediately becomes false

proven lantern
#

only true if const botName = "botName"

rose warren
#

But doing const botName = "botName" is pointless in that case ๐Ÿ˜‚

proven lantern
#

but it was the example that messed me up

rose warren
#

Just get the botName key and be done with it

#

Yeah it's a bad example that's why

rose warren
proven lantern
#

yeah, anything besides const botName = "botName" doesn't work

heavy marsh
#

Does anyone know how to stop undefined from spamming?

proven lantern
heavy marsh
#

Yes its mine

pale vessel
#

Does that only happen sometimes?

heavy marsh
#
module.exports = async(client, guild) => {

const guildcount = (await client.cluster.broadcastEval(`this.guilds.cache.size`)).reduce((acc, guildCount) => Number(acc + guildCount), 0);
    
botjoins.send(`![leave](https://cdn.discordapp.com/emojis/824410126358282272.webp?size=128 "leave") Left guild **${guild.name} \`[${guild.id}]\`** \`[Now in ${guildcount.toLocaleString()} servers]\``)
    
client.logger.log(`[GUILD LEAVE] ${guild.name} [${guild.id}] [Now in ${guildcount.toLocaleString()} servers]`);
    
};
#

Its the guildDelete event

pale vessel
#

Then you're receiving partial guilds

#

Try logging the guilds and see the available properties

rose warren
#

Yep

heavy marsh
proven lantern
#

you must get the guildDelete event after the fact. if the guild is in the cache then you get it otherwise you cant get it

rose warren
#

Ah wait

#

This happens after re-launching the bot?

heavy marsh
rose warren
#

Those might be unavailable guilds. Check if the guild is available before posting the leave message

#

if(!guild.available) return

proven lantern
heavy marsh
#

Server outrages

proven lantern
#

oh, so they still have the bot installed?

#

that's scary

pale vessel
#

It's guild.unavailable isn't it

proven lantern
#

i need to go fix a bug

rose warren
#

No it's guild.available

pale vessel
#

On API docs it's documented as guild.unavailable

proven lantern
#

i mark the guild as deleted in my database when i get that event

pale vessel
#

I guess discord.js does it opposite

rose warren
#

Unavailable guilds are partial so that would probably explain the undefined part

proven lantern
#

so now i must have marked a bunch of servers as deleted when they were just having an outage

#

how common is that?

rose warren
#

Yeah discord.js does guild.available

heavy marsh
rose warren
#

๐Ÿ‘†

proven lantern
#

i wonder how many times i've marked a server as deleted because of an outage

heavy marsh
#

When does slash commands come ... to d.js

rose warren
#

Trust me I learnt the guild.available problem the hard way ๐Ÿ˜‚ once my bot got stuck in a crashing error loop while I was asleep which smashed into the rate limit for connecting to Discord and locked it out for 24h ๐Ÿ˜ฌ all due to an unavailable guild

rose warren
#

If you've done it properly and you don't get the undefined messages now then they were just unavailable

heavy marsh
#

lets see it now

proven lantern
#

are unavailable server also servers that installed our bot and then the server itself was deleted?

heavy marsh
#

server = not available due to an outrage

rose warren
#

An unavailable server is a server that's unavailable due to Discord outages or rate limits and stuff like that

heavy marsh
#

like member limtes

rose warren
#

Yeah

heavy marsh
rose warren
#

No problem!

heavy marsh
#

Clusters a much better

#

2 Clusters with 3 shards each

rose warren
#

That's kinda overkill but kinda hot at the same time

heavy marsh
#

Less than 10 shards

#

lol

#

1k per shard

rose warren
#

Yeah

heavy marsh
#

cause mine is on 10k+

rose warren
#

What are you using for clustering?

heavy marsh
#

its a new npm

rose warren
#

Ah yes I saw that

heavy marsh
#

Very easy

#

and effective

#

less cpu usage

rose warren
#

I didn't want to use it since it's brand new

#

Hard to know if it'll be maintained or die in 2 months

heavy marsh
rose warren
#

Mhmm

errant flax
#

how do i get the response from a post request in node fetch?

i made the router from express to do res.send() but how would i get that sent string?

this is what it logs

prime mist
errant flax
#

imma try that thx

#

how would i do that with strings tho?
only works with objects :hmm:

lament rock
#

await response.text() is safer if the response isn't a JSON. If it is, then you can parse it yourself

split hazel
#

if its good i might implement it in a 50k guild bot as im stuck with a shit cluster module and would save me time writing my own clustering module (though thats probably still the best idea)

lament rock
#

eliminate the need for managed libs and blame yourself for shit code more than you might already do

split hazel
#

would've sounded like a good idea a while ago when the bot wasn't powered by 50+ files

split hazel
wheat mesa
#

Totally didn't just spend the last 2 hours confused out of my mind before realizing that I forgot to enable an intent...

errant flax
#

lmao thats me sometimes

#

mostly bc i didnt add the intents at the Websockets options

graceful shore
#

what permissions does a discord bot need for message embeds

proven lantern
#

if a guildDelete event happens and guild.available === false does that mean the guild still has the bot installed for sure?

graceful shore
proven lantern
errant flax
#

imma try communicating with discord's api from scratch hmm

errant flax
#

this will be hard dog_kek

#

oh thx for the link

prime mist
#

Using axios here, but you could swap it out for fetch.

earnest phoenix
#

Meanwhile in JavaScript

for(i=p=0,c=1;;p=c,c=i,i=p+c)console.log(i)
clear marlin
earnest phoenix
young rune
#

hmm

#

:/

tame kestrel
#

Yo does anyone know any modern/reliable ways of converting xml into js object/readable format

sudden geyser
#

They probably want a library

earnest phoenix
#

Perhaps

tame kestrel
#

sorry yeah I was thinking more or less programatically

sudden geyser
#

There are libraries on npm to get this done for you.

tame kestrel
#

yeah just wanted to see if anyone has a good package or anything lol

earnest phoenix
errant flax
#

why is
msg.member.voice.channel returns null when im in a voice channel

tame kestrel
#

@earnest phoenix thanks it seems like that's the best option

earnest phoenix
errant flax
#

v12

earnest phoenix
#
            guildSettings,
            guildSubscriptions
        ] = await Promise.all([
            this.client.mongodb.fetchGuildSettings(message.guild.id),
            this.client.mongodb.fetchGuildSubscriptions(message.guild.id)```
```Cannot read property of fetchGuildSettings of undefined```
#

what to define fetchGuildSettings?

#
        const isPremium = guildSubscriptions.some((sub) => new Date(sub.expiresAt).getTime() > (Date.now()-3*24*60*60*1000));
        const aboutToExpire = isPremium && !(guildSubscriptions.some((sub) => new Date(sub.expiresAt).getTime() > (Date.now() + 5 * 24 * 60 * 60000)));
earnest phoenix
# errant flax v12

Not sure about why that happens, it probably doesn't return null, you might be using the incorrect message instance or something to do with your intents

#

Are you using the dev branch or the normal stable branch

errant flax
#

the thing is im in the bot's cache

errant flax
earnest phoenix
#

I know, you could still be using the dev branch; I don't think the version was bumped at all in the dev branch

errant flax
#

lemme ss the version of djs

#

im checking what intents i have hmm

earnest phoenix
#

Then yea, probably the thing I said other than the branch

errant flax
#

im missing GUILD_VOICE_STATES intent KEKA

#

it works now lmaoCry

split hazel
#

the intents intent is to drive people insane

errant flax
earnest phoenix
#

today i found typing (_ => {})() into chakra ui's editable examples on their docs crashes the website

errant flax
#

whats that noobthonk

long crow
#

select menu

earnest phoenix
#

weeb

long crow
#

shoo

earnest phoenix
#

the different coloring of field text and titles makes it look bad

#

put english in the field title and japanese in the description mmLol

long crow
#

That is like 2days old, might change to my liking later

earnest phoenix
#

and give the bot nitro so they can send 4069 letters long text

long crow
#

I'm pretty sure got loads of copy pasta when I share this repo, but hey w/ever

earnest phoenix
#

is this work when bot cant have permission in server but it cant crash

#

.catch(err => console.log(err));

#

any one tell

sudden geyser
#

not enough context

earnest phoenix
#

he never gives context

sudden geyser
#

most users don't

hoary crown
#

So I've been wondering how do you get the database ping

dusk narwhal
#

hello

earnest phoenix
unique creek
#

Can someone tell me where I can make my bot where it hosts 24/7?

pale vessel
#

Rent a VPS

unique creek
#

Err is there a free way?

mild agate
#

nope

spare badger
#

People told me they host for free on Heroku.

earnest phoenix
#

you'd have to hate yourself, your mother, your father, your family, your life, everyone around you, the entire world, life itself and have died been reincarnated and died again, gone to hell, come back, jumped in a pit of spears, climbed out using a ladder made of needles like something out of saw and then fallen back in to want to host a discord bot on heroku

cinder patio
#

heruko is a good option for personal bots, i.e. bots which aren't meant for a lots of guilds

earnest phoenix
#

^ partial repost

#

heroku is not good for bots

#

even glitch works as a good testing environment

cinder patio
#

Heruko is a hosting service, why would it be bad for bots?

#

I've had a few personal bots hosted on heruko

spare badger
#

Why is Heroku bad for Discord bots? I don't have any experience with Heroku, just curious.

hidden coral
#

Guys

earnest phoenix
#

Girls

hidden coral
#

How do I use a proper image for my not page background?

#

The images I used rn are not full they do not fit the page and look bad

earnest phoenix
#

for your what page?

hidden coral
#

I need a good image which fits the page

long crow
#

Host on RPi4

hidden coral
#

Bot page top.gg @earnest phoenix

earnest phoenix
#

I used the backgrounds from there for my newtab page

spare badger
#

Unsplash is also a good website.

#

All very high quality and free to use.

earnest phoenix
#

Does unsplash require attribution?

spare badger
#

Sometimes. I tells you when.

hidden coral
spare badger
spare badger
#

I don't even know what your bot does

hidden coral
#

Pls

spare badger
earnest phoenix
#

Ok lemme get some

hidden coral
#

My phone is laggyy

marble juniper
#

just buy a new one

spare badger
#

You can use this link https://i.imgur.com/Bs0o9l9.jpg

marble juniper
#

l

hidden coral
earnest phoenix
spare badger
#

@hidden coral Are you using CSS to do this? You just have to do

background-size: cover;
background-repeat: none;
earnest phoenix
#

#image {
width: 100%;
height: 100%;
}

#

this is what i used

spare badger
earnest phoenix
#

background size didnt work for me

spare badger
#

Background size only works if you actually use the background-image attribute to show the background and not a img tag.

earnest phoenix
#

i did use background prop

spare badger
earnest phoenix
#

i needed it to fill the entire viewport so

hidden coral
#
background-image: url('https://imgur.com/a/UPcScxj');
background-size: cover;
background-repeat: none;
}
``` This would be the code?
spare badger
#

Jelly use that second link I send you

#

This link won't work

hidden coral
#

Oh ok

spare badger
#

You need a direct link to the file.

#

Other than that, yes that should work.

errant flax
#

stupid question but how do i hide files in GitHub lmaoCry

spare badger
#

@errant flax What do you mean? Do you want to ignore the file from being pushed to the repository or do you want it to be private?

#

You can either use .gitignore to ignore files from being pushed at all (like environment variable files) and you can make you repository private to hide the entire repository from the public.

errant flax
hidden coral
errant flax
#

like what content/code do i need to enter

spare badger
#

@errant flax You should add the config.json to a .gitignore file. Config files should never be pushed to github. What I then normally do is make a example.config.js file that I do push to the repository that is then a template for when I install the code somewhere new.

#

@errant flax You create a .gitignore file in the root directory of your repository folder and just add the path to the config.json in that file.

#

Path relative to the .gitignore file

#

So that would probably just be config.json if the config.json file is also in root.

errant flax
#

how do i make sure ppl dont actually see the file noobthonk

spare badger
#

You can't hide one single file in the repository. You have to make it so you don't push it to GitHub.

#

And you do that by using .gitignore.

#

.gitignore is also being used to ignore node_modules directory for example.

errant flax
#

ahh ok thx hmm

#

time to hide some files KEKA

opal plank
#

gitignore doesnt "HIDE" files

spare badger
#

It ignores them

opal plank
#

it just prevents them from being uploaded

#

exactly

#

git is basically just a clone of ur code

spare badger
#

And you also have to delete the files first if you add them to ignore after you've already pushed them.

opal plank
#

if u dont want to upload a file, add them to gitignore.

spare badger
#

Because otherwise git will ignore the fact that you deleted them Kappa

#

The easy solution would be to make your entire repository private

spare badger
#

O.o

#

Encrypt your config.json

prime mist
#

It isn't uncommon to have your config encrypted

spare badger
#

And then you need code in your project to decrypt the config since your project needs config variables and so you provide people a way to decrypt the config you encrypted so they couldn't read it? O.o

#

Doesn't make sense in my 4head

prime mist
#

Quite often a framework will only require a decryption key as the only external config item, and then you don't have to keep updating your production environment when you add more sensitive config etc.

spare badger
#

But then we are talking specifically about config.json files that contain configurations that are not environment specific?

prime mist
#

Yeah, if it isn't sensitive then a plain JSON is fine.

Things like tokens and keys need a different strategy.

errant flax
#

what does this means

spare badger
#

The json inside config.json is invalid.

errant flax
#

wew "message" event is deprecated for master branch

#

wait does .gitignore applies to the owner/collaborator of the repo noobthonk

hidden coral
#

@spare badger

#

Hey could u just go to my bot page and send me an ss of what you see pleased?

errant flax
#

isnt that advertising bonk

hidden coral
sly sierra
#

thats the dumbest excuse ever, you can see your bots page yourself

#

just because a bot reviewer sees it doesn't make it different

slender thistle
#

^

clear marlin
#

^

hidden coral
#

In pc

#

I am in mobile

#

@sly sierra @slender thistle @clear marlin

errant flax
#

how do i disable mentions in a message like i want to display it like it mentions a role but it doesn't actually ping the role

errant flax
#

can u give an examplehmm

opal plank
errant flax
#

im using djs

fallen vale
#

hey guys

#

do any of u know how to add / commands to your bot?

long crow
#

Vague question

errant flax
cinder patio
pale vessel
#

If you want to disable mentions for all messages, you can pass that to your ClientOptions

hidden coral
#

How do I edit the vote button on my bot page and make it like better?

pale vessel
#

Where exactly? Your bot page or on top.gg/bot/id/vote?

opal plank
#

what i sent you IS relevant to your question

earnest phoenix
#

How's my newtab lookin'?

#

Unfortunately Opera doesn't support chrome_url_overrides because "malicious extensions"

earnest phoenix
#

What does threads mean in hosting

#

Because I was looking into hosting and I stumbled upon CPUs and threads

#

Which now I am confused

#

any help about making a autospawning bot like pokecord/poketwo?

lyric mountain
#

threads are basically "parallel" processes

#

kinda like a highway with multiple lanes

quartz kindle
#

when hosting companies mention cpus and threads, they mean physical cores and logical cores

#

for example a 4 core intel cpu with hyperthreading will show as 8 cores in your task manager

#

thats what they're talking about when they mention threads

signal estuary
#

How do I get the owner of a server?
I used: ```js
const { owner } = guild

in v12 but it doesnt work in v13 now
quartz kindle
#

owner was removed in v13

pale vessel
#

Use guild.fetchOwner()

quartz kindle
#

you have to use guild.ownerID in combination with guild.members.fetch()

#

oh they added fetchOwner?

pale vessel
#

Yeah

quartz kindle
#

cool

pale vessel
#

PR by advaith

#

mmm

quartz kindle
#

that guy is addicted to discord lol

digital ibex
#

yo, does anyone know why im gettin this error: TypeError: Class extends value [object Object] is not a constructor or null ?

#

the code is just js class Position extends Core { ... }

#

and Core is require('../core/Class');

#

and that is...

signal estuary
digital ibex
#
class Core {
  constructor() {}
  
  get random() {
    return 'hi'
   }
}
lyric mountain
#

why did you put an empty constructor there?

digital ibex
#

bc i havent even like

#

started

quartz kindle
digital ibex
#

like i am gonna need it, but not yet

pale vessel
#

make sure to await it

quartz kindle
digital ibex
#

module.exports = Core;

#

and i added something to the constructor but still nothin

#

well not nothing

quartz kindle
#

and how did you import it?

digital ibex
#

but the same error

#
const Core = require('../core/Class');
quartz kindle
#

is module.exports = Core after the class Core?

digital ibex
#

yeah

quartz kindle
#

can you console.log(Core) after requiring it?

digital ibex
#
const Random = require('../structures/Random');
const random = new Random();
const generator = require('../../../index');

class Core {
    constructor() {
        this.generator = generator;
    }

    get random() {
        return 'hi';
    }
}

module.exports = Core;
#

^ class file

digital ibex
quartz kindle
#

ah

#

you have a circular dependency

#

never import index

digital ibex
#

?

quartz kindle
#

im assuming your index file is the file that you run?

#

index.js

lyric mountain
#

import sequence: index -> core -> index -> core -> index -> core -> ...

digital ibex
#

nah

#

index.js is just the like

#

actual class if that makes sense

cinder patio
#

does index.js require Core?

#

or any other file which requires Core?

digital ibex
#

welll, at some point yeah

cinder patio
#

If so, that's a circular dependency

quartz kindle
#

you have a circular dependency yeah

digital ibex
#

im a bit confused

#

im only importing Core to extend it

#

on a diff class

quartz kindle
#

your file that requires Core

#

causes the Core file to require everything it needs

flat copper
#
module.exports = {
	name: 'member',
	run: async (client, message, args) => {
		const array = [];

		message.guild.members.cache.forEach(m => array.push(m));

		message.channel.send(
			array
				.slice(0, 2048)
				.map(m => m.user.username)
				.join(', ')
		);
	}
};
quartz kindle
#

if any of those requires for some reason end up requiring the file that requires Core

#

then Core will never finish loading

earnest phoenix
#

You should slice the joined string instead

quartz kindle
#

it will keep requiring files in a circle

digital ibex
#

i get what ur sayin

flat copper
#

.join(" ,").slice()?

digital ibex
#

but i dont understand lol

#

idk

lyric mountain
#

may I ask

#

why are you making a rng lib?

quartz kindle
#

position.js also requires index

digital ibex
digital ibex
#

so how do i like

#

get the random generator object?

earnest phoenix
digital ibex
#

cuz i cant create a new one bc then it'll be the object yeah, but it wont show the correct data

quartz kindle
#
this.core = new Core(this)
earnest phoenix
#

hello is any way it cant send message in terminal it send in server .catch(err => console.log(err))

digital ibex
quartz kindle
#

in the randomGenerator class

earnest phoenix
#

tim can you help me

quartz kindle
#

then you will get an instance of RandomGenerator as the argument in the Core constructor

#

which then you can also pass to Position or Random

earnest phoenix
#

hello

quartz kindle
digital ibex
#

so i import lib/index ?

quartz kindle
digital ibex
#

i think he means discord server

quartz kindle
#

you dont import anything

#

RandomGenerator imports Core

earnest phoenix
#

.catch(err => console.log(err))

quartz kindle
#

then does new Core(this)

#

Core imports Random

digital ibex
#

oh

quartz kindle
#

then does new Random(argument from Core constructor)

earnest phoenix
#

any one say free bot hosting

quartz kindle
earnest phoenix
quartz kindle
#

err => message.channel.send(err.toString())

earnest phoenix
#

they give

digital ibex
digital ibex
#

?

earnest phoenix
#

Ohh okies

digital ibex
#

ask there, not here

earnest phoenix
digital ibex
#

@earnest phoenix

#

ask there

earnest phoenix
#

So what should I look for when buy/choose a host?

lyric mountain
earnest phoenix
lyric mountain
digital ibex
#

yeah

quartz kindle
earnest phoenix
#

Bot?

lyric mountain
#

...that doesnt narrow very much

digital ibex
#

it works now

#

noice

#

thank

quartz kindle
#

for starters, 1 cpu and 1gb memory should be enough

#

you can get that for 3-5 $ a month

earnest phoenix
#

Got it! Thank you!

earnest phoenix
#

Did discord api changed .Since same code returns :
DiscordAPIError: Cannot send an empty message

flat copper
#

How to get things serialize from array

#

Like
Math.floor(Math.random() * array.length) but this gives random

vivid fulcrum
#

huh?

quartz kindle
#

if you updated

earnest phoenix
#

Code:

let exampleEmbed = new MessageEmbed()
.setColor('#ff9900')
.setTitle('Ping')
const m = await message.channel.send(exampleEmbed);
let exampleEmbed2 = new MessageEmbed()
.setColor('#ff9900')
.setTitle('Ping')
.setDescription(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp
}ms. API Latency is ${Math.round(message.client.ws.ping)}ms`);
m.edit(exampleEmbed2)```
pale vessel
#

Maybe send({ embeds: [exampleEmbed] });?

earnest phoenix
#

Prob as well need a desc

earnest phoenix
pale vessel
#

Desc for?

pale vessel
earnest phoenix
#

wouldn't it brick stuff

#

Never mind, I missed the title

quartz kindle
#

code looks correct

#

i know discord deprecated embed but they didnt remove it

#

it should still work no?

pale vessel
#

Try channel.send({ embed: exampleEmbed }); then

earnest phoenix
quartz kindle
#

ah, maybe it only works with another field

#

if they changed it to require embeds, then embed would not work alone

#

only in combination with content or file

cinder patio
#

Wait so bots can send multiple embeds in a single message?

quartz kindle
#

yes

pale vessel
#

Yeah

earnest phoenix
cinder patio
#

cool

pale vessel
#

You don't need content

earnest phoenix
#

The char limit remains the same is kinda uh mmulu

quartz kindle
#

discord.js doesnt allow you to send nonexistent params

#

embeds doesnt exist in v12

#

so you cant really send it using embeds

pale vessel
#

Ah

earnest phoenix
pale vessel
#

It's on master iirc

quartz kindle
#

huh so embed still works after all

pale vessel
#

I have no idea what they updated since I don't use it anymore

earnest phoenix
#

Will be removed on v10 afaik

quartz kindle
#

v10?

pale vessel
#

API v10 ig

earnest phoenix
#

Yeah, source: devsnek

tulip ledge
#

Wait, they removing embeds?

pale vessel
#

embed in favor of embeds

feral aspen
#

Hi.

#
data.dailyMultiplier += 0.1;

.. is making it 0.100000000000000000000000000001

#

.. I forgot the method with inputting 2 arguments to set the amount of decimals.

lyric mountain
#

ye, that's how floating points work

feral aspen
lyric mountain
#

method for?

feral aspen
#

Locking the amount of decimals to 0.1 instead of 0.1000...0001

lyric mountain
#

you cant

tulip ledge
#

U round it

lyric mountain
#

that's how floating points work

feral aspen
lyric mountain
#

0.1 will always be that bugged value

latent heron
#

Round...

feral aspen
tulip ledge
#

Math.floor(x * 10)/10 iirc

quartz kindle
#

oh lul, api versions are moving so fast now, it was v6/v7 for like 4 years

tulip ledge
#

Or what were u gus talking about

feral aspen
earnest phoenix
tulip ledge
#

I think thats how u do it ye

quartz kindle
feral aspen
#

I remember a method like .someMethodName(x, y)

tulip ledge
#

Bruh

latent heron
#

Clamping values?

quartz kindle
latent heron
#

Max?

tulip ledge
#

He wants an integer no?

#

I mean u could parseint it

feral aspen
feral aspen
quartz kindle
#

then you need to multply and divide

#

there is no method to cap number of decimals

earnest phoenix
#

@quartz kindle Hello how to check if a user has voted or not. Discord.js btw

feral aspen
#

I want to add 0.1

tulip ledge
quartz kindle
#

yes

tulip ledge
#

U can change it to ceil or flior depending on how u want it

earnest phoenix
earnest phoenix
#

alright

feral aspen
#

Could I do ```js
... += 0.1.toFixed(2)

#

?

tulip ledge
feral aspen
tulip ledge
#

toFixed returns a string

tulip ledge
feral aspen
quartz kindle
tulip ledge
#

Oh

quartz kindle
#

embeds:[embed1, embed2, embed3]

feral aspen
#

Array..

#

^^

tulip ledge
#

Oh well thats pog

quartz kindle
feral aspen
#

๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘

tulip ledge
#

I legit sent u that earlierโ€ฆ.

feral aspen
#

I just opened scrimba to test it out.

#

Managed.. thanks all.

cinder patio
#

why do you need the accuracy

last tapir
#

hi

#
const superagent = require("superagent");
const generating = new MessageEmbed()
.setColor(black)
.setDescription("Generating a duck picture...")

let msg = await message.channel.send(generating);

let { body } = await superagent
.get(`https://random-d.uk/api/duck`);
//console.log(body.file)

const noBody = new MessageEmbed()
.setColor(red)
.setDescription("โŒ An error occured as I broke, please try again!")

if (!{ body }) return await message.channel.send(noBody);

const embed = new MessageEmbed()
.setColor(black)
.setImage(body.message)

message.channel.send(embed);

msg.delete();
#

did I do something wrong in .get

latent heron
#

A good read if anyone is interested

vivid fulcrum
#

newer versions are relatively ok

#

but if you use php today you're just a dumbass lol

#

modern web frameworks blow php out of the water

latent heron
#

i don't think using php today makes you a dumbass

#

it still has good uses

signal estuary
pale vessel
#

Await it

earnest phoenix
#

Just get the owner id if you wanna mention it

pale vessel
#

You can use Owner: ${await guild.fetchOwner()}

signal estuary
cinder patio
#

You don't need the entire object to mention them

lament rock
#

guilds should have an owner id property

signal estuary
lament rock
#

the way you mention users is <@UserID>

pale vessel
#

You're right oml

signal estuary
#

And thats not the case

pale vessel
#

use guild.ownerID

#

Since you only want to mention them

lament rock
#

what info do you need about the owner other than their ID

#

if you don't need username, discrim, avatar or any actual user info, just use the Guild's owner ID property

#

Fetching more users just leads to more memory usage, which is highly advised against

hidden coral
#

Guys how do I make the vote button on my bot page look better?

signal estuary
signal estuary
lament rock
#

target the css classes the buttons inherit

#

you can inspect element to look at classes

#

even edit in browser until you find settings you like

hidden coral
#

But I I on phone so I can't inspect

#

A small code just for making it look like a blue rectangle would do pls

wary flame
#

Idk if you're able to use css to style buttons outside of your bot description but you can select the button using

*[href="{your bot id}/vote/"] {}
hidden coral
#

Not this

#

I want to make the vote button on my bot page look better

wary flame
#

yes

#

I understand

#

You can apply this css selector to style it

#

The vote button doesn't have an unique class or id so selecting by href attribute is the best way

#

@hidden coral

wet scroll
#

So I have an API with the express framework, I am trying to post stats to the endpoint but I am getting the error: (node:12) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'authorization' of undefined

It is the same code as my other endpoints for requesting the authorization header but they do not throw this error, they return 401 if its missing or continue if its not.

If I try to console log req.headers['authorization'] it just causes the issue to occur still. Code below

https://haste.thecutefoxxy.com/yeuchemhla.js (API Endpoint Authorization Check)
https://haste.thecutefoxxy.com/lgejrldopn.js (POST Request Code)
https://haste.thecutefoxxy.com/ayulpflefp.js (API Logged Headers)

wary flame
#

@wet scroll In wich of the files does the error occur?

#

The first one?

wet scroll
#

Yes

cinder patio
#

you have swapped the parameters

#

the first parameter is the request, the second is the response

wary flame
#

It says it cannot read property "authorization" of undefined so req.headers is undefined

#

^

cinder patio
#

unless you call the function yourself and don't give it to express

wet scroll
#

THONK I am not checking response headers though

#

wait

wary flame
#

line 2 of first file, req.headers is undefined

cinder patio
#

the response object doesn't have a headers field

#

req is your response

wary flame
#

You probably swapped request and response

cinder patio
#

res is your request

wet scroll
#

should be req, res

cinder patio
#

no, it's the other way around

#

yes

wary flame
wet scroll
#

Ye, I noticed ๐Ÿคฃ

wary flame
#

Also you shared your token or whatever it is so you might want to change that

wet scroll
#

๐Ÿคฃ its just a random string I made lol

#

its not the actual token, the actual one is in a DB

#

but thanks ๐Ÿ˜… I am gonna go back to bed

quartz kindle
#

made a cool chart

sudden geyser
#

Why is every UI framework blue.

fallen holly
#

why this failed

solemn latch
#

are you sending a response?

zinc wharf
#

Ah buttons. Something I hate. They never work for me. No idea why tho ๐Ÿ‘€

solemn latch
#

not working in what way?
getting interaction failed, or not getting the events?

fallen holly
#

interaction failed

#

not showing any errors in the console when i hit it

#

it just says that

solemn latch
#

okay, are you responding to the button?

#

all button presses need some sort of response to the button press itself.

#

or well, what library are you using for buttons?

fallen holly
#

discord-buttons & discord-button-pages

solemn latch
#

if you add this somewhere the interaction failed issue should fix itself.

client.on('clickButton', async (button) => {
    button.defer(true);
});

all button.defer(true); does is say "i have nothing to say to this right now"

mild agate
#

can es6 npm modules run with react?

solemn latch
#

anywhere client is accessible

vivid fulcrum
#

react is just another library