#development

1 messages · Page 1988 of 1

neat ingot
#

fair enough 😄

boreal iron
#

So what would be the proper way then, to pass my database instance to the child?

#

Can I pass them sort of like I do with arguments to modules?

quartz kindle
#

if you want to keep them stateless

#

just pass events via ipc

#

master shard event -> ipc -> child -> ipc -> master database call -> ipc -> child -> response via http or -> ipc -> master response via http

quartz kindle
#

however database connections are usually very easy to create an maintain

boreal iron
#

Oh so I would basically build an event handler sending the event via ipc to the child

quartz kindle
#

you should easily be able to create a separate db connection on each shard

#

master shard event -> ipc -> child -> dedicated database call -> response via http or -> ipc -> master response via http

boreal iron
#

Well the goal was to create the database pool in the master

quartz kindle
#

if you are working with sql pools, then you need a separate pool on each child

#

you can make the pools smaller to compensate if you want

quartz kindle
#

however it would be more advantageous to just keep a connection always on instead of using a pool to connect/disconnect

prime mist
#

To be honest, internal sharding should get you a long way. I would definitely be looking at other options if I was considering process forking.

boreal iron
#

I feel like that somehow ruins my entire plan then
Im barely missing the basics here but I’ve never done this before it thought about it

quartz kindle
#

what exactly is your goal?

#

do you have a rough idea of what you want in terms of infrastructure?

#

could you draw a diagram if need be?

boreal iron
#

Yeah I have an explicit plan

#

But I can’t do anything else then trying to explain in words atm

#

Because you know why

quartz kindle
#

driving?

boreal iron
#

I’m usually like to discuss the theory about the things when I’m driving

#

To have time then to do things when I’m at home

boreal iron
quartz kindle
#

lel

#

so as i understand

#

you kinda want to go the oppositie direction of what people usually do

#

instead of having multiple processes handling shards and forwarding them to a centralized processor

#

you want to have a centralized shard handler and forwarding events to multiple event handlers

boreal iron
#

Basically yes

quartz kindle
#

techincally that is much easier to do than the other way around

prime mist
#

If you were building a massive bot, you would likely have a gateway service pumping events into rabbitmq or something.

You could then have zero downtime deployments.

boreal iron
#

And being trivial I thought I simply create my gateway connection and database connection in the master which creates a child process and I’m just passing my database and client (gateway) vars to the child when creating it

#

Simply spoken

quartz kindle
#

well you cannot pass the connection handlers

prime mist
quartz kindle
#

like if you create a database connection, for example const connection = await database.connect();, you cannot send the connection variable to a child process

boreal iron
#

Yeah which was the reason I thought then to emit an event in the child and pass the data to the event listener in the master then

quartz kindle
#

yes you can do that

boreal iron
#

Yeah the issue is it would be required for the gateway connection, too

#

Which makes is absurdly complicated

quartz kindle
#

whats so complicated about it?

boreal iron
#

Well wouldn’t I need to build an event handler in the master which would deal with any discord like event I’m using?

quartz kindle
#
// master
shard = new discordshardsomehow();
shard.on("message", data => {
  child.send(data)
});
child.on("message", response => {
  discord.post(response)
});

// child
db = new database();
process.on("message", data => {
  do something with data;
  result = maybe do db.fetch();
  process.send(result)
})
#

in stupidly simplified terms

boreal iron
#

Ah I see the master does require a shard manager for the gateway connection here even if I just create one child

prime mist
#

Shard(s) (if you use a mix of process and internal sharding) should have everything they need in their own process.

boreal iron
#

That’s a different story then as I need to get into sharding then even if it will always just be one shard

hoary apex
#

Guys my bot is not connecting

#

To code

boreal iron
earnest phoenix
#

UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

#

is it bcs my bot don't have permissions?

boreal iron
#

Aye

hoary apex
#

Nah same error

boreal iron
#

Dude if you don’t provide any code and errors how should anybody be able to help you?

quartz kindle
earnest phoenix
quartz kindle
#

i mean, this is what i understood you want to acomplish

boreal iron
#

Yeah which would bring me to the point to get into sharding then

earnest phoenix
quartz kindle
#

internal sharding is dead easy to do, you literally just set the number or set "auto"

#

no children are created, its all in the same process

boreal iron
#

For example sending a message

boreal iron
#

In theory my idea was great but I see it’s actually more complicated to accomplish it then throwing anything into modules I can reload at any time

quartz kindle
#

well

#

child processes are used for scaling, not for organizing code

boreal iron
#

Yeah I see

#

Well then thanks

#

That saved me a lot of time

#

Sleep well then, it’s your time freerealestate

hoary apex
#

Any replit developers I need a help

orchid nebula
#

const ban = await message.channel.send({content: `Are you sure you wanna ban \`${user}\`...`, components: [but1, but2]})
const collector = ban.createMessageComponentCollector({
    filter: (b) => {
if (message.author === user) {
    return client.createError(message, `❌ | You can't ban yourself!`);
   };
    },
  });
          
  collector.on("collect", async (i) => {
    await i.deferReply({
      ephemeral: false
    });
    if (i.customId === "confirm") {
      await message.guild.members.ban(user);

      i.editReply({ embeds: [ new MessageEmbed()
    .setColor("#F2C5F9")
    .setTimestamp()
                             .setDescription(`Successfully banned **${target}**`)] })
}
})
austere surge
#

did you mean: ${user}

orchid nebula
#

Dang yeh

austere surge
#

lol

orchid nebula
#

@austere surge but still error bro

austere surge
#

whats wrong

orchid nebula
#

Like the bot banning the user but not show the confirm embed

#

Just show this

austere surge
#

sec

orchid nebula
#

Ya

#

And no error in console also

austere surge
#

apparently theres supposed to be a ) at the end

orchid nebula
#

Wait lemme check coz i wrote whole code on dc

austere surge
#

where is the confirm being sent in the code

quartz kindle
#

weird but awesome js

orchid nebula
# austere surge where is the confirm being sent in the code

Interaction edit reply that's the confirm message ig

Like when a person will use ban cmd bot will send a content with two buttons one is confirm and other is cancel.

The confirm one is working as it bans the user but the I.editReply is not working

hoary apex
lyric mountain
#

Catch ur promises

hoary apex
#

?

#

Join my replit

lyric mountain
#

.catch(err => { handle error })

lyric mountain
hoary apex
#

..

shadow topaz
#

how to add like this image in bot page top.gg any one pls tell
if any video tutorial there pls give

wheat mesa
earnest phoenix
#

:)

#

I actually have no idea what im doing rn

wheat mesa
#

I know 🙂

shadow topaz
boreal iron
#

<img src="url" alt="image1" />

#

You can also simply paste your image URL into the description
That should also work

#

But I recommend using HTML

rocky hearth
#

how can ik when a thread gets archived?

boreal iron
#

By listening to the thread_update event according to the docs

#

Emitted whenever a thread is updated - e.g. name change, archive state change, locked state change.

rocky hearth
#

and I can unarchive a thread with bot, right?

boreal iron
#

Guess you’re using djs

#

You would need to pass false for the archived parameter

green pebble
#

how can i change this to an image for css... i check my code in codepen it works.. idk why it doesnt in top.gg custom css

wooden tusk
#

I want to do if a user vote to my bot , adds role on the support server

wheat mesa
#

then do it

#

😉

wooden tusk
#

Really ?

austere surge
#

yes'

green pebble
#

wtf werid link

#

better

austere surge
#

big

ivory siren
#

You sent link of command lol

#

Nvm

green pebble
ivory siren
#

Hmhm

earnest phoenix
green pebble
#

but how do i force dark now....

#

i used to see an option in bot settings.. but idk it disappeared

earnest phoenix
green pebble
earnest phoenix
#

!important is a very bad practice

green pebble
slender thistle
#

If it works it works

#

As long as they can sort their crap out later why not

green pebble
#

hmm cool

feral aspen
green pebble
earnest phoenix
#

as long as the bot has manage invite perms you can do it

feral aspen
#

Exactly. 😂

#

_ _

green pebble
earnest phoenix
#

Yea lets not tell people how to do it

#

smh

#

Even if its wrong

feral aspen
#

Why so? They would want to be spoonfed not explained.

earnest phoenix
#

Because then people will have an idea of what to do and actually do it

feral aspen
#

They would do it at their own risk, but oh well.

#

Stackoverflow really seems a lot of fun watching questions and having no idea how to answer them.

earnest phoenix
#

actually i think it would be okay if you use important

#

it's valid if you're overriding default css

earnest phoenix
#

using important is something you only do as a last resort iirc

#

^

#

It can fuck up css hierarchy if I remember correctly from what google said

#

there ya go

#

@green pebble so yeah it's fine to use !important ONLY if you're overriding top.gg's css

#

I remember I used important on almost everything

#

but that is because I was using bootstrap on my site

earnest phoenix
#

and bootstrap si really annoying

#

One of the reasons why I stopped using it

#

using bootstrap is a bigger crime than using important

#

I was beginner dont hate me

#

😔

#

same

#

I still am beginner but I learned not to use bootstrap KEKW

#

i used to put text inside img tags

#

Now i use my own css

#

took a long time to realize img tags can't have children

pale vessel
marble juniper
earnest phoenix
#

chakra < Mantine

marble juniper
#

^

earnest phoenix
#

mantine is better

marble juniper
#

Yes

#

More people should know about mantine

earnest phoenix
#

I use mantine over chakra when I use react

#

mantime

#

I mainly use angular these days tho

#

I like it over react

marble juniper
#

React components and hooks library with native dark theme support and focus on usability, accessibility and developer experience

earnest phoenix
#

link i have something to tell you

#

people care about mantine as much as they care about detritus

#

which is... not much

#

people should care about mantine

#

it beats chakra by a long shot

marble juniper
#

people don't care about detritus because nobody should

#

lol

marble juniper
marble juniper
earnest phoenix
#

I bet chakra can't do modals, drawers and manage date times, notifications, etc

marble juniper
#

yes

earnest phoenix
#

if mantine is accessible then i would use it

marble juniper
#

I think mantine is perfect for a document editor lol

#

cuz of its rte

#

rich text editor etc

#

or for forums

marble juniper
earnest phoenix
#

it is

#

modals are cool and so are drawers

#

that is my point

#

can do notifications too

#

who doesn't like sending notifications on their site

#

do you mean mobile browser notifications or just a text box at the top of your site

#

I think you can position it in any of the corners I can't remember tho

#

well yeah chakra has that

orchid nebula
#

earnest phoenix
#

"JavaScript developers are known for their ability to reinvent the wheel"

  • Fireship, 2022
#

But does chakra allow you to queue notifications?

earnest phoenix
#

I just steal other people's code

#

mantine's hooks seem cool tho

#

why do it myself if someone already does it

#

ye

marble juniper
earnest phoenix
#

mantine does have some cool hooks

marble juniper
#

This seems very useful to me personally

#

You could probably make like a document editor website with this

#

and the notifications system

earnest phoenix
#

markdown always better

marble juniper
#

Oh and you can install a code highlighting component as well

#

lol

#

They use it on the mantine site as well

#

I think I will make a document editor website with mantine

#

but with darkmode support

earnest phoenix
#

If you get a working version done

#

i'd use it

marble juniper
#

nice

green pebble
#

But how can I force dark... I'm trying a lot of different stuff but I'm not getting it to work

earnest phoenix
#

Can you even force dark mode on top.gg

#

If people have it on lightmode wont it just overwrite your pages css anyway

marble juniper
#

isn't there an option when u edit ur bot

#

to force dark mode

earnest phoenix
#

idk

marble juniper
#

also yo wtf

earnest phoenix
#

I don't even submit bots

marble juniper
#

I noticed my bot has 93 votes suddenly

azure yoke
#

Türkçe bilen var mı ?

earnest phoenix
#

Alright now to stop voting on links bot

marble juniper
#

:(

earnest phoenix
#

im kidding

azure yoke
#

@marble juniper Türkçe ?

marble juniper
#

No

azure yoke
#

Although there is a translation bot server, why is it not here?

marble juniper
#

wdym

green pebble
#

i added this too but no difference

green pebble
#

visiting my bots page in private tab rly fvks it up..

earnest phoenix
#

Till top.gg fixes the problem you can do one of these:

  1. Make your page look good on both light and dark mode.
  2. Make your own color scheme for the entire bot page that overrides whatever theme the user has selected.
#

oh boy is that css fucked on light mode

#

i suggest going for the first option

split hazel
split hazel
earnest phoenix
green pebble
#

how do i make a color scheme for the entire page that overides eyerthing??

#

i kinda have that as the last part... for the blue colors

earnest phoenix
#

Maybe I'd make a lib that lets you do that easily

green pebble
earnest phoenix
#

you can override the class chakra-ui-light on the html tag but you can't put javascript on your bot page to remove it pandasad

green pebble
#

uh

earnest phoenix
#

I've added a new "thing" to my schema, how do I insert it to all the available profiles in the db that doesn't have this "thing"?

marble juniper
#

Nobody can help you with that information alone

#

be more detailed

earnest phoenix
#

I added a new item in my schema (mongoose/mongodb) so I want to insert it to every documents in the profileModel collection if they don't have it already

lyric mountain
#

Refactor moment

#

Wouldn't it be better if u just set a default value if none found?

slender thistle
#

updateMany

#

Can't you do a set operation

earnest phoenix
vast cedar
#

If an access token expire after 7d, can i still refresh it ? Also, does the refresh token can expire ?

vast cedar
#

oauth2

slender thistle
rigid maple
#
  let memberActivities;
  onMount(async() => {
    let response = await get('http://localhost:9090/admin/dashboard');
    memberActivities = response.activities
    console.log(memberActivities) // Output: response.activities
  });
console.log(memberActivities) // Output: Undefined
    var controlActivity = memberActivities.filter(function(spotifyActivity) { // Cannot filter this because memberActivities is undefined
        if (spotifyActivity.id === 'spotify:1') {
            return true;
        }
    })
#

It returns undefined because it runs the code before the value is assigned

sudden geyser
#

The function you pass to onMount will be called some time in the future, so trying to assign it a variable isn't going to do it.

rigid maple
#

What can I do to make memberActivities wait for a value to be assigned?

sudden geyser
#

use the value inside the callback

#

and try updating whatever you're trying to do from within there.

#

don't know what framework you're using that handles it

rigid maple
#

i use svelte

earnest phoenix
#

do you have to always fetch the data AFTER it has been mounted?

#

can you not assign it a value during compile time

fiery stream
#

Yoo

earnest phoenix
#

hi

fiery stream
#

Question are if statements with multiple checks like if 1+1=2 && 2+2=4:

#

Ran left through right?

#

Or does it check both at same time in python

earnest phoenix
#

left through right

#

it would only ever run the second one if the first one returned true

#

with || it would only run the second one if the first one returned false

#

Conditionals are parsed and executed from left to right, although math expressions have their own set of rules for hierarchy

fiery stream
#

Ahhh that solved my biggest issue thanks for that @earnest phoenix

earnest phoenix
#

you're welcome

#

now pay me 100$ dogecoin for my assistance

fiery stream
#

Love you for that no homo

fiery stream
#

Like 2 weeks

#

It was fallin

fiery stream
earnest phoenix
#

yep

fiery stream
#

Perfect got it

earnest phoenix
#

if (smth) doThis();
can be written as
smth && doThis();

#

That's the behavior of the AND operator (&&), if you for example use the OR operator (||), the behavior will change, it will check for the second conditional if the first one fails

#

i already explained that five messages ago but ok

fiery stream
earnest phoenix
#

lmao why

fiery stream
#

Idk thought it might just be a thing lul

#

Well thanks guys I’ll apply that to my code n fix it later on

earnest phoenix
#

bye

fiery stream
#

Bye

earnest phoenix
#

alla hafiz

fiery stream
#

Thats sounds like a muslim thing idk what it means…

earnest phoenix
#

The compiler can misinterpret an expression and confuse their hierarchy if the expressions are colliding with each other, for example some compilers can interpret 1 > 0 && 6 < 7 || true as 1 > 0 && (6 < 7 || true) while it should be (1 > 0 && 6 < 7) || true

#

I assume that's what you're worried about

fiery stream
#

Are the || supposed to be a or statement or just shows whats its supposed to return lol?

earnest phoenix
#

That's an OR statement yes, those can collide with each other, hence can be misinterpreted, so that's probably what you're worried about, although most compilers interpret these correctly, so you don't have to worry about it much

fiery stream
#

Ahhh i see interesting

fiery stream
earnest phoenix
#

Yeah but that's just an example, nothing about the values, just the operator behaviors

fiery stream
#

I see gotcha

pale oasis
#

Will requiring something constantly affect performance?

if(cmd.info.privated.dev && !require('../config.json').DEVS.includes(message.author.id)) return

neat ingot
#

^ if you wanted to not cache it and do a fresh require each time

pale oasis
#

Okay.

neat ingot
#

If however, you are referencing the object obtained from your require, ie config, multiple times within a single file, you should (imo) do one single require for that file at the top of your program/file, and then reference that variable throughout your program, instead of having to write require('config') everywhere

pale oasis
#

Yes I know.
I have this at the top:
const configInfo = require('../config.json');

I just had a curious question about the require(); function.

neat ingot
#

no worries 🙂

#

another note on require:
if you have a module that exports an instance of an object, the first time you require that module, the object is created. all other times you require that module, it uses the same instance.

neat ingot
#

ie, that always has the same instance of DataStore

#

when i require the module

#

when a user upvotes your bot, you would need to have a server online listening and waiting for a webhook event to be sent to it from top.gg (send upon vote). your web server would then have to notify your desired discord server etc

earnest phoenix
#

How can i use text out of embed

neat ingot
wheat mesa
#

You can’t

earnest phoenix
#

A v6 idea
By default use link buttons for jump to the giveaway in win messages. someone said that, sad

wheat mesa
#

nobody wants to write your code for you

#

spoonfeeding is something we don't do here 😛

neat ingot
#

lol, lets see what the oldest version i have is... 😂

wheat mesa
#

if you look at top.gg's docs I'm pretty sure they have a comprehensive tutorial on how to set up listeners for voting

earnest phoenix
#

There is an example

#

Cache user in guild and add role ?

neat ingot
#

dang thats old 😂

#

is dblapi even still a thing?

wheat mesa
#

I highly recommend not asking people to write code for you

#

dblapi is deprecated iirc

earnest phoenix
#

Cache user in guild and add role ?

wheat mesa
#

you're not gonna learn anything if someone else does the work for you :p

#

we can give you tips and stuff, but nobody is going to give you a full functioning program

neat ingot
neat ingot
#

dang that code is so bad 😂

pale oasis
#

If you want to start learining how to use Discord.js, you can start with reading the guide, documentation, or a tutorial off YouTube.

neat ingot
#

imo, learning to write a bot is a great way to learn about programming, and how difficult it actually is 😂

wheat mesa
#

I wouldn't say writing a bot is necessarily really difficult, but if it's one of your first projects, it's quite a task

#

you'll learn a lot from doing it

neat ingot
#

I had been writing code for a solid 6/7 years before I started on bots, and I still to this day stumble into things im like 'wth?!'

wheat mesa
#

the discord api is vast

pale oasis
#

The most WTH thing ever is discord.js v13 message intent changes.

wheat mesa
#

it's difficult to know everything

pale oasis
#

Can't wait for v14!...

neat ingot
#

I'm curious how much v14 will actually change

earnest phoenix
pale oasis
#

They also deprecated 'message' and changed it to 'messageCreate'.
Again, unneeded.

neat ingot
#

lol

sudden geyser
#

depends on your definition of unneded

neat ingot
#

thats not the worst of changes tho. fairly easy to change a string for your event name

pale oasis
earnest phoenix
#

MessageEmbed and color updates

#

This will take hella time

pale oasis
earnest phoenix
#

waiting...

pale oasis
earnest phoenix
#

And it will be Embed

wheat mesa
#

djs devs complaining like it's the end of the world when one function gets renamed

earnest phoenix
#

RichEmbed: MessageEmbed,
MessageEmbed: Embed

wheat mesa
#

plus, the message to messageCreate change was due to the fact that the event in the actual api is named messageCreate

pale oasis
earnest phoenix
#

I see the future and did client.embed = new Discord.MessageEmbed so everytime i need embed i just type
let embed = client.embed
And if they change ill just update client.embed

wheat mesa
#

wtf KEKW

sudden geyser
#

oh no

earnest phoenix
#

They forced me to this lol

sudden geyser
#

no, you did :)

earnest phoenix
#

Maybe

pale oasis
sudden geyser
#

this is the price you pay for a library part of an ecosystem that's unapologetically modern

#

that looks even worse

earnest phoenix
#

If you use embed in each command

#

Not seems bad

neat ingot
#

just have a common utils class that you use for these things

pale oasis
wheat mesa
#

what the fuck

sudden geyser
#

also why bother exporting client if you can just do message.client

wheat mesa
#

^

neat ingot
pale oasis
#

WAIT

sudden geyser
#

available on pretty much any discord.js class/structure

wheat mesa
#

if you have an object from discord, 99 times out of 100 it has client attached to it somehow

neat ingot
#

yea, getting client from junk is real easy

neat ingot
pale oasis
#

Do you guys just allow copilot to do 90% of the work for you? 🤷‍♂️

sudden geyser
#

I don't like using copilot

neat ingot
#

~ never tried copilot

sudden geyser
#

Very intrusive with its autocomplete

pale oasis
earnest phoenix
sudden geyser
#

Intrusive as in it pulls up autocomplete in the worst moments/when I don't want it

#

Plus I use sublime text so no copilot

#

Copilot is the best AI code completion tool i've used though

pale oasis
sudden geyser
#

yucko

#

don't like its interface

pale oasis
#

VSC is superior change my mind.

sudden geyser
#

sublime text clean coolyuno

neat ingot
# earnest phoenix Why not

for a few reasons that i can see.
~ your passing the client object to super, the parent class likely already holds reference to it.
~ when a message or slash command interaction is created, you can get the client object from that, so there is no need to store it in the command at all really

pale oasis
sudden geyser
#

grr!

#

how does this not look beautiful

earnest phoenix
#

repl

wheat mesa
#

sublime isn't as cluttered as vsc imo

#

I still prever vsc because that's what I'm used to though

sudden geyser
#

I want to eventually move to neovim

pale oasis
#

Going to change that to an embed though.

sudden geyser
#

yeah but I'd rather abstract that away

#

since there's probably a lot of duplication

neat ingot
#

random question for yall: how many lines of code is your 'ping' command? 🙂

pale oasis
#

Disincluding white space?

sudden geyser
#

I don't have one

neat ingot
#

yea sure 🙂

neat ingot
sudden geyser
#

I feel like slash commands are enough of a "ping"

#

Where I don't need it

neat ingot
#

or the whole file size

sudden geyser
#

If I did have one, it'd probably be 8 lines.

earnest phoenix
pale oasis
#

Mine is 37 lines.

#

With whitspace.

neat ingot
earnest phoenix
neat ingot
#

7 lines of actual execution code SnorlaxDab

pale oasis
#

Without is 31.

neat ingot
earnest phoenix
#

Oh no lol

neat ingot
#

😭

pale oasis
neat ingot
#

lol thanks ❤️

pale oasis
#

Mine is just Bot and API Latency.

neat ingot
#

the thing i like most about it: no 'edited' text

neat ingot
#

most bot ping's have the little (edited) thing and it annoys the crap outta me lol

pale oasis
#

Nine?

neat ingot
wheat mesa
#

🤨

pale oasis
#

What're you doing, registering the user in to the pentagon?

earnest phoenix
#

hmm

#

Why is the error being sent to the channel lmao

pale oasis
#

It should be sent to a private channel.

earnest phoenix
orchid nebula
earnest phoenix
spark flint
#

smh

earnest phoenix
#

hmm

earnest phoenix
neat ingot
# earnest phoenix

this error seems to say that your client id for the spotify plugin isnt defined properly

earnest phoenix
#

hmm

#

hm

lyric mountain
boreal iron
earnest phoenix
#

lmao

neat ingot
boreal iron
#

Never heard of time traveling?

lyric mountain
#

No, like, the graph is going backwards at times

neat ingot
orchid nebula
neat ingot
lyric mountain
#

Like these moments

neat ingot
#

thats passed to chart.js

#

yea

#

line_tension 🙂

lyric mountain
#

What is line tension?

boreal iron
neat ingot
#

the smoothness of lines from point a -> b

boreal iron
neat ingot
#

by using a value over 1.0, it goes 'wonky' and wraps around itself and such. leading to this effect

lyric mountain
#

Shouldn't u decrease it then?

neat ingot
#

yes

#

but whers the fun in that?! 😄

lyric mountain
#

Lmao

neat ingot
#

also, makes my ping command unlike anyone elses SnorlaxDab

#

for the other graphs i use nice straight lines, as that data is more valuable and needs to be more precise (imo)

#

love me a nice graph 😂

boreal iron
#

You obviously like graphs

neat ingot
#

yes.

prime mist
earnest phoenix
#

How this guy playing with his bot

neat ingot
#

that is a great question.

#

I know how to get that to show on the bot's about me section. is there some place i can somehow attach that bot to my own about me?

unique beacon
#

discord rpc?

neat ingot
#

maybe its using some fancy markdown type thing?

#

oh yea no thats more likely tbh

unique beacon
#

do you mean something like my activity

neat ingot
#

yea, that is via rpc?

unique beacon
#

yes

earnest phoenix
#
let common = profileData.ownedCards.common || "No cards found";
^
TypeError: Cannot read properties of undefined (reading 'common')
at Object.run (/workspace/commands/user/cards.js:12:37)
at run (/workspace/events/message.js:79:22)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
``` breh
#

it worked like 5 mins ago

#

it's like this in the db

iron tendon
#

@earnest phoenix

earnest phoenix
#

change the last line to export default Document

iron tendon
#

this happens

earnest phoenix
#

reload page

iron tendon
#

nope

#

still borked

iron tendon
#

yeah you need to extend Document

junior pecan
#

do you have some more APIs or do you have just these?

spark flint
#

idk of any more

sudden geyser
#

What kind of APIs are you looking for

spark flint
#

low effort easy to use ones i guess KEKW

sudden geyser
#

I hope they're not just looking to throw in whatever to add more features

neat ingot
spark flint
#

missing images?

#

theyre there for me

neat ingot
#

hmm

spark flint
#

you block flaticon then

neat ingot
#

i do no such thing lol

#

but yea i get an error from that link there

#

wth? why are they blocked?

spark flint
sudden geyser
#

They're not loading for me either.

spark flint
#

sus

cinder patio
#

they are for me

boreal iron
#

Yeah for me, too

neat ingot
#

they arent displayed for me in firefox, chrome, edge, or opera 😄

boreal iron
#

Probably issues with the cdn or your IP or country might have been blocked temporarily by flaticon

spark flint
#

might be blocked in your country or something?

sudden geyser
#

why do you have opera

neat ingot
neat ingot
#

and to test website etc

marble juniper
#

(sql) anyone know how to create a column field in a table with a default value

boreal iron
#

There’s no excuse for having Opera installed - never!

earnest phoenix
sudden geyser
#

I think DEFAULT?

marble juniper
#

Also how can you declare if a field can be null or not

marble juniper
neat ingot
#

mongodb > sql

sudden geyser
#

Just DEFAULT ? where ? is your value.

earnest phoenix
boreal iron
sudden geyser
#

Can be computed, such as a UUID generator

marble juniper
sudden geyser
#

Yeah

#

sql and mongo both suck <3

marble juniper
#

I use postgres

#

lol

boreal iron
sudden geyser
#

still sucks <3

marble juniper
#

postgres is amazing

neat ingot
spark flint
sudden geyser
spark flint
marble juniper
earnest phoenix
#

*tit oh lord

spark flint
marble juniper
#

sus

sudden geyser
#

but if I can't use that postgres

marble juniper
#

imagine ur irl name was tat

sudden geyser
#

I don't like it but there's not much else

spark flint
atomic kindle
#

coding is for nimrods

marble juniper
#

postgres is amazing doe

atomic kindle
#

it is

marble juniper
#

its

#

t h e b e s t

sudden geyser
#

it's still sql so it's going to suck regardless

marble juniper
#

database

neat ingot
atomic kindle
#

not the best but yes it is top tier

marble juniper
#

and if you disagree u disagree

neat ingot
#

like what bruh?

sudden geyser
#

Yeah it's not popular

#

Only used in a niche community

#

But it's very nice

#

and much more flexible than sql

marble juniper
#

that looks absolutely horrible lol

sudden geyser
#

If you want to do more research just search for Datalog

marble juniper
#

sql is way easier to understand than this

sudden geyser
#

that's because you aren't used to it :)

marble juniper
#

you could say that for any programming language

sudden geyser
#

once you learn it you don't want to go back

boreal iron
#

Klay hating sql, Klay being a big troll

sudden geyser
#

I'm big troll

boreal iron
#

You big troll

sudden geyser
#

but really I don't like sql but still use it

junior pecan
sudden geyser
#

Yes but what kind of REST API

marble juniper
#

klay be like

junior pecan
#

Wait a min

boreal iron
sudden geyser
#

just join the metaverse

marble juniper
#

you can't say sql is bad cuz I said so

#

10/10 argument

junior pecan
sudden geyser
#

still not specific

earnest phoenix
neat ingot
#

omg im dying

boreal iron
sudden geyser
#

An anime API, for example, is more specific.

junior pecan
#

Oh

marble juniper
#

Does anyone here actually like mongodb

sudden geyser
#

surely

marble juniper
#

and would they use it in prod

neat ingot
junior pecan
marble juniper
#

lol

sudden geyser
#

look if rapidapi has anything in stock

marble juniper
#

idk if I would use it

neat ingot
#

been using it in production reliably for like 5 years

#

maybe 4, been a time tho 🙂

marble juniper
#

how would I delete certain keys in my data structure

#

oh wait

sudden geyser
#

Personally I don't like that MongoDB has no relationships

marble juniper
#

the data is not structured

earnest phoenix
#

i am using mongodb so

neat ingot
#

you can use mongoose to force a structure/schema

sudden geyser
#

but then what's the benefit of mongo

marble juniper
#

But thats just a lib

junior pecan
marble juniper
#

And also

neat ingot
#

for me the benefit is having my entire source written in js

marble juniper
#

I have found mongoose to be a hell to work with

boreal iron
sudden geyser
#

I like schemaless databases (so parts of MongoDB) since it's much more tolerant with the data you put in it, but still want a schema for certain behavior, like maintaining relationships between keys.

earnest phoenix
#

I'm using localhost mongodb on my server and actually i didn't encounter any problems but yea mongodb is slow

neat ingot
#

slow?

#

where?

marble juniper
#

with sql you at least know what data can be in each row

#

since mongodb is unstructured you have 0 idea

#

unless u know ur code

sudden geyser
#

That's kind of the point

#

There's an implicit schema in mongo

#

You still know the keys there because you're asking for them

junior pecan
marble juniper
#

pick a random meme off of r/memes

#

big brain

sudden geyser
#

or reddit

earnest phoenix
#

i could spoonfeed my entire code and the user won't be able to use it because it's detritus

marble juniper
#

That way u always have up to date memes

earnest phoenix
marble juniper
#

cough 🇺🇦

marble juniper
sudden geyser
#

I mean, meme subreddits are predominantly composed of 14-year-olds

#

So it shouldn't be a surprise r/memes or whatever is a circlejerk arena

earnest phoenix
#

r/dankmemes more like r/dankporn

marble juniper
#

sus

marble juniper
#

bruh wtf did u just find

earnest phoenix
# marble juniper

wtf wtf wtf wtf wtf wtf wtf wtf
wtf wtf wtf wtf wtf wtf wtf wtf
wtf wtf wtf wtf wtf wtf wtf wtf
wtf wtf wtf wtf wtf wtf wtf wtf

sudden geyser
#

figure out how to use the thing

#

you are the software developer!

junior pecan
#

Im trying

marble juniper
#

kinda sus ngl

sudden geyser
#

I only used rapidapi once (though not for API work), but there should be instructions for how to use that API.

marble juniper
#

It should be illegal for an api to have no docs

sudden geyser
#

No documentation is the best documentation

marble juniper
#

change my mind

#

like who tf is gonna want to fuck around with ur api to know what it does

sudden geyser
#

unless you're a trillion dollar company

#

cough apple

marble juniper
earnest phoenix
#

Documentation is intentionally hard to ward off idiots who'd abuse the API

Change my mind

sudden geyser
#

damn so that's why hypixel's api sucks ass

marble juniper
#

Hypixel stinks

marble juniper
sudden geyser
#

but seriously, hypixel's api is literally just a mongodb dump

marble juniper
#

Nah I mean my api is protected so only I can use the api lol

sudden geyser
#

you use a token for it?

marble juniper
#

ig yeah

#

I could make an ip whitelist but thats annoying

next crown
#

Hi, I tried creating new bot and it won't start with node . or node index.js

#

I tried in cmd and VScode terminal

#

It won't work

#

Plz help

solemn latch
#

did you use npm init?

solemn jolt
#

hello i want to add distube package to my code and i get this error

npm ERR! node_modules/distube
npm ERR!   distube@"^3.2.1" from the root project
spark flint
#

is it possible to detect when someone is marked as spam by discord? i'm using discord.js

marble juniper
#

I mean there is no api endpoint for it

#

so yeah

earnest phoenix
#

Can I get the arena cards from array? it's hard to explain in text

#

like I have an Object containing all the cards' information and I'd like to get the owned cards' arena from there

#

like get all the cards from object to inventory and filter them by arena

#

in arrays

severe nexus
#

Am I able to embed my website onto my bot’s description?

spark flint
#

yes

#

<iframe src="website url"></iframe>

junior pecan
#

I need your help guys

severe nexus
#

Got it, thanks

spark flint
junior pecan
#

Remember the rest api "youtube comment"

#

?

#

I bugfixed a error when you press space on the message

#

But is like this

lament rock
spark flint
#

ah

junior pecan
spark flint
#

i'll go try check

junior pecan
# junior pecan

@spark flint How do I make the message have space without giving an error?

#

I used a script that replaces the spaces in the message to - . So what character do I use to replace the space for the message to have space in the photo?

lament rock
#

replace the - with a space?

#

although you shouldn't do that since arbitrary text can still include -

#

If this is for an API, you should URI encode the string and then decode it as you create the image

sudden geyser
#

I used a script that replaces the spaces in the message to - .
Well, why'd you do that?

#

Is it so it goes through a URL? Does using percent encoding work?

lament rock
#

uri encoding should work. Most http server wrappers like express can auto parse uri encoded strings

#

Just don't encode the entire url. Only encode the arbitrary text

lament rock
earnest phoenix
#

how can I change my bot name?

#

Give it a few or kick and reinvite

#

I've kicked it and added it back

#

it does not get changed though

#

Did you change it in the bots developer portal

earnest phoenix
#

do i need to delete my application and make a new one?

#

No

#

Did you change its name in the bot tab of the application

#

I think you have to change it there as well

#

discord weird like that

#

mhm lemme send something

#

Yea just cause it changed the applications name doesn't mean it changed the bots name

#

iirc discord requires you to change it in the bots tab as well at least i've had to for the past 3 years

craggy pine
#

invite bot by clicking on its user on the side

earnest phoenix
#

I dont think you can do that via discord.js

craggy pine
#

Welp. It do be like that

earnest phoenix
#

If you can it is probably somewhere in the docs but if you can't you can just go to your bots developer portal and add the invite link there iirc

craggy pine
#

Oh it can be added via dev portal.

#

Good to know

earnest phoenix
#

Yep

#

its under the oauth tab

craggy pine
#

I found it. Ty much 😛

sterile lantern
#

How can I make the image go where the red box is?

#

I suck at CSS

earnest phoenix
#

You could possibly try using flex and align-items:center justify-content:center

#

Idk if it would work tho

sterile lantern
#

Flex?

earnest phoenix
#

yea

#

display: flex

sterile lantern
#

idk it didnt work

#

i want it like

#

next to the text

#

essentially

#

i dont have any wrapping/div stuff bc i'm not sure what to use

#

should i remove this

#

i tried making it float to the right but it doesnt work like i want it to

junior pecan
#

so i did this

hidden gorge
#

const Discord = module.require("discord.js");
const memberModel = require('../../database/welcome')

module.exports = {
  name: "suggest",
  description: "Anything",
  run : async (client, message, args) => {
    const msg = args.join(" ");
    if (!msg) {
      return message.channel.send("Add a suggestion please");
    }
      
     const data = await memberModel.findOne({
        GuildID: message.guild.id,
    })

    if (!data) return;
     const guild = await client.guilds.cache.get(data.GuildID);
    const schannel = await guild.channels.cache.get(data.ChannelID)
    await message.channel.send(
      `${message.author}, Your Suggestion has been submitted!`
    );

    const embed = new Discord.MessageEmbed()
      .setTitle("New Suggestion")
      .setDescription(`${msg}`)
      .setFooter(`Suggested by ${message.author.tag}`)
      .setColor("RANDOM");
     console.log(message.channel)

    schannel.send({ embeds: [embed] })
      .then(function (message, str) {
        message.react(":suggestionyes:946209266044370964");
        message.react(":suggestionx:946208906521231420");
      })
      .catch(function () {});
  },
};

/*if(client.guilds.cache.get(data.GuildID) && client.guilds.cache.get(data.ChannelID)) {
    let data = False
    let xx = True
    
    var x = {}
    
    if(!xx && x) {
        return console.log(error)
    }
}*/```
junior pecan
#

Guys help

#

I can't reaply my bot

#

I asked this to a reviewer

junior pecan
#

And he told me to wait longer and try again

#

But it still doesn't work help

earnest phoenix
hidden gorge
earnest phoenix
#

it is null

hidden gorge
#

how do i fix it?

earnest phoenix
#

schannel isn't actually a channel

hidden gorge
#

it’s a multi guild system

earnest phoenix
#

thats cool

hidden gorge
#

but we can’t figure that error out

earnest phoenix
#

Log what guild is

junior pecan
hidden gorge
#

Ok it’s a multi guild it sends to what ever channel the server owner sets it to

earnest phoenix
#

Okay but log what guild is

hidden gorge
#

ITS ANY GUILD

earnest phoenix
earnest phoenix
hidden gorge
#

oh

earnest phoenix
#

🤦‍♂️

marble juniper
#

huge brain

hidden gorge
#

i’m confused af

junior pecan
craggy pine
junior pecan
#

But it's already solved the case in #support

hidden gorge
earnest phoenix
#

Miyuka I've already explained it to him in caveman words

#

its no use

craggy pine
#

Ah.

#

Well

#

Was trying to understand it myself lol

#

see the approach he was going towards.

earnest phoenix
#

I can say that it is either the guild he thinks he is getting doesn't have that channel or the guild he thinks he is getting isn't the one he is getting

craggy pine
#

For commands like those where a user / admin sets a channel I'll create a database entry saving the ID and channel Name, that way I can compare the channel names are still the same and if not update the name by checking the ID, if they're both incorrect, I remove the entry all together and throw and error.

Simply fetching the channel via it's ID naming it channel or something and doing channel.send(embed)

earnest phoenix
#

pfft why save the ID just save the entire channel 😎

craggy pine
#

I mean, I suppose you could do that

earnest phoenix
#

I actually don't know if that would work but possibly I don't see why not

#

Save entire channel, fetch channel and send

craggy pine
#

Just simpler to just have the id imo

earnest phoenix
#

that way you dont have to do any channel lookup

craggy pine
#

then just fetch it via id

earnest phoenix
#

Tho if the channel no longer exists you're fucked

craggy pine
#

Exactly.

earnest phoenix
#

since it will be rather hard to tell until you send a message

#

or do anything with it

craggy pine
#

I probably save too much but I like the entires

earnest phoenix
#

Just get the channel and check if it exists first, although they don't seem to be understanding that as a solution

#

I don't get how they're not understanding it stuff

#

I have started making my database tables by hand

#

Ever since I started using C# that is

earnest phoenix
craggy pine
#

I'm rather newer to databases but I do like mariadb atleast thus far since using it.

earnest phoenix
#

I use postgres

#

and form my tables by hand

#

chad

earnest phoenix
craggy pine
craggy pine
earnest phoenix
#

It's better to check for the values directly than just blindly using the logical NOT operator (!), since direct comparison is faster and more verbose

#

Well guess what

#

I didn't ask

earnest phoenix
craggy pine
#

Damn he got your ip you're fucked

earnest phoenix
#

jokes on him that is my neighbors ip

#

I use his wifi

craggy pine
craggy pine
earnest phoenix
wheat mesa
#

If you think about it, you’re technically checking for more than one value by using if(!something) compared to if(something === undefined)

#

(Also I would definitely believe voltrex on V8 stuff lol)

earnest phoenix
craggy pine
#

Intersting.

#

Is it that big of a time difference where it would be worth changing 100's of line of checks in my code lul

wheat mesa
#

Probably not tbh

#

If it’s really performance based in the first place then maybe, but it’s probably an extremely tiny difference

earnest phoenix
#

The difference varies in the order of values that are being checked, for example, an empty string is the last value being checked, if you're mostly using it for that, then yeah, but not much in reality

#

It's only recommended to use the logical NOT operator (!) for boolean values

craggy pine
#

I primarily use ! when checking for null / undifined values in a database lookup

#

const thing = SELECT thing FROM table WHERE id = whatever

if(!thing[0]) return

wheat mesa
#

Probably not gonna notice any difference until you’re starting to do lots of iterations

earnest phoenix
#

Yeah

#

I will just hire voltrex to do my coding for me from now on

wheat mesa
#

Plus v8 might do some fancy stuff behind the scenes to optimize that check as much as it can

earnest phoenix
#

the payment will be in hugs and pats

wheat mesa
#

misty buy me an otter

#

I really want an otter

earnest phoenix
#

that sucks

craggy pine
#

kittyWaving kuu

lyric mountain
#

You really need to check groovy out, you'd love it

#

Best of js and java

#

Recently I was doing some documentation delving, it's impressive what they achieved with it

craggy pine
#

Groovy as in the moosik boot

lyric mountain
#

Language

craggy pine
#

got it

lyric mountain
#

It's also noteworthy that you get to use everything java has, even the libs

#

Since it's 100% vanilla compatible

craggy pine
#

But do I really want to use java...

lyric mountain
craggy pine
#

I could always try to get into the basics of java now that I'm getting more comfortable with JS... But after being with Icarus for so long, java just looks like a pain in the ass for the most part

lyric mountain
#

But give groovy a go when you can, I can say 100% it's satisfying to use it

#

It feels like js sometimes

craggy pine
#

I'm just not a fan of the whole

Public void String args shit they do

slow sable
#

1

lyric mountain
#

It doesn't have that

#

I mean, it can if u want, but not necessarily

#

Also groovy doesn't require typing

craggy pine
#

Also another thing java does I realised is that you HAVE to specify what kind of variable your creating

#

String thing = "thing'

#

or whatever it is

#

not a huge deal but just little things

lyric mountain
#

In groovy u can do thing = "thing"

craggy pine
#

neato

#

I assume ur bot is groovy

lyric mountain
#

Also it has if (!aNullValue)

lyric mountain
craggy pine
#

ah i c

lyric mountain
#

While I could switch to groovy entirely I kinda like java's strict typing

craggy pine
#

that's fair.

lyric mountain
#

Scoped method injection

#

Operator overloading

scenic kelp
lyric mountain
#

Ye

#

But let's say intellij prefers that I use groovy as groovy not as java

#

Many yellow highlights

scenic kelp
#

i'm sure you can configure it to not do that

#

it's annoying when IDEs decide "hey you should be less specific about what you want here"

#

when i was writing in java for my computer science class the IDE kept suggesting I use var instead of the type

#

i put the type there for a reason, shut up you stupid computer

ember lodge
#

Hello, anybody has any idea about why my form is not giving any value in a dropdown input, i am using express and ejs

spark flint
#

does anyone know anything about interaction file uploads yet

earnest phoenix
#

I think they are still working on it

sudden geyser
#

no it's available

spark flint
#

ah ok

#

oh

#

perfect

#

because i need to use on my bot KEKW

sudden geyser
#

assuming you're talking about uploading files in general

#

don't know about the attachment type they recently added

spark flint