#development

1 messages ¡ Page 2059 of 1

rigid maple
#

I'll try something thanks

hollow anchor
#

I use BDScript because it's meant for discord entirely and it's very easy and simple to learn and read it. It's still coding, structured different from the usual type

lyric mountain
#

I think the opposite, it's too abstracted to me, also "meant for discord entirely" applies for pretty much any discord library

#

no woo, it's not lang wars, we're just politely discussing

solemn latch
#

bdscript to me feels like combining...
oh crap im participating in lang wars

lyric mountain
solemn latch
#

but bd script is combining the complexity of a real programming language with the limitations of scratch.

#

That's fine if that's what you want, but its not ideal.

lyric mountain
#

I have nothing against who uses too, but I think it abstract so much that it starts to reverse the complexity level while decreasing the freedom

hollow anchor
lyric mountain
#

that'd be plain js

#

wait, there's a xkcd for that

hollow anchor
#

me not really understanding any of xkcd's crap:

quartz kindle
hollow anchor
#

JavaScript I think

quartz kindle
#

because most of these things use other discord libraries under the hood anyway

#

and you have no control over what its actually doing

hollow anchor
#

WDYM no control

quartz kindle
#

you dont know how it processes events, how it caches data, cant configure caching for tweaking ram usage, etc

#

the functions you write are not your own

solemn latch
quartz kindle
#

it writes them for you, and you cant always trust it

earnest phoenix
hollow anchor
#

BDScript has a $deletecommand function

solemn latch
#

every bot ive ever used on bdscript gives that error at some point during testing, 99% of users wont know how to solve it.

does bdscript have a method of preventing those errors and having your own error handler?

#

A typical bot will say "I dont have xyz permission to use that command"
A user typically will know how to solve that, if you cant use your own error handlers on bdscript thats a huge limitation.

earnest phoenix
#

Am I wrong in thinking most "devs" who use BDFD 100% use the if (command = blah blah blah) way of coding

quartz kindle
#

wait can you self host a bot using bdscript?

#

or is it exclusive for their app platform?

lyric mountain
#

found it

#

not xkcd at all, but

earnest phoenix
quartz kindle
#

bdfd = boy does face demons

#

bdfd = blatant deviancy fueling drama

lyric mountain
#

ik some botmakers allow u to host the bot in the app, but requires u to periodically open it to keep alive (and see ads)

solemn latch
#

👀

quartz kindle
#

is there any large bot made with bdfd?

#

like 10k+ guilds

fair axle
#

How can I convert a complex object into normal object?

Input:
PermissionOverwrites {
  id: '987662252725395476',
  type: 'role',
  deny: Permissions { bitfield: 2048n },
  allow: Permissions { bitfield: 0n }
}

Expected Output:
{
  id: '987662252725395476',
  type: 'role',
  deny: Permissions { bitfield: 2048n },
  allow: Permissions { bitfield: 0n }
}
lyric mountain
#

define "normal objects"

#

to me both look the same

fair axle
#

I'm trying to save permissionOverwrites of the channel to the database (mongoose). When I save the Input to the database I only get the id of the role/user

lyric mountain
#

well yes you can't save Permissions

fair axle
#

But I can save object literals

#

more specifically Expected Output

quartz kindle
#

you can map all keys to a new object

lyric mountain
#

your "expected output" is exactly the same as the top example btw

#

you just need to generalize Permissions

#

{ ...deny }

quartz kindle
#
const overwrites = {
  id: permissionOverwrites.id
  type: permissionOverwrites.type
  deny: permissionOverwrites.deny.bitfield
  allow: permissionOverwrites.allow.bitfield
}
#

if mongo supports bigint

lyric mountain
#

he probably wants to keep structure

fair axle
#

Thank you

lyric mountain
#

so bitfield would be inside an object

fair axle
#

I got it

quartz kindle
#

it would be an object without meaning

#

because bitfield is rarely ever accessed directly

#

you usually access it through Permissions methods

#

which are lost

#

so either way you will likely want to recreate it after retrieving

#

mongoobj.deny = new Permissions(mongoobj.deny)

#

yet another typescript fuckery i just found out

#

if i do js exports.BLA = require(...) or module.exports = { BLA: require(...) } in a js file, then typescript auto generated types will do this: ```ts
export var BLA = typeof import(...)

which works fine, but any types that are defined inside the file cannot be accessed from another file, it seems to only export the type of the value itself
#

but

#

if i simply change my js file to this ```js
const BLA = require(...)

exports.BLA = BLA
or
module.exports = { BLA }
then typescript auto generated types becomes this:js
export { BLA }
import BLA = require(...)

rigid maple
#

any idea what i can do?

#

main router

twitch router

home
dashboard
...
youtube router
home
dashboard
...

#

this is my main purpose

earnest phoenix
#

Also 666 contributors monkaW

lyric mountain
#

6m used by

#

they could just use "users"

quartz kindle
earnest phoenix
quartz kindle
#

so this is how i ended up documenting eventemitter events with jsdoc

#

which makes tsc generate this: ```ts
on: ((event: "event", callback: (data: ShardEvent) => void) => this) & ((event: "debug", callback: (data: string) => void) => this) & ((event: "close", callback: (data?: Error | undefined) => void) => this) & ((event: "ready", callback: (data: ShardReady) => void) => this) & ((event: "resumed", callback: (data: ShardResumed) => void) => this);

#

ugly af but it works

#

unfortunately there seems to be no way to use jsdoc to generate this instead ```ts
on(event: "event", callback: (data: ShardEvent) => void): this
on(event: "debug", callback: (data: string) => void): this
on(event: "close", callback: (data?: Error) => void): this
on(event: "ready", callback: (data: ShardReady) => void): this
on(event: "resumed", callback: (data: ShardResumed) => void): this

split hazel
#

rip

#

and i also got the same "cant tell you why" response from oracle 😠

#

but this time my new card isnt banned

quartz kindle
#

rip

split hazel
#

idk what could be causing it

#

maybe the email?

#

or it is indeed an AI that detects if a person is just gonna use it for free trial

#

seems like it

#

not the only one having these problems

round cove
#

oracle

#

Makes sense

wheat mesa
#

Steal someone’s identity and use them for your server

fathom sonnet
#

quick question: how do I check if the interaction user/member have higher role than bot?

hollow anchor
#

Using BDScript you can use something like $isAdmin or $isMod

split hazel
#

its a shame but oh well what can you do

wheat mesa
hollow anchor
wheat mesa
split hazel
#

i'll probably try out contabo very soon, tho not happy about the "one time setup fee" probably just a tactic to get you to commit to a long term plan and not constantly stop paying then start paying again

wheat mesa
hollow anchor
wheat mesa
#

BDFD is absolutely terrible for doing any sort of customizable behavior

#

djs is probably one of the easiest libraries out there; it holds your hand every step of the way

hollow anchor
#

and you have to understand JavaScript fairly

#

I learned BDScript in 30 seconds however d.js is a different story

quartz kindle
#

what looks better?

earnest phoenix
#

Second one looks way cleaner

quartz kindle
#

yeah

#

its a pain that it needs to have all those extra parenthesis lel

#

now time to refactor this

quartz kindle
#

but like

#

djs is like driving a car

#

bdscript is like having an ai drive for you

hollow anchor
#

^^^

quartz kindle
#

and in my opinion, driving myself is way more awesomer

earnest phoenix
#

And safe

cinder patio
#

not really

hollow anchor
#

I have no motivation to learn coding, I'm forcing myself to learn it in college

#

I only learn it if ez

earnest phoenix
cinder patio
#

yes

#

AI is definitely the better driver

quartz kindle
earnest phoenix
#

How so? Driving yourself is way safer than an AI driving for you troll

hollow anchor
earnest phoenix
#

AI isn't perfect, it can always have more flaws than a human being, so it's tend to have more issues in those ways honestly

hollow anchor
#

Humans aren't perfect?

cinder patio
#

Nah I'd rather AI drive the car than a random human being I don't know

earnest phoenix
#

Humans aren't perfect either, but definitely way better than AIs in thinking in sensibility, although who knows; since AIs are growing better and smarter maybe they'll one day surpass even in such tasks

cinder patio
#

Thing is driving a car is pretty straight-forward

#

even morons get to drive one

vivid fulcrum
#

the biggest flaw in any system is a human, i strongly believe that if all cars were driven by an AI, accidents would drastically go down

split hazel
#

you're an ai and you're about to collide with two people but you can swerve and only hit one person, who you pickin and why

quartz kindle
#

thing is humans can react instanty to any given situation, an ai's reactions are much more limited and highly depends on its performance, programming and training data

earnest phoenix
#

Exactly

hollow anchor
cinder patio
#

Humans don't have instant reaction time

#

I bet AI beats us there too

hollow anchor
#

^^

quartz kindle
#

it cant react to a situation it never seen before and has no training for

hollow anchor
#

It does though

earnest phoenix
#

It can't

hollow anchor
#

AI is trained for crashes

#

It detects obstacles and figures out a good path

#

It's not blind

earnest phoenix
#

It's not about crashes nor anything as such, the matter are things it has never seen before, nor has been trained for

quartz kindle
#

it can also detect ghosts in a cemetery and birds as people

#

and all kinds of weird quirks

hollow anchor
earnest phoenix
#

We're not talking about crashes

quartz kindle
#

but anyway going back to bdscript

#

bdscript is not even an ai

#

so that comparison is not even fair

hollow anchor
earnest phoenix
#

AIs aren't trained for literally everything, so it's likely for it to encounter something, or a situation/scenario it has never seen before, nor has it been trained for; which can just leave the AI wondering and probably just be extremely confused

earnest phoenix
#

It's not specific, for example; let's consider an AI playing some simple game which tasks the player with shooting enemies, but now it reaches to a point where the whole scenario changes where you have to collect items, and not shoot anybody, it won't be able to do it because it was never trained for it

#

I'm not just talking about the AI driving cars, any type of AI

hollow anchor
#

On that game, then you train the ai...

#

To be able to play it...

earnest phoenix
#

And you train an AI to be able to drive, it doesn't get the ability and the thinking sense to do so without any training

hollow anchor
quartz kindle
# hollow anchor What though???

avalanche, snow, fog, hurricane, tornado, deer, donkey, horse duck, dogs, cats, fish raining from the sky, tree falling, sinkhole, fissure, spikes/nails on the floor, ice/slippery road, fire, lava, ???, profit

quartz kindle
#

x doubt

hollow anchor
#

Lmao

rigid maple
#

Main Router (http://localhost:5000/)

Home (http://localhost:5000/home)
Profile (http://localhost:5000/profile)
Twitch Router (http://localhost:5000/twitch/)

Events (http://localhost:5000/twitch/events)
Dashboard (http://localhost:5000/twitch/dashboard)
... (http://localhost:5000/twitch/...)
YouTube Router (http://localhost:5000/youtube/)
Events (http://localhost:5000/youtube/events)
Dashboard (http://localhost:5000/youtube/dashboard)
... (http://localhost:5000/youtube/...)

How can I make 2 routers nested in this way? (React)

hollow anchor
rigid maple
#

actually what i'm trying to do is chatbot that will work on twitch and youtube

#

I am making a web dashboard for these and logically I should put the twitch settings and youtube settings on different pages.

#

ex:
To go twitch settings...
(http://localhost:5000/twitch/settings)
To go youtube settings...
(http://localhost:5000/youtube/settings)

#

do you have any idea how i can do it?

hollow anchor
rigid maple
#

what

hollow anchor
#

I still don't know

#

What does it do

rigid maple
#

chatbot

#

like moobot nightbot...

hollow anchor
#

ok so does it comment on videos

#

What is it used for

rigid maple
#

for live streams

hollow anchor
#

so post discord screen view as a live stream

wheat mesa
#

What lmao

rigid maple
#

user: !discord
bot: blablbal

hollow anchor
#

what

rigid maple
hollow anchor
#

WDYM for live streams lmaoo

rigid maple
#

you don't understand what i'm trying to do

hollow anchor
#

no

#

I really dont

#

what does it do with live streams

rigid maple
#

Do you know moobot?

hollow anchor
#

no

rigid maple
#

Think like a chatbot on twitch live streams

#

example

#

user: hello!
bot: hi!

hollow anchor
#

oh ok

wheat mesa
#

I believe there is twitch API libraries out there

rigid maple
#

user: !discord
bot: discordurl

wheat mesa
#

Unless that’s not your issue

rigid maple
hollow anchor
#

Yea how does that relate to a reply

rigid maple
#

You asked what I was trying to do and I answered

wheat mesa
#

I’m not very good with react router, I mostly use nextjs whenever I get the chance

hollow anchor
wheat mesa
#

Looking back at the original question, @rigid maple never asked anything about how to do a chatbot. @hollow anchor you were the one that turned it into that, he was just originally asking about how to set up react router to work with his routes

hollow anchor
#

yea?

rigid maple
#

yes

hollow anchor
#

what's you guys opinion on Rust and V

split hazel
#

rust is mid dont know about V

quartz kindle
wheat mesa
#

Rust is great idk what V is

hollow anchor
wheat mesa
#

This feels a little biased lmao

#

Who in their right mind is building compilers from the source?

hollow anchor
#

lmao idk

earnest phoenix
#

You only build a compilier once on release

quartz kindle
#

it demonstrates the simplicity and straight forwardness of the lang i guess?

#

its sintax is basically golang

#

but in a low level C-like environment

hollow anchor
#

So what's you guy's opinion? I've heard some good stuff about it other then that.

quartz kindle
#

havent heard of it before, but from their website looks like a cool project

hollow anchor
#

Would you use?

sharp geyser
#

it literally just looks like go on crack

hollow anchor
#

so would you

sharp geyser
#

no

hollow anchor
#

why not what's wrong with it

earnest phoenix
#

Lol v lang impressed me

sharp geyser
#

I don't see how it is worth learning it over something like rust

earnest phoenix
hollow anchor
sharp geyser
#

If you wanna use it go for it

earnest phoenix
sharp geyser
#

it isn't an inherently bad looking language, but I don't have a need for a language like that so personally I wouldn't learn it and use it

hollow anchor
#

What's the worst lang? (Not assembly, binary etc)

earnest phoenix
#

Bdscript

sharp geyser
#

BASIC

stable eagle
#

Brainfuck

wheat mesa
#

Python

#

Just kidding ofc

#

I feel it’s unfair to ask what the “worst lang” is

sharp geyser
#

I have a feeling waffle would love V

wheat mesa
#

No not really

sharp geyser
wheat mesa
#

Just looks like a more obscure rust to me

stable eagle
# wheat mesa Python

oMG hOw dAarEe yoU it IsmDB BeSTTT laNGUAAGGEEE i OXIY YOU MADDE33 memeee cryy ALAAAAA PyTHON SnaKE YUMMyyy

sharp geyser
sharp geyser
earnest phoenix
#

Python with braces🥲

stable eagle
#

python actually uses braces

#

v = 1
f"1 + {v} = 2"

hollow anchor
# stable eagle Brainfuck

It's Turing complete and uh it's painful. Really painful. Hello world in brainfuck:

+++++ +++++ initialize counter (cell #0) to 10 [ use loop to set the next four cells to 70/100/30/10 > +++++ ++ add 7 to cell #1 > +++++ +++++ add 10 to cell #2 > +++ add 3 to cell #3 > + add 1 to cell #4 <<<< - decrement counter (cell #0) ] > ++ . print 'H' > + . print 'e' +++++ ++ . print 'l' . print 'l' +++ . print 'o' > ++ . print ' ' << +++++ +++++ +++++ . print 'W' > . print 'o' +++ . print 'r' ----- - . print 'l' ----- --- . print 'd' > + . print '!' > . print '\n

wheat mesa
#

It’s an esolang

#

Of course it’s going to be shitty

#

Hence why I don’t believe it’s fair to ask what the worst lang is

quartz kindle
#

came accross this on a redit post about Vlang

The author has a history of making extravagant claims about what the language can do but either refusing to provide evidence or making empty promises to provide it later.

hollow anchor
#

How about I rephrase.

What's the worst language to write "hello world" in

sharp geyser
#

You seem like a vlang enthusiast

hollow anchor
#

intercal hello world wow

hollow anchor
sharp geyser
#

console.log("Hello, World") translates to over 7000 characters

hollow anchor
#

Holy shit

sharp geyser
#

Doesn't even work there is an error in the jsfuck

lyric mountain
hollow anchor
#

Minecrart in JSFuck pogey

sharp geyser
lyric mountain
#

it is dummy easy lul

sharp geyser
#

nope

lyric mountain
#

like, it's literally js but you deal with ascii and booleans instead of text

#

![] is true, !![] is false

#

![]+[] is "true", !![]+[] is "false"

#

basically is encapsulates the value in a string

earnest phoenix
#

i have a html file that uses external js
i get it via return res.status(201).send(fs.readFileSync(__dirname + "/tech.html"));
and type it let html = document.getElementsByTagName("html").item(0).innerHTML = await response.text()
with this method but it doesnt get external javascirpt file how can i fix it ?

lyric mountain
#

with that, u have letters t, r, u, e, f, a, l, s to play with

split hazel
#

hello world in jsfuck

lyric mountain
#

by using +[] u get 0

#

I dont remember how u increment it tho

#

but after that, u can build a sentence using those letters + index access

#

u keep going until u manage to write eval()

#

when u get eval u can just run those sentences

#

obviously at that point u have more than 5k lines of code

#

it's really fun to write in jsfuck, the only issue is that comment is a must

#

else u cannot stop coding else u'll forget later

quartz kindle
#
var wrap = document.createElement('div');
var scr = document.createElement('script');
scr.src = scriptUrl;
scr.type = 'text/javascript';
wrap.appendChild(scr);
document.body.appendChild(wrap);
sharp geyser
#

I feel like i am fucking up so bad rn with this rust lib

#

I have never used lifetimes so my understanding is extremely vague

quartz kindle
#

dolbayob

wheat mesa
sharp geyser
#

I'm scared cause you will laugh at me mmLol

wheat mesa
#

Show

sharp geyser
#
#[derive(Deserialize)]
struct APIImageResult<'a> {
    link: &'a str,
}

struct Animality<'a> {
    key: &'a str
}

impl<'a> Animality<'a> {
    pub fn new(key: &'a str) -> Self {
        Self {
            key
        }
    }

    #[tokio::main]
    pub async fn fetchRandomImage(animal: &'a str) -> APIResult<'a> {
        let resp = reqwest::get(base + "/image" + animal)
            .await?
            .json::<APIImageResult<'a>>()
            .await?;

        APIResult {
            link: resp.link,
            name: animal,
        }
    }
}

So like I read up on lifetimes but they still confuse me

#

I just know that the lifetime can't outlive what it is being used for

wheat mesa
#

You should probably not be used a string slice in that struct

#

Probably best to use a String

sharp geyser
#

I see

wheat mesa
#

All lifetimes are is labels that tell the compiler to not drop certain variables when they go out of scope so long as the lifetime is valid

sharp geyser
#

Also I am curious new returns a Animality right but how coem I can't then use fetchRandomImage after making a new one

wheat mesa
#

I don’t understand what you’re asking

#

Show what you’re trying to do

sharp geyser
#

this is invalid cause it doesn't seem like fetchRandomImage is a thing

wheat mesa
#

Because that’s not how you call a function

sharp geyser
#

Oh?

wheat mesa
#

You do animality.fetchRandomImage()

sharp geyser
#

I see

wheat mesa
#

The :: syntax is only for “static” functions

sharp geyser
#

Ah

wheat mesa
#

And the reason using a . Won’t work for you right here is because in your fetchRandomImage function you don’t make a &self parameter

#

In the function

sharp geyser
#

yea I just did that

wheat mesa
#

Also in the function, you don’t need the animal parameter to have that lifetime

#

Since all you need it for is building the request url, it does not need to live for as long as the entire struct

sharp geyser
#

Ah right

#

but key makes sense to have a lifetime right?

wheat mesa
#

You wouldn’t be able to compile without it so yeah

sharp geyser
#

it needs to live for as long as the animality struct is being used

wheat mesa
#

Basically if you are storing a reference in a struct at all, it’ll need a lifetime

sharp geyser
#

gotcha

earnest phoenix
sharp geyser
#

I am trying to figure out now how to add headers to my reqwest

lyric mountain
#

reqwest uwu

sharp geyser
#

figured it out

sharp geyser
cinder patio
#

ye

#

s

sour mural
#

Hi all, hope you are all feeling well 😄 I have a little question. Does someone understand why this line does not work (it is in my Client.on("ready") so I only have Client arg :

Client.guild.fetch(servID).members.unban(id)

Thank you in advance 😉

#

I do not have any error message neither bot crash...

wheat mesa
#

well, there's several reasons why this does not work

#
  1. Client.guild is not a thing. It's Client.guilds
  2. Client.guilds.fetch(id) returns a promise, so you would need to do (await Client.guilds.fetch(id)).members.unban(id)
  3. This isn't a reason why it doesn't work, but you should rename Client to client, discord.js has a class named Client that you may accidentally call functions from somehow instead of calling functions from the instance of it that you created
sour mural
#

and the user seems to stay banned

wheat mesa
#

I'm not quite sure what to tell you if you don't show any code or say how it doesn't work

#

¯_(ツ)_/¯

sour mural
#

Yes sure I will share it 😉

#
const Discord = require('discord.js');
const infactive = require('../infactive.json')
const fs = require('fs')
var cron = require('node-cron')

module.exports = async(client) => 
{
    console.log("The bot is now operationnal.");
    client.user.setStatus("online");
    let number = Math.floor(Math.random() * 2);;
    if(number == 0)
        client.user.setActivity(client.guilds.cache.size + ' servers | !invite', { type: 'WATCHING' });
    else
        client.user.setActivity(client.users.cache.size + ' users | !invite', { type: 'WATCHING' });
    var task = cron.schedule('* * * * *', () => {
        const exp = Date.now()
        for(let servID in infactive)
        {
            for(let infID in infactive[servID])
            {
                if(infactive[servID][infID][2] == "Tempban" && infactive[servID][infID][1] < exp)
                {
                    console.log("Tempban")
                    await client.guilds.fetch(servID).members.unban(infactive[servID][infID][0])
                    delete infactive[servID][infID]
                    fs.writeFile("./infactive.json", JSON.stringify(infactive, null, 4), (err) => {});
                }
                else if(infactive[servID][infID][2] == "Tempmute")
                {
                    console.log("Tempmute")
                    delete infactive[servID][infID]
                    fs.writeFile("./infactive.json", JSON.stringify(infactive, null, 4), (err) => {});
                }
            }

        }
    });
    task.start()
}
wheat mesa
#

oh boy

sour mural
#

the error with the await : ```await client.guilds.fetch(servID).members.unban(infactive[servID][infID][0])
^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules

wheat mesa
#

well, I did say to do (await client.guilds.fetch(id)).members.unban(id), not await client.guilds.fetch(id).members.unban(id)

sour mural
wheat mesa
#

And the reason your async isn't working is because your cronjob isn't marked as async

#

Also please please please please do not use JSON like this

#

Use a proper database

sour mural
#

It's not definitive don't worry

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sour mural
#

I don't know why 😢

wheat mesa
#

I still don't really know how to help you with that information

sour mural
#

I do not have any error message so it's complicated 😅

wheat mesa
#

the likelihood is that it is not being executed

#

try debugging, see if you ever reach that statement

sour mural
#

I'll try, ty

quaint rampart
#

how can i find with an element in an object using mongo?

actual object:

lottery: {
    autoLottery: Boolean,
    totalBoughtTickets: Number,
    totalEarnings: Number
}

attempt that didnt work:

const userProfiles = await usersDB.find({ lottery: { autoLottery: true } });
round cove
#

You need to use { where: { key: value } }

quaint rampart
round cove
#

I don't see where anywhere

earnest phoenix
#

The where operation is actually the default

round cove
#

I haven't used mongo in a bit.

#

I mean I guess I knew that?

#

Looking at old code

earnest phoenix
earnest phoenix
round cove
#

Does the user schema have lottery on it?

quaint rampart
#

no and yes

round cove
#

Is it return undefined?

#

Is it possible no data meets those conditions?

#

Does it return anything if you search with false?

quaint rampart
#

it returns []

#

and i tried with false same situation

earnest phoenix
#

Mind to show your full user schema?

quaint rampart
#

here is my schema:

const users = mongoose.Schema({
    userID: String,
    xp: Number,
    inventory: Array,
    work: String,
    pet: String,
    balance: Object,
    cooldowns: Object,
    streaks: Object,
    statistics: Object,
    premium: Object,
    marriage: Object,
    lottery: Object,
    banned: Object
});
round cove
#

Is it possible you can't search an object's properties for the schema since it's an unknown structure?

quaint rampart
#

honestly im not sure, im recoding my bot and im trying to clean up the db cuz i literally had everything in the schema without any objects so ive never tried something like this thats why im asking here im not even sure if its possible or not

#

but i tried the only thing that makes sense to me

earnest phoenix
#

I don't think MongoDB/Mongoose cares about the defined object structure when doing a find operation

#

Try to see if the lottery property even exists in such documents

quaint rampart
earnest phoenix
#

Try { $exists: { lottery: true } } instead of the web UI

quaint rampart
#

uhh i dont think im using it ruight

#

so am i supposed to use it like this?

#
await usersDB.find({ $exists: { lottery: true } });
earnest phoenix
#

That's correct

quaint rampart
#

i get this back:

MongoError: unknown top level operator: $exists. If you have a field name that starts with a '$' symbol, consider using $getField or $setField.

earnest phoenix
#

What the hell

#

Ah I remembered that the usage is swapped

#

Try { lottery: { $exists: true } }

quaint rampart
earnest phoenix
quaint rampart
#

i tried false originally

#

but tried true and also didnt work

#

then i sent it here

earnest phoenix
#

That's pretty strange, what version of Mongoose are you using?

quaint rampart
#

lates

#

t

earnest phoenix
#

{'lottery.autoLottery':true}
try this as query

#

Oh yeah that's the correct format

quaint rampart
#

well that works

#

thank you

#

im so confused tho { lottery: { autoLottery: true } } should work

earnest phoenix
#

Its a exact match with your query

#

Nested field checks require binding, which that format achieves

quaint rampart
#

yeah i know but i meant like it should work in that format too

#

oh alright

#

thank you guys for your help

earnest phoenix
#

No problem

quaint rampart
#

also is there a way to see if an array doesnt have an element

#

im trying to bascdiallty check if they have autolottery is on and they dont have a lottery ticket in their inventory

split hazel
#

@quartz kindle just a random thought i think you can understand

#

the bot luca just checks if a message is a single full stop and deletes it if it is

#

think of the wasted clock cycles and electricity from checking every single message

earnest phoenix
#

'array.$.foo': { bar: true }

quaint rampart
#

or do i not?

#

i tried this but it didnt return any data even tho it matches:

const userProfiles = await usersDB.find({ 'lottery.autoLottery': true, 'inventory.$.lotteryTicket': { bar: true } });
earnest phoenix
#

Oh that's just a placeholder, you can replace { bar: true } with the value of the lotteryTicket property you want to check for

sharp geyser
#

^

#

was about to say that

#

Also volty I made my first rust lib

#

😎

earnest phoenix
#

I saw, it's awesome

sharp geyser
#

I am sure null can make it even better and I hope she does

#

I wanna learn

quaint rampart
earnest phoenix
quaint rampart
#

yeah im trying to check if the array 'inventory' includes a string 'lotteryTicket'

#

so inventory looks like:

inventory = ['lotteryTicket', 'laptop']
#

etc

earnest phoenix
#

Oh I see, then you can just do { 'inventory.$': 'lotteryTicket' }

quaint rampart
#

wouldnt that return it if they have the lotteryTicket

#

im trying to make it so it returns ppl who dont have lotteryTicket

earnest phoenix
#

$in to check if it contains the value, $nin to check if it doesn't contain the value

quaint rampart
#

ty so much your an actual life saver

rigid maple
#

does anyone know React ?

earnest phoenix
pine nova
rigid maple
#

Main Router (http://localhost:5000/)

Home (http://localhost:5000/home)
Profile (http://localhost:5000/profile)
Twitch Router (http://localhost:5000/twitch/)

Events (http://localhost:5000/twitch/events)
Dashboard (http://localhost:5000/twitch/dashboard)
... (http://localhost:5000/twitch/...)
YouTube Router (http://localhost:5000/youtube/)
Events (http://localhost:5000/youtube/events)
Dashboard (http://localhost:5000/youtube/dashboard)
... (http://localhost:5000/youtube/...)

How can I make 2 routers nested in this way? (React)

earnest phoenix
rigid maple
#

thank you very much this is what i have been looking for for days

split hazel
#

bro did what took him days 💀

pine nova
#

💀

#

a simple google search fr

quartz kindle
#

at least those that still dont use slash commands

split hazel
quartz kindle
#

baguette

sharp geyser
sterile lantern
#

lets say i have a array like
[1:Name, 2:Name, 3:Name]

How would i be able to access only the Name value of each, such that i can put them into a new array like:
[Name, Name, Name]

quartz kindle
#

do you mean this? [{ 1: Name }, { 2: Name }, { 3: Name }]

#

or this? ["1:Name", "2:Name", "3:Name"]

sterile lantern
quartz kindle
#

you can do array.map(x => x.split(":")[1])

#

(assuming js)

sterile lantern
#

oh ty that works

#

also how would i modify this so it prints like

JohnV50,
Lxphere```
#

I tried \n but it looks horrible

#

for reference this is how the array is being mapped

sharp geyser
#

you can rejoin it with a new line

#

map returns a new array

#

so you can .join('\n')

sterile lantern
#

oh right

#

ty

#

the .join doesnt work

#

wait one sec

#

yeah still nothin

#

also if i try joining it throws a array.sort is not a function

sharp geyser
#

Show how you're doing

sterile lantern
#
    const shuffled = array.sort(() => 0.5 - Math.random());```
sharp geyser
#

well yes

#

join returns a string

#

sort first then join

sterile lantern
#

alr

quartz kindle
#

more typescript shenanigans, both session and sequence exist or neither does ```ts
type stuff = ({
session: string,
sequence: number,
} | {}) & {
token: string,
intents: number,
id?: number,
total?: number,
...
}

sharp geyser
#

wtf are you doing tim

quartz kindle
#

more cool stuff ```ts
type stuff = ({
total: number,
ids?: number[]
} | {
ids: number[]
}) & {
token: string,
intents: number,
...
}

#

if total exists, ids is optional, if total doesnt exist, ids is required

sharp geyser
#

👀

quartz kindle
#

just playing around with types

#

for tiny-discord

sterile lantern
sharp geyser
#

in my entire career of using ts

quartz kindle
#

and im doing it without ts

#

just using jsdoc

sharp geyser
#

lmao

quartz kindle
sharp geyser
#

rewrite tiny discord in actual ts ;)

quartz kindle
#

no :^)

sharp geyser
#

whey not?

quartz kindle
sharp geyser
#

still prefer to use a dynamically typed lang

quartz kindle
#

just found a weird js quirk

#

you can actually spread null because its an object lel

#

only works in objects, not in arrays

sterile lantern
#

how can i make it so a user (d.discordUser) can only be picked once. i am making a thing where you can have two entries for a better chance at being picked, but it most of the times it sends duplicates

sharp geyser
#

You'd likely have to store the already picked people in something like a Set and if the set already includes the picked user pick again

quartz kindle
#

if your data is a primitive like strings, you can use a Set

sharp geyser
#

that is my idea anyway

quartz kindle
#

otherwise you need an object of ids

sharp geyser
#

looks like me and tim thought of the same thing 👀

#

tim I am in ur mind now

quartz kindle
#

terrible minds think alike

#

:^)

sharp geyser
#

😔

sterile lantern
quartz kindle
#

ever used a Set before?

sterile lantern
#

nope

#

still kinda new to arrays n stuff lol

quartz kindle
#

its similar to a Map but also similar to an array

#

it doesnt allow duplicates to exist

#
const a = new Set();
a.add("wiefpwiejpgiwejpg");
a.add("43409jt0394j039");
a.forEach(...);
sharp geyser
#

It also isn't a k,v it is only a v

sterile lantern
#

if i switched my array mapping

#

to a set

#

would the sorting work

#

in other words are you still able to sort a set

quartz kindle
#

Sets cannot be sorted, so you have to convert it to an array first

#

you can do so using [...a] or Array.from(a)

sharp geyser
#

you can spread a set?

sterile lantern
#

i did this

#
    mainData.add(data.map(d => "<@" + d.DiscordID + ">" + ":" + d.RobloxUser))```
sharp geyser
#

why would you do that

#

defeats the purpose

sterile lantern
#

how else would i get the data in the set

#

in that format

quartz kindle
#

that would add the array itself into the Set

sterile lantern
#

o

quartz kindle
#

not the individual array items

#

you can use the spread operator

#

mainData.add(...data.map(d => ))

#

then the same to convert it back to array [...mainData]

vivid fulcrum
#

doesn't set accept an array in it's ctor

#

its*

quartz kindle
#

it also does yes

#

new Set(data.map(d =>))

vivid fulcrum
#

ahh

sterile lantern
vivid fulcrum
#

i remember using that trick a while ago for something

quartz kindle
#

so you can even do a one liner: [...new Set(data.map(d => ""))].sort()

#

the Set automatically eliminates duplicates

sterile lantern
#

hmm well

#

i think that kinda defeats the purpose of two entries

#

maybe i can create a set after its shuffled?

#

one sec

#

yeah that works, i just made a set after its been shuffled, thus a user has a higher chance if they have 2 entries

quartz kindle
#

👍

lyric mountain
#

Tim do u know anything abt monte carlo or card game ai?

quartz kindle
#

nop

sterile lantern
#

im trying to loop through the rblxusers and update a DB value of it

#
    for (rbxusers in Array.from(rblxuser)) {
      console.log(rbxusers)
      let user = await users.findOne({ RobloxUser: rbxusers})
      console.log(user)
      await user.updateOne({ Event1Picked: true})
    }```
#

not sure how for .. in loops work

ancient nova
#

what's the client.api endpoint refer to?

wheat mesa
#

Just so you know the Array.from is redundant, rblxuser is already an array

sterile lantern
#

oh right

ancient nova
#

also where is this error coming from? ERROR Unhandled rejection: TypeError [REQ_RESOURCE_TYPE]: The resource must be a string, Buffer or a valid file stream. ```js
if (dynamicFormat) {
await fetch(baseUrl).then((res) => {
format = res.headers.get("content-type") === "image/gif" ? ".gif" : .${defaultFormat};
return null;
});
}

wheat mesa
# sterile lantern not sure how for .. in loops work

The for...of statement creates a loop iterating over
iterable objects,
including: built-in String, Array,
array-like objects (e.g., arguments
or NodeList), TypedArray, Map,
Set, and user-defined iterables. It invokes a custom iteration hook with
statements to be executed for the value of each distinct property of the object.

wheat mesa
sterile lantern
#

kk will look into it ty

ancient nova
#
const attachment = new MessageAttachment(baseUrl + format + query, `${member.user.username}-banner.${format}`);
``` may also be from this line
wheat mesa
#

You’re probably trying to construct some form of media that doesn’t allow null

ancient nova
#

I do check for null though

wheat mesa
#

Yeah that’s where it’s probably coming from most likely

#

Give me a minute to look at the docs rq

ancient nova
#

it works if the user has a URL and it does check for null so the error somehow happens anyway

wheat mesa
#

So the docs don’t have a MessageAttachment class, I assume you’re working with a slightly older branch or something of djs?

ancient nova
#
    const { baseUrl, format, query } = await getUserBannerUrl(member.user.id, { size: 1024 });
``` I'm using a function, and in that function there is an if check that returns a message if the user doesn't have a banner
wheat mesa
#

Nevermind I found the docs for it

ancient nova
#

it's the same as MessageEmbed

wheat mesa
#

I was looking at main branch and not 13.8

ancient nova
#

well do you know why is it giving the error?

sharp geyser
wheat mesa
sterile lantern
#

there can be multiple documents for this search, how can i make it so that each doc updates

wheat mesa
ancient nova
sterile lantern
#

so e.g: there's two docs with RobloxUser as Bob, and rn it only updates 1 out of 2 documents

ancient nova
#

the error happens because it fails but that's why I included the check that breaks the script

wheat mesa
#

Try logging what baseUrl + format + query is before you construct the message attachment

ancient nova
#

they're either undefined or null

wheat mesa
#

Huh

ancient nova
#

if the user doesn't have a banner of course

wheat mesa
ancient nova
#
        if (!user.banner) return message.channel.send("This user has no banner");
``` I have this statement to return the function in case it happens, it succesfully sends but still gives me an error
ancient nova
sharp geyser
#

👀

#

Why discord returns back the data as null or the proper thing anyway

wheat mesa
#

The error is happening because something is wrong with what you’re giving it

sterile lantern
ancient nova
#

yeah but it shouldn't since I'm returning the statement mid function, it doesn't make sense why rest of the code would execute

quartz kindle
#

log. it.

wheat mesa
#

Just because it shouldn’t doesn’t mean it doesn’t

#

Lol

#

After all if we were able to successfully process code in our heads, nobody would ever need help c:

sharp geyser
#

I can process code in my head why do I still need ur help /s

#

AH right waffle

wheat mesa
#

You need my help but not for programming

sharp geyser
#

hows ur physic engine coming along

ancient nova
#

I somehow managed to break the code

wheat mesa
#

Haven’t worked on it in a bit

ancient nova
#

🤣

sharp geyser
#

Icic

wheat mesa
#

Been taking a break

sharp geyser
#

Yea I wrote my first lib in rust

wheat mesa
#

I saw

sharp geyser
#

it was absolute shit but it is a start

#

:p

wheat mesa
#

It is indeed a start

#

I’ve yet to do async rust yet, you’re already ahead of me on that

#

So

sharp geyser
#

It makes sense to me

#

but lifetimes still make my head bobble a bit

wheat mesa
#

Lifetimes are a weird syntax, but you’ll understand them eventually

#

It’s to ensure that there are no dangling pointers in your code

#

I'll show you an example of why you need them rq hold on

sharp geyser
#

kk

wheat mesa
#
// Say you have a struct that stores a reference to a string
struct MyStruct {
  some_field: &str,
}

fn main() {
  // Then you have something like so:
  let var: MyStruct;
  {
    // Make a &str variable
    let my_string_ref = "Hello, world!";
    // Assign said reference to the struct
    var = MyStruct { some_field: my_string_ref };
  } // my_string_ref dropped here (Bad!)

  // Uh oh!
  println!("{}", var.my_string_ref);
  // my_string_ref was dropped, and its data no longer exists
  // However, the struct also had the same reference
  // Therefore the reference in the struct is no longer valid, and it would be very bad
  // To access said field, since it points to memory we no longer own
}
#

So the compiler makes you do this: ```rs
struct MyStruct<'a> {
some_field: &'a str // anything assigned to some_field will live for as long as the MyStruct instance lives for
}

#

It's ensuring that you cannot fuck up and access undefined memory, which usually causes segfaults

ancient nova
#

LMAO @wheat mesa

#

how come it was NaN?

wheat mesa
#

average javascript fan vs average typescript enjoyer

ancient nova
#
        if (dynamicFormat)
            checkFormat = await fetch(baseUrl);
const format = checkFormat.res.headers.get("content-type") === "image/gif" ? ".gif" : `.${defaultFormat}`;
``` is that not a proper way to fetch? 🤣
#

says headers is undefined

sharp geyser
#

depends on what fetch is

wheat mesa
#

fetch is node fetch you dingus misty

sharp geyser
#

How the fuck am I supposed to know that waffle

#

it could of been some fucked up shit knowing this guys code

wheat mesa
ancient nova
#

should I make this into a npm package?

sharp geyser
#

no

ancient nova
#

why not, discord doesn't have an endpoint to fetch banners

#

might as well

sharp geyser
#

it is super easy to form a banner

ancient nova
#

some people might not wanna bother to create a function to form a banner

gritty widget
#

👀

wheat mesa
#

Ah yes npm, the land of 10 billion sub dependencies

sharp geyser
ancient nova
sharp geyser
#

but why

ancient nova
#

so gif banners are gif and jpg banners are jpg

sharp geyser
#

but the hashes can tell you that

wheat mesa
#

can't you just use webp for both

sharp geyser
#

all gif hashes start with a_

wheat mesa
#

pretty sure you can represent both as webp

ancient nova
#

well I didn't know that

sharp geyser
#

fetching here is a bit redundant

sharp geyser
ancient nova
ancient nova
sharp geyser
#

it was always redundant whether you knew it or not

ancient nova
ancient nova
sharp geyser
#

cause it hash a prefix on the hash

ancient nova
#

without that

wheat mesa
#

by not caring about the format and just using webp 😉

ancient nova
sharp geyser
#

it doesn't matter if it doesn't have it cause it does

ancient nova
#

wat

sharp geyser
#

you are like talking to a brick wall

wheat mesa
sharp geyser
#

except brick walls are smarter

wheat mesa
#

it's easier to just use it

#

I'm not entirely sure if it works, but if it does then you don't have to waste another request

sharp geyser
#

it should work

ancient nova
#

I know, I'm not trying to say it doesn't

sharp geyser
#

webp is the typical format discord uses in the app for all types of things iirc

#

gifs, png and jpeg

ancient nova
#

you just say it's redudant, I know that but it wasn't before since I didn't know about the hashing nor remembered that webps go both ways

sharp geyser
#

just cause you don't know something doesn't make it not redundant

#

but whatever use what you need

wheat mesa
#

🤭 🍿

ancient nova
#

🍪

lyric mountain
#

Discord uses apng instead

sharp geyser
#

mm

lyric mountain
#

Also yes, webp > png/jpeg

#

If only I could find out why the lib I'm using doesn't work with fractional compression

sharp geyser
#

I wonder what the limit of compression is before you start losing quality entirely

lyric mountain
#

Well, anything above 0% compression on lossy formats

#

For jpeg it's around 15 copies before you start to notice the degradation (at 20% compression)

sharp geyser
#

I see

lyric mountain
#

Tho I hate the fact that I got used to noticing jpeg artifacts on images, too much time handling images does this

#

It's a grid-like degradation, somewhat a pixelation or smth

sharp geyser
#

I notice a lot of apps like instagram and shit, if you post too high quality of an image they will compress it and then it looks like shit

lyric mountain
#

For sure

sharp geyser
#

I wonder if there would be a way to fix that though

#

ofc you wanna compress it so it doesn't take as much space but there has to be a way to counteract such a loss of quality

lyric mountain
#

Well, for most people 20% jpeg compression is not really noticeable

#

Heck you could throw 70% and I bet nobody would notice

#

Did u try to zoom into google images? They're nasty af

#

But for some, it stands out like a sore thumb

#

U could use a lossless format, or go hardcore and jump straight to bitmap

sharp geyser
#

I just feel bad for people who post their high quality art on instagram or pintrest and shit

#

I've seen a before and after of their art and it looks horrid on the platform

lyric mountain
#

Bitmap is basically a 2d array of pixels

#

It's uncompressed, raw at its fullest

sharp geyser
#

I assume bitmap does the opposite of what you'd want when talking about compression?

lyric mountain
#

Well, bitmap cannot be compressed at all afaik

#

If u want to preserve original quality, bitmap is the go

#

Or .raw, but that's for digital cameras

sharp geyser
#

I see

#

I kinda wanna fuck with sockets more tbh

quartz kindle
#

with the standard 24bit per pixel formats, a 1000x1000 image would take 3mb

sharp geyser
#

make a discord clone or smth

quartz kindle
#

uncompressed

sharp geyser
quartz kindle
#

with transparency, its 4mb

#

32 bit per pixel

#

full quality png's use that format i believe

#

but there are a billion different pixel formats out there

lyric mountain
#

Here's an example regarding jpeg degradation I keep around just because

#

You probably can't see a difference, but put that in an editing software and zoom into the right image

#

It's nasty, and it becomes evident if u attempt to do image processing on it

#

Been there, suffered with jpeg for that reason

sharp geyser
#

the right image does look a bit weird to me ngl

quartz kindle
#

jpg's compression format is pretty crazy

#

it uses a bunch of prediction techniques to try to guess the neighbouring pixels

lyric mountain
#

Jpeg compresses itself every time it's replicated

quartz kindle
#

and only actually stores key pixels every now and then

lyric mountain
#

It's funny because u can tell if something has a long repost history from how deepfried it is

quartz kindle
#

similar to keyframes in video compression

#

jpeg2000 and webp are even crazier

cloud bough
#

Would someone be able to help me with nginx config, I just want to redirect my node application on lets say port "5000" to port 80 with a pem and a key to go to cloudflare with the full encryption setting

#

Also is anyone elses discord being abit slow today?

quartz kindle
#

then setup nginx as a reverse proxy

lyric mountain
#

Wouldn't it be the other way around?

#

U redirect 80 to 5000

cloud bough
#

Yeah withcloudflare I have my ssl cert

lyric mountain
#

(or 443 with ssl)

cloud bough
#

Oh yeah, I was just talking from my node app prespective

#
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html; (im not sure about here)
    #        index  index.html index.htm;
    #    }
    #}```
quartz kindle
#
location / {
  proxy_pass localhost:5000;
}
lyric mountain
#

Those configs feel weird, mine has like 2 ssl configs

quartz kindle
#

same

#

kind of

#

rsa and ecc

lyric mountain
#

U also need to have a 80 -> 443 redirection so the user doesn't get security warnings

quartz kindle
#

yeah

#

this is what i use for port 80

#
server {
    server_name _;
    listen 80 default_server reuseport;
    listen [::]:80 default_server reuseport;
    return 444;
}

server {
    server_name DOMAINNAME.com
    listen 80;
    listen [::]:80;
    location ^~ /.well-known/acme-challenge/ {
        root /root/nginx;
    }
    location / {
        return 308 https://$host$request_uri;
    }
}
lyric mountain
#

This is mine

cloud bough
#

this is weird

#

so something like this? ```js
server {
server_name _;
listen 80 default_server reuseport;
listen [::]:80 default_server reuseport;
return 444;
}

server {
server_name aaaaa.gq
listen 80;
listen [::]:80;

location / {
    return proxy_pass:localhost:5000
}

}```

sharp geyser
#

though its documentation sucks ass

cloud bough
#

Ive never used nginx or socket.io before so idk if this is a config for it

sharp geyser
#

ah no I was talking about something I am doing sorry

#

:p

cloud bough
#

I'm trying to figure out how to get the cloudflare certificates onto blank.gq.crt etc, but its in 2 seperate files

#

I found this on the documentation, pretty hard to understand

lyric mountain
#

CF cert is the third line below ssl on on my image

#

The two above are the public and private keys

cloud bough
#

somethin like this? ```
server {
listen 80;
listen [::]:80;

server_name insignia.gq;
return 302 https://$server_name$request_uri;

}

server {
server_name insignia.gq
listen 443 ssl;
listen [::]:443 ssl;

#ssl on
ssl_certficate: /src/insignia.gq.pem;
ssl_certificate_key: /src/insignia.gq.key;
ssl_client_certificate /src/insignia.gq.pem;
ssl_verify_client on;

location / {
    return proxy_pass:localhost:5000
}

}```

#

just remove the hashtag to turn ssl on?

quartz kindle
#

ssl on is not a configuration, its really just a comment

#

you also dont need client certificate

#

just certificate and certificate key

cloud bough
#

Okay

quartz kindle
#

also no return on proxy_pass

cloud bough
#

Ill change that and ill try to start the server on port 5000

quartz kindle
#

and proxy_pass should have a space after it

#

not a :

#

same with certificates

#

all nginx options use spaces to separate key and value

cloud bough
#
server {
    listen 80;
    listen [::]:80 default_server reuseport;

    server_name insignia.gq;
    return 302 https://$server_name$request_uri;
}

server {
    server_name insignia.gq
    listen 443 ssl;
    listen [::]:443 ssl;

    #ssl on
    ssl_certficate /src/insignia.gq.pem;
    ssl_certificate_key /src/insignia.gq.key;
    ssl_verify_client on;

    location / {
        proxy_pass localhost:5000
    }
}```
#

I was used to making objects and minecraft configs ;-;

quartz kindle
#

shouldnt need client verify either

#

and afaik nginx doesnt support relative paths, so you have to specify the cert paths from the root dir

cloud bough
#

Im on windows though

quartz kindle
#

you're using nginx on windows?

cloud bough
#

so I gotta go from the C drive or something

#

Yes at the moment while im developing it

#

Im moving it over to a ubuntu server when I host the website 24/7

quartz kindle
#

then it should be from the root drive

#

ie C:/path/to/cert.pem

cloud bough
#

okay

quartz kindle
#

also, did you port forward your routers and firewalls?

cloud bough
#

yes I did with my router

#

the firewall doesn't seem to have an issue

quartz kindle
#

alright

cloud bough
#

It may be an issue on the ubuntu machine though

#

haven't tried to host a website on it yet

quartz kindle
#

usually they have ports open for webservers by default

#

the problem with home windows is usually the router, which isnt an issue in a vps

cloud bough
#

so this should work? should I put quotes because the space in the path

#
    ssl_certficate D:\Coding\slash commands\certinsignia.gq.pem;
    ssl_certificate_key D:\Coding\slash commands\certinsignia.gq.key;

    location / {```
quartz kindle
#

should be forward slashes

#

backward slashes are interpreted as escape characters

cloud bough
#
D:\Coding/slash commands/certinsignia.gq.key```
quartz kindle
#

and yes quotes would work

cloud bough
#

Ill just do "\\"

quartz kindle
#

D:/

#

or double backslashes yes

lyric mountain
#

windows is a weirdo for using \ for paths

quartz kindle
#

indeed

lyric mountain
#

it's the entire reason there are libs to convert between both path standards

#

it's annoying af

quartz kindle
#

they themselves regretted it so much they decided to go back on it

#

unfortunately it was too late, and they had to support both

lyric mountain
#

meh

cloud bough
#

For some reason the webserver isn't completing requests

#

it may be the firewall

quartz kindle
#

tried localhost:80 ?

cloud bough
#

says refused to connect

quartz kindle
#

probably because you only accept requests using your domain name

#

maybe try removing the server name for testing

cloud bough
#

just comment it out?

quartz kindle
#
server_name _
#

on port 80

cloud bough
#

does nginx reload config automatically or do I gotta end the process n start again

quartz kindle
#

you can do nginx reload

#

idk on windows

#

on linux would be service nginx reload

cloud bough
#

nope it isn't working

quartz kindle
#

hmm try enabling logs

#

and see whats going on

#

idk much about nginx on windows tho

#

on your main nginx.conf file you should have logging options

cloud bough
#

these? error_log logs/error.log; pid logs/nginx.pid;

#

I see this in error.log

#
2022/06/23 00:04:21 [emerg] 6188#5076: "server" directive is not allowed here in D:\Coding\slash commands\nginx/conf/nginx.conf:4```
quartz kindle
#

that means your config is invalid

#

should have given an error when starting/restarting nginx tho

cloud bough
#

this is my full config just to make sure. wait maybe its because theres no semicolon on the proxy_pass localhost:5000

#

like that? ```
error_log logs/error.log;
pid logs/nginx.pid;

server {
listen 80;
listen [::]:80;

server_name server_name _;
return 302 https://$server_name$request_uri;

}

server {
server_name server_name _;
listen 443 ssl http2;
listen [::]:443 ssl http2;

#ssl on
ssl_certficate "D:\\Coding/slash commands/certinsignia.gq.pem";
ssl_certificate_key "D:\\Coding/slash commands/certinsignia.gq.key";

location / {
    proxy_pass localhost:5000;
}

}```

#

and do I need to forward port 443 and 80?

quartz kindle
#

thats nginx.conf?

cloud bough
#

yep

quartz kindle
#

thats explains it then

#

the root nginx.conf is usually not recommended to be edited directly, nginx has a system of sites_enabled and sites_available, where you put your site's own conf files to avoid messing with the main file

#

but if you wanna use the main file, it needs to start with an http block

#
http {
  server {
    ...
  }
}
#

google some nginx config generators, there are many

cloud bough
#

and error_log will still be before http {

quartz kindle
#

they can generate a clean main conf file

#

yes error logs can be outside of http

cloud bough
#

okay

#

Okay and thats the only error I have

#
unknown directive "ssl_certficate" in D:\Coding\slash commands\nginx/conf/nginx.conf:19```
#

so I guess i shouldn't use the quotations?

#

wait I figured it out im pretty sure

#

its this line having issues

#
        ssl_certficate "D:\\Coding/slash commands/cert/insignia.gq.pem";```
cloud bough
#

Im gonna look at this more tomorrow and look around online

quartz kindle
#

you misspelled it

#

certificate
certficate

ancient nova
#

@quartz kindle you helped me with the enmap before, do you have any idea how to edit an existing enmap?

#

I'm not aware of all the functions it has, but basically I tried to get the already existing warn and edit the reason```js
const storage = warnstorage.get("5QRk3");
warnstorage.set("5QRk3", JSON.stringify(storage).replace(storage[3], "test reason"));

#

it kinda works but it breaks the way it's saved

sharp geyser
#

why ping a specific person

#

just ask and anyone who knows will answer

#

smh

ancient nova
#

relax, I just thought tim might know

sharp geyser
#

I mean you can delete and then reset with different values

ancient nova
#

I have to save the values I'm not changing tho

sharp geyser
#

you are already storing them in a variable are you not?

#

as long as the scope doesn't end you still have access to those values

ancient nova
#

nope, warnstorage.get returns an enmap

#

yeah I want to edit the value I want to change from that enmap

#

but I can't replace the string unless I stringify it first

sharp geyser
#

🤔

ancient nova
#

but if I stringify it the way it's saved gets wonky and it breaks my entire warn system

sharp geyser
#

what do you mean by it gets wonky

#

is there any errors that occur?

ancient nova
#

not while it's saving, they occur when I try accessing it, cause instead of an enmap, the map gets converted into a string and it looks something like this

#

"[value1, 2, 3]"

sharp geyser
#

You seem to be able to update a specific location in the enmap with set

#

as long as you know the index of the thing you wanna update you just use enmap.set('WhateverYouCalledItOriginally', 'newValue', indexOfWhatYouWannaUpdate)

ancient nova
#

oh nice

#

didn't know about the third thingy

sharp geyser
#

yes cause you don't read docs

ancient nova
sharp geyser
#

either way hope it fixed ur issue

ancient nova
#

it has, it's so much simpler than what I was doing

ancient nova
#

works perfectly

#
    // Lets check if the Id exists before trying to replace it. And also save the variable for later.
    const checkValidity = warnstorage.get(warnID);
    if (!checkValidity) return message.channel.send("This ID does not exist in our database.");
    
    // And lastly, update our warn. "2" is the position of our reason, so that's the value we need to replace. And set does that for us.
    warnstorage.set(warnID, reason, 2);
    
    // And lastly confirm it with a nice, informative embed.
    const warningsEmbed = new MessageEmbed();
    warningsEmbed.setTitle(`Z3RO Warn System (ID: ${warnID})`);
    warningsEmbed.addField("Updated Reason", `${checkValidity[2]} -> ${reason}`);
    warningsEmbed.setColor(commandColor);

    //And send
    return message.channel.send({embeds: [warningsEmbed]});
``` basically all I had to do
bright hornet
sharp geyser
#

Why are you

#

What is the point of you doing if(message.client.commands.get(commandName)) and then doing the same inside the if statement body

bright hornet
#

still havent updating my code

sharp geyser
#

also you are checking if there is no command inside the if statement while that if statement is checking for the command

#

so it is redundant

ancient nova
#

I wanna rewrite my old connect4 and tictactoe games

#

how should I do it?

#

I used reactions back then but idk if that still works

sharp geyser
#

sounds like pain

ancient nova
split hazel
#

enmap users realising its just a simple sqlite database with json support

bright hornet
#

When I used +result without any given args[0] the image 1 will be the result. But when I give command name then it will go to image 2

https://sourceb.in/s7ycHmpcRM

I remodified my code xd

#

I just dont understand, instead of copy the file, it replaced by the current used command

sharp geyser
#

args[0] is probably the name of the command being ran and not the one you are trying to reload

bright hornet
#

after running +reload test3 then it replaced with another function

sharp geyser
#
 if (!command) {
      return message.channel.send(`There is no command with name or alias ${name}`)
    } else if (command || message.client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(name))) {

this here why

bright hornet
#

😕

sharp geyser
#

you can group that together with the command variable and just do if(!command)

#
    const command = message.client.commands.get(name) || message.client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(name));
    if (!command) {
      return message.channel.send(`There is no command with name or alias ${name}`)
    } else {
bright hornet
#

i think i get it

#

wait

sharp geyser
#

also the only way I see you replacing it with the reload command is args[0] is the reload command name and not the command you wanna reload

#

so log args and check it's indexes

bright hornet
#

ah still the same

sharp geyser
#

Log.

bright hornet
#

wait

sharp geyser
#

Args

bright hornet
#

let me

#

should i do

#

name.command

#

?

#

lemme try

#

nvm

#

lmao

#

i think ive found the solution, its bec of for it only look for the command that im using

sharp geyser
#

woah as if I didn't say that

bright hornet
feral aspen
rigid maple
#

what's the problem?

when I'm open http://localhost:5000/twitch/dashboard/channel I see white screen but
when I'm open http://localhost:5000/twitch I see error page (404)

#

Each component has its own router.

fathom sonnet
#

any1 know why i getting that ** .name** is undefined?

so this code should log when someone update channel name, but instead it give this error

#

and this just started happening...why? IDK

near stratus
#

so can't read value channel.old.name and channel.new.name

#

Turns out you're doing the entire thing wrong

#

It should be like

client.on("channelUpdate", (oldChannel, newChannel) => { ... }
fathom sonnet
#

ahh tnx man

near stratus
#

And I don't understand why you're using an async function when you'll end up using callbacks

near stratus
#

I don't understand why /twitch/dashboard/channel is working either
Unless you have another router running at /twitch/dashboard

eternal osprey
#
//outside the guildmember event:
let timer;
 
//inside the guildmember event:
timer = await setInterval(function () {
  
 
  memberchannel.setName(`Totale Members--> ${number}`)
}, 10000);

}```this code is inside my guildmemberadd event. Would it start a new interval each time someone joins or is there a way to make it only activate once?
near stratus
eternal osprey
#

yeah that would result to an api rate limit after 10 joins lmao

#

how can i fix that

near stratus
#

define a new variable at root level (Outside guildMemberAdd

eternal osprey
#

i will just bind it to a command

eternal osprey
#

so like: the above snippet?

near stratus
# eternal osprey so like: the above snippet?
let members = 0;
let abrakadabra;

client.on("guildMemberAdd", member => {
    if(abrakadabra){
        member = //number
    } else {
        member = number
        abrakadabra = setTimeout((0 => {
            memberchannel.setName(`Totale Members--> ${members}`)
            // Not numbers
            // I'm not sure if it'll work as i intended but it doesn't hurt to try
        }, 69420)
    }
}
rigid maple
#

I can't understand why it's not working

near stratus
#

you have /twitch/dashboard

#

/twitch/dashboard/channel

#

and everything else

rigid maple
#

the problem is already /twitch/dashboard/channel not working

eternal osprey
#

What does it do

near stratus
eternal osprey
#

oowhhh

rigid maple
eternal osprey
#
//outside the guildmember event:
let timer;
 
//inside the guildmember event:
timer = await setInterval(function () {
  
 
  memberchannel.setName(`Totale Members--> ${number}`)
}, 10000);

}```isn't it essentially the same as this snippet tho
near stratus
#

like never

rigid maple
#

my goal is to show Channel file inside TWDashboard folder at /twitch/dashboard/channel