#development

1 messages · Page 30 of 1

white hornet
#

this is the code i want to check if the user have role or not

civic scroll
#

and null obviously has 0 props

white hornet
civic scroll
#

interaction is null

#

wait

#

no

solemn latch
#

permissionsFor is returning null

civic scroll
#

permissionFor(arg_0) is null

#

and it tried to read property has from it

white hornet
#

this is the error

civic scroll
#

we know the error

#

but you have to validate

civic scroll
#

if it's null or not

#

you can do an optional chaining

#

if you are using typescript

#

which you don't

#

@white hornet you should use typescript

white hornet
#

im sorry

#

but i dont get it

civic scroll
#

it returns either a channel

#

or null

#

alright?

#

hello

white hornet
civic scroll
#

then you make silly bugs

#

alright

#

the thing is

white hornet
civic scroll
#

hear me out.

#

interaction.channel.permissionFor(...) returns either a permission list, or null

#

alright?

#

you get me?

earnest phoenix
#

The error declares that the channel has no permissions assigned for the client, you should always check for that before checking the permissions on it

civic scroll
#

right, in this case it's not a permission list, but rather null

#

and in this case

#

you tried to read the property has from it

white hornet
civic scroll
#

aka. call the has() method

#

but since it returned null

white hornet
civic scroll
#

null has no such property called has to be called upon

#

so

#

you must check the permission list

white hornet
earnest phoenix
white hornet
white hornet
civic scroll
#
const permissionList = interaction.channel.permissionsFor(interaction.guild.me);
if (!permissionList) { // it's null
      // do somthing
}
if (!permissionList.has("EMBED_LINKS")) return
earnest phoenix
civic scroll
#

alternative: please read the docs

white hornet
civic scroll
#

yes

#

so

#

you must handle it

white hornet
#

interaction.channel.permissionsFor(interaction.guild.me) is null

civic scroll
#

in this case null means there are no permission flags assigned to said user

civic scroll
#

return

white hornet
civic scroll
#

if it's empty

#

return

#

that simple

civic scroll
#

and now you ask me how to write your program 💀

#

also

#

i assume you use vscode, right?

#

hover your mouse over the function

white hornet
civic scroll
#

it will show you the definition

white hornet
civic scroll
#
(method) methodName(arguments: argumentType): returnType
#

it's somewhat like that

white hornet
civic scroll
#

yes

white hornet
civic scroll
#

or if you don't want you can read the docs

#

just type the function name

white hornet
civic scroll
#

if the return type has ? that means it's nullable

#

if you read carefully you won't miss it

white hornet
white hornet
fervent moss
#

Someone?

earnest phoenix
#

Can you show us what it draws currently?

fervent moss
#

Like the result?

earnest phoenix
#

Yes

fervent moss
#

I want this Avatars to be circular

earnest phoenix
fervent moss
# earnest phoenix Now can you show us more of the code?
 const canvas = Canvas.createCanvas(1000, 500);
        const context = canvas.getContext('2d');

    const background = await Canvas.loadImage('https://cdn.discordapp.com/attachments/785156938627153992/910541044792311899/slap.png');
    
context.beginPath();
        context.arc(125, 125, 100, 0, Math.PI * 2, true);
        context.closePath();
        context.clip();
    context.drawImage(background, 0, 0, canvas.width, canvas.height);
    const { body } = await request(message.author.displayAvatarURL({ extension: 'jpg' }));
    const avatar = await Canvas.loadImage(await body.arrayBuffer());
    context.drawImage(avatar, 350, 70, 200, 200);
    
    const avatar1 = await Canvas.loadImage(message.mentions.users.first().displayAvatarURL({ extension: 'jpg' }));
    
context.drawImage(avatar1, 580, 260, 220, 220);

    
    const attachment = new AttachmentBuilder(await canvas.encode('png'), { name: 'slap.png' });

    message.reply({ files: [attachment] });
   
solemn latch
#

doesnt clip depend on specific locations.

ie you're putting your image not on the clipped position(125,125)

civic scroll
#

one solution

#

clip in one canvas context

#

and then apply that on the main

solemn latch
civic scroll
#

AHAHAHAHAHAA

solemn latch
#

i had that typed, just busy and couldnt finish the thought

civic scroll
#

got chu

earnest phoenix
civic scroll
#

this is confusing

lyric mountain
#

I just make an utility function for clipping

#

input image + shape, output clipped image

civic scroll
#

eys

#

yes

stiff dust
#

still have problem in installing Canvas someone help plz 0.0

earnest phoenix
stiff dust
#

npm err gyp

#

^

fervent moss
fervent moss
lyric mountain
earnest phoenix
fervent moss
#

What i have did what i want

earnest phoenix
fervent moss
lyric mountain
#

so u don't need to repeat the same code everywhere u need to crop an image

earnest phoenix
#

You're drawing the arc at coordinates X 125, and Y 125, but you're drawing the avatars far away from the arc

earnest phoenix
graceful cobalt
#

Oh thanks

stiff dust
earnest phoenix
# earnest phoenix Because you're drawing the other avatar in the clipped context as well, you're s...

For example

// Create canvas and get it's 2D rendering context.
const ctx = canvas.createCanvas(1_000, 500).getContext('2d');

...

// Draw the background.
ctx.drawImage(background, 0, 0, ctx.canvas.width, ctx.canvas.height);

...

// Draw the arc.
ctx.beginPath();
ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
ctx.closePath();

// Save the context.
ctx.save();
// Clip into the said arc.
ctx.clip();
// Draw the avatar in the coordinates relative and close to the arc.
ctx.drawImage(avatar1, 100, 125, 150, 150);
// Restore the saved context to unclip.
ctx.restore();

// And repeat the same process to draw other avatars with arcs.
fervent moss
lyric mountain
#

what

earnest phoenix
#

There's no need to create and draw into separate canvases and merge them, but it can be useful to not waste time coordinating the placements

fervent moss
#

So can I set arc only for the avatar if yes how?

earnest phoenix
fervent moss
#

Or make balnk canvas add background with load and draw and same for avatars and then only set arc for avatar context?

solemn latch
earnest phoenix
#

The stacktrace node-gyp outputs for you seems to contain linker errors

solemn latch
#

am I the only one who didnt know about windows powertoys? 🤔

fervent moss
fervent moss
#

Thanks i dint saw that code

earnest phoenix
# stiff dust 64

I doubt that, the node-gyp error stacktrace shows not only npm ERR! gyp info using node@16.17.0 | win32 | ia32 (notice the ia32) but also C:\\Program Files (x86)... which indicates a 32-bit installation

lament rock
#

Would probably be beneficial to get a test VM instead of using dev env

#

although might require some jank

earnest phoenix
#

I would recommend installing the 32-bit binaries of the outlined packages and libraries such as GTK 2 instead of the 64-bit ones

lament rock
#

alternatively, upgrade

earnest phoenix
#

^ Better solution, unless you aren't able to upgrade due to hardware limitations

feral aspen
#

So, I'm new to SQL, and I want to figure out what the address, database name, and the username is.

#

Is it localhost:3306, BungeeCord, and root?

bright thorn
#

anyone using shoukaku?

pale vessel
#

?

feral aspen
#

Ah, so I got this error:

Access denied for user 'Mysql'@'localhost' (using password: YES)
lyric mountain
#

wrong login or password

#

also ew, mysql

feral aspen
#

I have a question, whenever I downloaded MySQL...

#

I have this, what is this, exactly?

lyric mountain
#

that's a saved instance in mysql workbench

feral aspen
#

What is it.

#

Cause I never understood it.

lyric mountain
#

that ain't mysql, that's a database manager for mysql

#

it's a tool

feral aspen
#

Ah, so if I want to make a new database, where do I do so?

lyric mountain
#

CREATE DATABASE name;

feral aspen
#

Ah, so from terminal?

#

Well, what's the main purpose of MySQL Workbench, however.

lyric mountain
#

to have a visual interface

#

it's like asking what's the purpose of a browser if you have telnet

feral aspen
#

Fair enough, so if I would want to create a user within a database, what's the username supposed to be.

#

root@ or?

lyric mountain
#

you cant create a user within a database

#

users are above databases

#

you assign databases to users, not the opposite

feral aspen
#

Ohh.

lyric mountain
#

do note tho, mysql is a shitty database that has a lot o crap errors for seemingly no reason

#

and 1246189 types of collations

feral aspen
#

I'd use MongoDB but work needs MySQL. 💀

#

I think both are even worse than each other. I'd rather use PostgreSQL.

lyric mountain
#

this is the way

#

does ur work use specifically mysql?

feral aspen
#

A minecraft server, unfortunately yes. 💀

lyric mountain
#

like, there's maria which is a fork of mysql

feral aspen
#

I'm working with a bungeecord server so I gotta understand what I'm doing.. (great not a big one, however)

lyric mountain
#

do you have IJ ultimate?

feral aspen
#

No.

lyric mountain
#

meh

feral aspen
#

By the way, I just downloaded MySQL, are there supposed to be any users?

#

Example, root or something.

lyric mountain
#

root is just the default user so you can access the database to make other users

#

like postgres user

feral aspen
#

Ah, so when I create a database, how am I supposed to grant myself.

#

Do I grant root, or HamoodiHajjiri or create a new user?

lyric mountain
#

root is the superuser, forget about it

feral aspen
#
mysql> SELECT user FROM user;
ERROR 1046 (3D000): No database selected
#

Cause right now, no users.

lyric mountain
#

that's not how it works

lament rock
#

USE database;

lyric mountain
#

when u install mysql, it'll have only 1 user: root which is the superuser

feral aspen
#

Alright, fair.

lyric mountain
#

to make another u just create an user and assign it to a database

feral aspen
#

If I make databaseTwo, do I need to make another user?

lyric mountain
#

USERS ARE ABOVE DATABASEEEEEEEES

feral aspen
#

ALRIGHT.

lyric mountain
#

users have databases, not databases have users

sudden geyser
#

DROP DATABASE db; oh damn I dropped myself mb

feral aspen
#

Ah, so I should really make a user for myself, then.

lyric mountain
#

yes

feral aspen
#

Like hamood@localhost.

lyric mountain
#

give google a try, there are literal tons of resources regarding mysql usage

boreal iron
boreal iron
boreal iron
white hornet
#

Nesting of sub-commands is unsupported at this time
anyone now whats this error?

sudden geyser
#

I think it means you tried to put a subcommand under a subcommand.

sharp geyser
#

Damn, you're a father now

white hornet
sudden geyser
#

Because that's not an accepted form.

#

You can create subcommand groups, however.

white hornet
#

this is the option

sudden geyser
#

This don't look right.

sharp geyser
#

God, that much nesting will get confusing

#

Does discord even allow a sub command to go that deep?

sudden geyser
#

No.

#

Also I think they mean "limit" instead of "lmite"

white hornet
white hornet
white hornet
sharp geyser
#

I don't even know what you are trying to do

white hornet
#

and the warn will be like this

#

!antiban [lmite/value/warn] and for warn also have [owner/staff/user/log] for all of them the command have [lmite/value/warn]

#

and i now sounds like crazy😅

#

it mean i have 12-15 options

sharp geyser
#

lmite?

white hornet
#

and i have 8 command

boreal iron
#

we already talked about this the last time

sharp geyser
#

This seems like poor planning tbh

boreal iron
#

this structure you wnat is NOT possible (atm)

ancient nova
#

is this good enough? I tried to make it look professional while still being kinda chill, not sure how good it is in practice tho

boreal iron
#

there are no dynamic command parameters based on the option or choice you choosed

white hornet
lyric mountain
ancient nova
#

while still being chill

sudden geyser
#

Uses Sebastian from Black Butler
"Yo", "Cya"
professional.jpg

sharp geyser
ancient nova
#

I haven't gotten around to getting a custom profile picture yet, AND wanted to seem chill, kinda like dank memer used to be back in 2020

sharp geyser
#

If you wanna be professional, be professional. If you wanna be chill, be chill. Don't try and be both, it will just end up looking bad

ancient nova
#

I just wanted the bot to seem fun while being able to properly explain it's functionality

sharp geyser
#

Its a moderation bot no?

lyric mountain
#

kinda like dank memer
when will u stop saying "like XXX"

sudden geyser
#

Dank Memer and professional are two words I never want to see in the same sentence

sharp geyser
#

Why is a mod bot supposed to be fun

ancient nova
#

yeah, a moderation, automod, antiraid type of bot

sudden geyser
sharp geyser
#

its meant to help protect server not crack jokes

sharp geyser
ancient nova
#

it used to be multipurpose, has plenty of game commands, image manipulation and random utilities

sharp geyser
#

for amazing knock knock jokes

sharp geyser
#

its multi purpose

ancient nova
#

it is, I'm focusing on moderation now

#

like you've told me, to pick one thing I should focus on doing

sharp geyser
#

I mean, thats cool and all. But people will still see iit as multi purpose

lyric mountain
#

it's multipurpose if it has more than one purpose

#

moderation bot has nothing but moderation

#

games bot has nothing but games

fervent moss
#

After messing for while i was able to do this but the avatar is cut into 1/4 tho it's exact coordinate of arc like both coords are same

sudden geyser
#

More like a central purpose

#

rather than "only"

lyric mountain
#

my bot is multipurpose, there's no shame in that

#

even tho most of it is related to my tcg

ancient nova
#

I'm focusing on the bots moderation while everything else is like a side thing I add occasionally

ancient nova
lyric mountain
boreal iron
#

we're keep telling you different things to confuse you as much as you us

sharp geyser
#

There is nothing wrong with multi purpose, as long as you don't try and copy other people's ideas

boreal iron
#

:P

ancient nova
#

I am original, most of the ideas I came up with myself, others are mostly inspired

sharp geyser
#

The reason I said for you to focus on one thing is cause you were essentially just making a multipurpose bot that was the same as everything else already out there

#

and now with moderation you're doing the exact same thing

#

😔

fervent moss
ancient nova
#

and by inspired I literally mean commands like whois, serverinfo etc. I don't copy commands

sudden geyser
#

Me personally, I don't think there's anything wrong with copying others ideas.

ancient nova
sharp geyser
ancient nova
#

strong antiraid, automoderation, chat filters etc.

sharp geyser
#

A lot of people fail to do that though

lyric mountain
#

antinuke *

sharp geyser
#

and wonder why their bots aren't as successful

sudden geyser
#

I still don't think that's a problem.

#

A lot of people make bots to see others use them but ultimately for education

#

So even if it sucks it's not a problem since they'll do better next time

sharp geyser
#

And thats fine, but with growth in mind you have to think on how to actually achieve that. and I have seen many clones never succeed

earnest phoenix
#

And the width and height of the image you're drawing inside the arc also matters

ancient nova
#

quite happy with it

#

I jumped from 78 to 87 in 2 days

fervent moss
ancient nova
#

kinda spiked once I added the website

#

it jumped from 1 per day to ~3-5 per day

fervent moss
#

What is x,y = 0,0 in canvas is it supposed to be left hand side bottom corner?

ancient nova
#

left upper corner most likely

lyric mountain
#

always the left upper corner

knotty quartz
#

I need help

#

I am trying to set permissions using a if statement on my bot to make sure only people with manage.messages can use the purge command. I cannot seem to find the correct statement that works.

quartz kindle
#

whats your current code?

knotty quartz
#

const { SlashCommandBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('purge')
        .setDescription('Prune up to 999 messages.')
        .addIntegerOption(option => option.setName('amount').setDescription('Number of messages to prune').setRequired(true)),
    async execute(interaction) {
        const amount = interaction.options.getInteger('amount');
        if (amount < 1 || amount > 999) {
            return interaction.reply({ content: 'You need to input a number between 1 and 999.', ephemeral: false });
        }
        await interaction.channel.bulkDelete(amount, true).catch(error => {
            console.error(error);
            interaction.reply({ content: 'There was an error trying to purge messages in this channel!', ephemeral: false });
        });

        return interaction.reply({ content: `Successfully purged \`${amount}\` messages.`, ephemeral: false });

    },
};```
sharp geyser
#

1 and 99? that says 999

knotty quartz
boreal iron
#

No need to pass ephemeral: false as value

#

it's non-ephermal by default

knotty quartz
#

Just busy focusing on the permissions

#

if (member.permission.has("MANAGE_MESSAGES")), {
// command
} 
else {
await interaction.reply('You failed the requirements. You need MANAGE_MESSAGES!')
}``` but it doesn't check for the permission
boreal iron
#

which djs version?

knotty quartz
#

V14 the guide says

boreal iron
#

MANAGE_MESSAGES isn't a known constant

knotty quartz
#

First time building with slash commands

#

On discordjs

boreal iron
#

if so pass a string

knotty quartz
boreal iron
#

"MANAGE_MESSAGES"

knotty quartz
#

Like that ^^

sharp geyser
#

try it and see

knotty quartz
#

Ok ty

boreal iron
#

also...

#

member.permission.has

#

the property is called permissions

quartz kindle
#

v14 changed everything to pascal case

sharp geyser
#

Didn't they say they were on v13?

boreal iron
#

yeah but Tim is too lazy to read

quartz kindle
#

wat

boreal iron
#

and poor don't forget about that

#

wtf

knotty quartz
#

Wait a second, double checking

boreal iron
#

he wrote v13

#

and edited it

sharp geyser
#

yea

quartz kindle
#

lmao

sharp geyser
#

tf

boreal iron
knotty quartz
#

Yh correction v13

sharp geyser
#

tim ur the one confused

#

not us

quartz kindle
#

i did read chat

knotty quartz
#

Sorry it said v14 for a second

quartz kindle
#

lmao

boreal iron
#

well just don't randomly edit previous statements

#

just tell us

knotty quartz
#

Thank you and testing now

boreal iron
#

now I'm confused

#

is it v14 now or v13

quartz kindle
#

v13

knotty quartz
#

v13 defiently

boreal iron
knotty quartz
#

Ty for correcting me Tim

quartz kindle
#

since you're just starting, better go for v14

boreal iron
#

ok you're fine then

knotty quartz
#

It says member not define so I need to define it

quartz kindle
#

interaction.member

knotty quartz
#

Worked tysm you lot

round cove
#

Where's sayuri

#

@civic scroll

knotty quartz
round cove
#

How can I get an infinite repeating sliding image animation without it flickering if I want to make the background-size smaller

boreal iron
lyric mountain
#

have the first frame be the exact next frame of the last one

boreal iron
#

then checking the docs until you're familiar

quartz kindle
quartz kindle
#

like if you put two copies of it next to each other, does it blend nicely or is there a hard edge?

round cove
#

It blends just fine. The issue is if you shrink it's size and keep the same animation, when it goes to repeat it snaps in place as if it was it's normal size.

quartz kindle
#

can you show an example?

round cove
#

Created a parallax affect combined with falling petals. Noticed the background snapping back when waiting long enough since we have the bg petals fall much slower

quartz kindle
#

well you only have two options there, either fade out or increase the height

round cove
#

right lol

quartz kindle
#

the way i did a similar thing was to have it repeat

round cove
#

it is repeating 😭

quartz kindle
#

like set the image background to repeat

#

nvm let me check what i did

round cove
#

it just reaches the end of the set animation bg-position-y

knotty quartz
sharp geyser
round cove
#

it's called masonry wtf

sharp geyser
#

masonry?

quartz kindle
#

looks nice

round cove
#

Idk how to explain it, masonry is the name of the style of layout

boreal iron
#

missionary?

round cove
#

It's when cards of different heights fill up void space

quartz kindle
#

Lol

sharp geyser
round cove
boreal iron
#

damn those typos today

earnest phoenix
#

FakE secretly trying to flirt in a weird way

boreal iron
#

I'm not allowed to flirt with the guys in here

quartz kindle
# round cove :///

so the way i did it was to have multiple copies of the image and cycle them, like when the bottom-most image goes completely offscreen, it swaps to the top and starts entering

boreal iron
#

too young, you know

quartz kindle
#

yup

boreal iron
#

don't wanna have the fbi knocking at my door voltrux

earnest phoenix
#

FakE, everyone currently in this channel is of age I'm sure

sharp geyser
#

false

quartz kindle
#

nah dylan is 13

boreal iron
#

lol

quartz kindle
#

misty is 12

sharp geyser
#

I am not of age yet

boreal iron
#

true

earnest phoenix
boreal iron
#

no no

#

making an exception for him

#

he's such a cute girl

sharp geyser
#

Damn tim

boreal iron
sharp geyser
#

gotta expose me like that

sharp geyser
#

don't ever say that again

boreal iron
#

@.@

earnest phoenix
#

Gotta love development conversations

#

At least there are intelligent conversations here than the other channels mmLol

boreal iron
#

sometimes

earnest phoenix
#

When Bae is not around

quartz kindle
#

:^)

sharp geyser
#

AtItsOkayBae

boreal iron
sharp geyser
quartz kindle
#

Bae has an IQ debuff skill

#

lowers the IQ of everyone around

sharp geyser
#

damn

#

I have too much IQ to be affected though

quartz kindle
#

its percentage based

boreal iron
quartz kindle
#

the more you have, the harder you're hit

sharp geyser
#

I have a buff skill

#

😎

earnest phoenix
#

Misty you have a cursed code skill istg

sharp geyser
#

I only make my code cursed for you to refactor

round cove
#

I made a different keyframe and tweaked the bg-y numbers until it looked smooth, here's it going with a duration of 2 seconds, tell me if you can even notice a stutter

sharp geyser
#

All my if statements are now going to be ternary operators

earnest phoenix
#

How dare you! I'll put you into the LLVM decompiler!!!

sharp geyser
#

and I will throw you out a window

earnest phoenix
#

💀

#

Try compiling yourself first before even being able to do that

sharp geyser
#

I will make a language just for it to become a war crime

#

against u

boreal iron
#

voltrex putting everyone in his compiler he doesn't like

earnest phoenix
sharp geyser
#

never

#

cause I don't do lang dev

#

thats a war crime in itself to me

#

ew

earnest phoenix
#

i could never lol

#

What the hell, then how else would we make humans and computers interop and give each other instructions?!

boreal iron
#

true see how broke speedy is or parm

earnest phoenix
#

Unless we just scream at computers and hit them until they do what we want

quartz kindle
#

at this speed at least

round cove
#

it's going to be on a duration of 2mintues, I doubt anyone will notice it then

#

I certainly can't notice it

wheat mesa
boreal iron
#

true

#

heard kicking your ford door works, too

wheat mesa
#

Nah, you need a semi truck to hit it

earnest phoenix
boreal iron
#

u can use the "freedom of android" and delete your sys folder

#

that helps, too

earnest phoenix
boreal iron
#

there it goes.. no more freedom

#

sadge

earnest phoenix
#

You should also jailbreak your iPhone and delete it's important system directories, should also work as well!

boreal iron
#

not alllowed, sorry

earnest phoenix
#

So bad...

boreal iron
#

true

#

we live in sad times

ashen saffron
#

Does everyone know why does this happen?

2022-08-20 18:19:12.815  INFO 18893 --- [ XNIO-1 task-10] l.server.player.AudioLoaderRestHandler   : Got request to load for identifier "ytsearch:test"
2022-08-20 18:19:13.221  INFO 18893 --- [ader-2-thread-1] lavalink.server.player.AudioLoader       : No matches found```
sharp geyser
#

It couldn't find a match for your search query "ytsearch:test"

#

you are likely sending lavalink your query in the wrong way and it is taking the entire thing instead of just test

#

without code its rather hard to figure out though at least I myself can't tell what is going on without it

eternal osprey
round cove
#

discord video compression is pretty messed up

#

looks fine on mobile and desktop when in front

ashen saffron
sharp geyser
#

what exactly is search

ashen saffron
sharp geyser
#

Yes...I can see that

#

but I have no idea what the value of that is

ashen saffron
#

it's a string

sharp geyser
#

Okay but

#

whatever you are giving it, is going to make it return no results

ashen saffron
#

how

sharp geyser
#

That is what I am trying to figure out 😔

#

which lavalink lib are you using

ashen saffron
#

erela.js

sharp geyser
#

So you aren't doing anything wrong by the looks of it

#

have you tried searching for an actual song instead of just test btw?

ashen saffron
#

yes, the same happens

earnest phoenix
#

I think you're using an older version of ErelaJS, some people seem to have the exact same issue with the older versions

ashen saffron
#

i think i have the most updated one, but let me check

ashen saffron
ashen saffron
sharp geyser
#

It might be an issue with lavalink itself

ashen saffron
sharp geyser
#

Not even talking about version wise

#

lavalink could just be broken, its a probability

earnest phoenix
sharp geyser
#

would version matter here?

#

If it wasn't the right version wouldn't it just not run the lavalink server to begin with?

earnest phoenix
#

It requires Java 11, Java 13 is recommended; if you're using something higher it can cause problems like this

sharp geyser
#

ah i see

ashen saffron
earnest phoenix
#

Yeah you're using a way higher Java version than it can run with

ashen saffron
#

I see. Which version do I have to downgrade to?

ancient nova
#

I forgot about this piece of code, this kept breaking what did you guys say that I should change to make this better again?

ashen saffron
spark flint
#

ok so i have a JSON object

#

in the format ```json
{

"MODERATORID":[<array of bans>]

}```

rustic nova
spark flint
#

how can I format it into the user with the most bans decreasing

sharp geyser
#

it interfaces with the server running to make the music requests and respond back with the audio

rustic nova
spark flint
#

i tried js const sorted = all.sort(function(a, b) { return parseFloat(all[a]) - parseFloat(all[b]); });

#

probably very wrong

earnest phoenix
spark flint
earnest phoenix
#

I suppose you'll have to wait for them to fix the issue

rustic nova
#

whats "all"

spark flint
#

all is the object in the json format i sent before

earnest phoenix
#

The sort() method is for arrays, not JSON

ashen saffron
rustic nova
#

try loading the sizes into an array ye

spark flint
#

ahh ok

#

good idea

rustic nova
#

key value? sort the value, use key to identify which moderator it was

#

loop through the values, sort

earnest phoenix
rustic nova
#

Is my fair guess

spark flint
#

ok so found a solution

#
const sorted = Object.entries(all)
                .sort(([,a],[,b]) => a.length-b.length)
                .reduce((r, [k, v]) => ({ ...r, [k]: v }), {});```
#

that works, just need to reverse the array now

rustic nova
#

.reverse()

spark flint
#

yep

earnest phoenix
#

b.length - a.length

spark flint
#

oh perfect ty

#

even easier lmao

rustic nova
#

for whats the .reduce

earnest phoenix
spark flint
#

got it working iara_cheer_yay

rustic nova
earnest phoenix
#

10,030 👀

spark flint
#

yup kek

#

49k total bans, then a further 1.5k on the new bot where we actually track it

#

spent a good hour scraping 49k embeds

earnest phoenix
#

Zamn

spark flint
#
async function scrape (client, channel, options = { reverseArray: false, userOnly: false, botOnly: false, pinnedOnly: false }) {
        const { reverseArray, userOnly, botOnly, pinnedOnly } = options;
        let messages = [];
        let lastID;
        while (messages.length < 49000) { // eslint-disable-line no-constant-condition
            const fetchedMessages = await channel.messages.fetch({
                limit: 100,
                ...(lastID && { before: lastID }),
            });

            if (fetchedMessages.size === 0) {
                return messages;
            }
            
            messages = messages.concat(Array.from(fetchedMessages.values()));
            await Promise.all(fetchedMessages.map(async (msg) => {
                if (!msg.embeds[0]) return
                const moderatorID = msg.embeds[0].author.name.match(/\(.*?\)/gmi)[0].replace(/\(|\)/gmi, "")
                const userID = msg.embeds[0].fields[0].value.match(/\(.*?\)/gmi)[0].replace(/\(|\)/gmi, "")
                const banTimestamp = msg.embeds[0].createdTimestamp
                const msgid = msg.id
                const duration = msg.embeds[0].fields[1].value
                const evidence = msg.embeds[0].fields[2].value
                const reason = msg.embeds[0].fields[3].value

                const moderator = rblxToID[String(moderatorID)] || "NoLongerModerator"

                console.log(`Inserted ${userID}'s ban by ${moderatorID} (${moderator}) to the database`)
                await client.db.collection("bans").insertOne({ moderator, moderatorID, userID, banTimestamp, msgid, duration, evidence, reason })                
            }))
            console.log(`Fetched ${messages.length} (${messages.length/50000*100}%)`);
            lastID = fetchedMessages.lastKey();
        }
};``` my glorious method
#

easy way of getting past the 100 max thing, works really well

#

i didn't even know that lastID was a possible thing before today

earnest phoenix
#

Although that can get you ratelimited pretty easily

spark flint
#

was hosted on a dev instance of our bot and fetched 49k in ~8 mins

earnest phoenix
#

Oh alright

tribal axle
#

how can i add link

spark flint
#

?

#

in what context

tribal axle
#

here

spark flint
#

[Join our support server.](https://discord.gg/INVITE)

#

that works for markdown,

tribal axle
#

oh like the embed

#

ok ty

spark flint
#

wdym embed?

tribal axle
#

nvm

ancient nova
#

it does seem to work properly

#

for now at least

wheat mesa
#

Why do you keep doing .map(x => x) after we already told you that does nothing lol

civic scroll
#

did you fix it

round cove
#

yeah I tweaked some numbers for a keyframe since I already had everything you suggested.

round cove
civic scroll
#

you wasted n operations

#

for nothing

#

remove the map function call

round cove
#

the silly map makes the neurons fire

ancient nova
#

I could've sworn .filter didn't work unless I mapped the collection first

round cove
#

collection

ancient nova
#

but I may just be wrong

round cove
#

.values()

civic scroll
#

it's a collection

#

so

#

you dum dum

ancient nova
civic scroll
#

[...collection.values()].filter()...

#

you apply the spread syntax to the iterator inside square brackets

wheat mesa
#

can't you filter in a collection already without the values? I'll check the docs rq

civic scroll
#

gonna turn them into array

wheat mesa
civic scroll
#

wait isn't collection a combination of array and map

round cove
#

collection is just amap

#

lol

civic scroll
#

but it has arrays

#

wah

round cove
#

so yes you could just use filter

wheat mesa
#

collection is a map with some utility

civic scroll
#

bae moment

ancient nova
wheat mesa
#

the class heading is quite literally class Collection<K, V> extends Map<K, V>

ancient nova
#

my b my b weirdsip

earnest phoenix
#

noob css question incoming

how would i center all of this for a galaxy fold?
(ignore the blub, will fix)

civic scroll
#

margin: auto

ancient nova
#

I'll fix that tomorrow cause i already closed my PC for today

#

🤭

civic scroll
#

or margin-inline: auto

earnest phoenix
civic scroll
civic scroll
wheat mesa
#

please

#

typescript is based

civic scroll
#

if the parent is a vertical flexbox

ancient nova
wheat mesa
#

yes because it's not that hard

civic scroll
wheat mesa
#

actually nvm if you turn on strict mode with YOUR code you'd probably have like 600 million errors

ancient nova
#

well it is quite different, syntax wise

wheat mesa
#

not really

civic scroll
#

hu

wheat mesa
#

it's a superset of js

civic scroll
#

it's just javascript

#
  • more stuffs
ancient nova
#

somethings are done differently, is what i mean

civic scroll
#

nah

round cove
#

Good TS is literally just JS lol

ancient nova
#

but

wheat mesa
#

nothing is done differently, it's a superset

#

you just have the option of doing things differently

civic scroll
#

you can paste javascript code into a ts file and it still work, given you disabled typechecking

wheat mesa
#

and strict mode

civic scroll
#

but no

#

bae

#

you need to stop making silly mistakes

wheat mesa
#

if you're using ts without strict mode then there's not much of a point tho

round cove
#

right lol

civic scroll
#

you need help of types

#

and intellisense

#

if you don't know the data you are working with, what's the point of programming

ancient nova
#

I am my own intellisense

#

jk

#

but

civic scroll
ancient nova
civic scroll
#

human intellisense are just worst

#

get machine to do it for you

ancient nova
#

I do not speak german PES2_SadGeCry

civic scroll
#

huh

wheat mesa
#

there's a reason not many of us write our entire projects in C anymore

#

because humans are bad at not making mistakes

ancient nova
wheat mesa
#

I didn't say anything in german

#

I said "Helen Keller Intellisense"

#

lmfao

ancient nova
#

💀

civic scroll
#

also

#

it's not like full ban from js either

ancient nova
civic scroll
#

use js for fast prototyping

wheat mesa
#

you are the one who's too lazy to debug code bae

#

just being honest here

ancient nova
#

I'm joking of course

#

🤭

civic scroll
#

and ts when you are writing it in project

#

aka. implement

civic scroll
ancient nova
#

maybe

ancient nova
civic scroll
#

"would you rather have silly errors during development or sanity-inducing bugs on production"

ancient nova
#

not the official way but it is a way

civic scroll
#

console log is pointless

wheat mesa
#

here: ```js
function add(thing1, thing2) {
return thing1 + thing2;
}

add(1, 5) // This is what you intended
add("Hello, ", "world!") // This is not what you intended, however it still works
whereas in tsts
function add(num1: number, num2: number) {
return num1 + num2;
}

add(1, 5) // This is what you intended
add("Hello, ", "world!") // This is not what you intended, but because you made that clear to the compiler, it will error during compile time instead of having an issue during runtime

civic scroll
#

breakpoint exists

wheat mesa
#

the debugger is cool

#

breakpoints and logpoints can essentially completely replace needs for console.log

civic scroll
wheat mesa
#

Though I still use console.log so I can look through long objects without needing to stop my code

pale vessel
#

"Hello, " as any

wheat mesa
#

Since in the debugger you can expand objects like that

ancient nova
#

ok ok I get your point, I'll rewrite to ts in the near future

#

when I'm not too lazy

wheat mesa
#

you said the same thing about changing your database to use booleans instead of strings lmfao

civic scroll
#

also make use of debug breakpoints

ancient nova
#

I usually code my bot without a ide just use the code editor of my vps

wheat mesa
#

brug

civic scroll
#

bruh

wheat mesa
#

that's why you're in here all the time then

ancient nova
#

I assume I need code for that

civic scroll
#

you have a vps

#

install vscode on it

ancient nova
#

u can do that??

civic scroll
#

or vim

round cove
#

vsc server yeah

wheat mesa
#

or... just use vscode on your PC and a VCS to deploy to your VPS...

ancient nova
#

vim yeah

civic scroll
#

nah

#

test the code on your pc

#

and deploy production code to vps

wheat mesa
#

^

ancient nova
#

sounds good

civic scroll
#

jeybrains space

wheat mesa
#

this is what I do for all of my projects pretty much

civic scroll
#

minecraft realm

wheat mesa
#

IDE -> Github -> Clone on VPS -> set up whatever the project needs

ancient nova
#

I guess it's time to get professional soon DIDSOMEONESAYKEKW

civic scroll
#

also make sure

#

the main branch is the stable version

ancient nova
#

my bot should hit 100 severs in a couple days

civic scroll
#

if you wanna implement a big feature, just split into new branch

wheat mesa
#

@civic scroll rate my pixel art of my gf's cockatiel

ancient nova
wheat mesa
#

first ever real pixel art I've done

#

thought it came out pretty good

civic scroll
#

great job

wheat mesa
#

making her bird a video game that she can play with godot C:

civic scroll
#

now convert it to vectors

ancient nova
wheat mesa
#

I did

civic scroll
wheat mesa
#

I just exported as svg

#

ez

civic scroll
#

that's ehat i'm talking about

ancient nova
#

I...

#

I on purpose, converted my svg paths into a png

#

is that bad?

civic scroll
#

no

#

depends

ancient nova
#

ok good

wheat mesa
#

we do a little bit of dogshit logic that I will refactor tomorrow

civic scroll
#

i convert to svg for animations

#

if it's a still image

#

then png

wheat mesa
#

svg is just infinitely resizable with no loss because that's what it's meant for

ancient nova
#

you know what would be easier tbh

civic scroll
ancient nova
#

convert that isOnFloor func into a variable

civic scroll
#

huh

wheat mesa
#

that's not my function and why would I do that

#

that's a built in godot function for a KinematicBody2D, which I'm extending

ancient nova
#

privatw bool isOnFloor ... => logic will return true or false when used

wheat mesa
#

no

ancient nova
#

way easier

wheat mesa
#

the function is built in for me

#

that's not easier

#

I'd just be doing the same thing

civic scroll
#

💀

wheat mesa
#

IsOnFloor() is defined in the superclass that I'm inheriting from

#

I don't need to be changing that

ancient nova
#

... I don't have to

civic scroll
#

what if it's something 100-line-ish of code check for position

#

and you declare that as a variable?

wheat mesa
#

It's a complex check, it's not just "Oh it's on the floor"

ancient nova
#

you can use curly brackets still

wheat mesa
#

It does vector normalizations and such

civic scroll
#

nah

#

your broke abstraction

#

go back to c

ancient nova
wheat mesa
#

here you go

#

this is what you wanted right, let me change that into a variable for no reason

civic scroll
#

💀

ancient nova
#

ok relax

#

I forgot u used godot

wheat mesa
#

not my function, no need to change it into a variable since I would just be making the same call either way

civic scroll
#

man just said that earlier

ancient nova
#

I said that

#

I forgor

civic scroll
#

@wheat mesa btw conditions can be simplified

ancient nova
wheat mesa
#

I have a little bit too many constants

civic scroll
#

just return when one of the blocks checks out

ancient nova
#

anyway I'll go to bed cause I'm hella tired

#

gn

wheat mesa
#

I kinda just threw this together earlier today so I haven't refactored it yet

ancient nova
#

no headers looks bad

wheat mesa
#

wdym no headers

civic scroll
#

💀

ancient nova
#

I need to have some kinda sorting when doing variables

civic scroll
#

nah

wheat mesa
#

I don't need to sort them cus I know what they do via their names C:

ancient nova
#

too bad godot doesn't have that

wheat mesa
#

Godot is so much better than unity in my experience so far

#

It's so much more responsive

#

Projects take like 3 seconds to start instead of unity's 3 minutes

ancient nova
wheat mesa
#

And the node system is much easier

ancient nova
#

anyway gn

radiant kraken
lyric mountain
#

depends

#

for example, if your constant holds considerable resources you might want to keep it at instance-level so it gets collected together with the instance

sudden geyser
#

Do you guys have preferences for ID formats/tools to use (UUID, NanoID, etc.)?

lyric mountain
#

I just use sequential ids

#

unless I need to make an unique column, in which case I use uuid

sudden geyser
#

Just an incrementing number (1, 2, 3, etc.) or any sequential ID? (e.g. squuids)

lyric mountain
#

the former

#

auto-increment for ids

sharp geyser
wheat mesa
#

Yes

wheat mesa
#

I’m just not using static because const feels more appropriate

radiant kraken
#

but static doesn't get created every time you construct an object with it

civic scroll
#

singleton

#

so

wheat mesa
#

The script is only instantiated once

#

Plus it’s const so it probably gets inlined either way

#

I’m sure the C# compiler is smart enough to do constexpr folding

celest gate
#

when i do npm install it give me this error

sharp geyser
#

What packages are you trying to install

celest gate
# sharp geyser What packages are you trying to install

"discord.js": "^13.2.0",
"discord.js-akinator": "^3.3.0",
"discord-yt-poster": "^3.1.2",
"quickmongo": "^3.0.2",
"moment": "^2.29.1",
"humanize-duration": "^3.27.0",
"canvas": "^2.8.0",
"node-superfetch": "^0.2.3",
"br": "git+https://github.com/Sintya4/discord-image-generation-v",
"canvacord": "^5.2.3",
"one-liner-joke": "^1.2.2",
"something-random-on-discord": "^3.4.4",
"https": "^1.0.0",
"fs": "^0.0.2",
"axios": "^0.24.0",
"discord-xp": "^1.1.16",
"util": "^0.12.4",
"ms": "^2.1.3",
"common-tags": "^1.8.0",
"lodash": "^4.17.21",
"quick.db": "^7.1.3",
"merge-options": "^3.0.4",
"events": "^3.3.0",
"glob": "^7.1.7",
"path": "^0.12.7",
"express": "^4.17.1",
"discord-giveaways": "^5.0.0",
"node-fetch": "^2.6.1",
"body-parser": "^1.19.0",
"express-session": "^1.17.2",
"http": "^0.0.0",
"sourcebin_js": "^0.0.2",
"discord-backup": "^3.0.1",
"youtube-sr": "^4.1.6",
"ytsr": "^3.5.3",
"yt-search": "^2.10.0",
"dblist.api": "^1.1.1",
"@koenie06/discord.js-music": "^1.2.9",

sharp geyser
#

Yea, gl

celest gate
iron crescent
#

Its a node-gyp error...

#

And btw he asked which package you were trying to install

#

Not your package.json file

sharp geyser
#

They showed the correct thing

celest gate
#

npm install

sharp geyser
#

they were running npm install which installs everything from the package.json

celest gate
#

the hole package

iron crescent
#

Ohhh

sharp geyser
#

The issue is, I am not going to sit through and figure out which package is having troubles at 3am

iron crescent
#

Damn it's 4 pm here lol

sharp geyser
#

Though canvas is in there

#

so

iron crescent
#

Yeah it's prob that

sharp geyser
#

I will take a wild guess and say that is a big one that is having issues

iron crescent
#

yeah

pearl trail
#

all you need is to install microsoft visual studio 2017 or newer with Desktop development with C++ to fix the error based on the error's message

radiant kraken
#

i love node-gyp

civic scroll
#

anyone know why this behaviour happens?

#

the same happens with spread syntax

#

so i can't override properties

#

apparently it appears as if the object is sealed / frozen

#

i'm crying

sharp geyser
#

makes sense yes

civic scroll
#

huh

#

why so

#

it's supposed to show the en key

#

resolved: didn't define the key as enumerable

lethal mantle
#

Hey does descriptions support media queries?

#

I wanna remove something in mobile but only display in desktop

radiant kraken
civic scroll
#

also the object has a variable key

#

a key defined by a variable

#

so i can't do the normal object syntax

quartz kindle
#

why not?

#

{ [somevar]: someval }

lethal mantle
#

For bot pages descriptions does it support media queries?

civic scroll
#

WHAT

#

tim

#

you are kidding me

#

@quartz kindle you better be staying up 24/7

#

i need you as javascript dictionary

radiant kraken
#

what's the point of (() => {})()

celest gate
#

npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe C:\Users\creative infotech\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\creative infotech\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! npm ERR! Unsupported URL Type "workspace:": workspace:^
npm ERR!

civic scroll
#

i didn't wanna save the variables

#

so i did IIFE

radiant kraken
#

you know scopes exist right

#

like { let a = 'nice'; }

quartz kindle
#

lmao

civic scroll
#

i thought that was a rust thing

radiant kraken
#

that exists in every language with curly-brackets

#

the difference is that in Rust you can do let a = { return 69 };

quartz kindle
#

and dafuq does that do

#

the same as let a = 69?

radiant kraken
quartz kindle
#

lel

radiant kraken
#

scopes in Rust can also act like (() => {})() would do in JavaScript

#

pretty convenient if you ask me

celest gate
lethal mantle
#

Can someone please help me

solemn latch
#

With?

quartz kindle
#

with how to shower in hell?

lethal mantle
#

For bot pages descriptions does it support media queries?

solemn latch
#

I would guess so.

lethal mantle
#

Its not working for me how would I make it work

quartz kindle
#

dev tools

lethal mantle
#

dev tools?

quartz kindle
#

element inspector / F12

lethal mantle
#

I am saying I tried to use media queries

#

and it wasnt working

quartz kindle
#

use the mobile preview and check the css

lethal mantle
#

its not detecting mobile

#

@media only screen and (max-width: 800px) {}

quartz kindle
#

did you test it with mobile preview in dev tools?

lethal mantle
#

I have yes

quartz kindle
#

using top.gg preview or did you actually save?

solemn latch
#

media queries seem to work for me

lethal mantle
#

I saved

#

hm

lethal mantle
#

fixed it

stiff dust
#

How can I uninstall chocolatey

safe summit
stiff dust
#

tbh I dont know correctly

#

but it dont let node js install necessary applications like Python

pearl trail
wheat mesa
#

You don’t need to uninstall that

#

It literally says that it was successful

#

It’s just warning you

earnest phoenix
#

It just says that it won't install Chocolatey again (basically overwriting the current installation) for security reasons, you can just use Chocolately itself to update Chocolately

#

As Waffle said, it's just a warning, nothing else

stuck dawn
#

anyone knows how to use a image as a texture in css

#

?

#

i think i found a way..

lyric mountain
#

they kno da wae

earnest phoenix
spark flint
#

How can I turn a timestamp like 2419200000 into 28 days?

#

Using Javascript

solemn latch
#
spark flint
#

ty

#

will try it now

boreal iron
spark flint
spark flint
wheat mesa
#

ms is very popular yeah

spark flint
#

i finally got it to stop pinging users too, took a bit of experimenting

wheat mesa
#

You could also use discord's timestamps like @someone muted @someoneelse until <corresponding discord timestamp>

#

I usually prefer that approach since it localizes for all users

lyric mountain
#

discord timestamp is nice because it's not only localized, but also reflects the viewer's timezone

solemn latch
#

its probably not a good idea here though

#

its important to keep a length of mute on hand

wheat mesa
#

You could do both

#

@someone muted @someoneelse until <corresponding discord timestamp> (1 hour)

boreal iron
#

then do 1 hour (expires in xxx minutes)

#

or xx minutes left

#

whatever

spark flint
#

i'm restricted by the format

#

as the bot i'm making is replacing an existing bot and I'm making it log identical to the previous bot

#

we have other log channels, this is just for our audit logs channel

ancient nova
boreal iron
#

what am I reading here again

wheat mesa
#

you can tell ms to format it differently bae