#development

1 messages ยท Page 121 of 1

neon leaf
#

but that will probably cause a leak

quartz kindle
#

the index is not being removed from the array

neon leaf
#

yep

#

thats why I asked if I should slice

quartz kindle
#

which would require you to have additional logic to handle null functions when emitting an event

grim aspen
#

@hushed robin i think you may have a point. i think for some reason a component in the actionrowbuilder is setting it to false

quartz kindle
#

the way you are currently doing it there is no way to remove without screwing up the indexes

neon leaf
#

oh yeah

quartz kindle
#

if you want to return an id, you will have to use objects

#

that way you can add/remove specific keys

hushed robin
#

who knows how i can do this without modifying it globally

neon leaf
grim aspen
#

the first condition i think was enabling it

#

since the second button has the custom_id of 'mode' it was enabling it @hushed robin

grim aspen
#

no it doesn't

#

your doing that to the second button

hushed robin
#

how does the second button have the custom id mode

#

who can help me resolve this

grim aspen
#

you're overcomplicating it. i think what it's doing is setting custom_id of the first button to mode while the second one has a custom_id of "mode" which is called reassignment. it's assigning a new value to the second one being originally 'true' to 'false'

hushed robin
#

the second button does not have the custom id 'mode'

#

where are you getting that from?

grim aspen
#

bro omfg. the first one is being set to mode

hushed robin
#

no it's not?

#

the custom ids aren't changing at all

grim aspen
hushed robin
#

what about that?

hushed robin
#

thats an if statement? โ˜ ๏ธ

#

bro what are you going on about

quartz kindle
#

but for iterating and emitting the events, an array would be faster to iterate

grim aspen
#

ok now i might have figured it out

#

for some reason discordjs doesn't like 'true' being a value

#

do setDisabled() in both the original two buttons and then run it @hushed robin

#

do not put 'true' in it

hushed robin
#

honestly

grim aspen
#

wait do you want the first one disabled or enabled?

hushed robin
#

stop helping

#

your not being helpful

grim aspen
#

BRO WHAT THE FUCK

#

i'm done

eternal osprey
#

hey guys

hushed robin
#

do you actually program?

#

you just said an if statement was me assigning a variable

#

like are you serious

#

and i already know the issue, i said what it was

hushed robin
#

how are you

eternal osprey
#

he was talking shit tbf

eternal osprey
hushed robin
#

i'm doing great asta_dance

eternal osprey
hushed robin
#

yup

#

if you need help why not ask scream

eternal osprey
#

on my way to asking XD

so guys, i recently created a JavaFX program, and do you see that focking jpeg file there? I am trying to load it as an icon using:

Image homePageIcon = new Image("40315055.jpeg");
       homePageStage.getIcons().add(homePageIcon);
        ``` 
its returning me fucking null. i even set the root path once, even the absolute path and this still always returns me an error of url not found. Any help would be appreciated
#

i once found an article that explained how javaFX worked and it told me that it starts seraching and indexing files from the src folder. So only passing the file name should be fine.. well it isn't..?

real rose
#

They're trying to help but theres miscommunications going both ways

hushed robin
#

i'm literally just saying he's not helping, i appreciate it but it's going nowhere

real rose
#

You can tone it down a bit next time please

hushed robin
#

no

real rose
#

-mute @hushed robin Refusal to follow mod request to tone down their rude behaviour to helping devs in #development | 2d

gilded plankBOT
#

upvote battleless#0026 was successfully muted

quartz kindle
#

Lol

wheat mesa
grim aspen
# hushed robin and i already know the issue, i said what it was

i'm cutting it from here after this. i've given you the most simplist solution the first time. you never thought it would work. even another mod told you to try it and you wouldn't. at this point i'm straight accusing you of gaslighting because you overcomplicated the code by putting extra code that wasn't needed. and no you never gave your solution to anyone as far as i've seen. other users who i talked to regarding your extra code also agreed it wasn't needed. unless you needed the condition statement, you could've easily disabled it by using the solutions i gave but noooooo, you complicated it more and had to accuse me of not being a programmer.

eternal osprey
#

bro you are a hero

#

my god it worked wahahha

lyric mountain
#

personally I don't like how it feels, but is 100% better than dealing with swing

#

unless ofc u have a custom rendering logic

#

then swing is better as u can use canvas for some sweet buffering

lyric mountain
#

That folder is made exactly for that, assets

#

Then use getClass().getResource() to retrieve it

#

Oh, just saw waffle answered it

lament rock
#

Lord forgive me, I have sinned. I started using Java

frosty gale
#

to be historically accurate sun microsystems

#

on a side note the person that made java coincidentally looks like a java developer

earnest phoenix
topaz terrace
#

bump

boreal iron
lament rock
lavish ibex
#
@bot.command()
async def play(ctx):
  hug_emoji = discord.PartialEmoji(name='๐Ÿค—')
  kiss_emoji = discord.PartialEmoji(name='๐Ÿ’‹')
  slap_emoji = discord.PartialEmoji(name='๐Ÿ‘‹')
  options = ['Hug', 'Kiss', 'Slap']
  embed = discord.Embed(title='Choose an action:',
                        description='\n'.join(options))
  message = await ctx.send(embed=embed)

  for option in options:
    await message.add_reaction(hug_emoji)
    await message.add_reaction(kiss_emoji)
    await message.add_reaction(slap_emoji)

  def check(reaction, user):
    return user == ctx.author and str(reaction.emoji) in options

  try:
    reaction, user = await bot.wait_for('reaction_add',
                                        timeout=30.0,
                                        check=check)
  except asyncio.TimeoutError:
    await message.delete()
    await ctx.send(
      f"{ctx.author.mention}, you didn't choose an action in time.")
  else:
    xp = user_data[str(ctx.author.id)].get('xp', 0)
    if reaction.emoji == hug_emoji:
      await ctx.send(f"Trying to Hug Bright...")
      await asyncio.sleep(4)
      if xp >= 100:
        user_data[str(ctx.author.id)]['level'] += 1
        user_data[str(ctx.author.id)]['xp'] = 0
        await ctx.send(
          f"Bright Accepted Your Hug, you earned 50xp and leveled up to {user_data[str(ctx.author.id)]['level']}!"
        )
        # Update the welcome message with the new level
        welcome_message = (
          f"Welcome {ctx.author.name}! You're currently at level {user_data[str(ctx.author.id)]['level']} ||Normal Girl||"
        )
        await ctx.send(welcome_message)
      else:
        user_data[str(ctx.author.id)]['xp'] = xp + 50
        await ctx.send(f"Bright Accepted Your Hug, you earned 50xp!")
    elif reaction.emoji == kiss_emoji:
      # handle kiss option
      pass
    elif reaction.emoji == slap_emoji:
      # handle slap option
      pass

    # Write the updated user data to file
    with open('user.json', 'w') as f:
      json.dump(user_data, f, indent=4)
#

when the user react ๐Ÿค—

#

nothing happens

eternal osprey
#

i created a brand new project, selected javafx, gradle, and also added jdk 20

#

whatt theee hell

#

why the fuck is intellji such a headache. I will switch back to eclipse if this shit doesn't workout, honestly have been trying to find a fix for 3 hours now.

#

``> Could not open cp_proj generic class cache for build file '/Users/apple/Desktop/VoltCPP/build.gradle' (/Users/apple/.gradle/caches/7.6/scripts/8jmd2jl9agvx7pmmk4tawqw2c).

BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 64
``

lyric mountain
#

And the oracle jdk, ofc

lyric mountain
#

It's not intellij's fault

eternal osprey
#

i've fixed it apparently my jdk was not installed

peak drum
eternal osprey
#

another problem tho... I am trying to use the javafx.scene.media but it seems to not get recognized by the ide. This is my file structure, and beware, when i have a file above the gitignore, so basically right under the main folder voltcpp_v2 then it works.

#

So tf am i doing wrong

eternal osprey
#
module com.example.voltcpp_v2 {    requires javafx.controls;    requires javafx.fxml;    opens com.example.voltcpp_v2 to javafx.fxml;    exports com.example.voltcpp_v2;}```
#

this is its content

lyric mountain
#

...

#

so...is it inside module-info or not?

eternal osprey
#

no i added it now..

#

and it works...

#

this shit took me 4 hours....

#

Thanks i didn't know what that module-info was tbh

lyric mountain
#

that's not what I'm asking buddy

#

I wanna know if we're talking abt module info

#

if so, it's inside default package

eternal osprey
lyric mountain
#

u need to put inside some package

eternal osprey
#

that was the module-info above

lyric mountain
#

that's why it has the coffee icon

eternal osprey
#

i indeed had to use import javafx.bla bla bla

eternal osprey
#

i found that media shit

#

i added it to the requires, but for some reason when starting the file it now tells me module not found: javafx.media requires javafx.media;

#

the module seems to be imported correctly tho..

lyric mountain
#

just to confirm, did u put module-info inside your package chain?

#

no source files should be put directly under java

#

that's why it has the coffee icon

eternal osprey
#

hmmm it is under the java

lyric mountain
#

coffee icon = bad

eternal osprey
#

yeah

lyric mountain
#

put it inside your domain

eternal osprey
#

inside the com.example?

lyric mountain
#

com.example.voltcpp_v2

#

that's your domain

eternal osprey
#

I never really done this, and for some reason the javafx project did this on its own

lyric mountain
#

did it? then it's different to java

#

ignore what I said

#

your issue is likely something else

eternal osprey
#

i could try moving it inside the domain, maybe it would work>

lyric mountain
#

what are the intellij warnings?

eternal osprey
#

this is what happens when i move it inside my domain

lyric mountain
#

then it must be in the root

#

see what intellij has to say about those yellow lines

#

never ignore a yellow line

eternal osprey
#

that's just gradle, i don't think it matters that much for this issue.

#

this is what happens when i try to run the program.

lyric mountain
#

it definitely does matter, intellij is 99% right in most warning cases

eternal osprey
#

strange as well because my media IS defined.

lyric mountain
#

yep

#

it might hint at what ur missing

eternal osprey
lyric mountain
#

no, not that

#

hover the mouse on those yellow lines

eternal osprey
#

you mean these

lyric mountain
#

anything that has a different background is a potential issue

eternal osprey
lyric mountain
#

see, it's ambigous

#

which means the runtime will be confused about what module ur meaning

eternal osprey
#

this is my run config

#

might be useful?

lyric mountain
#

nope

#

press alt + enter while you have the caret on that line

eternal osprey
lyric mountain
#

see if it has any suggested change

eternal osprey
#

but once its in there boom it doesn't know fucking media

eternal osprey
#

which one should i choose

lyric mountain
#

second

eternal osprey
#

takes me to this page

lyric mountain
#

hm?

#

did u ctrl click or alt enter?

eternal osprey
#

i am on mac so idk how to do alt enter

#

i used crtl click wahhaha

lyric mountain
#

...

#

ctrl click is an entirely different thing

#

this is what u want

#

usually it gives u a suggested fix, if it doesn't you'll need to google a bit on how to solve that

eternal osprey
#

it sadly doesn't, i am using option, shift and enter but yeah

#

it does give me suggested fixes on all other files tho

#

just this file it doesn't.

lyric mountain
#

if it's saying the declaration is ambiguous then u did something wrong

#

which is likely why it isn't finding that module

eternal osprey
#

because javafx.controls and javafx.fxml work pretty fine without importing the javafx.media

#

but as soon as i add the media then it start to error

#

so it's rather an issue on the media package

lyric mountain
#
lib 1
-----------------------
javafx.controls
javafx.fxml
lib 2
-----------------------
javafx.controls
javafx.fxml
javafx.media
eternal osprey
#

i have made sure i added the javafx as a module, etc etc still doesn't wanna work.

lyric mountain
#

this is why I think the error can be related

#

if the runtime is using lib 1 (because it was the first found), then it'll not find javafx.media

#

which is why ambiguity can be an issue, you need to explicity state which library you'll be using

#

you cant let the runtime "suppose" anything

eternal osprey
#

i see

lyric mountain
#

javafx is made to be more lenient than java, so it allows u to let it "suppose" things

eternal osprey
#

is there any way to fix this manually instead of letting the ide do its thing

lyric mountain
#

it's not the ide, it's the runtime that's confused

#

the ide simply noticed that potential issue

eternal osprey
#

yeah i know, i rather meant can i like select which package to use manually instead of using the automatic fix thing you told me about

#

the alt + enter.

lyric mountain
#

do you really need the top one?

eternal osprey
#

i can try to remove it?

lyric mountain
#

are u using oracle jdk or openjdk?

#

did u let intellij install it automatically?

eternal osprey
eternal osprey
lyric mountain
#

those two comments are conflicting

#

intellij never install oracle jdk, u need to install from the site

#

which u shouldn't, because oracle jdk is bad as hell (many constraining contract clauses)

eternal osprey
#

lmao let me check

#

one sec

lyric mountain
#

if u let intellij install it, then ur using openjdk

#

openjdk doesn't come with javafx, oracle jdk does iirc

eternal osprey
#

it actually did install tho

lyric mountain
#

intellij?

eternal osprey
#

yeah

lyric mountain
#

ok, then that's not the issue

#

see if this solves it

eternal osprey
#

i am using the coretto version now tho

#

i deleted the modules of that javafx i installed

#

media is now undefined whahaha

lyric mountain
#

all those are openjdk forks, it just changes the distributor

eternal osprey
#

omg

lyric mountain
#

the oracle jdk I mean is the "official" one

#

intellij will never download it as you need to sell your soul and firstborn to be able to download it

lyric mountain
#

add it on gradle

eternal osprey
#

damn that person has the exact same issue as i do

lyric mountain
#

that link shows how to do it on maven, but gradle is similar

#

simply convert this to gradle notation

#

or access the link right on top of that and select gradle

eternal osprey
#

Bare with me i haven't fiddled with gradle since starting this course lmao

#

i have no clue where to change these settings

lyric mountain
#

inside dependencies block

#

a dependency line will either be
implementation("group:name:version")
or
implementation group: "group", name: "name", version: "version" (recommended)

eternal osprey
#

in the project structure?

lyric mountain
#

in gradle.build

eternal osprey
#

gotcha

#

i think this is where i should add the javafx.media?

lyric mountain
#

no

#

wait

#

well, try it

#

it shouldn't be, but I suppose javafx is different to the usual gradle.build structure

eternal osprey
#

no i don't think so

lyric mountain
#

then find ```gradle
dependencies {
...
}

eternal osprey
#

yeah i found this:

dependencies { testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")}

lyric mountain
#

add a new line to it

#

implementation group: 'org.openjfx', name: 'javafx-media', version: '20.0.1'

eternal osprey
#

should it be wrapped inside a testImp... or testRun...

#

sadly didn't work

#

maybe i should just give up and use vsc or something

lyric mountain
#

changing ides wont help a project issue

#

it'll just handicap you even more

lyric mountain
eternal osprey
#

i am mentally challenged how do i sync it?

lyric mountain
#

click on the elephant on the top right corner

#

with a ๐Ÿ”„ next to it

eternal osprey
#

oh hold up

#

i accidentally added a $

#

it worked, media still undefined tho

lyric mountain
#

and sync the project

#

anything u do in gradle.build will require a sync

eternal osprey
#

like this

lyric mountain
#

yes

eternal osprey
#

no way it fucking worked

lyric mountain
#

btw, did u sync it the first time u changed modules content?

lyric mountain
#

if not, try removing the dependencies line u added to see if it still works

eternal osprey
#

Not sure whether this is part of the issue but now it says my ptah is not defined

#

i am on the brink of ending my bloodline

lyric mountain
#

getClass().getResource("path")

#

new File("path") looks at the project root

eternal osprey
#
Media media = new Media(getClass().getResource("background.mp4").toExternalForm());MediaPlayer mediaPlayer = new MediaPlayer(media);mediaPlayer.setAutoPlay(true);MediaView mediaView = new MediaView(mediaPlayer);``` i see, i changed it but now it returns me null lmao
sand sparrow
#

i have a bdfd bot i have do vote log, but how i can do it with reward

lyric mountain
#

simply do whatever u need to do with the info supplied

eternal osprey
#

damn it worked, thanks kuu. i LOVE YOU

sand sparrow
lyric mountain
lyric mountain
#

btw, just adding to that, / indicates you're grabbing a resource from the resources root, the abscence of it means you want to grab from the current file's path

sand sparrow
lyric mountain
#

you'll likely never want to use the latter, so always use leading /

lyric mountain
#

well, you'll need to use @top.gg/sdk library, idk how it works for bdfd

sand sparrow
lyric mountain
#

no

#

you can't use bots for that, you need to implement the logic yourself (through code)

sand sparrow
#

oh so i cant

lyric mountain
#

you can, I just cant tell you how to do it with bdfd

#

I have no experience with bot builders

sand sparrow
solemn latch
#

๐Ÿ‘€ I have heard of people doing it with bdfd, but its not something I know how to do.

if bdfd has a support server Id suggest going there

lyric mountain
#

yeah, try asking at bdfd support server

sand sparrow
#

ok

deft wolf
#

It seems to me that the most logical option (in this case) is to read the embed and then use it to give the user a reward. I don't really know how this whole program works either, but if you can receive a message, you can also use it to give a reward to the user

#

Someone must have written it before

lyric mountain
#

your java version is too high

#

go to gradle.build and use a lower version

eternal osprey
#

there's no java specified there

lyric mountain
eternal osprey
#

nope not in there

lyric mountain
#

try googling it then

wheat mesa
#

@lyric mountain do you by chance know how to rotate an image? Trying to allow rotations to be applied to objects and I canโ€™t fully figure it out

wheat mesa
#

Iโ€™ll try that ๐Ÿ‘

lyric mountain
#

remember, rotate is in radians

#

I got stuck for some time trying to figure out why the angles were all messed up, turns out I was using degrees

wheat mesa
#

(After I fix a different bug Iโ€™m getting, for some reason my ECS is freaking out when I load an object)

lyric mountain
#

lmao

wheat mesa
#

And all im getting is NULL as the error ๐Ÿ˜ญ

lyric mountain
#

that's probably because the exception has no message

#

what's the exception class?

wheat mesa
#

Difficult to debug

#

Something with my for loop is freaking out since this only occurs when I create a game object

lyric mountain
#

add the exception class to ur logger

#

[FATAL] the.exception.class.IsThisException: message

wooden swallow
#

C

lyric mountain
#

but given the stacktrace, I'd say that's a CME

wheat mesa
#

Ahhhhh itโ€™s a CME

lyric mountain
#

lul, thought so, it's the only exception that nextNode can throw

wheat mesa
#

I need to just queue objects until the next update cycle

#

Since thatโ€™s what I do with deleting them as well

#

Thereโ€™s probably a better solution but thisโ€™ll do for now

lyric mountain
#

honestly, don't think there is

#

it's basically the same that I'm doing

#

all new entities go on a queue, which gets dumped to the entities set on the next simulation cycle

wheat mesa
#

Sounds good, pretty much what Iโ€™m doing

#

Iโ€™ve got it working, I just need to fix my rotation and my math now

lyric mountain
#

remember, radians KEKW

wheat mesa
#

Yup

#

Radians are intuitive though

#

(Ironically working on this while Iโ€™m in my calc class rn)

lyric mountain
#

never liked radians, like, I know 0 and 360 are the same point, that 180 is halfway and 90 is a quarter

#

for radians it's always a calculus for angles (2 * PI * prcnt)

wheat mesa
#

pi is half a circle, 2pi is a circle, pi/2 is a quarter circle

#

It makes a lot more sense when doing trig

#

(imo)

#

@lyric mountain is there a way to set the width and height of the image after transformation

#

Because itโ€™s setting my sprites back to their original size

lyric mountain
#

affinetransform has 3 methods

#

translate, rotate and scale

wheat mesa
#

Nvm got it with scale yeah

lyric mountain
#

or all three in transform

wheat mesa
#

Just had to figure out the math a little lol

#

Works perfectly now, thank you!

lyric mountain
#

yw

lyric mountain
#

the default rotate anchor is the top-left corner

wheat mesa
#

Yup, Iโ€™m going to set it to the middle of my sprite

#

Width / 2 height / 2

#

Also casting is a 0 cost operation right

#

Apparently not

#

Thatโ€™s alright, seems like the JVM is smart enough to optimize this actually

lyric mountain
#

yep, don't bother with such minimal optimizations, else you'll make JIT's job harder

wheat mesa
#

@lyric mountain for some reason AffineTransform is making my rectangular sprite look like this:

#

Iโ€™m using ```java
tr.translate(finalX, finalY);
tr.scale(finalWidth / spriteWidth, finalHeight / spriteHeight);
tr.rotate(rotation, finalWidth / 2f, finalHeight / 2f);

#

I guess I need to scale after I rotate

lyric mountain
#

rotate should always be applied last

#

what's ur original sprite?

#

oh, wait, try using spriteWidth instead of finalWidth for rotate

#

same for height

wheat mesa
#

And this is using rotate as the last transformation

#

Translating, scaling, then rotating

lyric mountain
#

that's weird

#

try with another order

wheat mesa
#

Doing translation, rotation with the negative version of my angle (with 0,0 anchor points) then scaling seems to yield a decent result

#

Angled at 65 degrees

lyric mountain
#

hm, so scaling does interfere with rotation

#

I'll keep that in mind

wheat mesa
#

I should make a quick little AffineTransform visualizer

#

That would be a nice project

lyric mountain
#

would be useful yeah

#

btw, do note translate is delta, not coordinates

#

so ```java
at.translate(1, 0);
at.translate(1, 0);

will make the transform move 2 units to the right
#

same for the others

scenic kelp
lyric mountain
#

I mean, u could also n >> 1, but the runtime is smart enough

#

Probably

scenic kelp
#

yeah

#

i think * 0.5f and / 2f can have rounding differences though

#

not that it matters for any practical purposes

lyric mountain
#

0.5 doesn't

#

It's 0.3, 0.6 and 0.9

hasty rampart
#

Hi how i can make position in leaderboard of user with sequelize

celest swan
#

I really dunno what to do anymore beacuse this is getting on my nerves! Everytime I code and embed response in js for command and fix all errors it message not embed. It reply discord api unknown interaction! This is my code for v14:

const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js');

// Set a 30-minute cooldown for the command
const cooldowns = new Map();

module.exports = {
  data: new SlashCommandBuilder()
    .setName('funfact')
    .setDescription('Get a random fun fact!'),
  async execute(interaction) {
    // Check if the user is on cooldown
    const userCooldown = cooldowns.get(interaction.user.id);
    if (userCooldown && (Date.now() - userCooldown) < (30 * 60 * 1000)) {
      const remainingTime = Math.ceil((userCooldown + (30 * 60 * 1000) - Date.now()) / (60 * 1000));
      return interaction.reply({ content: `**This command is on cooldown.** Please wait ${remainingTime} minutes before using it again.`, ephemeral: true });
    }

    // Set the user's cooldown
    cooldowns.set(interaction.user.id, Date.now());

    const facts = [
      "If you consistently fart for 6 years and 9 months, enough gas is produced to create the energy of an atomic bomb.",
      "Bananas are berries, but strawberries are not.",
      // Add more facts here...
    ];

    const fact = facts[Math.floor(Math.random() * facts.length)];

    const embed = new EmbedBuilder()
      .setColor('#0099ff')
      .setTitle('Did you know?')
      .setDescription(fact)
      .build(); // Fix: Add .build() at the end

    const button = new ButtonBuilder()
      .setCustomId('newFact')
      .setLabel('New Fun Fact')
      .setStyle(ButtonStyle.PRIMARY)
      .setDisabled(false)
      .build();

    const row = new ActionRowBuilder()
      .addComponent(button)
      .build();

    await interaction.reply({ embeds: [embed], components: [row] });
  },
};

I got other command named /topic and it embed reply suggest topic its working but /funfact not working

deft wolf
#

What does .build() do in all this?

hasty rampart
#

Hi how can i make leader board with sequelize
-sequelize model name: Tags
-cash: zawarte_partnerstwa
-user id in model: ID

It need to look like

  1. Kitki30#4111 - Cash: 100
  2. Username#2222 - Cash:2
peak drum
#

I don't know much about sequelize I search it online and Iโ€™m assuming itโ€™s a database so one thing you could do is fetch all users in the guild from the database and then sort it on how much cash the user has

hasty rampart
#

Tags model:

peak drum
#

Just to clarify youโ€™re creating a discord bot right?

peak drum
#

Alright

#

So how dit u save the users to the database

#

Using their UserId as a key?

hasty rampart
peak drum
#

You need to fetch all users from your database that are in the guild the command was issued

peak drum
#

I donโ€™t know how you saved the users in your database nor do I know how the package ur using for your database works Iโ€™m sorry

#

This is an old example

#

// leaderboard.js

module.exports = {
  name: 'leaderboard',
  description: 'Displays the leaderboard based on cash',
  execute(message, args) {
    // Retrieve a list of all the users in the server
    const users = message.guild.members.cache;

    // Sort the list of users by their cash amount
    const sortedUsers = users.sort((a, b) => {
      return getUserCash(b) - getUserCash(a);
    });

    // Build the leaderboard message
    let leaderboardMsg = 'Leaderboard - Cash\n';
    sortedUsers.forEach((user, index) => {
      leaderboardMsg += `${index + 1}. ${user.user.username}: ${getUserCash(user)}\n`;
    });

    // Send the leaderboard message to the channel where the command was used
    message.channel.send(leaderboardMsg);
  },
};

// Helper function to retrieve a user's cash amount
function getUserCash(user) {
  // In this example, we'll assume that each user has a "cash" property attached to their Discord user object
  return user.user.cash || 0;
}

hasty rampart
#

Users in database is saved as id

deft wolf
peak drum
#

Only thing youโ€™d have to change is ofc the message to interactions and the helper function to fetch the cash from your database

ashen prairie
#

so i have a bot pretty old written in djs 13 and its in 100 servers, most small ones with a couple of members. now i want to make the bot to be avaible to everyone, so it has to leave some small servers and i want to put a member requirement on it so it doesnt reach 100 servers this quick. i dont want the bot to just leave servers without people knowing why, any like ways i could solve this the best (no i dont want to verify the bot since i am not going to maintain it at all)

vivid fulcrum
#

iirc there's no built in feature for that, you can check the guild member count when your bot joins one - then leave if it's smaller than your desired count

ashen prairie
#

yeah but like its at 100 servers rn so it needs to leave servers below lets say 50 members and i want to notify the owners somehow to make sure they know why it left but idk what way would be the best to do so

fleet mason
#

what about sending a message in a chat or to the owner?

ashen prairie
#

yeah so i was considering those but to the owner idk if it will be considered as unwanted dming and in a chat would be kind of weird if the top channel is announcements and my bot suddenly sends a message there or something like that

fleet mason
#

If you do not want to send the owner a dm, do a filter on special channels or try to check if there are a general/bot chat

ashen prairie
#

hm alr ill consider that

#

thank you

dry delta
#

Is it against tos to buy a bots code?

deft wolf
#

Probably not, you can normally pay someone to write a bot

#

You cannot buy tokens

earnest phoenix
#

Buying code of/for a bot, no - buying a bot with its token, yes

dry delta
#

I wonโ€™t buy the token just@the code

deft wolf
#

No one would have even noticed if you hadn't asked

earnest phoenix
#

Then it's fine, it's just like paying someone to code

lyric mountain
#

Also, "available to everyone" but don't want to verify?

earnest phoenix
#

Just shutdown the bot at that point lmfao

lyric mountain
#

Yep, that's the proper way, notify all current servers that it'll cease working after X days

earnest phoenix
#

looking for a developer team to develop a discord bot in discord.py or discord.js pm me for more information ๐Ÿ™‚

spark flint
#

@unkempt ocean -needdev

gilded plankBOT
#

@earnest phoenix

You seem to be asking for something you don't have experience for or something that hasn't been done yet, but really need for your bot/server.
You can hire developers from Fiverr or Freelancer to code the things you need for your bot/server.

stark abyss
#

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.Edge.WakeUp () (at <f3a68e51ee8d41df8b60333ca1187c56>:0)
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List1[T] inEdges, System.Collections.Generic.List1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at <f3a68e51ee8d41df8b60333ca1187c56>:0)

unity, have zero clue how to fix. I don't even know if its a script thats causing it or if inside unity

quartz kindle
stark abyss
#

yeah I saw that

rigid maple
#

how can i fix it

#

obj return undefined but it was supposed to return "asd"

rustic nova
#

if you're calling onload after obj gets logged, it of course isn't defined

#

as it hasn't reached that part of code before your log statement

rigid maple
#

what should I do

rustic nova
#

yeah cant really help there otherwise, it just isnt defined as your log is getting executed before your onload callback triggers

celest swan
quartz kindle
#

when onload runs, the function is already finished and exited

#

console.log and return happens first, and only later onload happens

#

so the console.log and return happens when obj is still undefined

#

if you want to return something that is created inside onload, you need to return a Promise, which makes that an async function

rigid maple
#

i did thanks

frail summit
#

Hey i just want know how do for Control what the bot says

earnest phoenix
#

You already got a response, long time ago

proven lantern
#

do i need oauth perms to create a group dm?

#

i have the interaction token and the bot token, but i dont have user access tokens. sounds like oauth tokens

quartz kindle
#

yeah looks like oauth

#

each user needs to login with their discord accounts and give you their access token with the gdm.join scope

proven lantern
#

that's probably smart. group dm are probably popular for spamming people

hushed robin
#

does anyone know a better way to do this

let quantityData = undefined;
let itemQuantity = undefined;

if (i.values.length === 1) {
                    await i.showModal(quantityModal);

                    const filter = interaction => interaction.customId === 'quantity';
                    quantityData = await interaction.awaitModalSubmit({ filter, time: 60000 })
                        .catch(() => {
                            console.log('Item quantity modal was not filled.')
                        });

                    itemQuantity = parseInt(quantityData.fields.getTextInputValue('itemQuantity'));

                    if (isNaN(itemQuantity)) {
                        return await quantityData.reply({
                            content: 'The item quantity must be a number!',
                            ephemeral: true
                        });
                    };
                };

                if (quantityData !== undefined && itemQuantity !== undefined) {
                    await quantityData.update({
                        embeds: [tradeEmbed(i.user, Array.from(offer, (item => { return { name: item[1].name, icon: item[1].icon,  emoji: item[1].emoji, amount: item[1].amount }})), Array.from(request, (item => { return { name: item[1].name, icon: item[1].icon,  emoji: item[1].emoji, amount: item[1].amount }})))]
                    });

                    quantityData = undefined;
                    itemQuantity = undefined;
                } else {
                    await i.update({
                        embeds: [tradeEmbed(i.user, Array.from(offer, (item => { return { name: item[1].name, icon: item[1].icon,  emoji: item[1].emoji, amount: item[1].amount }})), Array.from(request, (item => { return { name: item[1].name, icon: item[1].icon,  emoji: item[1].emoji, amount: item[1].amount }})))]
                    });
                };
            };

because it's really buggy

#

i wanna access the variable from that top if statement outside of it

wheat mesa
#

jesus

#

this is why you don't do everything in a one liner

#

it's impossible to read

pale vessel
#

one liner is based

hushed robin
#

i can read this perfectly fine

#

โ˜ ๏ธ

wheat mesa
#

@unkempt ocean

#

that's the first scam ad on discord I've seen with a phone number lmfao

unkempt ocean
#

ty

hushed robin
#

gdead development

celest swan
#

-needdev

blissful ridge
hushed robin
earnest phoenix
#

Try again later

#

Nothing you can do

hushed patrol
#
app.post("/dblwebhook", webhook.listener(vote => {
  console.log('Recived a vote!', vote)
  // vote will be your vote object, e.g
  const user = client.users.cache.get(vote.user)
   if (!user){
  return
} else {
   const embedE = new MessageEmbed()
.setTitle('VOTING SYSTEM')
 .addField(`Thanks <@!${vote.user}> for voting`,`You got 5000 coins as for now this is the only voting reward join the support server and tell us some suggestions`)
    user.send({ embeds: [embedE]})
 db.add(`money_${vote.user}`, 5000)
  
 // console.log(vote) // 395526710101278721 < user who voted\

 
 } // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))``` when i do send test and when i voted nothing happened
earnest phoenix
#

Have you set the IP/domain and port correctly in your bot's webhook panel on Top.gg

sharp saddle
#

well, I've been wondering why I shouldn't use https://npmjs.org/postgres package

eternal osprey
#

hey guys i created this snake game in javaFX but let me tell you that's not how a snake should move ๐Ÿคฃ

this is my current code:

(This is being ran once a new Segment of the snake is created):

@Override
public void onNewSegment(Segment segment){   
 Rectangle xRect = new Rectangle (4,4 , 20, 20);   
 xRect.setFill(Color.rgb(8, 80,2));   
 xRect.translateXProperty().bind(segment.getXProperty());                    
 xRect.translateYProperty().bind(segment.getYProperty());   
 getChildren().add(xRect);}

code snippet ran once the snake head eats food:

 body.add(x);    
world.moveFoodRandomly();  
  for (SnakeSegmentListener listener : listeners) {     
   listener.onNewSegment(x);   
 }}
for (Segment x : body) {  
  currentX = x.getX();   
 currentY = x.getY();   
 x.setPosition(currentX + direction.getDX(), currentY + direction.getDY());}

how can i make the snake well, move like a snake?

quartz kindle
sharp saddle
#

idk why

quartz kindle
#

well idk why either

deft wolf
#

A database like any other. People have their favorites and those they don't like

lyric mountain
#

the segment must be bound to the parent's last pos, not current pos

#

that way it'll "lag" behind the parent

lyric mountain
#

btw, it'll not work as you expect it to, unless you either rotate the segment to align with the movement vector OR make the whole snake fixed to a grid

#

else it'll look really weird (a square moving without facing forward)

eternal osprey
#

oowh i see, i tried a lot of things out and just cannot seem to fix this

#

I have a rotate vector which moves only the head of the snake

#

should i maybe change it to rotate all the segments?

lyric mountain
#

no, always treat each segment separate

#

snaker (the name of that game) is really simple, all you need is to have segments bound to the parent's previous state

#

it's a pretty good way of learning OOP, as you're kinda forced to use it

eternal osprey
lyric mountain
#

the movement is basically

H = head
S1 = segment 1

H  | moves to target pos
S1 | moves to H
S2 | moves to S1
S3 | moves to S2
S4 | moves to S#
SN | moves to S(N-1)
eternal osprey
#
for (int i = 1; i < body.size(); i++) {   
  body.get(i).setPosition(body.get(i - 1).getX(), 
  body.get(i - 1).getY());
}
body.get(0).setPosition(newX, newY);
lyric mountain
#

BUT you need to store the last known position

#

else every segment will move to the head's new pos

eternal osprey
#

it has an x and y coordinate

lyric mountain
#

there's no "body"

#

there's only segments

eternal osprey
#

the body list

#

yeah

#

cuz based on this code we are first setting the segment next to our head to the old head position, then the 2nd segment to this current segment etc etc and then after that we update

#

or am i lacking rationality here

lyric mountain
#

so ```groovy
def segments = [...]

segments.each { seg ->
seg.oldPos = seg.pos

if (seg.head) {
seg.pos = [x + dX, y + dY]
} else {
seg.pos = seg.parent.oldPos
}
}

#

basically

#

dX would be either -1, 0 or 1, depending on the X movement, dY the same but for Y movement

eternal osprey
#

hmm i see, and seg.parent.oldPosX would just be body.get(i-1).get(x)?

#

as the head is index 0, tail [0, ->]

#

or is body.get(i-1).get(x) not the old value?

lyric mountain
#

pos and oldPos are arrays of coordinates

#

ofc u should not overwrite it on each frame, so u could have pos.x and pos.y

#

but on groovy I can override operators, so let's just consider that's what I did

eternal osprey
#

i see, but couldn't we use body for that instead as that already contains the segments and their position getters?

#

Or is that actually an old value, because in that case we could maybe define the current positions in the array as you said below the for loop,

lyric mountain
#

you'd have 2 arrays, one for current pos and one for old pos

#

forget abt body, there's no body

#

you can't have a global coordinate property because the segments move independent of the body

#

aside from shadowing the parent

#

a segment must only know its parent (previous segment)

#

if there's no parent, it's a head

eternal osprey
#

the body is not a global coordinate

#

my bad that i didn't specify it, it's a linkedlist that contains all segments

#

and each segment has a getX and getY

lyric mountain
#

that's fine then

#

btw, use arraydeque

#

u don't need random access, so u can save some overhead

#

arraydeque is better for sequential iteration

eternal osprey
#

my lecturer gave us the template code, we are sadly not allowed to change it

#
for (int i = 0; i < body.size(); i++) { 
   if(i == 0){      
  body.get(i).setPosition(newX, newY);  
  }else{       
 body.get(i).setPosition(body.get(i-1).getX(), body.get(i-1).getY()); 
   }}```
lyric mountain
#

ah, ok then

eternal osprey
#

omg intellji keeps on fucking my code up like this when i copu

lyric mountain
#

I cant read oneline code

eternal osprey
#

my bad, intellji does it automatically for some reason after enabling beta mode

lyric mountain
#

that wont work

#

you'll have all segments stay where the head is

#

because setPosition will change the state

eternal osprey
#

oowh shit yeah ofc

#

maybe we could move that code of the head after the for?

lyric mountain
#

there's no way to avoid getOldX or smth

#

you can, tho, iterate reversely

eternal osprey
lyric mountain
#

start from the tail and move up to the head

eternal osprey
#

hmm that;s interesting but seems a bit harder then the getOldX method tho

lyric mountain
#
H = head
S1 = segment 1

SN | moves to S(N-1)
S4 | moves to S3
S3 | moves to S2
S2 | moves to S1
S1 | moves to H
H  | moves to target pos
eternal osprey
#

so how would we set the oldx? maybe in the segments creating a new private oldX and upon use of setPosition, first setting the oldX and then chaning the current shit

lyric mountain
#
private final int[] position = new int[2];
private final int[] oldPosition = new int[2];
#

whenever u update position, save the current values to oldPosition

#

BEFORE u update the value

eternal osprey
#

ah i see

#

I will actually try that out right now

#
for (int i = 0; i < body.size(); i++) {  
  if(i == 0){   
     body.get(i).setPosition(newX, newY);  
  }
else{  
int[] previousCoords = body.get(i-1).getOldCoordinates();        body.get(i).setPosition(previousCoords[0], previousCoords[1]);   
 }
}``` my new move code
#
public void setPosition(int x, int y) {    
oldCoordinates[0] = this.x.getValue(); 
   oldCoordinates[1] = this.y.getValue();  
  this.x.setValue(x);   
 this.y.setValue(y);}```
the new segment.setPosition()
#

i think it could be working but do you know what the problem is?

lyric mountain
#

what error?

eternal osprey
lyric mountain
#

please ffs make that thing faster

eternal osprey
#

look, now it's a blob because i think that the code is working but the rectangle is like 20x20 so even if it changes the position by 1px it doesn't really change

#

should we do like. + 20 to make it work

lyric mountain
#

the issue is because it's not aligned to a grid

eternal osprey
#

oowh

lyric mountain
#

so it IS lagging behind the head, but only 1 pixel behind

#

the segments are way too big for a 1px grid

eternal osprey
#

fuck

#

how should we fix that?

lyric mountain
#

make the grid bigger

eternal osprey
#

what grid tho

lyric mountain
#

...

eternal osprey
#

we are working with a borderpane as root and not a gridpane

lyric mountain
#

the movement grid, it's 1px by 1px (image pixels) by default

#

if u increase it to, say, 20px, the snake will "jump" by 20px on each movement

eternal osprey
#

owh i see

lyric mountain
#

it's as simple as drawImage(segment, segment.getX() * 20, segment.getY() * 20, null)

eternal osprey
#

owhh that's the scaler

#

there's one defined in the file, it's 16 instead of 20 tho

#

so that means our square should be 16 as well?

lyric mountain
#

yes

#

else they'll overlap

eternal osprey
#

i fixed this shit earlier on with the +20 and -20

#

this was for my direction as it was overlapping

#

instad of the scaler can't we just use this said method

lyric mountain
#

...why don't u simply use a movement array?

#

private final int[] vector = new int[2]

eternal osprey
#

and what should that array represent?

lyric mountain
#

x.setPosition(position.x + vector.x, position.y + vector.y)

lyric mountain
#

for X, for example, [-1, 0] would mean 1 unit to the left

#

[1, 1] would be 1 unit to the right, 1 unit down

#

which cant exist in a snake game, but whatever

eternal osprey
#

is this for like the directions?

lyric mountain
#

yes

eternal osprey
#

I have a directions class made already

lyric mountain
#

instead of having a switch-case

eternal osprey
#

an enum class

lyric mountain
#

yes, and it's bad

eternal osprey
#

they provided it

lyric mountain
#

they are bad then

eternal osprey
#

whahahaha

#

shiii but this means that i must multiply everything with 16 to make it work?

lyric mountain
#

only when rendering

eternal osprey
#

or only the part where we set the objects

eternal osprey
lyric mountain
#

the actual values don't matter, only the part where you show the game

eternal osprey
#

this is what they did btw

setPrefSize(world.getSize() * SCALE, world.getSize() * SCALE);```
#

the scale is 16

#

this is how i represent one segment of the body:

Rectangle xRect = new Rectangle (4,4 , 20, 20);
xRect.setFill(Color.rgb(8, 80,2));
xRect.translateXProperty().bind(segment.getXProperty());
xRect.translateYProperty().bind(segment.getYProperty());
getChildren().add(xRect);```
#

but where should the scaler be applied tho, i was thinking about the width and height but that would make this rectangle humongous

lyric mountain
#

where u draw it

eternal osprey
#

this is where i create the element and add it to the borderpane

#

but it doesn't seem the right spot to do so

lyric mountain
#

idk what that code is supposed to do, but simply multiply where u draw the elements

eternal osprey
#

that's in the code above right?

#

I am just creating a new rectangle (which is the part of my body) and then add it to the borderpane

#

that's it.

lyric mountain
#

segment.getXProperty() multiply the return of this

#

inside that method, not outside

eternal osprey
#

i must multiply my property?

#

hmm

#

it's. a predefined method tho

#

so this means i cannot really touch it

#

is there no other way to fix this

lyric mountain
#

idk, you'll need to figure that out yourself

eternal osprey
#

okay, thank you!

#

for all the help

lyric mountain
#

what you need is to multiply the rendering coordinates, that's as far as I can say

#

you'll need to find out where

#

if it was regular java it'd be easier as hell, idk why ur teacher chose javafx for a game

#

they could've passed a site or app project instead, not a game

eternal osprey
#

they are trying to fuck us that's why

#

but you've been a great help, appreciate it!

quartz kindle
#

you guys wanna see something cursed

rustic nova
#

No

quartz kindle
#
const size = chunks.length * 8 - last < 4294967296n ? last < 65536n ? last < 256n ? 7 : 6 : last < 16777216n ? 5 : 4 : last < 281474976710656n ? last < 1099511627776n ? 3 : 2 : last < 72057594037927936n ? 1 : 0;
rustic nova
earnest phoenix
# quartz kindle ```js const size = chunks.length * 8 - last < 4294967296n ? last < 65536n ? last...
<?php

class เถฉ
{
  public bool $๐Ÿ‘Œ;
  public bool $๐Ÿ˜ก;
  public int $๐Ÿ’€;

  public function __construct(bool $๐Ÿ˜ˆ, int $๐Ÿ’€ = 0, int $๐Ÿ‘จ)
  {
    if($๐Ÿ˜ˆ) $this->๐Ÿ‘Œ = true;
    $this->๐Ÿ’€ = $๐Ÿ’€;
    $this->๐Ÿ˜Š = $๐Ÿ‘จ;

    if($this->๐Ÿ‘Œ) $this->๐Ÿ”ช();
  }

  public function ๐Ÿ”ช()
  {
    while($this->๐Ÿ˜Š)
    {
      $this->๐Ÿ’€++; $this->๐Ÿ˜Š--;
      echo "เถฉ ๐Ÿ”ช ๐Ÿ˜Š [{$this->๐Ÿ’€}] ๐Ÿ˜‡\n";
    }
  }
}

new เถฉ(1, 0, 6);

?>
quartz kindle
earnest phoenix
# quartz kindle old
fn ๐Ÿ˜œ๐Ÿ˜€๐Ÿ˜(๐Ÿ˜€๐Ÿ˜: i32, ๐Ÿ˜๐Ÿ˜€: i32) -> String {
    if !๐Ÿ˜€๐Ÿ˜.is_positive() || !๐Ÿ˜๐Ÿ˜€.is_positive() {
        return "๐Ÿšซ๐Ÿ˜ฑ๐Ÿ‘‰๐Ÿ’ป๐Ÿ‘ˆ".to_string();
    }
    
    let ๐Ÿ˜œ๐Ÿ˜€ = ๐Ÿ˜€๐Ÿ˜.to_string().chars().rev().collect::<String>().parse::<i32>().unwrap();
    let ๐Ÿ˜œ๐Ÿ˜ = ๐Ÿ˜๐Ÿ˜€.to_string().chars().rev().collect::<String>().parse::<i32>().unwrap();
    
    let ๐Ÿ˜ = ๐Ÿ˜œ๐Ÿ˜€ + ๐Ÿ˜œ๐Ÿ˜;
    
    let ๐Ÿ˜œ๐Ÿ˜๐Ÿ˜œ = ๐Ÿ˜.to_string().chars().map(|๐Ÿ˜€| match ๐Ÿ˜€ {
        '0' => '๐Ÿ˜ˆ',
        '1' => '๐Ÿ˜บ',
        '2' => '๐Ÿ˜ก',
        '3' => '๐Ÿ‘ป',
        '4' => '๐Ÿ’ฐ',
        '5' => '๐Ÿคข',
        '6' => '๐Ÿคก',
        '7' => '๐Ÿค–',
        '8' => '๐Ÿคฏ',
        _ => '๐Ÿ‘ฝ',
    }).collect::<String>();
    
    ๐Ÿ˜œ๐Ÿ˜๐Ÿ˜œ
}
quartz kindle
#

lmao

earnest phoenix
quartz kindle
# earnest phoenix Most likely when we mark code coverage as stable, as making a visualizer in the ...

should be pretty simple to just parse this output

โ„น src\packer.js | 34.94 | 48.28 | 38.46 | 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 102, 103, 104, 105, 146, 147, 149, 150, 151, 152, 153, 154, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 244, 245, 246, 247, 248, 249
...```
#

or you think that output is still gonna change?

earnest phoenix
#

It could change, that's what I meant

quartz kindle
#

just make it output a format compatible with existing tools

#

like .lcov

earnest phoenix
eternal osprey
#

The getX() and getY() of the segments?

earnest phoenix
quartz kindle
eternal osprey
#
@Override
public void onNewSegment(Segment segment) { 
   Rectangle xRect = new Rectangle (4,4 , 20, 20);  
  xRect.setFill(Color.rgb(8, 80,2));  
  xRect.translateXProperty().bind(segment.getXProperty()); 
   xRect.translateYProperty().bind(segment.getYProperty());  
  getChildren().add(xRect);
}

public SnakeGame(World world) {   
 Segment head = new Segment(3,3);   
 world.getSnake().addSegment(head);  
  onNewSegment(head);   
 world.getSnake().setDirection(Direction.DOWN); 
   setPrefSize(world.getSize() * SCALE, world.getSize() * SCALE);  
  this.world = world;  
  world.getSnake().addListener(this);  
  Food food = world.getFood(); 
   food.moveTo(25,65); 
   IntegerProperty foodPosX = food.getXProperty(); 
   IntegerProperty foodPosY = food.getYProperty();  
  Circle foodObj = new Circle(10);  
  foodObj.setFill(Color.rgb(0, 0,255)); 
   foodObj.centerXProperty().bind(foodPosX);
    foodObj.centerYProperty().bind(foodPosY);  
  getChildren().add(foodObj);```
this is my only rendering code i use
earnest phoenix
quartz kindle
#

indeed

quartz kindle
#

ie:

buffer[index] = Number(1n); // slower
dataview.setBigUint64(index, 1n, true) // faster
#

even tho the latter writes 8 bytes and the former only writes one

#

conversions are a pain am i right? xd

earnest phoenix
#

Yeah, they are

quartz kindle
#

not that big of a difference

#

but increase the number or writes, and it becomes a very big difference

earnest phoenix
#

What engine/runtime version are you testing on?

quartz kindle
#

chromium idk

#

v111

#

lemme update, since chromium doesnt auto update lel

#

ye same result on v113

proven lantern
#

is there something like github co-pilot that helps writes commit messages in intellij?

earnest phoenix
#

how can i loop a message to keep sending?

earnest phoenix
#

Not in intellij though but it exists for the terminal

#

So someone most likely made the same as plugin

proven lantern
earnest phoenix
#

No a brain, as in your brain trol

proven lantern
#

i dont want to waste my brain power on writing comments

#

i dont have much

#

left

earnest phoenix
#

Commit messages are shorter than 50 characters

#

Took you more time to write here than think and write a commit message

proven lantern
#

but i have to remember all the things i did

lyric mountain
#

"Minor changes"

earnest phoenix
#

Just

Add things

#

but yeah as mentioned, exists in terminal

#

Heard about it months ago, some GitHub repo

#

Like commitai or whatever

#

If you search you'll find that one

proven lantern
#

ctrl+ k then ctrl+shift+k is how i commit and push

lyric mountain
#

don't worry much abt messages if you're the sole maintainer

#

chances are you'll never go back anyway, and if you do, you're very likely to know which commit to revert to

earnest phoenix
#

Although it's good practice to have not nonsense commit messages

proven lantern
#

commit message are useful even when programming solo

eternal osprey
#

like idk what the graphics should look like

#

you told me about multiplying the x and y getproperty but that amde my code a mess by moving all rectangles out of the field directly

lyric mountain
#

well yeah, that'll happen if you multiply the global coordinates

#

it'll make the canvas much larger

eternal osprey
#

shit man

#

this shit is the only thing left so i can hand in this assignment

#

but i just don't get how to change the pref size so that the rectangles are not fucking each other

lyric mountain
#

to better explain the issue:
let's say you have a game panel of 1024x1024, in your current case that means a 1024x1024 grid

#

thing is, it'll be very granular (each step moves the segment by 1px in the global coordinates)

#

to make it more "skippy" you need to reduce the grid by size / scale, then upscale to fit the game panel

#

for example, if you divide the grid by 8 you'd have a 128x128 grid in local coordinates, then you upscale it by 8x so you get a 1024x1024 grid in global coordinates

#

this would make each pixel in local space represent 8 pixels in global space

#

does this make sense?

eternal osprey
#

so all my global coordinates must be divided by 16?

#

because my game is 12 x 16

lyric mountain
#

12x16?

#

but well, simply upscale the local grid

eternal osprey
rocky dagger
#

im downloading a gif into ./downloads/ and i call the gif media.gif and i want to use it to reply to a command and i have the code bellow but it doesnt work```js
const attachment = new AttachmentBuilder('./downloads/media.gif', {
name: 'media.gif',
});
const embed = {
description: 'Attachment',
image: {
url: attachment://${attachment.name},
},
};
let message = interaction.reply({ embeds: [embed], files: [attachment] });

eternal osprey
#

like if i knew it would be ez

#

should i multiply everything with 16?

#

Would that be upscaling lmao

proven lantern
civic scroll
civic scroll
# hushed robin who knows

// Sayuri.Codex optimise @lang:auto @o3
// Sayuri.Codex optimiser ERROR: There was syntax error when copying source snippet. 
// Take this code with a grain of salt. 

let quantityData, itemQuantity;
if (i.values.length === 1) {
    await i.showModal(quantityModal);

    quantityData = await interaction
        .awaitModalSubmit({ 
            filter: ({ customId }) => customId === 'quantity', 
            time: 60000 
        })
        .catch(() => {
            console.log('Item quantity modal was not filled.')
        });

    itemQuantity = parseInt(quantityData.fields.getTextInputValue('itemQuantity'));

    if (isNaN(itemQuantity)) 
        return quantityData.reply({
            content: 'The item quantity must be a number!',
            ephemeral: true
        });
    
}

const embeds = [
    tradeEmbed(i.user, Array.from(offer, ([, item]) => item)), 
    Array.from(request, (([, item]) => item))
]

if (quantityData && itemQuantity) {
    await quantityData.update({
        // Sayuri.Codex optimiser ERROR: Ambiguous use case for `embeds` array: Same value was used on alternative branch of this condition
        // embeds: [
        //     tradeEmbed(i.user, Array.from(offer, ([, item]) => item)), 
        //     Array.from(request, (([, item]) => item))
        // ]
        embeds
    });

    // Sayuri.Codex optimiser WARN: Those variables are not used after reassigned
    quantityData = itemQuantity = null;
    // 

} else {
    await i.update({
        // Sayuri.Codex optimiser ERROR: Duplicated code fragment 
        // embeds: [
        //     tradeEmbed(i.user, Array.from(offer, ([, item]) => item)), 
        //     Array.from(request, (([, item]) => item))
        // ]
        embeds
    });
}
civic scroll
hushed robin
#

ok

#

thx

#

will look into this

civic scroll
#

alright

hushed robin
#

why does this occur

civic scroll
#

i don't even know what you are trying to convey

wheat mesa
#

โ€œWhy does this occurโ€
Also shows a complex modal process and doesnโ€™t say whatโ€™s wrong

hushed robin
#

it doesn't add

#

to royal chair

civic scroll
#

have you considered trying something called debugging?

hushed robin
#

no

civic scroll
#

you need that to troubleshoot and know the bug by monitoring application behaviour in real time

hushed robin
#

ok

#

i will troyubleshoot

#

rn

civic scroll
#

sounds like you know your stuff

hushed robin
#

OK

#

i broke my bot even more

#

why doesn't this work if itemQuantity is null

wheat mesa
#

that might be the most horrendous use of logical OR I've ever seen

civic scroll
#

doesn't work as in what

hushed robin
#

how am i suppose to use it

wheat mesa
#

that is technically a valid use but it makes code so much more confusing

civic scroll
#

that results in 1 assuming everything is off-favor

civic scroll
wheat mesa
#

This should work in theory, but you've probably not given us information that's important

wheat mesa
#

yeah

#

that's horrendous

civic scroll
#

all of that just for this

#

kids this is why you read documentations

hushed robin
#

๐Ÿ˜

civic scroll
#

you might find some cool advanced use of syntax / built-in apis

hushed robin
#

I don't get what it's not updating it

#

this makes no sense

#

everything is correct

civic scroll
#

i'm off, too tired

hushed robin
#

๐Ÿ˜”

#

goodnight

quartz kindle
hushed robin
quartz kindle
#

addition has a higher precedence than OR

#

which means

hushed robin
#

W

#

I FIXED IT

#

TY

quartz kindle
#

lol ok

hushed robin
#

lets go

quartz kindle
#

so you dont need my explanation anymore

hushed robin
#

no

#

i understand what that means

#

i am smart

quartz kindle
#

๐Ÿ‘

hushed robin
#

๐Ÿ•ต๏ธ

novel fiber
#

C

crystal wigeon
#

hey how do i change the icon on topgg?

#

for my bot

earnest phoenix
#
  1. Refresh Data
  2. Edit
  3. Save
crystal wigeon
#

it still showing the old icon and i dont see a place to change it

earnest phoenix
#

And that's how you do it

crystal wigeon
#

i edited my bot icon on discord developers portal

earnest phoenix
#

Literally just click the buttons i've sent above cat_clown

crystal wigeon
#

but i dont see the option to change icon on topgg. i edited some of the contextual data and saved

#

o

#

where are the buttons fr, i dont see any

#

This is all i see

earnest phoenix
#

Bruh it's literally on your bot's page

#

right below the "Edit" button there is the "Refresh Data" button

#

Click that one

#

The edit

crystal wigeon
#

yeah i clicked that

earnest phoenix
#

then save

#

And that's it

#

Not rocket science

crystal wigeon
#

fam, i still dont see my bot icon change

earnest phoenix
#

there is none jeez

#

just click those 3 goddamn buttons

crystal wigeon
#

there it changed damn

#

lol

#

thanks

#

wew

earnest phoenix
merry hull
#

How do i host my own bot on my localhost?

#

I want to do this while im developing it.

civic scroll
#

with whatever your bot program's entry point is

#

eg. node then node main.js

merry hull
#

okay

grim aspen
civic scroll
#

and for webservers or database servers, do the same

grim aspen
#

^

civic scroll
#

if you want your bot to update when you change source code, use a daemon

#

i usually just write my own reload code since daemon would restart the whole bot when i update source code

primal musk
#

does linux have an undo shortcut or command?

#

like

#

lets say i accidentaly delete the wrong file

#

can i undo that

grim aspen
#

Nope

primal musk
#

ah

lyric mountain
primal musk
#

cant i use ctrl z on windows? as long as its in the bin

lyric mountain
#

I mean, you "can" retrieve it if you shutdown the system right away and take it to a data restore technician

lyric mountain
primal musk
#

fair enough

lyric mountain
#

windows actual delete shotcut is shift + del, if u just "delete" the file it simply moves to a reserved folder (bin)

#

u can do something similar on linux, just make a folder and write an alias to move things to there

primal musk
#

o

boreal iron
#

As long as the sectors aren't overwritten (by accident) data is always "completely" recoverable

#

If the data would be overwritten aka. deleted for real your drive would reach its max TBW real quick

#

too keep things simpe

violet latch
#

how to delete a bot from my profile

earnest phoenix
#

By clicking on the very secret delete button on your bot's page

#

I know, mind blowing

rustic nova
#

Daily reminder to use git

hushed robin
#

why

civic scroll
#

gitgud

surreal sage
#
npm ERR! code 3221225786
npm ERR! path C:\Users\Astrid\AppData\Roaming\npm\node_modules\node-pty
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/install.js
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR!
npm ERR!   conpty.cc
npm ERR!   path_util.cc
npm ERR!   win_delay_load_hook.cc
npm ERR!   Generating code
npm ERR!   Previous IPDB not found, fall back to full compilation.
npm ERR!   All 946 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
npm ERR!   Finished generating code
npm ERR!   conpty.vcxproj -> C:\Users\Astrid\AppData\Roaming\npm\node_modules\node-pty\build\Release\\conpty.node
npm ERR!   conpty_console_list.cc
npm ERR!   win_delay_load_hook.cc
npm ERR!   Generating code
npm ERR!   Previous IPDB not found, fall back to full compilation.
npm ERR!   All 177 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
npm ERR!   Finished generating code```
Enjoy the chat flood, can anyone help me?
boreal iron
# lyric mountain

Yeah I'm aware, just to relate your statement which could cause confusion

earnest phoenix
surreal sage
#

aa

grim aspen
#

Looks like itโ€™s trying to find a folder/file that doesnโ€™t exist

earnest phoenix
#

Hard to find cPES_Wink

violet latch
violet latch
earnest phoenix
#

Literally on your bot's page

#

As I said

violet latch
earnest phoenix
#

It's not your bot's page

#

You clicked on "Edit"

#

Did I ever say that? No.

violet latch
#

Danke

#

*Thank you

quartz kindle
#

you pressed ctrl C

surreal sage
#

yea took a bit too long

#

and it's installed now

#

it was hanging

#

not forever

#

but the spinner wasn't spinning either

#

so

peak drum
#

yeah some times that happens xD

earnest phoenix
#

Can anyone help me

#

Not if you don't ask anything

hushed robin
#

๐Ÿ”ฅ

earnest phoenix
#

Can you help me to add button which opens modal and send the input the same channel where the button was clicked @earnest phoenix @hushed robin

#

Just show your current code

hushed robin
#

yuh

earnest phoenix
#

And if you've made no attempt before, do at least one and show the code you came up with

hushed robin
#

are you using discord.js?

earnest phoenix
#

A sec

hushed robin
#

if so they have a guide on using modals

earnest phoenix
#

Then show them

#

Many

#

if (interaction.commandName == "important") {
let embed = new MessageEmbed()
.setColor("BLURPLE")
.setTitle(Important!!)
.setDescription(To add the members to the server, you will need a bot. After you added the bot. Click on **Done**.);

    let noob = new MessageActionRow().addComponents([new MessageButton()
                                                     .setLabel("Done")
                                                     .setCustomId("done_done")
                                                     .setStyle("SUCCESS")
                                                    .setEmoji("โœ…๏ธ"),
                                                    ]);

return interaction.reply({
embeds: [embed],
components: [noob],

#

I have to add modal in this

hushed robin
#

this will help

#

it explains how to use modals

lyric mountain
#

that bot is a little sussy

spark flint
hushed robin
#

whats the bot do

spark flint
#

from what it seems

#

oauth joins

hushed robin
#

oh

#

sussy sus

earnest phoenix
#

๐Ÿ˜‚๐Ÿ’€๐Ÿ’€๐Ÿ’€

spark flint
#

so what is it then

lyric mountain
#

I suppose the bot invite would try to sneak a "Join servers" scope so whatever that command is could simply pull its users to the server

#

took too long to send that, internet had a hiccup

wheat mesa
#

So thatโ€™s how raids end up happening so easily sometimesโ€ฆ

lyric mountain
#

well, I mean, the bot's intent could be to allow "member sharing" among servers, but it'd definitely crash the server in the process lmao

hushed robin
#

ok

coarse fjord
#

Is this the original package?

grim aspen
#

Ye

coarse fjord
#

can someone teach me, how to make my bot send a message to a channel when someone votes for it?

winged linden
#

can someone help me with that error?

TypeError: Chart is not a constructor

glacial orbit
#

Can someone verify my bots pls

lyric mountain
#

wait your turn

sharp saddle
glacial orbit
#

ok

#

i wasnt rushing anyone i was just wondering sorry

hushed robin
#

not sure how you want someone to help further without knowing what Chart is ๐Ÿ˜”

wheat mesa
winged linden
quartz kindle
#

its not a built in thing, its either something you made, or a library you are using

#

so if its something you made, show it, if its a library you're using, tell us which library it is

wheat mesa
#

Yeah we donโ€™t know what Chart is, but from this error message itโ€™s obviously not a class

quartz kindle
#

yeah but we dont know if its supposed to be a class or not

#

so we dont know if they are using it wrong, or the lib is broken

crystal wigeon
#

hey, how do i use sqlalchemy with multi processing? When a new process is spawned i can see a new postgres connection but it keeps crashing and it doesnt update the data

civic scroll
crystal wigeon
#

someone help me with python CRS_MiaIsCold

quartz kindle
#

call a snake handler

crystal harness
#

Hey

winged linden
quartz kindle
winged linden
lyric mountain
#

are u using official chart.js or that alpha fork of it?

#

also doubt it's broken as it's one of the most used node libs

boreal stream
#

hey guys sup
is here anyone that knows how to work with the firebase to help me a bit

stark abyss
lyric mountain
#

i can catch, you'll fail for UnknownIssueException

earnest phoenix
#

anyone have a bot idea ?

quartz kindle
primal musk
#

english

limpid estuary
#

I'm having a problem with my bot page
the profile picture of the bot appears as a letter insted of the proper icon

lyric mountain
#

refresh data -> edit -> save

quartz kindle
earnest phoenix
#

@errant horizon You're here too

wheat mesa
#

@lyric mountain streams my beloved

lyric mountain
#

Oh, u discovered them lul

#

They're extremely powerful and fun to use