#development

1 messages · Page 126 of 1

wise citrus
#

I'll attempt an integration then

quartz kindle
#

good luck!

wise citrus
#

Thanks

#

I first need to fix a previous issue though

ancient nova
#

new game sneak peak boisss

#

any tips

lyric mountain
#

that label gave me astigmatism

wise citrus
#

Uhhhh guys, I duped my bot code, removed everything but one command to test it, ran the new bot version with this one command, refreshed discord but all my previous commands where still present. What do I do?

#

No new commands are being pushed to the bot, idk how to fix

wise citrus
#

Yeah

quartz kindle
#

is it the same bot token?

wise citrus
#

Yep

#

I reset it just in case as well

quartz kindle
#

did you remove the other slash commands?

wise citrus
#

Yep

#

I removed all the code

quartz kindle
#

by sending a delete request to the api

wise citrus
#

But the one

wise citrus
#

I just removed the code from the script and restrated the bot

quartz kindle
#

slash commands are registered and unregistered via api requests to the discord servers

wise citrus
#

How does that happen?

quartz kindle
#

yoi probably already have code to register them

#

it its not needed to register every time the bot starts

#

commands should be registered only once, and then only if you need to update something in their structure

#

and if you want to remove them, you need to unregister them

wise citrus
#

All i do is write the code for it, save the file, restart the bot

#

They usually then appear on discord

#

But all of a sudden they aren't

quartz kindle
#

show the code where you create the slash commands

wise citrus
#

And I can't remove them

#
async def botserverlist(ctx: discord.Interaction):

    if not stop_all_commands:
        users_cursor.execute("SELECT Admin FROM usersdb WHERE user_id = ?", (ctx.user.id,))
        user_admin = users_cursor.fetchone()[0]

        if user_admin == 0:
            await ctx.response.send_message(f"You do not have permission to run this command.")

        else:
            for guild in bot.guilds:
                servers = "".join(guild + "\n")

            await ctx.response.send_message(servers)
        
    else:
        await ctx.response.send_message(f"All commands are currently disabled. Watch [#1111010464026066964](/guild/264445053596991498/channel/1111010464026066964/) for any updates.")```
#

That's the test command

quartz kindle
#

you will have to ask in the support server of your discord library, its probably registering them automatically for you

#

you can remove them by fetching all commands, and them removing the ones you dont want

#

check the documentation for your library for how to fetch slash commands and how to delete them

slender wagon
#

What's the best way to pass a variable to another function

#

for example:

let finalCost = calculateCost("V3", idsJson.ids.length)

finalCost is inside a function but i want to use it on other functions too

boreal iron
#

Just make it a global var?!

#

Define it outside your functions

slender wagon
#

well the idsJson for example comes from the input of the function

proven lantern
#

does discord have any monetization rules like apple where you aren't allowed to sell stuff outside of discord eco system?

lyric mountain
#

wdym?

proven lantern
#

like can my bot return a link to sell a subscription instead of using the server subscription thing Discord built

lyric mountain
#

yes you can

proven lantern
#

nice!

#

i just found this. im reading through it

#

but if someone is using discord on iOS then my bot wouldn't be allowed to sell outside of iOS?

#

i think

solemn latch
#

Anyone tried indexnow for seo?

eternal osprey
#

that doesn't matter as my resource folder is seen as the main resource entry

#

all other things worked with using Videos/file.extension

#

and videos and ringtones are in the same file.

#

really?

quartz kindle
#

it also said you can use Path and File classes to do it for you

#

new Path(path).toURI().toString() or something

eternal osprey
#
  ImageView imageView = new ImageView(new Image(imagePath));```this worked fine for me, where path = "Videos/file.extension".
#

except for the ringtone it just doesn't for some reason

#

it cannot find it

quartz kindle
#

well different classes require different arguments

#

Image is not the same as Media

#

you have to check what each class constructor requires

eternal osprey
#

aha,

new Media(getClass().getResource(ringtonePath).toExternalForm())``` this one worked.
quartz kindle
#

you can always check the javafx docs

eternal osprey
#

thanks for clarifying, i thought that image and media paths were the same

quartz kindle
#

Constructor Detail

Media

public Media(String source)

Constructs a Media instance. This is the only way to specify the media source. The source must represent a valid URI and is immutable. Only HTTP, FILE, and JAR URLs are supported. If the provided URL is invalid then an exception will be thrown. If an asynchronous error occurs, the error property will be set. Listen to this property to be notified of any such errors.

If the source uses a non-blocking protocol such as FILE, then any problems which can be detected immediately will cause a MediaException to be thrown. Such problems include the media being inaccessible or in an unsupported format. If however a potentially blocking protocol such as HTTP is used, then the connection will be initialized asynchronously so that these sorts of errors will be signaled by setting the error property.

Constraints:
    The supplied URI must conform to RFC-2396 as required by java.net.URI.
    Only HTTP, FILE, and JAR URIs are supported.
viral shoal
#

when trying to run the instruction using cpi :
'Program failed to complete: Instruction passed to inner instruction is too large (18446744073709551615 > 1280)',
this error occured. Is anyone help regarding this.

halcyon coral
#

I need help. I created an oauth2 app with guilds.join scope. I got the access token. But how do I make the user join a server?

eternal osprey
#

does anyone know a good site to bootstrap discrete data?}}|
So for example:
base_dataset = [
["create me an appointment for tomorrow 1:00", "appointment"],
["I have a date tomorrow at 20:00", "alarm"],
["I need to wake up at 7:00 tomorrow", "alarm"],
["I need to wake up", "uncompleted"],
["create me an alarm for 12 june at 12:00", "alarm"],
["create me an appointment for 12 june at 12:00", "appointment"],
["how are you?", howAreYou"],
["You are ugly", "cussing"],
["What appointments do I have for tomorrow?", "goToAppointments"],
["What alarms do I have for tomorrow?", "goToAlarms"],
["What appointments do I have?", "goToAppointments"],
["What alarms do I have?", "goToAlarms"]
]

lyric mountain
surreal sage
#

Shorter way to do this?

bool ? "string" : ""```
#

got it

#
bool && "string"```
lyric mountain
#

the latter will return either "string" or false

hidden patio
#

hi - this may not be the right channel to ask my question but i didn’t know where else to ask

#

does anyone know of a bot that can cycle between a few pics setting them as server icon? so every 24 hours for example it’d change the server icon to one of the images i had already provided

#

if someone answers, please ping me :)

quartz kindle
#

dont know a bot that does that, but should be very simple to do it yourself

deft wolf
#

It's probably even a few lines of code, you can write something like this without much problem in a few minutes

hidden patio
#

@quartz kindle @deft wolf yeah i'm aware but keeping it online is the issue 🫤

radiant kraken
hidden patio
deft wolf
#

Then you need to wait

halcyon coral
lyric mountain
#

bcuz like, I've saw many bots that try to sneak a join scope in invites and make people join servers without their consent

deft wolf
quartz kindle
#

well discord shows them what they are allowing, their fault for not reading

#

:^)

surreal sage
lyric mountain
halcyon coral
lyric mountain
#

condition && value will always return either value or false

#

regardless of where it is, because you're using &&

surreal sage
lyric mountain
#

yes, if you want to return a value if false

#

don't try to shorten too much, you might make things more complicated for you

dusk sequoia
#

anyone know any hosting service for discord bots like i dont wanna go with aws and all cause really dont wanna pay high for a discord bot

peak drum
#

i can offer you a discord bot hosting for €1

deft wolf
pale vessel
#

idk what I'd do without my friend

#

literally can't afford a VPS for my bot

#

the VPS compiles faster than my PC so I use it for compiling too LUL3D

peak drum
#

my vps is €8 xD

#

you can afford that right

pale vessel
#

naw brah

grim aspen
deft wolf
#

Mine is something like 10$ for 4gb ram

pale vessel
#

I need sundar pichai to give me a free google cloud vps

peak drum
#

mine is 8 for 8gb xD

pale vessel
#

REAL

peak drum
#

xD

#

why a google cloud tho

pale vessel
#

because @nova ingot

lyric mountain
#

I do have one too, for him vps prices are a cup of coffee

#

for me it's a month's worth of coffee

peak drum
acoustic bough
#

(ignoring that I am mostly selfhosting by now)

deft wolf
#

Then I'm gonna look for better hosting kapp

boreal iron
#

man discovered hot plug devices mmLol

grim aspen
#

^

rustic nova
#

or just a ups*

acoustic bough
#

Yes I do know that

#

One is main power other is 10 kWh battery

#

Please ignore the ssd without a caddy <3

#

@grim aspen @rustic nova (just pinging because of my reply above)

acoustic bough
#

dont ask why I made this pic but there is the battery

slender wagon
#

Hallo

#

So i am working on a project where i need to generate a subdomain automatically

#

Do you guys know what could be a way around it?

proven lantern
#

wildcard cert

slender wagon
#

How does that work?

proven lantern
#

it gives you https for your domain and subdomains

acoustic bough
#

hi @slender wagon

slender wagon
#

Ssl is gonna be for later, i now need to figure out how to create the subs automatically

slender wagon
slender wagon
#

Ah

rustic nova
#

since when do they support * masks

#

or is that only on proxied mode

acoustic bough
#

3-4

eternal osprey
#
Tell me a joke, error
What's the best way to learn a new language?, error
Please cancel my appointment for next Thursday, goToAppointment
Translate 'hello' to Spanish, error
Remind me to buy groceries tomorrow, error
Set an alarm for 6:00 PM, alarm
fuck you bitch, curse
man fuck you, curse
yo what's up, greeting 
how are you sir, greeting
everything good, greeting
hey, greeting
hello, greeting```

is there anyone who knows how to bootstrap a small dataset like this so that i can use it for my decision tree?
lyric mountain
#

buddy, lemme tell u

#

you're in for a HUGE work making something like this

#

that's literally half the work of making an ai

eternal osprey
#

😭

#

i thought that there were some packages online to use

lyric mountain
#

there kinda is, tensorflow

#

but it won't be as easy as u might think

frosty gale
#

its free and pretty simple to use and you query it using an api and you assign labels to text

#

only downside is you need to login via facebook but you can use a burner one

boreal iron
#

you're partially right saying usually but in fact those PSUs not only act as redundant power supplies but also increase the max Watt the server can use while one usually only delivers 450W max

#

Also not only the power redundancy outside the PSU matter but PSUs can fail as well making it highly recommendable to not only plug one in even if they all use the same outer power source

boreal iron
#

That's impossible the see on mobile

#

Just do a screenshot

#

Which is your target element?

#

Can't u just use its as selector?

#

An ID should be unique and static

#

But does the ID?

#

---new-message-bar

#

The selector would be:
div#---new-message-bar

#

Ah messages bar

#

I forgot a s

#

Like I said I highly doubt the ID changes

#

So you could use it

#

You can also combine the class the and ID in one selector

#

To be sure it's your element

#

div[class=...]#---new-messages-bar

#

Like I said before I'm sure the element ID (---new-messages-bar) will be permanently and unique

lyric mountain
#

wont just ```css
#---new-messages-bar {
display: none
}

#

cuz like, ids are unique anyway

boreal iron
#

I asked before already got no answer

lyric mountain
#

they'd be fairly crazy to change ids tbh

boreal iron
boreal iron
#

Could have an abstract new name by tomorrow

#

Just because why not

#

Yeah you never know

eternal osprey
boreal iron
#

Many, many providers nowadays offer APIs for example also allowing you to change your dns zone

#

You could also create your own dns infrastructure mmLol

#

Then writing a simply API locally resolving the dns zones changes on your system

#

By executing the associated commands on your system

slender wagon
#

Shit i will be buying the domain out of a .al provider

#

I doubt they have that

#

I might have to get a .com

boreal iron
#

Might be easier this way around

#

Or like I said host a dns server yourself, buy the domain and change the nameservers to your(s)

frosty gale
#

i will buy .zip domain

frosty gale
#

and even then we struggled to prop it onto the stand lol

#

its designed to power an entire office, computers, network, servers etc for a couple of hours and its only the size of roughly a pc

proven lantern
#

if you have a premium option on discord's app directory how can you tell if a server is currently subscribed? is there a flag in the interaction messge?

boreal iron
boreal iron
#

But they usually last many many years when not constantly being under full load

hushed robin
#

is it actually possible to make a crash predictor

wheat mesa
#

...predictor?

hushed robin
#

predictor

wheat mesa
#

That's called the halting problem

#

You can definitely tell if your program is going to crash IF you're the one controlling when it crashes, i.e "Oh this function returned an error, I'm going to terminate the program in x seconds"

hushed robin
#

no

#

i dont think u understand

wheat mesa
#

Then explain it better

hushed robin
#

not that type of crash

#

crash is a gamemode on gambling websites

#

i see a lot of them on github but they all look like malware tbh

#

im not trying to make one btw im just wondering

wheat mesa
#

I highly doubt that it's possible to predict gambling websites. That's the whole point.

hushed robin
#

yeah thats what i thought

#

this came into my mind because someone in this server im in is trying to hire someone to make one

wheat mesa
#

Whoever is asking for that is incredibly stupid and inexperienced with how randomization works

#

They just say "machine learning" as if an AI can predict randomness any better than humans can

#

Not to mention the incredibly large dataset you would need to train such a model to even get it to play like a human

#

I'm sure there's some sort of "intuition" involved, and maybe some small patterns, but it's not going to be possible to predict this type of stuff any better than a human, otherwise it would've been done decades ago

hushed robin
#

people would get very rich

#

is it possible to bot stars on github

wheat mesa
#

I'm sure it is but that's not something that is ethical nor something you would receive help with here

hushed robin
#

oh no i dont wanna bot them

#

im just asking because this repo has like 170 stars and all it is is an exe

#

i think its teting to scam people

lyric mountain
wheat mesa
#

true!

#

kuuhaku I'm trying to come up with a syntax for my JVM language, any ideas?

#

I sort of have this syntax in mind, but it's kind of odd

lyric mountain
#

what's the ? for?

wheat mesa
#

All this really does is switch up Java's syntax

wheat mesa
#

That's not how the lang would actually look in practice

#

For this example it could be something like ```
func main() {
stdout("Hello world!");
}

class Main: public {
someInstanceVariable: public int;
static MY_NAME := "Waffle";

Main(): public {
someInstanceVariable = 15;
}
}

#

This is just brainstorming I came up with in 5 minutes, I'm not really liking it so far since it's basically just java with more confusing syntax

#

I do like the idea of not having the main method enclosed within a class, and I do want to be able to have better type inference than javac does

#

So I am kind of liking the var someVariable := "Type inference!"; idea, but still not married to it

lyric mountain
#

public in front of the name makes me uneasy

#

but idk what to say, it does look unique

#

maybe a bit close to kotlin

radiant kraken
#

just use the equal sign

wheat mesa
#

Fair

dusk sequoia
#

anyone who can help me that how can i upload images to cloudflare r2 bucket using apis??

like if anyone can help me or provide me docs?

dusk sequoia
#

pls?

desert verge
acoustic bough
frosty gale
#

i wanna make my own UPS on a side note

#

would be an interesting project

#

connecting some kind of microcontroller, high current transistors, maybe some car batteries or anything i can find

#

something that can generate 230v ac

#

im no electrician tho

rustic nova
#

then thats a bad idea

#

try smaller

#

try to make your own powerbank first

#

then build up from there

frosty gale
#

probably a better choice lmao

#

have a phone charger connected to it which in turn is connected to a phone/etc and have it switch to battery backup if phone charger switches off

rustic nova
#

something like that

#

as long as it is below save levels of power

#

below dangerous levels*

neon leaf
#

so I have a c++ node module that exports 2 function, 1 takes in a v8 function and saves it in a new struct with the context and actual function then returns the memory address as string to js, then I have a function that takes in a v8 string and turns it into a pointer to the struct (that part suprisingly works 100% fine) and then aims to execute the function with the saved context, problem has to do with where im calling it, im executing the 2nd function in a worker with a different isolate but still want to use the other context, how can I do that (Im aware of race conditions)? I already have something but im getting v8 errors related to handles.
https://pastes.dev/717wixB5Q9
(the code may be a mess because im testing around)

acoustic bough
acoustic bough
earnest phoenix
#

I need help

#

this ping command is not working

earnest phoenix
#

Enable the "Message Content" privileged intent from the Discord Developer Portal for your bot, and also enable that intent in your code:

intents = discord.Intents.default()
intents.message_content = True

client = commands.Bot(command_prefix = "!", intents = intents)

...
#

tysm @earnest phoenix

#

been so long since i actually tried to code a bot (1yr+ prob)

#

what's this error for

#
TypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
earnest phoenix
earnest phoenix
#

tysm

#

i'll head to the documentation then

earnest phoenix
#

I have to objectify it?

frosty gale
#

might still pursue it in the future but im chilling rn

#

i had an interview for arm to be a designer of processors but i had to cancel because terrible dates and i have other things planned rn

wheat mesa
#

We also don’t know if those lines are what’s causing your error there

earnest phoenix
frosty gale
#

🐱

wheat mesa
#

Yeah no that’s not what’s causing your error there

earnest phoenix
#
Error: Expected the value to be an object, but received string instead
    at ObjectValidator.handle (/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:1161:25)
    at ObjectValidator.parse (/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:113:88)
    at EmbedBuilder.setFooter (/home/runner/Generator/node_modules/@discordjs/builders/dist/messages/embed/Embed.cjs:66:37)
    at Object.execute (/home/runner/Generator/commands/activate.js:56:16)
    at Client.<anonymous> (/home/runner/Generator/index.js:79:32)
    at Client.emit (node:events:390:28)
    at Client.emit (node:domain:475:12)
    at MessageCreateAction.handle (/home/runner/Generator/node_modules/discord.js/src/client/actions/MessageCreate.js:23:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/runner/Generator/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
wheat mesa
#

Yeah that’s caused by <Embed>.setFooter()

#

Check the docs for Embed, it takes an object now, not a string

earnest phoenix
#

aight

#

MessageEmbed also not a builder now ;-; it's EmbedBuilder tf

deft wolf
#

I think they changed it when upgrading from v13 to v14

frosty gale
#

they keep changing shit literally every v0.0000000000000001

#

they probably also turn typo fixes in documentation into breaking changes somehow

rustic nova
#

welcome

#

to discordjs

#

anyways what version you're using? v512093 or v6932843242343

peak drum
#

no i use v9990809830284

earnest phoenix
#
/home/runner/Generator/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:293
        throw new DiscordAPIError.DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
              ^

DiscordAPIError[50006]: Cannot send an empty message
    at SequentialHandler.runRequest (/home/runner/Generator/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:293:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (/home/runner/Generator/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:99:14)
    at async REST.request (/home/runner/Generator/node_modules/@discordjs/rest/dist/lib/REST.cjs:52:22) {
  rawError: { message: 'Cannot send an empty message', code: 50006 },
  code: 50006,
  status: 400,
  method: 'POST',
  url: 'https://discord.com/api/v10/channels/1114585209262854315/messages',
  requestBody: {
    files: [],
    json: {
      content: undefined,
      tts: false,
      nonce: undefined,
      embeds: undefined,
      components: undefined,
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: undefined,
      flags: undefined,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined
    }
  }
}
#

this error pops up

#

when I use a command

#

and idk why it pops up ._.

#

it is trying to send a message correctly with correct parameters I think

deft wolf
#

I don't think so

#

There is no embeds or content value

earnest phoenix
#

this is how it's trying to send

sharp geyser
#

are you sure that is where the error is coming from?

earnest phoenix
#

think so

#

I'm only using that command

#

and there's nothing in index.js that sends a message

sharp geyser
#

Well if that is how you are doing it then somehow embed is not working properly

earnest phoenix
#

aight

#

ty anyways

earnest phoenix
#

You can find out by running npm ls discord.js

deft wolf
#

The latest rather, it makes no sense to install v13 right? Aware

rustic nova
#

am i allowed to get brain damage from sql?

#

actually nvm

earnest phoenix
#

(The latest stable version)

#

oke

#

I did

#

And it looked like it fixed and it appeared new error, when I fixed the new one it appeared again

#

I'll be looking deeply into my code, thx for the help here

rustic nova
#

Got something assigned by my teacher to do

#

Code a dashboard that is connected to mysql

#

Got a preset of a database

#

Shit is weird

rustic nova
#

question to mfs understanding sql

#

Lets say I have the following SQL query


SELECT table1.id FROM table1, table2

Now wanting to use subqueries to do a IN query, am I able to refer to the table2 when wanting to check if said id is in another row of table2?

Such as

SELECT table1.id FROM table1, table2
WHERE table1.id IN (table2.id)

Or do I specifically need to make a subquery

SELECT table1.id FROM table1, table2
WHERE table1.id IN (SELECT table2.id FROM table2)
#

because if I do refer to it in the subquery using table2.id, it just returns every id

#

and I feel like it would interfere with any query section from the SELECT table2.id FROM table2 query I've made, or is that FROM only scoped to that subquery

foggy monolith
#
/home/runner/ServerGuard/node_modules/@discordjs/rest/dist/index.js:640
      throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
            ^

DiscordAPIError[40060]: Interaction has already been acknowledged.
    at handleErrors (/home/runner/ServerGuard/node_modules/@discordjs/rest/dist/index.js:640:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async BurstHandler.runRequest (/home/runner/ServerGuard/node_modules/@discordjs/rest/dist/index.js:736:23)
    at async REST.request (/home/runner/ServerGuard/node_modules/@discordjs/rest/dist/index.js:1387:22)
    at async ChatInputCommandInteraction.reply (/home/runner/ServerGuard/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:111:5)
    at async Object.execute (/home/runner/ServerGuard/Commands/Moderation/auto-setup.js:39:5) {
  requestBody: {
    files: [],
    json: {
      type: 4,
      data: {
        content: '✅ Autorole has been set to <@&1113973366311886959> and will show a message in the channel [#1114582937938174004](/guild/264445053596991498/channel/1114582937938174004/).',
        tts: false,
        nonce: undefined,
        embeds: undefined,
        components: undefined,
        username: undefined,
        avatar_url: undefined,
        allowed_mentions: undefined,
        flags: undefined,
        message_reference: undefined,
        attachments: undefined,
        sticker_ids: undefined,
        thread_name: undefined
      }
    }
  },
  rawError: {
    message: 'Interaction has already been acknowledged.',
    code: 40060
  },
  code: 40060,
  status: 400,
  method: 'POST',
  url: 'https://discord.com/api/v10/interactions/1114678929618391120/aW50ZXJhY3Rpb246MTExNDY3ODkyOTYxODM5MTEyMDpYNDVwZEF1ampGQVdzVmZnaXV6WTJneTdteEc2djJtMVRUNlJCS1MwcHB3WUdVV29ZTnpBbXk2aDFiaDhUU2lmQjltMzIyYm5TY1lqTVIzcmxTTkdOeHhLVGFja0FQZnBTYVM0dDhMQ2xacnhWRXVzZ2xXTktwdlhrTkNrVUhsTw/callback'
}``` help please
rustic nova
#

the interaction has already been acknowledged

#

you cant respond to an interaction again

#

yeah nah fuck sql

#

fuck that

foggy monolith
rustic nova
#

no

foggy monolith
rustic nova
#

I just said no

foggy monolith
#

please can you help me

rustic nova
#

I cannot

foggy monolith
#

why not

rustic nova
#

because I have no clue about the library or the language or the thing you're doing there

#

wait for someone who can

thorny bay
#

so

#

whats wrong

foggy monolith
foggy monolith
foggy monolith
thorny bay
#

chill

foggy monolith
#

ok

#

sorry i just need it fixed

#

so do you know how to fix

thorny bay
#

let me see

foggy monolith
#

ok

thorny bay
foggy monolith
#

software?

#

v14 djs

#

and js

thorny bay
#

no like

#

replit

#

vscode

foggy monolith
#

ye

#

replit

thorny bay
#

add 06prive to the repl

#

ill try to fix it

foggy monolith
#

why couldn't u tell me

thorny bay
#

and remove token from script if you want

rustic nova
#

Might suggest not to

thorny bay
foggy monolith
thorny bay
foggy monolith
thorny bay
#

leme search

foggy monolith
slender wagon
#

warn(prisma-client) There are already 10 instances of Prisma Client actively running.

#

how the fuck does this happen

pale vessel
#

shit code

rustic nova
slender wagon
#

does restarting the serveer 300 times within a few minutes count?

#

oh fuck

#

i am so stupid

#

i am creating new instaces on all files instead of importing it

slender wagon
#

at least it wasn't on production

foggy monolith
#

@thorny bay #

neon leaf
#

whats the best way of making some commands only viewable by x ids? not just block the command with a basic if check, literally disable seeing the command for non registered people

quartz kindle
#

i dont think there is a way to do that

#

only via roles and channels

deft wolf
#

But you can't code it when deploying command no? You would have to set it manually on the server in the "integrations" tab

rustic nova
boreal iron
#

It doesn't ping anyways
What's the point then of filtering it?

#

smh

boreal iron
rustic nova
boreal iron
rose warren
#

It's very effective

neon leaf
peak drum
#

yes in the settigns tab of your server and then intergrations

#

and then your bot xD

desert verge
#

My Discord is so fucking laggy and my bot too

peak drum
#

😂

proven lantern
vapid gate
#

I just found out it takes 1 to 2 weeks

#

Dang

#

🥲

quartz kindle
hushed robin
#

bots can't edit the role / channel permissions for commands

#

only the server permissions

boreal iron
#

Not exactly

#

The permissions itself have to be passed within this when registering it

proven lantern
#

for users

boreal iron
boreal iron
knotty quartz
#

Hi I get this error:

    at Object.execute (/home/container/commands/help.js:63:65)
    at Client.<anonymous> (/home/container/index.js:90:46)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)```

However, I don't know how to fix it as it use to work and now it just glitches the bot.

```js
    const commandName = interaction.options.getString('command').toLowerCase();
rustic nova
#

getString is returning null

#

ensure the option you're looking for actually exists

#

print out the options

knotty quartz
eternal osprey
#
public void forwardDate(String input) {
        String filePath = "Videos/trainer.py";
        String filePath2 = "Videos/trainer.py";
        File file1 = new File(filePath);
        File file2 = new File(filePath2);
        if (file1.exists()) {
            System.out.println("File exists.");
        }
        if (file2.exists()) {
            System.out.println("File exists.");
        }```

how the fuck am i still getting a module or path not found error
#

i swear that file is in my Videos

#

and even when hovering over the file it shows the metadata

rustic nova
#

you cant just relative-path a file

#

your files are in the resources folder

eternal osprey
#

what should i do else then?

rustic nova
#

your code would theoretically check:

  • myapp.jar
  • Videos/trainer.py

which doesnt exist

eternal osprey
#

ahhh wauw i see

#

i tried to link my java project to my py model, it's an AI:

public void forwardDate(String input) throws URISyntaxException {
            try {
                setExecutable();
                File pythonScript = getFileFromResource("Videos/trainer.py");
                String pythonInterpreter = "python3";
                Process process = Runtime.getRuntime().exec(pythonInterpreter + " " + pythonScript);
                OutputStream outputStream = process.getOutputStream();
                PrintWriter writer = new PrintWriter(outputStream, true);
                writer.println(input);
                writer.close();
                InputStream inputStream = process.getInputStream();
                BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
                String output;

                while ((output = reader.readLine()) != null) {
                    System.out.println("Processed Output: " + output);
                }

                reader.close();
                process.waitFor();
            } catch (IOException | InterruptedException e) {
                e.printStackTrace();
            }

    }


#

however, my shit ain't working, no errors or whatsoever

peak drum
#

goodluck

#

it sucks when you don't get any errors

eternal osprey
#

Nick that ain't helpful the fuck should i do 😿

#

honestly i tried everything

#

nothing tends to work

rustic nova
#

bit confused tho

#

why not run the script directly

#

or whats your goal

eternal osprey
#

i have a javafx gui

#

upon button click i want to use my decisiontree, made in py to return my output

#

to my java file

#

to eventually use it

swift tusk
#

@somber ridge

frosty gale
#

my main pc has windows 11 but its annoying how microsoft really wants you to get it

rustic nova
#

it is annoying asf

peak drum
#

KEKWDisco your vm is eligble for windows 11?

rustic nova
#

though did end up upgrading it, not seeing any issues yet

peak drum
#

never saw that happen

#

xD

rustic nova
#

LMAO WAIT IS THAT A VM?

#

actually

frosty gale
#

yeah

rustic nova
#

copy the vm

#

and do an upgrade

#

would be interesting to see what it does

peak drum
#

well it does work

frosty gale
#

upsell number 2

peak drum
#

but i never saw the upgrade message

frosty gale
#

i have tpm enabled on the vm maybe thats why

#

and gave it good specs

peak drum
#

yes that's why

#

xD

frosty gale
peak drum
#

windows 11 needs the tpm chip

#

there are ways to upgrade without it but for the message to show it needs the tpm chip xD KEKWDisco

frosty gale
#

yeah i did that once you can use rufus to patch the iso to not force tpm

#

microsoft got way too comfortable adding soft requirements

peak drum
peak drum
quartz kindle
#

when windows 12

peak drum
#

never KEKWDisco

#

they will skip to 13

quartz kindle
#

11 is the classic bad one they release every 2 releases

peak drum
#

KEKWDisco true

quartz kindle
#

honestly

#

they should just use a versioning system lile nodejs

#

an lts version every 2 years

frosty gale
#

kinda like android

#

each major update you would get excited for because it would bring a new ui cool redesign and new features

#

now each major version is like eh

onyx urchin
#

every other windows release is bad

#

7 was good, 8 was bad, 10 was good, 11 is bad

earnest phoenix
# frosty gale now each major version is like eh

I would say that not every major version needs massive overhauls to the UI and features and whatnot, sometimes it's about improving the entire experience with some backwards incompatible changes or just improvements so great that deserves a major version bump

onyx urchin
#

11 is just a reskin of 10 that makes it harder for power users

#

also breaks some applications like steam with the fullscreen

frosty gale
earnest phoenix
#

Windows 11 is not just a reskin, there are lots of changes behind the scenes that makes it better than Windows 10

  1. It provides nicer and much more optimized APIs for the developers
  2. It revamps important/highly-used applications that never got a design update before (like Task Manager)
  3. It has much better performance improvements and consumes less resources
  4. Allows for native integration of Android applications
  5. Provides the latest and greatest support for all your hardware with the latest drivers available (ones that aren't compatible with Windows 10 or below)
  6. Improved multi-tasking and similar features

And more...

#

Basically there's no reason to not upgrade unless your device doesn't meet the Windows 11 requirements

earnest phoenix
# frosty gale they do it literally every year though i think if they dont have anything signif...

Not really how it works, in software development (including operating systems, because they're software as well), there can be breaking changes that just cannot land without a major version bump, and because of that reason lots of features or changes can fall behind that relies on the said breaking changes

For example, this is the reason why Google Chrome doesn't exactly follow the SemVer versioning scheme rules, they make major version bumps a lot even without user-facing changes, and Firefox also followed suit

digital swan
#

i've just started getting 'unable to get local issuer certificate' error on vscode terminal, works in my normal terminal. anyone know a fix?

earnest phoenix
digital swan
#

not from what i can see

#

happens with pnpm & logging into discord bot

earnest phoenix
# digital swan

You're clearly running a command then, show us the command you're running before that error

digital swan
#

node .

earnest phoenix
digital swan
#

discordjs

#

git pull works but pnpm doesnt also

earnest phoenix
#

Are you behind a proxy of some kind?

digital swan
#

nope

#

no vpn or anything

#

iterm works fine

#

just vscode terminal

earnest phoenix
digital swan
earnest phoenix
# digital swan

Does it work if you uncheck the "Http: Proxy Strict SSL" option and try again?

digital swan
#

okay weirdly its fixed after changing my node version

#

i didnt realise i was on 20.x so i went back to lts and now it works

earnest phoenix
#

Weird, though yeah there still are issues with Node.js v20, we haven't marked it as LTS so better stick to the latest LTS release (v18 currently)

digital swan
#

still confuses me how it only affected vscode

#

oh well at least it works now

earnest phoenix
#

Well VSCode itself uses Node.js, so there must've been some issues with setting up the proper environment with Node.js v20

hushed robin
#

how do i make this loopable

sharp geyser
#

you just use a for loop?

boreal iron
#

... of Object.entries(obj)

sharp geyser
#

if thats a json file just do

const jsonFile = require('somejsonfile')

for key,value of jsonFile.requirements {

}

no idea if this is right actually I have not used js in so long

#

god what have I become

hushed robin
hushed robin
boreal iron
#

then for .. in

sharp geyser
#

right cause naturally its not

#

so what fake said is the proper method

#

you can only index an obj like that not for of it

hushed robin
#

but how can i make it iritable without doing that

boreal iron
#

either using Object.entries() or a for .. in loop

#

those are your choices

sharp geyser
#

its easier to just do Object.entries

#

you aren't tim

hushed robin
#

i can loop through ranks without doing that tho

sharp geyser
#

because its an array of objects

hushed robin
#

yeah

#

so how do i do the same with requirements

sharp geyser
#

Object.entires()

hushed robin
#

without doing that bruh

sharp geyser
#

you can't

#

unless you do some wacky shit

hushed robin
#

but i did with ranks

sharp geyser
#

which is useless

#

BECAUSE ITS AN ARRAY YOU DUMBFUCK

hushed robin
#

how can i do with ranks but not requirements

hushed robin
#

bruh

sharp geyser
#

arrays are iterable by nature

boreal iron
#

an array is not an object

sharp geyser
#

objects are not

hushed robin
#

it is an array

#

look

sharp geyser
#

looks like an object to me

hushed robin
#

i made it this and it still doesn't work

sharp geyser
#

You fucked up

hushed robin
#

what

sharp geyser
#

one requirements is an object the other is an array of objects

#

smh

boreal iron
#

if you can already loop through ranks then you can also loop through requirements

hushed robin
#

oh wait

sharp geyser
#

when you loop it will hit the rank that doesn't have an array of requirements first

hushed robin
#

ok but it still doesn't work

pale vessel
hushed robin
#

why is it printing out thhe entire thing

#

instead of just one

boreal iron
earnest phoenix
sharp geyser
#

you can't for of an object

#

as we said numerous times

#

without using Object.entries

hushed robin
#

but i made it an array

earnest phoenix
#

You did, but the other ones are still an object and not an array

hushed robin
#

no i changed them too

#

still no work

earnest phoenix
#

Look carefully in your JSON file, or just show it to us

pale vessel
#

print each rank and see

hushed robin
sharp geyser
#

did you save the file?

hushed robin
#

yes

sharp geyser
#

double check

#

vscode users like not doing such things

hushed robin
#

😐

#

it's saved

pale vessel
#

print the object

rustic nova
#

wont for requirement of rank.requirements print out the full object?

#

since thats the only element in the array

hushed robin
#

no there's 3

pale vessel
#

rank, I mean

hushed robin
#

look

rustic nova
#

what do you mean with 3

pale vessel
#

print each rank and make sure all of them have requirements as an array

earnest phoenix
hushed robin
sharp geyser
#

not what he meant

earnest phoenix
#

Don't get into the implementation details much, you'll get lost

sharp geyser
#

but anyway

boreal iron
hushed robin
#

i'm looking at it right now

#

there's only 2 ranks

pale vessel
#

on the console?

sharp geyser
hushed robin
#

no in my file

rustic nova
#

pseudocode

for each requirement in rank.requirements
print requirement

result:
{"trainings": 2, "patrols": 2, "bounties": 2}

pale vessel
#

nah not the file

rustic nova
#

this is what you're getting with what you're trying

pale vessel
#

log it to console

hushed robin
sharp geyser
pale vessel
#

ya never know

earnest phoenix
rustic nova
sharp geyser
#

ik im fucking with ya

#

kek

hushed robin
rustic nova
#

I'm good enough to work with jquery (cry about it) on prod code

hushed robin
#

i wanna loop through them to see if they're valid

#

that's the point

rustic nova
boreal iron
sharp geyser
#

im good enough to fuck up jquery (cry about it) on prod code

pale vessel
#

what are you using jQuery for

rustic nova
#

yes

hushed robin
sharp geyser
#

I dont even know what jquery is

#

I know its some ancient dinosaur

hushed robin
#

can anyone help

sharp geyser
#

and commonly used on web apps

hushed robin
#

i don't understand

earnest phoenix
#

Your car...

boreal iron
sharp geyser
#

Can't take voltrex seriously when he doesn't even have a car

earnest phoenix
#

Better than having a goofy ahh car

sharp geyser
#

not really

#

he gets around places

#

you walk

#

imagine

earnest phoenix
#

Wait imma just download a car

sharp geyser
#

same

#

Matter of fact

#

ima just make my own tesla

earnest phoenix
#

Elon Misty

sharp geyser
#

yessir

earnest phoenix
sharp geyser
#
import { Client, ClientOptions } from "discord.js";

declare module 'discord.js' {
    interface Client {
        // Will later add stuff here so intellisense picks stuff up
    }
}

export default class GalaxyClient extends Client {
    constructor(options: ClientOptions) {
        super(options);
    }

    
}

Help my code doesn't work, I was trying to take over the galaxy but the client is borked

earnest phoenix
#

Instead of that, that formatting is taking over my brain cells

hushed robin
#

ok changing of to in works but

#

it only returns the text

#

how can i make it return the number beside

sharp geyser
#

probably rank.requirements[requirement]

rustic nova
#

does it return literally {trainings: 2, patrols: 2, bounties: 2}

earnest phoenix
#

in gets the enumerable keys in objects

boreal iron
#

watching that dude is getting me an headache

sharp geyser
#

its not formatted

earnest phoenix
#

I know it's not formatted, hence I'm pointing out the general formatting of the code

pale vessel
earnest phoenix
sharp geyser
#

looks perfectly fine to me

#

I also don't remember how to make discord bot

#

😔

earnest phoenix
#

I'm talking about the extraneous newlines there

boreal iron
#

can't have a proper car and cant have a proper screen

rustic nova
#

if client no work

#

reason: skill issue

boreal iron
sharp geyser
#

I think you're going crazy

earnest phoenix
sharp geyser
#
import { Client, ClientOptions } from 'discord.js';

declare module 'discord.js' {
    interface Client {
        // Will later add stuff here so intellisense picks stuff up
    }
}

export default class GalaxyClient extends Client {
    constructor(options: ClientOptions) {
        super(options);
    }
}

looks perfectly fine to me

#

PHP is a language

#

just not the best

boreal iron
#

quiet misty

sharp geyser
#

hey I am sticking up for you

boreal iron
#

you don't know anything about it anyways

#

so shhhhh

sharp geyser
#

I know enough

boreal iron
sharp geyser
#

I know its older than dirt itself

#

and its obsolete

earnest phoenix
sharp geyser
#

Still don't see it

earnest phoenix
#

Just like in the screenshot Flazepe showed

boreal iron
#

there ain't enough red arrows on your pioc

#

*pic

earnest phoenix
#

Oh shit you're right

#

That should make it clearer

sharp geyser
#

Hmm still not getting the picture

earnest phoenix
sharp geyser
#

Ah

#

thanks

boreal iron
#

@earnest phoenix any good minimal system recovery tool you can recommend?
It requires disk dump, ssh and network service
I have to copy the entire disk as the source currently is Windows (sadly) but I need the system to be deployable even as backup

#

Deployable as ISO and should load itself into the ram

earnest phoenix
boreal iron
#

I need to move a cloud server into my local proxmox instance
Since the host system is windows i have to copy the entire disk byte by byte to take all data with me

#

So I'm activating rescue mode on the host and wanna use disk dump to move all data to the target, the entire file system

#

The target yet is an empty VM hasn't anything on it

#

Just grub sub system

#

I need the target to be in rescue mode too to overwrite the entire file system

#

Just dunno any good rescue mode software for the target

#

The host uses the providers rescue system of course

#

Guess I will just have to test random shit I can find in the net

earnest phoenix
#

Oh no idea, I've never been in such a situation so never used anything like that before to recommend a good one

boreal iron
#

Makes me sad topggDoge

hushed robin
#

how do i get status code using fetch

rustic nova
#

response.status

sturdy verge
#

hey guys, got an issue, my bot (reaction roles) decided it didn't want to work. Anytime I type in any command for it I get

Reaction Roles
BOT
— Today at 4:24 PM
The application did not respond
Only you can see this • Dismiss message

any idea whats going with it?

rose warren
#

Or there's an error in your code that's preventing it from responding.

#

Check your logs.

sturdy verge
rose warren
#

Where are you hosting it?

sturdy verge
#

that what you meant?

deft wolf
#

Where do you run your bot

rose warren
#

No where does the code run?

#

Actually, is this your first time trying to set up your bot? Or did you get it running before?

#

I assume you got it running before in some capacity since the commands have been posted to the Discord API.

sturdy verge
#

I had someone set it up for me. this person also set the roles up

#

however I haven't touched anything, I noticed that all a sudden roles just stopped working, when I asked this perosn if she knew, she said she never seen this before.

rose warren
#

You should ask them how to start the bot process then. We can't help you.

#

-needdev

gilded plankBOT
#

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.

sturdy verge
#

that system.

#

but I'll double check

rose warren
#

We're not affiliated with any of the bots on our site.

#

You need to talk to your developer.

sturdy verge
#

Oh I seee.

#

You wouldn't have the reaction role bot discord?

rose warren
#

I very much doubt she's using their code.

#

It's not public.

sturdy verge
#

So what do I do then? how do I fix my reactional roles?

rose warren
#

She's either coded it herself or used an open-source repository. You can either just use that bot you mentioned above or another one, or contact your developer to fix the one she made.

#

@sturdy verge is the bot online?

#

And are you getting the error when clicking a button? Or running a command?

sturdy verge
#

So basically when I type in any command, like /stats

#

it'll pop up that same message

rose warren
#

If the bot is online you can also check that your Discord app is up to date.

sturdy verge
#

I'll check discords app now

rose warren
#

But ultimately you should resolve this with your developer and not us since you have no access to the bot process, host or code.

sturdy verge
#

Also on the members list on my discord, that's bot is offline, MEE6 and Streamchord are online but Reaction Roles is not.

rose warren
#

Yeah we can't help you then. Talk to your dev.

earnest phoenix
#

I am Doing a Chatbot, So can I enable privileged intents for my Discord Chat bot?? If my bot got verified??
The Bot is working there is a command called /setchannel so after we put a channel name the bot will start chat there if we messaging in that channel. so will I can Approve privileged intents to the chatbot if the bot got verified??

peak drum
#

I guess they will allow that

lunar copper
#

Hi

oak wind
#

@shell tundra

solemn latch
#

How does autocomplete on slash commands work?

Will discord send an autocomplete interaction as soon as a user focuses a specific field?

boreal iron
solemn latch
#

yeah
I am focused on 'user' here

#

👀

boreal iron
#

You receive an interaction as soon as the user starts typing for choices

solemn latch
#

not typing, just as soon as it is focused(clicked on or tabbed onto)

boreal iron
#

to provide the list of choices

solemn latch
#

hmm 👀 its a shame if its only when they start typing

boreal iron
#

Well seems like it's not

#

An autocomplete interaction can return partial data for option values. Your application will receive partial data for any existing user input, as long as that input passes client-side validation. For example, you may receive partial strings, but not invalid numbers. The option the user is currently typing will be sent with a focused: true boolean field and options the user has already filled will also be sent but without the focused field. This is a special case where options that are otherwise required might not be present, due to the user not having filled them yet.

#

so...

#

The option the user is currently typing will be sent with a focused: true

solemn latch
#

darn

#

thanks

boreal iron
#

guess the user needs to start typing

solemn latch
#

It wouldnt be an issue, but I dont expect users will remember their choices.

boreal iron
#

I mean, you could just use a select menu

#

also using autocomplete

#

save the last inputs of the user and display them as options

#

I mean since it's a message component you can update the select menu at any time

solemn latch
#

ay it runs on focus

boreal iron
#

ah

#

i mean it does make sense tho to display choices when on focus

pale vessel
#

you need some separators in your names

boreal iron
#

smh

pale vessel
#

w(ebh)oo kid

#

ed it web hook

#

I hate lowercase convention

rustic nova
#

weoo kid

#

ebh

#

Woo kid

solemn latch
spark flint
#

well focus is possible

#

but typing event is a few seconds after

#

prevents it spam sending events everytime they spam letters KEKW

solemn latch
#

it happens on focus, which was my only concern

spark flint
#

ahh ok

warm surge
#

something ain't right here

rustic nova
#

sus

#

gib bot page

warm surge
#

and my AD blocker is off and it's still making me turning it off even tho ITs OFF

rustic nova
#

gib bot page url

#

kthx

warm surge
#

bruh

warm surge
rustic nova
#

try disabling it, then ctrl+5 on the voting page

#

works for me

warm surge
#

oh shit it's ain't general

#

i tried

#

I've disable every plugin i got

winged linden
#
  <rejected> DiscordAPIError: Invalid Form Body
  embeds[0].description: This field is required
      at RequestHandler.execute (D:\discordbots2\ufocasino3.0\node_modules\discord.js\src\rest\RequestHandler.js:349:13)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async RequestHandler.push (D:\discordbots2\ufocasino3.0\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
      at async InteractionWebhook.editMessage (D:\discordbots2\ufocasino3.0\node_modules\discord.js\src\structures\Webhook.js:311:15)
      at async CommandInteraction.editReply (D:\discordbots2\ufocasino3.0\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:137:21) {
    method: 'patch',
    path: '/webhooks/772248843109531661/aW50ZXJhY3Rpb246MTExNTM2NDgyMzg1MzY5OTE5MzpWYXhVRG94aGFMcnlPNEdFY2xoV21SR2xxa2pqQnpsd09tSEhWUjhJa1A5NEdGd29iemJNYlpZakJRT0RXVmh2Q1FnSVZ6ZDZqaUhaU0dWdUlKaEpMdE56TTNhdXE2TWVoWlFPUk4wU091NGZybjJhZkwyOVV5NEdqOEdjYklGUg/messages/@original',
    code: 50035,
    httpStatus: 400,
    requestData: { json: [Object], files: [] }
  }
}
reason: Invalid Form Body
embeds[0].description: This field is required```

~~getting that error any idea why?~~ fixed
drowsy sage
#

does your embed has a description?

winged linden
winged linden
#

yoo can i set values or someshit for buttons?

deft wolf
#

I think it's called custom id

craggy pine
#

I personally use randomly generated strings for buttons since customID's have to be unique across all servers using the bot

rustic nova
#

I occasionally use them in formats such as randomstring_action_index

#

To differentiate between actions

peak drum
pale vessel
#

yeah, they aren't unique

lyric mountain
#

they need to be unique only within the same message context

craggy pine
#

Ah maybe I'm remembering incorrectly bloblul Been on a coding hiatius for a bit.

lyric mountain
#

you forgor 💀

vale eagle
#

Are users' snowflake IDs going to remain the same when they change the username system?

spark flint
#

yes

lyric mountain
#

cant see why it'd change

vale eagle
#

great thanks

hushed robin
#

how can i get a array of a tables columns with sql

#

i did

#

thats why i ask for help

#

what is your schema

#

?

#

i don't know what that is

#

ok

#

@covert gale

#

does not work

#

why is it so difficult to get columns of table

#

sad

#

if anyone knows feel free to spam me with pings

#

nvm i figured out

hushed robin
#

does anyone know why i can't use a parameter here

#

I get the error SqliteError: near "?": syntax error

#

(better sqlite3)

lyric mountain
#

This does not apply to all databases

#

That one is specific to postgres

lyric mountain
hushed robin
#

but i want to make it so i can use a parameter

#

which is ?

#

but it errors when i try adding it

lyric mountain
#

Ok ok, why do u need the list of columns?

hushed robin
#

so i don't need to make one for every single table

hushed robin
lyric mountain
#

I need to understand the context, because 99% of the time there's proper way

#

Listing columns is just a dirty workaround usually

#

U have the schema already don't u?

hushed robin
#

so if one doesn't exist

#

i add it

lyric mountain
#

I believe u can set alter table to skip existing columns

#

If not, there's probably a command for that

#

Hm, now I see from where u got that pragma

#

You can simply concatenate the name of the column to the sql

hushed robin
#

um

#

what

lyric mountain
#

Instead of params, concatenate it

#

It's not arbitrary data, so it's fine

#

Unless your table names are illegal

hushed robin
lyric mountain
#

Who is "someone"?

hushed robin
#

idk

#

no one tbh

lyric mountain
#

You're the only one controlling that check

#

No external data will be passed to it

hushed robin
#

true

#

ok

#

i did that

#

and now it works

#

🎉

lyric mountain
#

Double quote it

hushed robin
#

double quote what

lyric mountain
#

As I said, "unless your table names are illegal"

#

Some names might be detected as keywords

#

Put double quotes around every concat

#

Except for pragma

#

As it's a string already

hushed robin
#

but it works without

lyric mountain
#

A column named data for example

#

Double quotes signal an identifier, so the database knows you mean what's written not some type or keyword

#

You can go without it ofc, but mind what you name your columns/tables then

hushed robin
#

makes sense

#

thx for the help

earnest phoenix
#

I searched for way to long why my code was working on my pc, but not as a docker image.
Turns out, that i put the entyre /app folder inside a volume instead of just /app/BotName.
This ment, that a new image would be basically useless. XD

maiden gazelle
#

does somebody know why my hourly income command says this even tho I set the custom hourly income to 120

const Discord = require('discord.js');
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
const { Database } = require("quickmongo");
const db = new Database('my mongo db URL');


module.exports = {
    name: "hourly",
    description: "Claim your hourly earnings",
run: async(interaction, bot, args) => {
    await db.connect()
    
    let amount = await db.get(`hourlyamount-${interaction.guild.id}`);
    
let result = await cs.hourly({
    user: interaction.user, 
    guild: interaction.guild,
    amount: amount || '100',
});

let user = interaction.user;

let embed = new Discord.EmbedBuilder()
.setColor("#61C83D")
.setAuthor({ name: `${user.username}'s Hourly Earned`, iconURL: bot.user.displayAvatarURL() })
.setDescription(`**Amount:** $${result.amount}`)

if (result.error) return interaction.reply(`You have used Hourly recently Try again in ${result.time}`);
else return interaction.reply({ embeds: [embed] });
}
}
#

this is where i set the custom income

if (interaction.customId.startsWith('ha')) {
        const filter = (message) => { return message.author.id === interaction.user.id };
        let collector = interaction.channel.createMessageCollector({ filter, max: 1 });
        
        let senlEmbed = new Discord.EmbedBuilder()
        .setDescription(`Send the amount you want for the hourly amount. (Type cancel to stop.)`)
        .addFields([{ name: '**Example:**', value: `100` }])
        
        interaction.reply({ embeds:[senlEmbed] });
            
        collector.on('collect', async (message) => {
        const args = message.content.trim().split(/ +/g);
            if(isNaN(message)) return interaction.reply({ content:'Invalid number', ephemeral: true }); 
        if(args[0].toLowerCase() === 'cancel') return;
        
            db.set(`hourlyamount-${message.guild.id}`, message);
            
            const embed = new Discord.EmbedBuilder()
              .setDescription(`Hourly amount has been set to ${message}`)
              .setColor("#B468FF")
           
          message.reply({ embeds: [embed] })
             
          collector.stop();
        })}
wheat mesa
#

Well I think that part of the issue is that you're doing const cs = new CurrencySystem;

#

That should be throwing an error, you can't construct an object like that afaik

#

Also you should consult the documentation for the library you're using, since that's a 3rd party library

maiden gazelle
wheat mesa
#

apparently that's a valid way to construct an object

#

that's very weird, you should do new CurrencySystem(); for consistency

maiden gazelle
#

this is what that libary says

deft wolf
#

Why do you use interaction.guild when it clearly says guildID. It should be interaction.guild.id then no?

wheat mesa
#

Are you sure your database is right? amount might be an ID in your database on accident, keep in mind

deft wolf
#

Idk how this lib works tbh

#

Same thing with user in cs.hourly()

maiden gazelle
deft wolf
#

That's weird

solemn latch
#

just out of curiosity, is the number in amount the id of the current guild?
The number looks like an entity id.

maiden gazelle
#

na I just checked that

earnest phoenix
maiden gazelle
#

oh

#

how do i fix that

earnest phoenix
#

You're also setting the custom amount as a string in your database as well

solemn latch
#

Its certainly a snowflake 👀

earnest phoenix
#

You can use the global parseInt() function to convert a string to an integer

solemn latch
#

something created 3 days ago at 2:17

maiden gazelle
earnest phoenix
#

Yeah they're storing the ID of the message

#

The collector passes a message object on it's collect event listener

deft wolf
#

Also isNaN(message) kapp

solemn latch
#

op yeah 👀

earnest phoenix
#

Use message.content

#

Note that you'll need the "Message Content" privileged intent to be able to access the message's content

maiden gazelle
#

i have that

earnest phoenix
#

Then use it

deft wolf
#

What's about user and guild option in cs.hourly() Voltrex?

#

Hes also using guild and user object instead of their ids

#

Or it's valid? ia_think_thonk

solemn latch
#

👀 it just calls valueof in certain contexts iirc?

earnest phoenix
#

I think the library converts the user and guild objects to strings, in which their toString() methods return their respective IDs, and about the library I'm not exactly sure how it works

It most likely accesses the client in some way and sends a message and adds data to the database

solemn latch
earnest phoenix
#

At this point just make your own, this is so goofy

solemn latch
earnest phoenix
solemn latch
#

oh?

earnest phoenix
#

It just calls the toString() method of the user and guild objects, which can be modified by the developers to return whatever they want, so the discord.js maintainers modified it to return their respective IDs

solemn latch
#

👀 huh

earnest phoenix
#

It's basically

class Foo {
  constructor(id) {
    this.id = id;
  }

  toString() {
    return this.id;
  }
}

const foo = new Foo('12345');

console.log(foo.toString()); // 12345
console.log(`${foo}`); // 12345
console.log(String(foo)); // 12345
console.log(foo); // Foo { id: '12345' }
solemn latch
#
class Test {
  wee: string;
  constructor() {
   this.wee = 'Woo';
  }
}

class TestCustomPrimitive {
  wee: string;
  constructor() {
   this.wee = 'Woo';
  }
  valueOf(){
    return 'hi!'
  }
}

const test = new Test()
const testCustomPrimitive = new TestCustomPrimitive()

console.log(test.valueOf(), test.toString()); // Test { wee: 'Woo' } [object Object]
console.log(testCustomPrimitive.valueOf(), testCustomPrimitive.toString()); // hi! [object Object]

🤔 I'm not certain though

#

This method is called in priority by numeric conversion and primitive conversion, but string conversion calls toString() in priority, and toString() is very likely to return a string value (even for the Object.prototype.toString() base implementation), so valueOf() is usually not called in this case.

This part confuses me tbh

#

Honestly, object primitives confuse me

earnest phoenix
#

You didn't modify the toString() method of the Test class, so it returns it's string representation as [object Object]

hushed robin
#

hi nerds

#

how are you

solemn latch
#

👀 I need to look into it more for sure.

#

This is one of those things I really should understand better.