#development

1 messages · Page 20 of 1

lyric mountain
#

cuz deep would make all objects and their innards into separate references

wheat mesa
#

I believe it’s deep

#

Ah nvm it’s shallow after looking it up

ancient nova
#

then I don't know what I was thinking

#

if it's really making it better then my bad

wheat mesa
#

Still, unnecessary and slower for literally no reason

ancient nova
#

worse*

#

but I finally realized my issue xd

#

like why it was not working from the very beginning

wheat mesa
#

Chaining together random array methods and expecting magic results is not going to help you

lyric mountain
wheat mesa
#

Tomorrow I will have to use Java again for the first time in a couple months

lyric mountain
#

yay

wheat mesa
#

I think it’ll feel fresh after having to worry about borrowing and ownership for a while

ancient nova
#
            check: (message, member = undefined) => {
                // Lets check if we filled the optional member property, 
                // if not let's get the member property from the *message* variable
                if (!member) {
                    member = message.member;
                }; const modRole = message.settings.modRole, mentionedRoleRegex = /^<@&(\d+)>$/;
                
                // Try fetching the role by either name ID or mention.
                let finalCheck, roleID; if (mentionedRoleRegex.test(modRole)) {
                    finalCheck = message.guild.roles.cache.get(modRole.replace(/<@&(\d+)>/, "$1"));
                } else if ((roleID = modRole.match(mentionedRoleRegex)) !== null) {
                    finalCheck = message.guild.roles.cache.get(roleID[1]);
                } else {
                    finalCheck = message.guild.roles.cache.find(_role => _role.name.toLowerCase() === modRole.toLowerCase());
                }; return (
                    message.member.roles.cache.has(
                        finalCheck?.id || message.member.roles.cache.find(role => role.name === finalCheck)?.id || finalCheck
                    )
                ).catch((err) => {
                    return false;
                })
            } 
#

I believe this is going to fix it

#

whoops

#

one more issue

lyric mountain
#

idk why u insist in using inline ifs and returns

#

oh and variables

wheat mesa
#

yeah wtf is that formatting

ancient nova
#

why, is that not something you'd do

wheat mesa
#

that makes literally no difference

#

space != performance

#

you'll save like 6 bytes per file while making your code infinitely more unreadable

lyric mountain
ancient nova
#

I have a weird coding style

#

I can read that just fine

wheat mesa
#

that's not a coding style, that's satanic

#

just use a linter and save yourself and everyone helping you a headache

lyric mountain
#

having your own coding style is fine (like newlile brackets or different casings), but there's a line where it becomes just bad habit

wheat mesa
#

trust me, no sane dev would want to read this

ancient nova
#

ahh yes!!that fixed it

ancient nova
wheat mesa
#

use a linter

#

like eslint or prettier

#

and set your IDE to format on save

#

easy

ancient nova
#

no my code actually breaks most indexers 🤣

#

I tried formatting it like that on 2 different programs

wheat mesa
#

The only code that “breaks” linters is invalid code :p

ancient nova
#

no it actually does

#

I can show you what it does with my code when I try formatting it

ancient nova
#

nvm it just didn't change at all

#

but it does on some snippets I tried formatting before

#

and they worked fine

#

of course something would be wrong

#

TypeError: member.roles.cache.has(...).catch is not a function

sudden geyser
#

has returns a boolean

ancient nova
#

doesn't really explain why catch wouldn't work on it but oh well

lyric mountain
#

it does

#

catch doesn't work on anything that's not a promise

ancient nova
#

fixed 👍

radiant kraken
uneven tartan
#

i think its a formatter

solemn imp
#

how would i make a vote cooldown show up when someone votes

eternal osprey
#
  let receivedDataAsJSON = JSON.parse(data);
          console.log(receivedDataAsJSON.events[0].subcalendar_ids)
  console.log(receivedDataAsJSON.events[0].subcalendar_ids.includes('11101805'))```how is this returning false?
#

\📆

wheat mesa
#

Because it's an array of numbers not an array of strings

uneven tartan
eternal osprey
#

huh

#

i am running on djs v13.9

#

is the addField method deprecated?

#

It wasn't deprecated in 13.9 right?

#

even the docs have this feature

radiant kraken
lyric mountain
solemn imp
#

or whats a good way to track

lyric mountain
#

Save the timestamp for that users whenever they vote

#

Then simply get the difference between currentTime and voteTime + 12

boreal iron
#

Same question, same answer oldEyes

solemn imp
#

do i just do like current time and timestamp

#

and compare them

solemn imp
lyric mountain
solemn imp
lyric mountain
#

Store as TIMESTAMP

solemn imp
#

um ok

boreal iron
#

INT works as well of course

crystal wigeon
#

hey, how do i get the bot to ping a certain role?

#

i have the role ID and im using <@&id> there no notification

#

what permissions do i need to give the bot?

boreal iron
#

Also make sure the role can be mentioned by others

uneven heath
#

Is it just me or that Discord.js v13 doesn't have ActionRowBuilder for TypeScript?

crystal wigeon
#

Thanks

uneven heath
#

Add option receive a SelectMenuOption[] which should work in this circumstance

#

Am I missing something here?

#

I feel like I am having sleeping issue that i forgot to do something here but I don't remember which

#

Nvm, I remember now, I need to spread it

carmine summit
#

does .getImageData() read the image left to right, or up to down?

sharp geyser
#

What

earnest phoenix
carmine summit
lapis cliff
#

How can I blacklist a server from adding my bot?

boreal iron
#

Not really but you can store the guild ID and leave the guild immediately when joining it

thin bison
#

any idea on why its not sending the image even tho base64 is correct and has image on it

const SendToChannel = (imgBuffer, ctx) => new Promise(async (resolve, reject) => {

    const image = imageBuffer((await imgBuffer.arrayBuffer()),'png')

    const attachment = new Discord.AttachmentBuilder(image);

    ctx.send({content: 's base:\n⁣', files: [
        { attachment: [attachment] }
    ]}).then(() => {
            resolve();
        })
        .catch(reject);
})
#

its passing text but not the attachment

lyric mountain
#

did u try logging image?

thin bison
#

yea

#

its a base64 format

#

the encoding is correct

#

i can copy that and try it on online website and it shows me correct image

lyric mountain
#

is the attachment expecting base64?

thin bison
#

technically

#

it support buffers

lyric mountain
#

but didn't u say image is a base64 string?

thin bison
#

yes i was trying to encode to image format and see how it goes

#

but here a orginal code with buffer

const SendToChannel = (imgBuffer, ctx) => new Promise(async (resolve, reject) => {

    const attachment = new Discord.AttachmentBuilder(Buffer.from((await imgBuffer.arrayBuffer()), "base64"));

    console.log(attachment);

    ctx.send({content: 's base:\n⁣', files: [
        { attachment: [attachment] }
    ]}).then(() => {
            resolve();
        })
        .catch(reject);
})```
#

i can see that attachment is showing correct info but it's not sending

lyric mountain
#
ctx.send({
  content: 's base:\n⁣', 
  files: [{ attachment: [attachment] }]
})
.then(() => resolve())
.catch(reject);
#

just so I can read it

#

is attachment supposed be be inside an array?

earnest phoenix
thin bison
# earnest phoenix The option is supposed to be `attachments` not `attachment`

still same

const SendToChannel = (imgBuffer, ctx) => new Promise(async (resolve, reject) => {

    const attachment = new Discord.AttachmentBuilder(Buffer.from((await imgBuffer.arrayBuffer())));

    console.log(attachment);

    ctx.send({
        content: 's base:\n⁣', files: [
            {
                attachments: attachment,
            }
        ]
    }).then(() => {
        resolve();
    })
        .catch(reject);
})```
earnest phoenix
#

Not like that

#
ctx.send({
  content: 's base:\n',
  attachments: [attachment]
});
thin bison
#

still same it just send content only

#
  attachment: <Buffer 47 49 46 38 37 61 7b 00 28 00 e7 00 00 1c 12 24 5c 86 a4 84 c2 ec 84 66 8c 44 4a 44 bc ba b4 dc 82 cc bc da 94 2c 2e 2c 5c 66 6c bc ba c4 84 82 7c 9c ... 2520 more bytes>,
  name: 'image.png',
  description: undefined
}```
earnest phoenix
#

how i use custom font in canvas ?

civic scroll
# earnest phoenix how i use custom font in canvas ?
import { registerFont } from 'canvas';

// register font
registerFont('path/to/font', {
    fontFamily: 'font name',
    // ...fontConfig
});

// @define <context> type Canvas2DContext
// @define <x>, <y> type int | float
// use it
<context>.font = '<size-px> font name';
<context>.fillText('text', <x>, <y>);
civic scroll
#

why'd you ask?

rustic nova
#

fuck

#

async

#

thanks for coming to my talk

civic scroll
rustic nova
#

no its like

civic scroll
#

anywho what was the problem

rustic nova
#

pissing me off

civic scroll
rustic nova
#

nah i havent fixed it

#

flask + discordpy: Shit

#

literally:

Have a dashboard on flask, want to send messages through it. The method that sends the message is async

#

9 thousand fucking stackoverflows later

#

still not fucking fixed

#

back to java

rustic nova
#

I can

civic scroll
#

or you just can't verify that the message is sent

rustic nova
#

Thing is, literally the flask view (aka the one that handles the request) is async

#

but like

#

fuckin async still cries

#

it pisses me the fuck off

civic scroll
civic scroll
rustic nova
#

Nah im gonna change it to a clown in a bit

civic scroll
lyric mountain
rustic nova
#

Literally

#

I'd prefer java rn, if it wasnt for the shitty way how to do the same stuff as flask

#

ik Springboot exists

lyric mountain
#

u can use groovy

rustic nova
#

but that stuff looks cringly overcomplicated

lyric mountain
#

same java power, more convenience stuff

rustic nova
#

I can use a waterbucket too

lyric mountain
#

tf is waterbucket

rustic nova
#

water

#

nvm

#

fuck python, quitting coding kthx

civic scroll
#

java

lyric mountain
#

spring itself is what's complicated

civic scroll
#

me when async Result<?> RequestFactory.PrepareRequest awaitRequest(String url, ...? response)

radiant kraken
#

can anyone help me with this because my brain can't function properly atm
let's say i have this array

[
  { a: 2, b: 4 },
  { a: 3, b: 1 },
  { a: 7, b: 10 },
  { a: 9, b: 5 },
  { a: 10, b: 5 },
  { a: 11, b: 5 },
  { a: 12, b: 6 },
  { a: 15, b: 23 },
  { a: 16, b: 24 },
  { a: 17, b: 25 }
]

how do i find sorted a values all with the same b values, in a way that it would yield

[
  { a: 9, b: 5 },
  { a: 10, b: 5 },
  { a: 11, b: 5 }
]
``` ?
#

feel free to send me pseudocode or on how the algorithm would work

lyric mountain
#

filter by b

#

ah wait, u want only entries where b repeats at least once?

#

regardless of the value

civic scroll
#

we can sort by b

#

then later on filter to get array with 2 or more entries

#

reduce method works

radiant kraken
#

also all as must be in an order and they have to be like 9, 10, 11, ...

civic scroll
#

yeah order guaranteed

radiant kraken
#

then what is the way of finding [2, 3], [9, 10, 11, 12], and [15, 16, 17] from an array like [2, 3, 7, 9, 10, 11, 12, 15, 16, 17]

civic scroll
#

continuos ranges?

radiant kraken
#

yeah that's what i meant

civic scroll
#

i remember i did something similar to this in codewars a few months ago

#
function solution(list){
    let out = [];
    const modArray = (array) => {
        array.toList = function () {
            return this.length > 2 ? `${this[0]}-${this.slice(-1)}` : this.join(',');
        }
        return array;
    }
    let streak = modArray([]);

    for (const x of list)
    {
        if (!streak.length || streak.slice(-1)[0] + 1 === x)
            streak.push(x);

        else
        {
            out.push(streak.toList());
            streak = modArray([x]);
        }
    }
    out.push(streak.toList());
    return out.join(',');
}
radiant kraken
#

yum thanks for the spoonfeed

civic scroll
#

> sayuri extract algo -i number[] -o number[][]

rustic nova
#

RuntimeError: Timeout context manager should be used inside a task

#

also most depressing moment

sage bobcat
civic scroll
#

so ```js
function range(list: number[]) {
let out = [], streak = [];
for (const x of list) {
if (!streak.length || streak.slice(-1)[0] + 1 === x)
streak.push(x);
else
{
out.push(streak);
streak = [x];
}
}
if (streak.length > 1)
out.push(streak);
return out;
}

lyric mountain
#

you know you're desperate when u searched for an error solution on reddit

radiant kraken
#

i can implement it myself by looking at the code

rustic nova
#

literally back to java rn

sage bobcat
civic scroll
rustic nova
radiant kraken
#

i already can read it

rustic nova
#

yet python cries with

#

RuntimeError: Timeout context manager should be used inside a task

civic scroll
#

sorry

radiant kraken
#

this might surprise y'all but

sage bobcat
#

One message removed from a suspended account.

radiant kraken
#

i have the ability to read

rustic nova
#

async flask

rustic nova
#

async method

#

rage

sage bobcat
#

One message removed from a suspended account.

rustic nova
#

I'm starting to hate it

civic scroll
#

i personally will have to use python

sage bobcat
#

One message removed from a suspended account.

radiant kraken
#

fuck Python

civic scroll
#

because computer science

radiant kraken
#

Cobra is better

sage bobcat
#

One message removed from a suspended account.

civic scroll
radiant kraken
#

yes

#

i have that ability too

lyric mountain
#

use groovy if u dont like java verbosiness

radiant kraken
#

ik you all are jealous 😎

rustic nova
#

i literally started to fuckin figure out bootstrap

#

then python gives me the middlefinger

#

I love it

civic scroll
rustic nova
#

also whatever this fucking site managed to fuck up

civic scroll
earnest phoenix
radiant kraken
#

you're late

#

i'm ashamed of you

earnest phoenix
dry imp
#

python is pog

#

literally best language 🙄

rustic nova
#

k am officially done

#

fuck this language

winter pasture
wheat mesa
#

Not hard to swallow, python is stinky

wheat mesa
rustic nova
#

I'm so fuckin down bad, am literally about to just start 2 sockets, have one be the bot and the other one the website and have them exchange the messages

solemn imp
lyric mountain
#

why tho?

#

you want your dates to be precise and parseable, not readable

lyric mountain
#

simply format it when showing to the user

solemn imp
#

how would i show the timeleft if they are on cooldown

#

in this format

#

HH:MM:SS

#

how would i format datetime.datetime.utcnow()

lyric mountain
#

what language are u using?

pale vessel
#

That's python

lyric mountain
#

ah, idk python enough to answer then

#

literally the first result

floral mist
#

anyone has experience with systemctl? when i run script manually, it loads all my language models correctly but when i run the same script with systemctl its not loading all the models. noob w systemctl

#

it loads like half

radiant kraken
#

i thought it was a type of snake

floral mist
#

maybe i have to give proper permissions MegaThonk

#

solution was to set User under [Service] GG

earnest phoenix
#

If I want to do that the bots do not save their information or any things in the database or no one can see what they have?

lyric mountain
#

you simply don't save

#

I'm starting to think there's no "friend" at all given how much stuff ur trying to implement

rustic nova
#

Hello everyone who does Python, I am once again asking for your support:

I'm currently working on the following setup:

  • a discord bot using pycord
  • a flask server, running a dashboard

My goal is to send a message into a channel using said dashboard for testing.

But oh no.. I am facing the following issue:

Timeout context manager should be used inside a task
This error seems to happen on the coroutine to the send method from where I'd send a message on
Flask is using the asyncio extra so that I can execute coroutines within flask views

Stackoverflow has not helped me either

lyric mountain
#

accept your destiny and come to java

#

being multithread helps a ton for apis

rustic nova
#

I am honestly

#

contemplating on doing so

#

But I dont like how java does stuff aaaa

wheat mesa
#

Java is easy

rustic nova
#

python too

civic scroll
#

javascript

rustic nova
#

async is annoying

lyric mountain
#

go groovy if u dont like java syntax

civic scroll
#

kotlin

#

fun main

rustic nova
#

fun main

#

more like

wheat mesa
#

Java futures are annoying imo but it’s still a good language

rustic nova
#

pending doom

civic scroll
#
fun NotFun() {}
lyric mountain
#

there's just too much similarity to be coincidence

rustic nova
#

i was like, literally at the point of just removing the Runtime error line from the helper.py of aiohttp

wheat mesa
#

Either way promises are much better than futures

rustic nova
#

out of frustration

lyric mountain
wheat mesa
#

Async await syntax is much better

#

I just don’t like the way futures work in Java, it feels like a clunky workaround to adding async to it

rustic nova
#

is it a bad idea to ask on stackoverflow

#

cant go lower anyways

lyric mountain
#

it has 90% chance of being downvoted to oblivion and marked as duplicate

#

but sometimes it works

rustic nova
#

then they should tell me the appropriate solution to my issue

#

smh

civic scroll
#

just use languages that has proper async syntax

earnest phoenix
wheat mesa
rustic nova
#

lmao

wheat mesa
#

Or use rust

#

Rust has great async await

rustic nova
#

nah

#

too close to the system for me

#

did try rust in my internship

#

but not my thing really

wheat mesa
#

It’s fun if you’re into it

rustic nova
#

nah

wheat mesa
#

Some of the web frameworks abstract a lot of the low level stuff away from you

#

To a certain extent you’ll always be dealing with it though

rustic nova
#

oh

#

my

#

fucking

#

god

#

i did it

#

Literally

#

5th

#

fucking google page

wheat mesa
#

Lmfao

sudden geyser
#

I don't know how I feel about Java Futures though

wheat mesa
sudden geyser
#

Yeah, but that's what I don't like about it. The syntactic sugar actually makes it harder to use!

civic scroll
#

mmm yes, chained promise callback hell

civic scroll
#

in case of js

#

and actually in js i would prefer the syntactic sugar

dry needle
#

Is there an API Limit on how many roles you may create per day? 😅 Either i Broke my code or reached it when debugging on a test server

sudden geyser
civic scroll
#

it's easy to see the indication

#

and context as well

sudden geyser
#

There was some article I read a while ago that shared many of the same issues I had with it but I can't find it

#

No, not really.

earnest phoenix
#

Someone tell me what does this calculation do?

{return 5 * (Math.pow(level, 2)) + 50 * level + 100;}}

I mean, what is required of the user to reach the next level?

sudden geyser
#

Turn that code into a function and try calling it with different levels.

civic scroll
#

or assume level is x here is a more concise version

5x² + 50x + 100
wheat mesa
#

It’s a quadratic function

civic scroll
#

it's a number operation

#

trol

wheat mesa
#

(The x axis will be the level, and the y axis will represent the amount of xp required to reach that level)

lyric mountain
#

that formula is brutal depending on how much xp u earn

wheat mesa
#

Yeah quadratic is exponential so it’s not an amazing leveling formula at higher levels

lyric mountain
#

I use level² * 100, has a good curve tbh (15 xp per message)

#

also I use cumulative xp so there's that

sudden geyser
lyric mountain
#

I heard so many jokes abt mee6 levelling that I'm afraid to ask if it's THAT bad

sudden geyser
#

it's just bad

#

like real bad

lyric mountain
#

in a scale of CD Projekt <---------------> EA, how bad?

sudden geyser
#

EA surprise mechanics bad

lyric mountain
#

zamn

eternal osprey
#

hey guys, how would i convert this so, that it only would get the current time? js end_dt:'2022-08-10T12:15:00-04:00'

#

Instead of that date, and 04:00 behind it (04:00 is the current timezone)

sudden geyser
#

So the 12:15:00?

#

What language are you using?

eternal osprey
sudden geyser
#

You have two options:

  • Convert it into a Date object and use the toLocaleDateString method (don't know if this would result in the behavior intended, but the Date object should still have methods for getting the pieces you want).
  • Convert it into Unix time and have Discord format it for you (https://discord.com/developers/docs/reference#message-formatting).
uneven heath
#

Say I have to transfer some data in form of Objects to the interaction event after an user interact with a select menu. How would I should go with it.

Currently thinking of storing the object in a Collection<string, Object> and then use message id as a reference (put it in menu id, parse it later in interaction event)

#

FYI: This is Javascript/Typescript btw

winged linden
#

yo

#

got a question, i just upgraded from v12.5.1 to v13.3.1

whats the equivalent of message.guild.me.hasPermission("EMBED_LINKS") in this version

eternal osprey
winged linden
#

thanks miss/sir

wheat mesa
#

But if you’re handling that part fine, Collections are just fancy maps

winged linden
uneven heath
winged linden
uneven heath
#

I don't want to mean Object in a literal way

wheat mesa
#

Ah okay

#

Collections are just extended maps, with O(1) access. They’re very efficient for storing data where you have a set of unique keys like IDs. If it works for you, it’s a good solution most likely

uneven heath
#

Welp, guess that's the way then.

wheat mesa
uneven heath
#

Feels like updating to v14 might be nicer for handling permission and stuff

#

After all, stuff like ChannelType or Permission are now on Enum

#

Esp on TS

quartz kindle
#

maps/collections are better if you have lots of keys, like thousands

#

objects are always better for small stuff

wheat mesa
#

I thought maps/collections were just basically objects

quartz kindle
#

they are different under the hood

#

maps are hash tables

wheat mesa
#

Then what are objects

quartz kindle
#

objects are many things depending on context

#

they can be structs, can be linked lists, can be hash tables

wheat mesa
#

I see

quartz kindle
#

maps have a much bigger instance overhead

#

both memory and performance

#

so they are not good for creating and deleting instances lots of times

wheat mesa
#

A good hashing algorithm will be very fast, but yeah it does require a lot of memory overhead/allocations

#

Or at least that’s what I’ve learned from my individual experience and CS classes

ancient nova
#

ERROR Unhandled rejection: TypeError: Cannot read properties of null (reading 'has')

    if (message.guild && !message.channel.permissionsFor(message.guild.me).has(
        [
            Permissions.FLAGS.VIEW_CHANNEL, 
            Permissions.FLAGS.SEND_MESSAGES, 
            Permissions.FLAGS.EMBED_LINKS
        ]
    )) return;
#

why?

#

I check if it's in a guild first, so it cannot be because someone DMs the bot

#

I should probably add that it only happens sometimes, not quite sure when but when it happens it spams the console at least 1000 times before stopping

hidden gorge
#

ok so i’m wondering this in py our bot has a command and when you run it you have to put a message that has 100 characters is there a way to send a message saying that the message is under 100 characters?

ancient nova
#

obviously

#

check for string length and do the more than operator

#
if (string.length >= 100)
   return message.reply({
     content: "You cannot have a string longer than 100 letters"
   });
wheat mesa
#

inb4 he tries to use this js code in python

ancient nova
#

🤣

wheat mesa
#

No no, let it happen

wheat mesa
#

I have money on this

ancient nova
quartz kindle
ancient nova
wheat mesa
#

That would get you the same result

ancient nova
#

cause my temporary fix was kinda lazy xd

quartz kindle
#

no thats doing the same thing twice

ancient nova
wheat mesa
ancient nova
#

how do you actually fetch it then?

wheat mesa
#

Fetch yourself

quartz kindle
#

guild.members.fetch

wheat mesa
quartz kindle
#

goan fetch yourself

ancient nova
hidden gorge
quartz kindle
#

did discord move the deadline for the message content intent again? i swear it was end of september, not beginning

#

that means i have 20 days now to rework my bot

#

i didnt even start yet

ancient nova
#

I can't come up with anything more creative

quartz kindle
#

lol

wheat mesa
#

Make a permissions handler and stop using that inline “style” it hurts my eyes mmulu

ancient nova
#

I will add slash at some point tho

quartz kindle
#
const me = await message.guild.members.fetch(client.user.id);
...permissionsFor(me)...
ancient nova
#

besides it would be dangerous kinda, it would fetch each time the messageCreate event is called

quartz kindle
#

all djs fetch functions check the cache before fetching

#

unless you use force:true

ancient nova
quartz kindle
#

yes, you can always check the source code for fetch

ancient nova
#

just to make sure that's on every d.js version?

#

I'm using 13.8

quartz kindle
#

afaik it has always been like that

ancient nova
#

huh then why did the people always tell me not to use fetch when I can check cache?

wheat mesa
#

No

ancient nova
#

wdym no

wheat mesa
#

The return bothers the hell out of me

quartz kindle
#

stuff like channels and guilds usually dont need fetching because they are always cached by default

ancient nova
wheat mesa
#

You have the biggest if statement known to man

quartz kindle
#

ive had bigger ones lol

wheat mesa
#

Personally I would just assign that to a variable and then do if(variable) return;

ancient nova
wheat mesa
ancient nova
wheat mesa
#

It bothers me that you’re still using strings for booleans, yes

#

Other than that it’s perfectly fine

ancient nova
#

someone else proved that it won't matter whether I use strings or bools a couple weeks ago

wheat mesa
#

I just don’t like looking at the giant multiple line if statement and then the tiny inline return

ancient nova
wheat mesa
#

I’m pretty sure Tim said it wouldn’t matter on a small scale

quartz kindle
#

pretty much ^

ancient nova
wheat mesa
#

But that if it scales up it will chew up memory

ancient nova
#

my bot already uses almost 400mb

wheat mesa
#

Not to mention your poor database will be eating bytes for breakfast

quartz kindle
#

noob

ancient nova
#

I cache wayy too many things

proven escarp
# ancient nova does this bother you, Waffle?

ok here are some fucked things about your code:

  1. WTF DON'T USE BOOLEANS AS STRINGS?!??!? 💀
  2. WHAT IS THIS IF STATEMENT ON THE SAME LINE AS THE END OF THE OTHER IF STATEMENT 💀💀💀
  3. PLEASE JESUS MAKE A FRICKING VARIABLE FOR THAT IF STATEMENT 💀💀💀💀💀

thanks for reading my message ❤️

quartz kindle
#

once i rework my bot, it will use 30mb ram

proven escarp
ancient nova
proven escarp
#

also igor with a 6gb vps for his bot with 90 servers

quartz kindle
wheat mesa
#

Ah okay I was about to say…

quartz kindle
#

basically a glorified webserver

wheat mesa
#

Since gateway connections are relatively expensive to maintain

ancient nova
#

so that's why discord is trying to get rid of them?

quartz kindle
#

webhook interactions really were god given

wheat mesa
#

What

wheat mesa
#

Gateway connections are not going to disappear

#

Lol

quartz kindle
#

no more receiving 848828834 irrelevant events

wheat mesa
#

You can simply choose to have interactions sent to a webserver instead for your own reasons if you don’t require a gateway connection

ancient nova
wheat mesa
#

That’s not how it works

#

You receive almost all events through the gateway

ancient nova
#

idk there is always that cheaper option that companies will go towards

proven escarp
#

what?

quartz kindle
#

indeed, currently webhooks can only be used for 1 out of 40+ events

proven escarp
#

that makes no sense

#

not tim

wheat mesa
#

Slash commands aren’t a replacement for a gateway connection, you can just choose to use them instead if your application does not need anything related to gateway

quartz kindle
#

who knows if they will enable webhooks for more events

proven escarp
#

probably not

#

they didn't update the webhooks in so long

wheat mesa
#

Some events just happen far too often for discord to send a POST request for each one

proven escarp
#

ye

wheat mesa
#

I feel like getting messageCreate events through POST would suck KEKW

quartz kindle
#

imagine presence updates

#

:^)

wheat mesa
#

Lmfao

ancient nova
wheat mesa
#

One bot would bring down the whole DAPI from presence updates

quartz kindle
#

precense updates via webhook is basically a dos attack

wheat mesa
#

That’s why they got rid of the banlist endpoint or whatever it was, some bot had like 500k+ bans and was nearly bringing down the whole API every time it fetched it KEKW

proven escarp
#

fun

quartz kindle
#

xD

quartz kindle
#

i mean

ancient nova
#

I have a banlist command

quartz kindle
#

they could just paginate it

#

like they do with members

wheat mesa
#

Yeah but then it would way less useful

#

Unless they supplied some other information

quartz kindle
#

filters by date or by username

wheat mesa
#

Yeah

ancient nova
#

@quartz kindle could using fetch ever be slow?

wheat mesa
#

Yes

ancient nova
#

would using fetch in my case be slow?

wheat mesa
#

No

quartz kindle
#

whats the single most expensive rest api call today?

wheat mesa
#

After you fetch it once it’ll be cached

#

Then when you call to fetch it again, instead of fetching it’ll return it from the cache

ancient nova
wheat mesa
#

No

#

They’ll both be fast

quartz kindle
#

list guild channels can have up to 500 channels

wheat mesa
#

Fetching the first time will just be slower than the cache

#

Since that’s what cache is designed for

ancient nova
#

I just restarted my bot and it responded with a 1-2 second delay for the first few command executions

#

even now it feels slightly slower

wheat mesa
#

Sounds like a major skill issue and not a fetch issue

ancient nova
#

might be my imagination though

wheat mesa
#

Although I don’t know what all you’re fetching

ancient nova
ancient nova
#

almost never do .fetch

wheat mesa
#

Unless you’re fetching like 20000000000 people you’re not gonna really notice a difference unless the API response time is slow for whatever reason

ancient nova
#

the api response for me is 100mb

wheat mesa
#

If you ever notice your bot being slow, check it’s rest api ping

quartz kindle
#

100mb

ancient nova
#

ms *

wheat mesa
#

Then check the DAPI server status for any issues

#

But if your bot is consistently slow then it’s probably your code

quartz kindle
#

my ping is 130mb

wheat mesa
#

I have 650ns of ram

ancient nova
#

whats ur heartbeat ping @quartz kindle ?

quartz kindle
ancient nova
#

mine is 32ms

quartz kindle
#

usually about 25

ancient nova
#

dang

radiant kraken
wheat mesa
#

My gateway ping is like 60-85ms, rest is about 150-250 depending on the day

quartz kindle
#

my heartbeat ping will be 9999999 after the rework

#

:^)

wheat mesa
#

rss is below 90mb 😎

ancient nova
#

and after a couple days it can reach up to 300

wheat mesa
#

memory leak

quartz kindle
#

host on windows and your rss will bw 20mb

#

:^)

wheat mesa
#

(Doesn’t mean it’s actually only using 20mb though!)

ancient nova
#

I'm hoping it's because I cache a lot of stuff for each guild

wheat mesa
#

Sounds like a memory leak to me, considering your bot is under 100 servers

#

Especially if it grows over time

quartz kindle
#

message cache

#

members cache

ancient nova
#

then do you have any ideas where it might be coming from?

quartz kindle
#

those things grow over ti.e

wheat mesa
#

Yes but I have those caches enabled and I don’t grow over 120mb usually

ancient nova
#

yeah and a clean boot doesn't have them cached yet

#

is that it?

quartz kindle
#

ye

ancient nova
#

great

#

I mean it still isn't great that it's using over 300mb but it's great that it's not a mem leak

wheat mesa
#

I don’t see how cached messages/members at his bot’s size would account for up to 200mb of ram though

radiant kraken
#

js moment

quartz kindle
#

djs moment

ancient nova
#

everybody be hating on js

wheat mesa
#

Nobody hating on js but insane devs

#

Or C devs still living their glory days in the 90s

quartz kindle
#

im insane and i like js

wheat mesa
#

js is so powerful now that you can’t even hate on it that much

#

Though the date api overhaul proposals need to hurry up

radiant kraken
quartz kindle
#

its so powerful it kidnapped princess leia

ancient nova
#

can anyone check cause I think I'm actually tripping

wheat mesa
#

C devs when they see C++ users using a couple bytes of overhead for smart pointers to ensure a safe program

quartz kindle
#

you are

ancient nova
#

is my bot's response time slow or not?

wheat mesa
#

Actually nvm smart pointers have 0 memory overhead

quartz kindle
#

response time doesnt really matter

#

i mean

wheat mesa
#

But it’s technically still slower :troll:

radiant kraken
#

C devs using unsigned char over int because it saves them 3 bytes of memory

ancient nova
quartz kindle
#

add a timer at the beginnign of your event, and another at end of your command

wheat mesa
#

C devs using unsigned char over int and not realizing that it’ll be aligned to 4 bytes either way because of the CPU

quartz kindle
#

see how much ms the command takes to complete

#

anything beyond that, is internet issues

ancient nova
#

I'll just ask another human to run a couple commands and test it out

ancient nova
radiant kraken
#

what a waste of 3 bytes

ancient nova
wheat mesa
#

ItsOkayBae using strings for booleans instead of bitsets for settings :troll:

quartz kindle
ancient nova
#

when I converted those strings back to booleans it broke my entire saving system I had to rewrite it again back to string

#

😩

quartz kindle
#

noob

ancient nova
#

but now I kinda realize I just could've put a toString before saving the input that it would've been solved

#

so my bad ig

#

too lazy to try and rewrite it again

#

tho

wheat mesa
#

I’m now thinking about how much memory overhead it would save you to use bitsets instead of fucking strings for true/false settings 😭

#

On a large scale that would actually be a pretty significant improvement

quartz kindle
#

about 50kb out of his 300mb

#

lmao

ancient nova
#

once my bot joins more than 200 servers I'll rewrite it

wheat mesa
#

I think I just like bitsets as a data structure tbh

ancient nova
#

atm I'm too lazy

wheat mesa
#

They’re cool

#

Also this year I’m taking a digital electronics class and I’ll finally be able to learn how the low low level shit works

#

Like logic gates and shit

radiant kraken
#

if you care about memory so much then rewrite it in C

#

i mean Rust

wheat mesa
#

I don’t care about memory THAT much but cmon it really wouldn’t take much effort to use bools instead of strings

#

And if you think about it you could save a few clock cycles by comparing 1 bit instead of at minimum 1 byte at a time 😉

quartz kindle
#

youre complaining about using strings for bools while discord sends you an array of guild features as strings instead of a bitfield

wheat mesa
#

God I’m starting to sound like speedy

#

I think I just like low level stuff

ancient nova
wheat mesa
#

It’s fun

radiant kraken
#

same

#

but you use Rust

#

instead of C++

wheat mesa
#

Maybe I’d enjoy the compiler optimizations part of langdev

#

I know C++ I just am not very good at it

#

And the C++ community is kinda unhelpful in a lot of cases

#

Seems like they always want you to do something with an obscure stdlib function

quartz kindle
#

everyone tells you to install boost

wheat mesa
#

Lmfao

#

Literally that

radiant kraken
#

boost is bloat

wheat mesa
#

Honestly the main difference between C and C++ at this point is the fucking standard libs

#

C++’s stdlib is basically a whole language itself

quartz kindle
#

90% of stackoverflow answers for c++ use boost

radiant kraken
#

Can't wait for someone to make a C++ compiler but instead of including the std library it uses boost

quartz kindle
#

lmao

wheat mesa
#

I still wanna make OogaBoogaLang

#

CavemanLang

#

Whatever it’s called

#

Sounds like a fun project

quartz kindle
#

lmao²

radiant kraken
wheat mesa
#

Lmao

#

Me when you can return multiple different types from a C++ function by throwing them instead of returning

quartz kindle
#

namespace std as fuck
fuck::any

radiant kraken
#

it's basically what goto does

wheat mesa
#

Although I was told that’s tapping into some sort of special c++ virtual machine environment at that point

#

Not sure if that’s true or not, but was told that by some c++ expert

ancient nova
#

very nice

quartz kindle
#

i tried making a multi type hash map

#

in c++

#

the compiler went ape shit trying to generate all possible template combinations

ancient nova
#

what are u guys talking about

wheat mesa
radiant kraken
#

ezpz

wheat mesa
#

Enjoy template errors

ancient nova
#

I would 100% write a discord api wrapper for caveman lang

wheat mesa
#

Write one for BreakfastLang when I finish it

ancient nova
wheat mesa
#

Though you’d have to be pretty knowledgeable on how to create one since I don’t have any idea how you would even start

#

And I don’t have interop with rust or FFI for C or anything

quartz kindle
#

brb writing tinycave and tinybreakfast

wheat mesa
#

Though I think I may add some interop with rust

ancient nova
wheat mesa
#

Also it’s not really object oriented :troll:

radiant kraken
quartz kindle
#

lmao

ancient nova
#

Waffle I found the perfect name for your caveman lang

radiant kraken
#

it's not tiny enough

#

must be microscopic

quartz kindle
#

just use dpp with node gyp

ancient nova
#

C man
so it would sound like a C branch
and the long name would be Cave man

radiant kraken
#

yes

wheat mesa
#

I like that

#

@quartz kindle tinyasm when?

quartz kindle
#

lmao

ancient nova
#

🤣

quartz kindle
#

brb writing a discord wrapper in binary

radiant kraken
quartz kindle
#

discord lib written in tapes and punch cards

wheat mesa
#

I should just make a bytecode compiler for x86

radiant kraken
#

discord.f

wheat mesa
#

The parsing… would be easy…

#

And it would basically just be as easy as going straight from assembly to opcodes

#

Since asm is basically just opcodes already if you think about it

quartz kindle
#

or straight to gay

wheat mesa
#

A little bit more abstracted than opcodes but not by much

radiant kraken
#

is there a discord api wrapper in fortran

wheat mesa
#

Probably

quartz kindle
#

fortran and C are kind of transpilable between each other no?

wheat mesa
#

I’m sure they are

quartz kindle
#

i believe ive seen libs like that

#

with both versions

#

@wheat mesa write something in intercal

ancient nova
#

can anyone tell me what this does kek

/^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/
quartz kindle
#

things

#

looks like its matching ip addresses

#

both v4 and v6

ancient nova
#

oh that makes sense

#

why does it include ftp tho

quartz kindle
#

well its a valid protocol

#

idk what the purpose of this regex is

#

my phone is diedieying

#

pepsiying

ancient nova
quartz kindle
#

i go sleep kthxbye

ancient nova
#

you okay tim?

ancient nova
wheat mesa
#

bro my school blocks github

#

it's so annoying

#

I just want to work on my language at school

#

we do a little bit of non descriptive commits

#

lmao I accidentally committed my cranelift ir file I was testing with

#

whoops

radiant kraken
wheat mesa
#

brug

radiant kraken
#

maybe they were super biased towards unity

wheat mesa
#

if anything unity is way more of a threat than godot at this point

#

cough cough ironsource

ancient nova
#

I watched a vid about this like a month ago but didn't see any updates on that

wheat mesa
ancient nova
#

ah that's the company?

#

that kinda reminds me of my game

#

gonna have to go finish it at some point

lyric mountain
#

and has literally 0 bugs

wheat mesa
#

yeah it's the most impressive thing I've ever seen

#

the only C it uses is for DirectX compatibility layers

lyric mountain
#

that man literally won the life game

#

it's hard for anyone to ever reach that level of skill

#

I mean, there's also the templeos dude

wheat mesa
#

he made over 20 million for that game saga though

#

well deserved

#

Hard work with no promise of a big reward, yet it still happened

#

That's respect right there

proven escarp
#

then it's C iirc

lyric mountain
#

until sid meyers came

proven escarp
lyric mountain
#

according to him, god sent to his mind the entire source code

#

the most insane part is that he fckin managed to write an entire OS "alone"

ancient nova
#

he wouldn't lie

sharp geyser
#

The company didn't inherently spread malware, it was just a form of harmless adware as it wasn't really in the way it was just there and the idiots who click through an installation wizard don't pay attention to the check boxes download the advertised software that is patched into it

#

The whole malware thing came from people abusing their SDK

#

You can't hold a company responsible for people abusing their software for what it wasn't intended to be used for.

#

At that point you might as well just blame windows as well

sharp geyser
#

Not to mention, Ironsource has since abandoned that project and made amends for their "mistake" and have focused on advertising purely

#

Yes but the company can't be held responsible for other's misdeeds

sudden geyser
#

yes you can

#

that's called negligence

sharp geyser
#

Then you might as well shame windows as well

sudden geyser
#

we do

sharp geyser
#

And yet you guys still use it despite the risks?

sudden geyser
#

because windows has actually gotten good at blocking malware

sharp geyser
#

The internet ain't going to be sunshine and rainbows, and not to mention Ironsource's intentions was never to promote the spreading of malware

sudden geyser
#

there's some other attribute of the company buying unity that's concerning but I won't say

sharp geyser
#

They might of dabbled in adware but they never did any malware

#

They didn't buy unity though?

#

They just made a exchange in stocks but that doesn't mean they bought out unity

sudden geyser
#

ah, not a buyout, but still a merger

sharp geyser
#

Yea

#

All that merger does is enhance unity's ad side of it

#

So unless you don't use Unity ads

#

you have nothing to worry about if you still think you'll be harmed in some way

#

The only thing I dislike about the people who are fighting against the merger is they didn't do any research before hand and just go based off rumors

sudden geyser
sharp geyser
#

"The... company best known for its malware delivery system? You're merging with them, and proud of that?"
Again, I feel a little offputting about this

#

I personally feel you can't blame a company for someone using their software for what it wasn't intended to be used for

#

Sure, their SDK helped people do malicious things, and that is primarily why it was abandoned

#

They didn't want to keep that image going so the abandoned it and decided to focus on their companies main point, which was advertising. This can be seen just by searching for installCore or ironsource's website

sudden geyser
#

most companies don't develop software with malware in mind. imo it doesn't matter if it wasn't intended to be used in some way—it still was ultimately its use value to people. it's like me being apologetic towards a crypto company that got drained because they had bad security: sure, it wasn't the use value, but it still happened, and now I'm broke

sharp geyser
#

Okay, but putting all that blame on a company for something that was relatively out of their control. Just seems like a shit thing to do. They have already made efforts to make amends for a mistake they didn't intend on making and yet people give no fucks.

#

When it comes down to it, even if their software was used maliciously. They can't be the only ones to blame. Not to mention even if their software wasn't a thing, people would still find other ways to do it despite this fact.

sudden geyser
#

Yes, and they deserve every ounce of criticism they get. I'm more sympathetic to the people who got malware installed on their systems due to that company's bad practices (and other brands that chose to use them as well). But this has dragged on for a bit

sharp geyser
#

Well I guess we can just agree to disagree

sharp geyser
#

People shouldn't be installing random shit on their computer

#

If you got malware that is kind of your own fault

bright hornet
#

Anyone knows how to get the user information?

[Map Iterator] {
  GuildMember {
    user: User {
      id: '920847730480390175',
      bot: false,
      system: false,
      flags: [UserFlags],
      username: 'Rim Kyung-Mi',
      discriminator: '9069',
      avatar: 'b266c41fea5df722db5a199caf89cdfa',
      banner: undefined,
      accentColor: undefined
    },
    avatar: null
  }
}

its from message.mentions.members.values()

bright hornet
#

using message.mentions.members.values().user is undefined

bright hornet
sharp geyser
#

Yes, but what are your intentions

#

You normally never have to do .values

bright hornet
#

I need to get the id's from one mention or multiple mentions for storing it on database

sharp geyser
#

Also it looks like only one user was mentioned, you can just do .first()

bright hornet
sharp geyser
#

.values() as it says in the result

#

returns a Map Iterator

bright hornet
#

hmm

#

so userList.map or something

sharp geyser
#
for(const member of <Message>.mentions.members.values()) {
  <Database>.insert({userId: member.id}) // idk how you do your db stuff but just insert your member.id appropriately
}
bright hornet
#

oh

#

values automatically gets the ids?

sharp geyser
#

No

#

It just makes an iterator

bright hornet
#

ah i understand now

sharp geyser
#

so it has a array of member objects

bright hornet
#

alright thanks for that

sharp geyser
#

no problem

sonic lodge
#

so i have a react component in a file defined like this:

// component.js
import {Component} from 'react';

window.addEventListener('load', () => {
  console.log('load');
});

class Main extends Component {
  // ...

  componentDidMount() {
    console.log('componentDidMount');
    window.addEventListener('load', () => {
      console.log('load 2');
    });
  }

  // ...

  render() {
    console.log('rendered');
    // ...
  }
}

const container = document.getElementById('ui');
const root = ReactDOM.createRoot(container);
root.render(<Main/>);
#

when i render this component on my pc, it always logs in this exact order:

rendered
componentDidMount
load
load 2
#

but when i render this component on my phone, it always logs

load
rendered
componentDidMount```
#

basically the component is a modal that starts out with a .hidden class, then when i get the load event, i remove the class so it fades into existence
but with the second behavior, the load event comes first and at that moment there's no rendered component to modify
anyone know why ?

sharp geyser
#

Oh god

#

using the class version of react components

sonic lodge
#

oop

sharp geyser
#

Question

#

Why are you doing a load event when it mounts and one before it mounts?

sonic lodge
#

i was just trying to solve the problem mentioned above

#

you can ignore the second one

sharp geyser
#

Well it seems you wanna do it on mount no?

#

or am I misunderstanding the situation here

lament rock
#

front end work ChiyoDead

sharp geyser
#

Im an angular kind of guy

lament rock
#

a cute angle

vivid fulcrum
#

the logic doesn't make sense anyways

lament rock
#

I'll see myself out now

sharp geyser
#

I mean what

vivid fulcrum
#

by the time react gets to the render function everything should be loaded

sharp geyser
#

Doesn't react render before running componentDidMount

sonic lodge
#

as in the load event should be emitted after rendering?

vivid fulcrum
#

you shouldn't be using the load event in the first place

sonic lodge
#

hm

sonic lodge
#

because the load event gets emitted after render is called

vivid fulcrum
#

you're trying to show a pop up on the page load, right?

sonic lodge
#

yeah

vivid fulcrum
#

i think you can just use a boolean state for this with a default value of true

#

states come later in the lifecycle

sharp geyser
#

iirc you can use componentWillMount

#

which runs before render

#

Actuallyy wait no

#

componentWillMount is deprecated so you can't use it

sonic lodge
# vivid fulcrum states come later in the lifecycle

something like this?

class Main extends Component {
  constructor(props) {
    super(props);
    this.state = {
      hide: true,
    };
  }

  componentDidMount() {
    this.setState({hide: false});
  }

  render() {
    return <div className={this.state.hide ? 'hidden' : ''}></div>
  }
}```
vivid fulcrum
#

TIAS

sharp geyser
#

Using state is definitely a good idea though

vivid fulcrum
#

also is there a reason you're not using hooks?

sharp geyser
#

let [hide, setHide] = useState(true)

#

is the better thing to do tbh

sonic lodge
sonic lodge
vivid fulcrum
#

you should definitely switch to react hooks

sonic lodge
sharp geyser
#

well

#

hide is the value

#

setHide is the setter

vivid fulcrum
#

const*

sharp geyser
#

yea sure const let

#

doesn't really matter tbh

#

not when using hooks

sharp geyser
#

or setHide(true) if you want it to be true

sonic lodge
#

isnt useState for function components

#

according to doc

sharp geyser
#

Honestly

#

using classes is dumb anyways

#

React is the only time I'd never use classes

sonic lodge
#

hm i can sorta see why

#

but we were getting a bit off track there

sonic lodge
#

oh wait it worked

#

forgot to webpack

earnest phoenix
sharp geyser
#

nah

#

perfectly fine

earnest phoenix
#

good

#

i was worried i was over doing it c

#

xd

sharp geyser
#

I don't think its enough tbh /s

earnest phoenix
#

ooo?

sharp geyser
#

do you use djs?

earnest phoenix
#

whats djs

#

js?

sharp geyser
#

good answer

earnest phoenix
#

loool

#

i use py

sharp geyser
#

I mean

#

its better than djs so

#

gj

earnest phoenix
#

mhm

sharp geyser
#

but on a serious note

#

I think your current hardware should last you for a while if managed properly

earnest phoenix
#

i heard i gotta build shards eventually?

#

tf is a shard

sharp geyser
#

It is basically just splitting up the workload

#

Think of it like child processes of the main process

#

it splits the guilds up to manage em better and is less strenuous

#

At roughly 1.5-2.5k you will need to start sharding

#

discord won't accept it otherwise iirc

earnest phoenix
#

oooo

sharp geyser
#

Sharding also comes with some thing that people sometimes find challenging

feral aspen
#

I have this method...

public void paintComponent (Graphics graphics) {
    super.paintComponent(graphics);
    Graphics2D graphics2D = (Graphics2D) graphics;

    player.draw(graphics2D);

    graphics2D.dispose();
};

As you can see within the .draw() method, I passed down graphics2D, however, within the .draw() method.

public void draw (Graphics2D graphics2D) {
    graphics2D.setColor(Color.white);
    graphics2D.fillRect(x, y, graphics2D.tileSize, graphics2D.tileSize);
};

.tileSize is undefined?

#

I was like, alright, maybe I didn't use public, so I did so and it still doesn't find it?

public final int tileSize = originalTileSize * scale;
sharp geyser
#

Mmm dn java

#

else i'd help

#

But whenever I see undefined

#

my first thought is usually Is 'x' really what I think it is?

feral aspen
#

I used the wrong variable, my bad.

sharp geyser
#

:p

#

So issue resolved?

feral aspen
#

Yes.

eternal osprey
#
let end_dt = '2022-08-10T12:15:00-04:00'
let date = end_dt.toLocaleDateString()
console.log(date)```hey guys why is this returning undefined?
#

I basically want to get that end date variable and convert it to a timestamp basically

sudden geyser
#

toLocaleDateString should be used on Date instances

eternal osprey
#

so basically new Date('2022-08-10T12:15:00-04:00'). I see!

#

that actually returns me "8/10/2022"

#

So what i would have to do now, is convert this to a timestamp and use the discord styling tag right>?

#

However, can't i just use regex to remove the string before the T and after the - character?

#

That would be way easier

#

Yup got it using regex!

lyric mountain
#

simply use dateformat

#

no need for regex

#

oh, js doesn't have date format

civic scroll
#

💀

#

you can do new Date(end_dt).toWhatever()

#

iirc there's also ISO format that you can parse

#
/(\d+)-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/
#

idk how gmt offset format works in iso format

ancient nova
wooden ember
#

bruh since when did the topgg bot have commands

#

-ping

gilded plankBOT
pliant gorgeBOT
#

Pong!

wooden ember
#

or has that been a thing for ages and i just never noticed

#

also, what does the voiseStateUpdate event give you? is that just fires when the bot joins/ leaves or is that just when it gets moved

proven escarp
wooden ember
#

bruh

#

its the same as one of my bots commands and thats how i found it

proven escarp
#

ok

proven escarp
wooden ember
#

you sure?

#

only saw it used in some bot i saw on github

#

so it might just be a shoddy missimplamentation

#
client.on('voiceStateUpdate', (old, New) => {
    if(old.id !== client.user.id) return
    if(old.channelID && !New.channelID) client.queue.delete(old.guild.id)
})
``` this was all it did henc why i was asking