#development

1 messages · Page 149 of 1

sharp geyser
#

but I swore it errors if you dont

#

especially if you're extending something

tulip ledge
earnest phoenix
#

Only if you want to do something other than just calling super, or if you want to call it with specific parameters

sharp geyser
#

ah I see

tulip ledge
#

but what does voltrex not know ;-;

sharp geyser
#

Well hes a maintainer of the v8 stuff I wouldn't be surprised if he knew something so trivial

frosty gale
#

unable to use the 4k skull

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sharp geyser
#

now that just sounds personal chloe

#

👀

frosty gale
lament rock
#

Voltrex likely gets plenty of hugs

proven lantern
#

how would a single elimination tournament work that allows ties? should a tie count as half a loss or nothing?

viral swift
#
app.post("/dblwebhook", webhook.listener(vote => {
  console.log("vote received")
  // ...
}), (_req, res) => {
  res.status(200).json({ message: "Vote received" })
})
```I needed to test some things on the dev bot before releasing it in the main bot, but the dev bot is private because it's for testing purpose of new features only and I can't public it to top.gg for testing the vote updates system. is there some solution for it? what could I do?
the dev bot is locally on, so I tried putting the localhost url in the webhook url of the main and used send test, but it didn't work
deft wolf
#

If you don't do port forwarding then localhost won't work for you

eternal osprey
#
<script type = "module" src = "script.js"></script> 
  <div class = "login_box">
            <button class ="login" onclick = "getDetails()">
                Login
            </button>
        </div>

where the function getDetails is created. Only problem is, is that the getData function is not recognized?

frosty gale
eternal osprey
#

a regular js script with a function getDetails(), and an import at te top.

#
import {date} from "./data" assert { type : 'json'}
 function getDetails() {
    let passwordValue = document.getElementsByClassName("password_input")[0].value;
    let usernameValue = document.getElementsByClassName("username_input")[0].value;
    if(passwordValue == "test" && usernameValue == "123"){
     alert("You have successfully logged in! Welcome back to the dashboard.");
     window.location.href = "loader.html";
  }else {
      alert("The entered password and or username are incorrect. Please try again.");
    }
  }
#

i've watched yt tutorials, used chatgpt, no one had the right answer.

frosty gale
#

are you sure your script is loading properly? scripts marked with module are a lot more picky and restrictive when being loaded

eternal osprey
#

3login.html:29 Uncaught ReferenceError: getDetails is not defined
at HTMLButtonElement.onclick (login.html:29:61)

#

it's not loading at all as it is throwing me an undefined

frosty gale
#

maybe onclick doesnt work with modules? dont know modules are still reasonably new
can you try instead attaching a click event to the button from the script?
something like:

document.querySelector(".login").addEventListener("click", () => {
  console.log("click!");
});
eternal osprey
#

it would still be undefined

frosty gale
#

well what I am thinking is that the onclick handler for some reason cannot see your getDetails functions because of some reason, so you should try to add a click event as i said above with an example and try call the function from there, or just log some test string

#

to rule out other possibilities

eternal osprey
#

i know why it is not defined, it's because i am importing my script file as a module type rather than a js file.

#

But i am unsure on how to do it otherwise.

soft laurel
#

Specifically the section about exporting.

oak tide
#

How to make my bot read all the messages in replit's console and type all the things in the specified channel in discord using python code

#

?

rustic nova
#

sounds sus

deft wolf
oak tide
#

Using it for ai

sharp geyser
#

even more sus

oak tide
#

Oki nice

#

I am sus

soft laurel
#

There's plenty of tutorials on how to get started with discord bots. Such general questions like that would require us to write the code base for you. Once you've gotten started and have a more specific problem you can come back.

oak tide
quartz kindle
#

what you have to do is find where in the code is the bot outputting the things to the console, and make it output to discord as well

civic scroll
sage bobcat
#

One message removed from a suspended account.

civic scroll
wheat mesa
neon leaf
#

why is postgres so fast

#

Im doing the most unholy queries imaginable with string includes, 2 deep relational checks and it just doesnt care

quartz kindle
#

why or how?

neon leaf
#

probably more of a how

quartz kindle
#

xD

#

you could probably run an explain query to check what its actually doing

proven lantern
lyric mountain
#

huh?

proven lantern
# lyric mountain rematch

should all the other players in the tournament wait until there is a winner, or should the rematch happen next round? Making all the other players wait would be annoying for them, but moving them to the next round basically means both teams won

lyric mountain
#

sql does anything but fail at scale

lyric mountain
#

a thing you CAN do, tho, is use a score-based tournament

lyric mountain
#

then u can solve the ties in a final match, as there'll be more than 1 winner

proven lantern
proven lantern
lyric mountain
#

the player gets eliminated if they lose

#

if it's a tie, both players advance until they lose

proven lantern
#

or triple

lyric mountain
#

if they reach the finals, make them match against eachother until 1 lasts

quartz kindle
#

there are many ways to scale sql horizontally

proven lantern
#

full sql or partiql?

quartz kindle
#

full sql

proven lantern
#

here's the proof.

#

see the lines

quartz kindle
#

lmao

#

thats specifically mysql, not sql in general

#

also depends which engine

#

sql has many different engines

#

also you can partition sql the same way you can nosql

proven lantern
#

at least sql lets you do it the right way

proven lantern
#

i need to see how they do it in soccer and chess

#

this could be helpful

#

all their methods for tie breaking are very bad

lyric mountain
#

ties are quite hard to deal with

proven lantern
#

maybe i shouldn't support ties. if there are ties the discord server can figure out how to handle it

neon leaf
#

in my experience nosql was miles slower at everything

proven lantern
frosty gale
#

its not really about the query language but about the algorithms and technology behind the database

neon leaf
quartz kindle
proven lantern
#

for free

neon leaf
#

my experience was based off selfhosted mongodb and selfhosted postgres

#

because I despise the cloud

quartz kindle
#

on your own vm

frosty gale
#

proprietary :c

proven lantern
neon leaf
#

what

proven lantern
#

i only need around a billion machines to test the load

neon leaf
#

ah yes ok

proven lantern
neon leaf
#

imagine using aws or gcloud CATBRUHZ

proven lantern
neon leaf
#

ok

#

I switched from firebase to my own servers / api

proven lantern
#

firebases serverless is too slow

quartz kindle
#

and try querying

proven lantern
proven lantern
#

want me to run some perf tests?

neon leaf
#

I need my sweet db ping

quartz kindle
lyric mountain
# proven lantern can sql handle this ``` Amazon DynamoDB reliably handled 105.2 million requests/...

Everybody is talking about Big Data and about processing large amounts of data in real time or close to real time. However, to process a lot of data there is no need for commercial software or for some NoSQL stuff. PostgreSQL can do exactly what you need and process A LOT of data in real time. During our tests we have seen that crunching 1 billi...

▶ Play video
proven lantern
#

i can't even test that

#

or can i?

neon leaf
#

wdym stability

#

how is pg not stable

proven lantern
neon leaf
#

not really

lyric mountain
#

joins dont matter much if ur using primary keys or at least indexed (also unique) columns

proven lantern
#

nosql doesn't even support the idea of a join

neon leaf
#

it doesnt support relations either does it?

lyric mountain
#

it does "support"

#

note the quotations

#

but then ur defeating the point of using nosql

proven lantern
#

it like how js has class keyword

#

it has it, but you shouldn't use it

lyric mountain
#

tf do u mean u shouldn't

proven lantern
#

if you want to use class use something like java

frosty gale
#

oop is terrible use procedural!

neon leaf
lyric mountain
#

class is perfectly valid if you're working with oop in js

proven lantern
sage bobcat
lyric mountain
neon leaf
frosty gale
# proven lantern applets ftw!

we could still technically implement java applets back into browsers lmao
port the jvm into webassembly and execute it 💀

neon leaf
#

literally never had a project that didnt use some kind of relations

sage bobcat
lyric mountain
#

nosql is, in simple terms, a queriable map

neon leaf
#

ah

#

so redis++

lyric mountain
#

pretty much

#

redis would be sqlite but for nosql

proven lantern
quartz kindle
#

redis is a full server

quartz kindle
proven lantern
#

redis has an event subscribe thingy

proven lantern
neon leaf
#

for that you get speed

quartz kindle
#

it supports larger than ram datasets

#

but its not meant for it, its meant for use as a cache, so yeah

sage bobcat
#

One message removed from a suspended account.

quartz kindle
neon leaf
#

ben I think you should stick to your null vs undefined debate

proven lantern
neon leaf
#

really?

quartz kindle
#

by judge Ben

neon leaf
#

ä-.ö0

#

47 e3w#

#

sry cat

quartz kindle
#

lmao

lyric mountain
neon leaf
#

me when

#

(heads up, thankfully not my code)

proven lantern
#
const {application_id, token, guild_id, member: {user: {id: user_id}}, data} = event;
neon leaf
#

🫠

lyric mountain
#

idk, but having the left bigger than the right gives me some shivers

proven lantern
#

i'm using the guild scheduled events feature to schedule tournaments. if the tournament is a 2v2 should i only allow one person to register for the team or should i require both of them to register and register as a team?

#

i think only allowing one person to register for the team will be a better UX

#

and much easier to program

lament rock
#

Clyde is a real user that you can message lmao
@prisma lichen

{
  id: '1081004946872352958',
  username: 'clyde',
  avatar: '6170487d32fdfe9f988720ad80e6ab8c',
  discriminator: '0000',
  public_flags: 0,
  flags: 0,
  bot: true,
  banner: null,
  accent_color: null,
  global_name: 'Clyde',
  avatar_decoration: null,
  display_name: 'Clyde',
  banner_color: null
}
#

@prisma lichen Are you here as well?

#

Experiment not enabled be like

rustic nova
#

-ui 1081004946872352958

gilded plankBOT
#
» Username

clyde#0000

» ID

1081004946872352958

» Nickname

None

» Highest Role

None

» Badges

​None

» Joined Server

Not in guild

» Creation Date

<t:1677802063:F> <t:1677802063:R>

rustic nova
#

Pogu

#

-b 1081004946872352958 bye stinky

gilded plankBOT
#

cross Something went wrong when trying to ban this member

rustic nova
#

And there goes clyde

sharp geyser
#

ye fuck clyde

rustic nova
#

Shit bot ikr

sharp geyser
rustic nova
#

You're about to lose Aurel name privileges

sharp geyser
spark flint
#

lol

strong lark
#

First time for me making my site I keep seeeing random GET requests such as GET /autodiscover/autodiscover.json?@zdi/Powershell 404 0.366 ms - 169

Should I be concerned

sage bobcat
#

One message removed from a suspended account.

frosty gale
#

had that happen to me a few times

sage bobcat
#

One message removed from a suspended account.

strong lark
#

No VPS

frosty gale
#

tried to see if my website had a php version vulnerable to the .php file upload vulnerability and if they could access the directory tree for the current directory lol

lyric mountain
#

I mean, u can put a robots file, but people will scrap the site as soon as it's online

#

Even when offline tbh

lament rock
#

Some bots do check for vulnerabilities. Some also check for a /well-known/security.txt so that they can email you about vulnerabilities they find

#

Nobody has emailed me yet tho because I don't use wordpress and I don't use php.
XSRF tokens are also being used

sharp geyser
#

I will find a vulnerability 😉

lament rock
sharp geyser
#

I will use social engineering to my advtange

#

gib root pass kthxbai

lament rock
#

I only use public key authentication. There is no password

sharp geyser
#

gib private key file 😉

lament rock
#

Damn. Got me there

sharp geyser
#

lol

#

also your bot looking at me seductively makes me wanna invite it

sharp geyser
#

ayo?

lament rock
#

We commission the donut

sharp geyser
#

nice

lament rock
#

blahaj

lament rock
#

based mod banning clyde

plucky hearth
#

Yo guys I just joined

#

What’s the game name?

lyric mountain
#

Amogus

sage bobcat
#

One message removed from a suspended account.

rustic nova
earnest phoenix
#

Howto fix bang

#

In the logs there is no errorr

deft wolf
#

Debugging time poggers

sharp geyser
#

Show your code

warm mango
#

hello

craggy pine
#

Hey 👋

earnest phoenix
#

its work now

deft wolf
#

This may not solve your problem

#

A lot of people don't know that you have to respond to an interaction within 3 seconds unless you use .deferReply()

#

If you use some api or play with the database in the command, it is worth using it because not in every case you will be able to respond to the interaction in time

lyric mountain
#

rule of thumb is, if you're not immediately replying or editing, defer it

wheat mesa
#

Tbh I always defer no matter what. It’s in my handler. Is that a bad idea?

rustic nova
#

not really

#

but if something does fail, it'll just continuously show that thinking thing

#

unless you respond with something if something fails

deft wolf
#

Someone will wait 10 minutes just to see "interaction failed" TROLL

rustic nova
#

oh yeah thats a thing too

lyric mountain
#

just wrap the handler in a try-catch, with a reply if anything happens

#

btw @wheat mesa, doing a bot in what lang?

earnest phoenix
# rustic nova not really

I want to ask if if our bot is verified we can report people who try to copy our bot? To discord support.

#

My bot is still 80 servers thanks to top.gg, and I'm top 1 on growtopia searches

rustic nova
#

if you're referring to situation between your bot and that other one, we dont handle that

#

nor im guessing would discord

#

unless they're using assets owned and copyrighted by you, then discord could interfere if that bot is verified

lyric mountain
#

besides, copying in what sense? pretty much every feature was already done by at least a dozen of bots

earnest phoenix
rustic nova
#

nope

earnest phoenix
lyric mountain
#

just ignore them

deft wolf
#

Keep doing your stuff

earnest phoenix
#

Yes, I've tried to let it go because my bot was made by him first. But this is very anoying

lyric mountain
#

block them

#

wouldn't be the first time someone got triggered when they found out their unique idea ain't really unique

earnest phoenix
#

Here is a photo of both bots commands. You even copied the prefix.

#

Really?

rustic nova
#

just ignore them

#

theres like

#

actually nothing else to do there

earnest phoenix
#

ok thanks

rustic nova
proven lantern
#

do we have access to the private key that discord uses to sign messages that are sent to our bot's interaction url?

rustic nova
#

nope

#

also

#

discord signs messages??

proven lantern
#

they do something like that

rustic nova
#

then im sure they dont

proven lantern
#

so it shouldn't be too dangerous to allow someone elses bot to point to your interaction url and be authorized.

rustic nova
#

unless you're using a different authorization token to respond to a interaction

#

then discord would notice

#

tbf, I feel like that could result in a funny bug

proven lantern
#

as long as the commands are registered correctly then it should work

frosty gale
proven lantern
#

in double elimination tournaments there is a winners bracket and losers bracket. in a triple elimination tournaments would there be 3 brackets? one for players with 0 losses, one for players with 1 loss and another for 2 losses?

proven lantern
hasty nest
proven lantern
frosty gale
#

fairs

hasty nest
#

you could fairly easily create a seperate key for automation.

frosty gale
#

yeah

hasty nest
#

It's just an ed25519 curve iirc

proven lantern
#

just bypass it too

hasty nest
#

that's the other option

sharp geyser
hasty nest
sharp geyser
#

thanks!

wheat mesa
#

I’m not currently doing it because my idea got fucked by paywalls on stock information APIs

mortal flint
#

hi

rustic nova
#

wanted to like, make a grocery api that hooks up with a screen on a raspberry pi so I could keep an inventory of my fridge

#

turns out theres no grocery api at all for use

#

fucked my idea too, would've been good

rustic nova
#

theres no API for these fuckin grocery barcodes

frosty gale
#

work at a supermarket lol

#

you get access to portals that have all stock and barcodes

rustic nova
#

sadly I do IT rather than in supermarkets KEKW

#

actually

frosty gale
rustic nova
#

could've built up my own database

frosty gale
rustic nova
#

just tried that

frosty gale
rustic nova
#

yeah doesnt work

#

not worth my project that size

frosty gale
#

$100 for 5k api calls 💀

hasty nest
rustic nova
#

too generic imo

#

Wanted stuff like the brand, type etc

#

for example, theres soups here in germany of any type and any brand, each is different

spark flint
#

also only 421 barcodes there

#

and not updated in 7 years

hasty nest
#

oof

slender wagon
#

I saw this one site that had a very nice looking and smooth flame like effects with different color that only showed when you move your mouse around.

#

Does anyone have a clue what effect it might be

mortal flint
#

youtube exists

slender wagon
#

If i am here it usually means i have done my research

rustic nova
#

cool shit like this

sharp geyser
#

Kind of like those mag strips in cards

rustic nova
#

nope

#

only a number

sharp geyser
#

Honestly

#

right

rustic nova
#

and that number is associated with a item for example in groceries

sharp geyser
#

it just is another form of the UPC

rustic nova
#

or qr codes

#

or whatever people use

sharp geyser
#

it makes it so you don't have to manually type the UPC in

rustic nova
#

yes

sharp geyser
#

Honestly

#

go to your local grocer and scan items into a database

#

you might look like a weirdo but anything works

rustic nova
#

true true actually KEKW

#

I mean theres nothing about me just manually adding the ones I buy and using that smaller dataset

#

but new items need to be added too

sharp geyser
#

or as you buy things and you know you will frequently buy them

#

just scan it at home

rustic nova
#

yea

quartz kindle
#

barcode numbers are pretty dope tho, they include a lot of data like country of origin, type of item, etc

#

like discord snowflakes

rustic nova
#

yes exactly

#

but theres no public dataset of these

#

from like, all countries

#

:((

#

at least no dataset free to use

sharp geyser
#

I can help put it together tho it won't be useful for a german boy to have american products

rustic nova
#

KEKW yeah

sharp geyser
#

idm taking some time out of my very busy day to help you I guess

quartz kindle
rustic nova
#

paywalled again

sharp geyser
#

Aurel

#

making a free database of global products actually sounds like a fun project

rustic nova
#

it did successfully find the product I have here

sharp geyser
#

ofc you'd have to get others to help

rustic nova
#

but the api being paywalled

quartz kindle
#

dayum

rustic nova
#

I'd imagine a model like this:

  • contribute a certain amount of barcodes
  • get access to the api for free
  • otherwise an acceptable api limit or buy for unlimited
sharp geyser
#

Honestly I might start a project like this aurel KEKW

#

this actually sounds fun

rustic nova
quartz kindle
#

9 bucks for 100 calls per month seems ridiculously expensive

sharp geyser
#

It would also give me a chance to mess with a rasp pi

rustic nova
#

still

#

why pay for that

quartz kindle
#

almost like their database is terribly unoptimized

sharp geyser
#

look at the site

#

it looks like its from the early 2000s

rustic nova
#

its literally like

SELECT * FROM items where EAN13 = 12345

#

nothing else to it

#

this isnt resource-intensive at all

quartz kindle
#

they probably dont even have indexes

rustic nova
#

yeah

sharp geyser
#

its all in a JSON file tf you mean

quartz kindle
#

jasondb

sharp geyser
#

lol

rustic nova
#

nah

#

literally a .txt file

#

separated by spaces on each line

#

that explains it all

#

also a cool added feature

#

beep when barcode

sharp geyser
#

Are you actually making this rn?

#

or is that sample code

craggy pine
#

Ooh barcode stuff. I wanted to do something like that to catalog magic cards irl

quartz kindle
sharp geyser
#

silly magic doesn't exist

sharp geyser
sharp geyser
#

cmon tim get with the program

quartz kindle
#

i mean

#

who dafuq makes windows beep

#

also why call the same function twice

sharp geyser
#

I troll my friends with the windows 10 error soundboard

quartz kindle
#

lmao

sharp geyser
#

@rustic nova mind if I steal the idea of making a global UPC database?

rustic nova
#

no go ahead

sharp geyser
#

Ima make it free to use

rustic nova
#

python

sharp geyser
#

anyone can contribute to it as well :p

quartz kindle
#

make an account on their website, download entire database, upload to your database, profit

sharp geyser
#

ong

#

What kind of data should I store though Thonk

#

obviously the UPC and product name

#

also how does one even make a barcode reader

#

tf does it even do

#

meh i'll figure it out

quartz kindle
#

results are embedded into their html, so its easy to scrape, plus they claim to have 600+ million products, twice as much as the other one

#

could test what kind of protection they have against scraping if any :^)

rustic nova
#

cloudflare is what they have

sharp geyser
#

i'd rather not

#

I wouldn't feel right leeching off of others so ima just force ask people from around the world to submit to my database

sharp geyser
#

nvm

#

I don't know enough about PCBs to even attempt this

rustic nova
#

You could probably 3d print a handle that just has a light and a camera on it

#

If you want a handheld thing

sharp geyser
#

I dont think you can just use a camera no?

rustic nova
#

You can

#

Just needs a general amount of lighting I figured out

#

And a pretty good amount of focus/autofocusing

#

A camera capturing low quality won't work really

sharp geyser
#

Could you not just use lasers ?

#

Thats what normal barcode scanners use

rustic nova
#

Yes you could

#

But you'll need a whole unit to decode these barcodes then

sharp geyser
#

Making something like this would be fun though

rustic nova
#

Yes ofc

sharp geyser
#

yet it would cost a bit of money which im short on atm

#

😔

rustic nova
#

Same

sharp geyser
#

for now ima just focus on compiling a database of items you get from stores

#

@rustic nova I will make it a public database so if you wanna add items lmk, I will make a web ui for it at a later date to make it easier for people

rustic nova
#

Swag

sharp geyser
#

Honestly I might store more than just the product name and manufacture

#

If its food items I will store the nutrition info as well

rustic nova
#

Should add a way to live-camera scan a barcode ngl

sharp geyser
#

I will once I get the funds to build/buy something to test that

#

Heres my plan for data storage

  1. UPC (obviously)
  2. Manufacture Name
  3. Product Name
  4. Nutrition Info (calories, sodium, sugar, etc)
  5. Ingredients list
  6. Maybe even add in Allergen info, such as peanut free or gluten free
#

For anything non food, I will store similar data but might include other info

rustic nova
#

Allow adding images too

#

For the product image

sharp geyser
#

Fair

#

My original idea was two data tables but putting it all into one and just adding an edible field is probably the better idea so im not making 2 database calls

sharp geyser
#

Might as well make use of my contabo object storage as well and use that to store images

#

:p

#

what should I call this project thinkEGG

spark flint
#

scanny barcode product thingymabob the third 👍

lyric mountain
#

SCAM - Scan Code for Any Market

sharp geyser
#

Honestly fuck it why not

#

actually now that I thought about it for 2 more seconds I know why not

#

namecheap definitely wont sell me a domain

sharp geyser
lyric mountain
#

ESCAPE - Extended Scan Code for Any Product and Entity

spark flint
#

SCAB - Scan Code For Any Barcode

sharp geyser
lyric mountain
#

TINABS - This Is Not A Barcode Scanner

#

Tbh, there's YABS, yet another barcode scanner

sharp geyser
#

YABS sounds good

spark flint
#

PPBS - Poor Persons Barcode Scanner

#

IATFPN - I Asked Top.gg For Product Names

sharp geyser
pale vessel
#

YAGPDB - Yet Another General ProDuct thingymaBob

sharp geyser
#

isn't that a bot name?

spark flint
#

No it’s a barcode project name Frfr

pale vessel
#

I don't know what you're talking about

spark flint
#

Yet Another Startup Tech Company

sharp geyser
#

3.1 million servers

pale vessel
#

fake news

sharp geyser
#

dayum

pale vessel
radiant kraken
warm surge
#

idfk

rustic nova
#

They own yagpdb and several other bots

#

Aka bought them at some point or became partners

radiant kraken
#

crazy that companies buy discord bots too

rustic nova
#

additional revenue

radiant kraken
#

but it seems that their service is just to help with uptimes on bigger bots

rustic nova
#

could be

#

or yeah these are investors

#

so they dont buy the bots directly, but merely help them

radiant kraken
rustic nova
#

iirc requirement being, you need to state that in your bots about me that you're sponsored by them

radiant kraken
#

true

#

probably anything discord development related

dry imp
rustic nova
#

invite only weeb content api

#

for images and shit

#

tried to apply before with a bot with like 5 servers KEKW

radiant kraken
rustic nova
#

yes

radiant kraken
#

you should be familiar with it if you are a multipurpose bot developer onesieKEKW

deft wolf
#

/neko TROLL

rustic nova
#

-declinebot Your bot uses nekos.life with content that is not suitable with discord, skill issue

civic scroll
#

@rustic nova bot alerta compress

rustic nova
#

ban

civic scroll
spark flint
#

they buy them

#

YAG and Piggy and Carl are all botlabs now

rustic nova
#

They actually do? KEKW

#

Cring

spark flint
#

and they all advertise each other, are owned by botlabs and operate it all

#

and they use AWS 🤮

neon leaf
#

is there any benefit using postgres enums over varchars when im not querying by them?

earnest phoenix
# neon leaf is there any benefit using postgres enums over varchars when im not querying by ...
  1. They enforce a specific set of values which can help to maintain data integrity and prevents invalid/unexpected values from being inserted into the column
  2. Enums can generally make the data more readable and self-explanatory, since you can give them meaningful names which can also help all developers working on the project
  3. Enums can be more efficient in terms of storage and performance compared to varchars, this is because PostgreSQL stores them as numeric identifiers so they take up less space and are faster to query

Though note that enums values can't be modified easily once they're defined, because adding or removing enum values can require altering the table structure

And since these enums are specific to PostgreSQL, it makes it less portable so if you ever have to move to other databases, it won't be easy

neon leaf
#

so except storage space there isnt really a drawback? (yes I know readability but I have a wrapper that handles that)

earnest phoenix
#

Well yes, and note the first point as well if you actually even need that

neon leaf
#

I dont really need that, If I actually use ints instead of varchars the storage space shouldnt be a problem either

eternal osprey
#

hey, i have a question. I recently started html and css coding. I am not very good at it, and i haven't acquired a good taste of design yet lmao.
is this background ugly?
second, i rather instead of the gray wanted an image to span across the whole body height, but maintaining it's width;

this is my css:

body {
    
       
        background: linear-gradient(
          to right,
          #5A5A5A 0%,
          #5A5A5A 50%,
          #F5F5DC 50%,
          #F5F5DC 100%
        );
    margin: 20px;
}```
neon leaf
#

alr

shadow storm
#

hey

small tangle
#
ARG TOKEN=""
ENV TOKEN=$TOKEN

is this the proper way to handle env vars in dockerfiles?

    build:
      context: .
      dockerfile: Dockerfile
      args:
        TOKEN: ${TOKEN}

because with this i can add env vars from a .env file in my docker compose but im not sure if this is the best (or considered the correct) way pikathink

#

so maybe for a bit more context, im builing an image of my bot which needs the token to login

earnest phoenix
small tangle
#

Ok good to know that im on a good track thanks blanketJam

solemn latch
#

just export ^-^

earnest phoenix
#

You can't import an ES module using require(), you would have to either using import statements (which doesn't exist in CJS), or use dynamic import()s (which exists in both ESM and CJS)

proven lantern
#

help pls

rustic nova
#

literally an extension that only benefits these people that go "using master for git is offensive"

#

ffs

#

uninstall ez fix

proven lantern
#

i didn't install anything

#

this is intellij

#

who is alex

rustic nova
#

uninstall intellij, use vsc

peak drum
frosty gale
rustic nova
#

im gonna git push master off the cliff

proven lantern
#

Does this sound right for how a 6 team triple elimination tournament would work?

The first round matches up teams randomly. there would be 3 matches this round

The second round matches up teams that won against each other and teams that lost against each other. 2 teams would sit out this round since there are 3 winners and 3 losers and a winner can’t play a loser unless there are no other matches available.

The third round matches up teams that haven’t lost against each other, teams that have lost one game against each other, and teams that have lost two games against each other.

At some point 3 teams will be eliminated and there will only be 3 teams left. Let’s say team0 has 0 losses, team1 has 1 loss and team2 has 2 losses. Team1 and team2 would be matched up until one of them is eliminated and team0 will get byes. Then the last two teams match off until one is left.

civic scroll
proven lantern
#

i had a plugin

civic scroll
#

you can use "victorious" and "defeated"

proven lantern
#

good idea

keen forum
#

What would cause Favicon not to show up it works mostly on my phone is a 14 pro max it works on my friends phone which he has an exact model I tried clearing cache twice but just fails to show up on safari I’m about to give up

#

It even shows up when you share the web page to someone … but not in the tab space

rustic nova
#

safari wanting to be "special"

#

thats your answer

#

safari occasionally differs on very crutial elements from chrome, firefox etc

sharp geyser
#

typical safari problem

rustic nova
#

exactly

sharp geyser
#

A lot of stuff that works on say firefox, chrome, etc won't work on safari

craggy pine
#
Promise {
  <rejected> [Error: 54190000:error:0A000410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:c:\ws\deps\openssl\openssl\ssl\record\rec_layer_s3.c:1586:SSL alert number 40
  ] {
    library: 'SSL routines',
    reason: 'sslv3 alert handshake failure',
    code: 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE'
  }
}

Anyone know what could have caused this error. Didn't effect my bot for what it was doing at the time, kinda strange.

sharp geyser
#

This come from?

craggy pine
#

I have 0 idea which is the thing.

sharp geyser
craggy pine
#

I've coded this bot for over a year, first time seeing it.

#

Just listening to music and it posted in my error log channel

sharp geyser
#

Well it seems to have initiated a connection but the server failed to return a response

#

No idea what that could be from

craggy pine
#

Oh you know what.

#

I think it was my patreon API pinging it.

sharp geyser
#

Likely

craggy pine
#

I dont use patreon anymore so Ill just yeet that.

sharp geyser
#

Never seen that error occur with discord itself

frosty gale
strong lark
#

When I was doing OpenSSL stuff I was so confused I just gave up and did a os fresh install

sharp geyser
#

you fucked up so badly you had to reinstall windows?

frosty gale
#

i had a weird openssl issue too i could not solve it

#

i had to update ubuntu to fix it lmao

sharp geyser
#

damn

sharp geyser
#
model Item {
  id                 Int     @id @default(autoincrement())
  UPC                String
  ProductName        String
  ProductDescription String
  AveragePrice       Int
  Edible             Boolean
  NutritionFacts     Json?
  @@unique([UPC])
}

So I have a prisma model here, would it be best to make NutritionFacts its own Model detailing the data or is there any other way I can outline the kind of data NutrionFacts is?

opaque acorn
#

Termux still work for hosting?

deft wolf
#

Termux is a android app right?

sharp geyser
#
model Item {
  Id                 Int             @id @default(autoincrement())
  UPC                Int
  ProductName        String
  ProductDescription String
  AveragePrice       Int
  Edible             Boolean
  NutritionFacts     NutritionFacts?

  @@unique([UPC])
}

model NutritionFacts {
  Ingrediants   String
  Servings      Int     @default(0)
  ServingSize   Int     @default(0)
  Sodium        Int     @default(0)
  TotalSugars   Int     @default(0)
  TotalFat      Int     @default(0)
  Calories      Int     @default(0)
  Protien       Int     @default(0)
  Item          Item    @relation(fields: [ItemId], references: [Id])
  ItemId        Int
  @@unique([ItemId])
}

Is this overboard? I feel like mapping it out like this might be too much and going too in depth

#

or is it in a case like this the more information available the better

#

for those who don't know what im doing im making a database of product information that can be looked up via barcode or putting the UPC numbers in directly

split patrol
#

does any1 know how to fix this barbaric error

#

my terminal keeps closing it's annoying

sharp geyser
frosty gale
lyric mountain
#

that way you can have a variable amount of ingredient per product, as some do stray from the usual, especially regarding vitamins

buoyant musk
#

I have a question according to the terms the bot does not require administrator perms to run a command so does that mean that I cannot add administrator to the invite or the command

sage bobcat
#

One message removed from a suspended account.

buoyant musk
#

Alright thanks for help

sage bobcat
#

One message removed from a suspended account.

buoyant musk
#

Ok

lyric mountain
#

basically, each component is from a fixed components list from the third table (nutrition component)

#

with postgres u can use an enum, it's essentially the same thing

lyric mountain
#

see the name of the file

rustic nova
#

useful for relation diagrams

#

I see

civic scroll
#

just draw manually

sharp geyser
#

That’s essentially 3 tables no?

#

I’d have to call from all three

lyric mountain
#

That's called a M-N relationship, it's very common when you have items that also have items not necessarily owned by a specific item

#

It's more scalable than a fat column (like a json), and much faster to query

#

The table count matters very little in sql, especially in very low table amounts

#

As long as ur doing an INNER JOIN on an indexed column (preferably the PK), the joining part will be O(1)

craggy pine
#
components[1].components[1].custom_id[COMPONENT_CUSTOM_ID_DUPLICATED]: Component custom id cannot be duplicated

Getting this error while trying to recreate my buttons for an embed. My custome Ids are different, which is why I'm a lil confused.

ButtonBuilder {
  data: {
    type: 2,
    emoji: undefined,      
    custom_id: 'yNDYwMTgw',
    style: 1,
    label: '1'
  }
}
ButtonBuilder {
  data: {
    type: 2,
    emoji: undefined,      
    custom_id: '2NjM1OTA1',
    style: 1,
    label: '2'
  }
}
ButtonBuilder {
  data: {
    type: 2,
    emoji: undefined,
    custom_id: '3NzY2OTkz',
    style: 1,
    label: '3'
  }
}
ButtonBuilder {
  data: {
    type: 2,
    emoji: undefined,
    custom_id: '5MDMxODk4',
    style: 1,
    label: '4'
  }
}
ButtonBuilder {
  data: {
    type: 2,
    emoji: undefined,
    custom_id: '1ODcyOTI3',
    style: 1,
    label: '5'
  }
}
#

unless im blind and not noticing what I'm doing incorrectly.

#
    let row = new ActionRowBuilder()
    let row2 = new ActionRowBuilder()
    let row3 = new ActionRowBuilder()

    if(pages.length === 1) {
        if(songs.length < 5) {
            for(i=0;i<songs.length;i++) {
                row.addComponents(buttonsList[i])
            }
            row.addComponents(buttonsList[12])
        } else if(songs.length < 10 && songs.length >= 5) {
            for(i=0;i<songs.length;i++) {
                if(i < 5) {
                    row.addComponents(buttonsList[i])
                } else if(i < 10 && i >= 5) {
                    row2.addComponents(buttonsList[i])
                }
                row2.addComponents(buttonsList[12])
            }
        }
    } else {
        for(i=0;i<buttonsList.length;i++) {
            if(i < 5) {
                row.addComponents(buttonsList[i])
            } else if (i < 10 && i >= 5) {
                row2.addComponents(buttonsList[i])
            } else {
                row3.addComponents(buttonsList[i])
            }
        }
    }

This is the code it comes from. Probably ugly and IK. Just a personal bot for my discord.

quartz kindle
#

that buttonsList[12] is inside the loop

#

so you're adding the button 12 multiple times

craggy pine
#

that would do it

#

im a dummy ty

#

that was meant to go outside the loop one } down. Its my cross button

split patrol
sharp geyser
last tapir
#

is it possible to check who's the server owner via a server id

deft wolf
#

If you have access to that server then yes, the guild object has something like ownerId if I remember correctly

sharp geyser
#

and if you're using djs it just gives you the owner object if they are cached

sharp geyser
sharp geyser
#

what

lyric mountain
#

The side with 3 strokes is the many side

#

The one with a vertical bar is the one side

sharp geyser
rustic nova
#

question

#

is ejs old?

sharp geyser
#

A one to many relation here makes 0 sense

sharp geyser
#

yea I get that but a One to Many relation makes no sense in this case

lyric mountain
#

One product can have many facts, one component can be in many products

sharp geyser
lyric mountain
#

So it's a many to many relationship

sharp geyser
#

I've never seen a product with multiple nutrition facts

lyric mountain
#

Not the whole table lmao, the individual rows

sharp geyser
#

What exactly are you thinking the data will look like between those 3 tables maybe im just not getting it

lyric mountain
#

Each row will be a single ingredient

sharp geyser
#

👀

rustic nova
#

pogu db relation discussion

sharp geyser
#

So NutritionComponenet is basically an ingrediant?

sharp geyser
#

you're the one who got me into this

rustic nova
#

you're the 1 to my 1 cardinality

sharp geyser
rustic nova
#

nutritions facts sounds confusing

sharp geyser
rustic nova
#

could be that im not american, its called ingredients here in the eu

sharp geyser
#

well

#

Nutrition facts are like the calories, sugar percentages, etc

rustic nova
#

yup

sharp geyser
#

Ingrediants is really a separate thing

lyric mountain
#
Product
---------
id: 1
name: Potato
facts_id: 1
Nutri Facts
---------
id: 1
component: 1
amount: 100
---------
id: 1
component: 2
amount: 50
---------
id: 1
component: 3
amount: 1200
Component
--------
id: 1
name: Protein
--------
id: 2
name: Carbohydrates
--------
id: 3
name: Vitamin A
#

For example

sharp geyser
#

I just couldn't be asked to make it something else

rustic nova
#

gotta remember to normalize your database

sharp geyser
#

what is the use in doing it this way

lyric mountain
#

Having many ingredients for one product

#

Without resorting to a fat column

rustic nova
#

1 to many yeah

lyric mountain
#

Also u get a common list of ingredients to be used in many products

rustic nova
#

a ingredient should not be limited to one product tho

lyric mountain
#

It isn't

rustic nova
#

good good

sharp geyser
lyric mountain
#

Note my previous diagram

#

It's a many to many relationship

sharp geyser
#

Im trying to figure this out as I haven't really done any programming in months

#

so give my smol brain time to process

rustic nova
#

thats so called normalizing, is to avoid redundancy within databases

#

I hate it

sharp geyser
#

I get what you mean now

rustic nova
#

normalization 1 2 3 etc

lyric mountain
#

Consider you have 1000 products

#

The list of ingredients is pretty much constant

#

All that changes is the concentration or presence of it

rustic nova
#

exactly

sharp geyser
#

There will ofc be a lot of commonality in ingrediants amonst products

lyric mountain
#

So the middle table is for holding the rows of the nutri table

sharp geyser
#

My question is

#

How would I assign those ingredients to a new table if they already exist in the NutriComponent table

lyric mountain
#

Wdym?

rustic nova
#

a relational table, consisting of foreign keys

lyric mountain
#

Just foreign key to it

sharp geyser
lyric mountain
#

A foreign key is a reference to another table's id column

rustic nova
#

its fun to learn about relational databases right? Troll_Smile

sharp geyser
#

What I mean is, each time someone adds a new product to the database, what would be the best way of linking any already existing ingrediants to the new product without re-adding it.

rustic nova
#

using that middleware-like relational table

sharp geyser
#

I'll force hire you to do it instead /s

lyric mountain
sharp geyser
#

Wouldn't I have to know the component_id at all times to do that?

rustic nova
#
| ProductName | IngredientComponentID | ...
| Cheese      | 1                     |
  | 1         | 1            |
  | 1         | 2            |
...
  | Milk          | 1
#

if thats how I understand this issue for example

#

thanks discord for your shit formatting

lyric mountain
#
SELECT p.name
     , i.name
     , f.amount
FROM product p
INNER JOIN nutri_facts f ON p.nutri_id = f.id
INNER JOIN ingredient i ON f.ingredient_id = i.id
sharp geyser
#

no idea how prisma does it

lyric mountain
#

This will list all ingredients of product X

#

With the amounts

sharp geyser
rustic nova
#

run from relational dbs as long as you can

proven lantern
#

Does this make sense for how a tournament would work? Green and red indicate who won and (2/1) means 2 wins and 1 loss. Byes are people who sit out a round.

lyric mountain
#

But you already have the component's at hand

#

All you do is assign the id to the fact row

sharp geyser
#

Im even more confused now

#

How would I know the id of the ingredient beforehand, are you asking me to make a map of ingredient ids or smth?

#

Unless I am missing something here I don't logically see how I would be able to do it like that

lyric mountain
#

Think about it as a list of all possible ingredients

#

Regardless of product

sharp geyser
#

ok

proven lantern
lyric mountain
#

I'll give u a more concrete example in a sec

proven lantern
#

since you dont start with the id

lyric mountain
#

You do start with the id

proven lantern
#

so anyone adding a value to the DB would be choosing from the list of existing ingredients

lyric mountain
#

yes, exactly

#

here, lemme print an example

proven lantern
#

not very dynamic

lyric mountain
#

how exactly would it be more "dynamic"?

#

without having a shitton of redundant ingredients, that is

#

consider Potato potato POTATO Some round underground fruit idk

sharp geyser
#

Honestly I was just going to let them enter the ingrediants for each product but that would indeed end up with too many repetitions

lyric mountain
#

now u have 4 entries for the same thing

lyric mountain
#

the PK is the first column

proven lantern
#

just store it in a nosql db. storing redundant stuff is encouraged with nosql

lyric mountain
#

now, each user can collect many cards

sharp geyser
#

I understand what ya mean now

lyric mountain
#

lemme finish it

sharp geyser
#

I can just make a drop down of ingrediants and those chosen will be mapped to a comp id no?

sharp geyser
lyric mountain
#

this table references a card, and who collected it

#

censored the user ids

vernal smelt
#

Hello

lyric mountain
#

so it's what your Nutritional Facts would be, a row of product x ingredient

vernal smelt
#

Hi

lyric mountain
#

and this is the table for general collection data

#

like storage capacity, etc, stuff not directly related to the cards

#

it links to kawaipon_uid in the previous table

#

that way many users can have many copies of the same card

#

without linking a character, but the collected card to a specific user

lyric mountain
proven lantern
lyric mountain
#

?

proven lantern
#

everyone has a stash capacity of 250 by default. if it's more or less store that offset

#

otherwise assume it's 250

lyric mountain
#

it has no advantage over what I did

#

an INT column will use 32 bits regardless of the current value

#

also makes querying easier

proven lantern
#

yeah, splitting it into tables would be more querying

#

i'm guessing you need that stash capacity often

lyric mountain
#

splitting what? the capacity?

#

like, there's literally no reason to put it in another table

proven lantern
#

you could remove the stash capacity column

lyric mountain
#

if that table is already the one supposed to hold general info

lyric mountain
proven lantern
#

you could have another table for stash capacity offset keyed off user id. only put a row in for the user if they have an offset

lyric mountain
#

see what I said earlier

proven lantern
#

remove the stach capacity row in the general table

lyric mountain
#

that table is supposed to hold general info regarding that user's collection, not putting them there would make the whole table unnecessary

proven lantern
#

at some point you'd split it up right? or keep adding columns?

#

like if each user could have 1000s of different stash capacities

lyric mountain
#

they cant

#

an user can only have one collection

proven lantern
#

ok, imagine you didn't have breakfast this morning

lyric mountain
#

...?

frosty gale
#

but can a collection have multiple users 😳

lyric mountain
#

you're making no sense, why would I create many tables for info regarding a single user?

#

that sounds like something a nosql user would do mmLol

plucky hearth
#

Hi

buoyant musk
#

I have a question, when the bot is being reviewed what perms does it have

earnest phoenix
buoyant musk
#

I have a problem when my bot was being reviewed the bot gave an error saying it doesn't have enough perms to send an attachment in guildCreate event while the invite link had administrator on it, making my bot to be declined

earnest phoenix
#

The bot isn’t allowed to have administrator perms on it for any reason that’s how my last one got denied

buoyant musk
#

But when I asked they said that the bot can have administrator on the invite but it can not be required for a command

#

My bot was denied because the commands were not working because of the error

deft wolf
#

When adding a bot, you can not give the administrator perms to the bot. You have to be sure that your bot works without it because not everyone wants to add bots with such permissions

#

Giving every bot an admin is a very ill-advised habit

buoyant musk
#

The bot can work without administrator but the error comes with attach files perms

#

I asked the reviewer and he said that the bot are being added with perms=0 for reviewing

deft wolf
#

Did your bot then send a message to the user that the bot doesn't have permission to send files?

buoyant musk
#

No

#

It's an guildCreate event file

deft wolf
#

I don't quite understand what your bot would send when adding it to the server

buoyant musk
#

It just send an embed with an image attachment

deft wolf
#

Then make sure your bot has permission to send files

buoyant musk
earnest phoenix
#

I had to look through my 156 commands and see what one had admin only on it

deft wolf
#

The fact that you give it such permissions in the link does not mean that it will always be added with such permissions

buoyant musk
earnest phoenix
#

Is it bad my bot has 140k+ members between 46 servers

deft wolf
#

Giving it admin permission won't fix anything if eventually this permission is not granted and this can happen in a very large number of cases

#

You need to work on the bot a bit more

quartz kindle
#

when commands that require permissions fail, your bot has to explain why it failed and ask the user to give it the necessary permissions, and only those, not any excessive permission

civic scroll
#

in other words, only require the permission only when you do an action that requires it

quartz kindle
#

your bot was declined because your commands failed without any explanation, you are supposed to catch those errors and provide an explanation

#

for example if the command fails, your bot has to respond saying that it failed and why, instead of not responding anything

buoyant musk
#

Alright thanks

wooden ingot
#

Hello, I am trying to post my server count to top.gg using clustering (discord-hybrid-sharding) and Discord.JS. The top.gg AutoPoster doesn't work as the manager needs to be either a Discord Client or a ShardingManager, whereas the cluster library I'm using has a "ClusteringManager" which does not sub-class the ShardingManager. Any ideas how I could get around this?

quartz kindle
#

you can always do manual posting

wooden ingot
quartz kindle
#

then make a post request to the top.gg api

wooden ingot
#

thanks 👍

earnest phoenix
#

im using pycord

How would i make a @bot.event whenever someone votes on my bot, and it returns the users ID

quartz kindle
tulip ledge
#

Can I use canva or another library to add 6 gifs into one, bigger gif?

pale vessel
#

you mean append gif 2's frames to gif 1 for example?

tulip ledge
#

No

#

So they’re like side by side

pale vessel
#

tiled gifs?

tulip ledge
#

Yeah

dense musk
#

Good eve

civic scroll
#

good evening

dense musk
#

What would I do

civic scroll
#

this channel is for asking questions regarding development

dense musk
#

Thank ok

civic scroll
#

so if you want some regular chatting, consider #general

tulip ledge
civic scroll
#

after all, gif is a sequence of frames

tulip ledge
#

So if I tile each frame of each gif

#

Side by side

pale vessel
#

you can use gifsicle

#

imagemagick could work too

#

although I'm not really familliar with the usage of those two but there's definitely a way

tulip ledge
#

Yeah guess I’ll look into it

pale vessel
#

if you want JS only solution it would look janky and extremely slow

tulip ledge
#

But the gifs are from an api

pale vessel
#

you'd have to save them to some temp folder then

#

or pipe them

tulip ledge
#

Mmh

#

Ok ty will look into it

pale vessel
#

this is for imagemagick for example

tulip ledge
#

And how would I use imagemagick with javascript?

pale vessel
#

there are wrappers

#
#

works for graphicsmagick and imagemagick

tulip ledge
#

Ah alr

small tangle
#

is there another way to shutdown a docker container if one of its services exits? im currently using docker compose up with the --abort-on-container-exit flag but is there maybe a config setting for the docker-compose.yml?

#

because i have a db service and bot service and want to shutdown the whole container if my bot service exits

sharp geyser
#

can't you do that with docker compose already?

#

unless im misunderstanding

small tangle
#

so i have my normal shutdown logic for my bot and it exits normally with 0 but the database service keeps running

#

i tried to configure that the db depends on the bot but it didnt change anything

rustic nova
#

iirc there is a option within docker-compose.yml that depends on another container being up

small tangle
#

(and the bot rather depends on the db on startup)

sharp geyser
#

are all these services running in the same container?

small tangle
#

ye

#

wait a sec

#

oh maybe the service healthy condition

sharp geyser
#

then doesn't docker compose down work?

#

providing its being run in the same container

#

it will bring all services down

rustic nova
#

this

#

dunno why you should shutdown the bot container and not the whole docker-compose setup

small tangle
#

nono it works perfectly. i want to use /shutdown on my discord bot and it shut down the container its inside

wooden jungle
sharp geyser
#

I don't think its possible to shut individual services down like that tho I have limited use with docker so take my word with a grain of salt

rustic nova
#

you can do a crackhead solution and pass through the docker socket to control it

#

bad idea though

wooden jungle
rustic nova
#

since that gives you access to all of your containers

wooden jungle
#

||Check the image i sent :/||

small tangle
#

docker compose up --build --abort-on-container-exit i mean when i start my container with this it works since the bot service exits and the docker stops the remaining services

#

but i thought of a more elegant solution

sharp geyser
#

wait your turn

lyric mountain
wooden jungle
#

Mhm

#

I use bdscript

lyric mountain
#

still

wooden jungle
#

kk

#

Well i will cut the token

sharp geyser
#

just execute docker compose down on /shutdown

rustic nova
#

ohmy definitely didnt leak

small tangle
#

xD

#

i was confused

rustic nova
#

perhaps thats what you're looking into

sharp geyser
#

At this point im still confused on what they are wanting

#

It sounds like to me they are wanting to shut the entire container down

small tangle
#

yes

rustic nova
#
version: '3'
services:
  container1:
    image: your-image
    # other container1 options
  container2:
    image: your-image
    depends_on:
      - container1
    # other container2 options

as an example

sharp geyser
#

then use docker compose down whenever you /shutdown

wooden jungle
#
$nomention
$var[apikey;TOKEN TOPGG]
$var[normal_color;#ff3366]
$var[success_color;#08b278]

$httpAddHeader[authorization;$var[apikey]]
$httpGet[https://top.gg/api/bots/$botID/check?userId=$authorID]
$if[$checkContains[$httpResult[voted];1]==true]
$var[voted;true]
$else
$var[voted;false]
$endif

$if[$var[voted]==true]

$title[Reward claimed!]
$description[You successfully claimed your reward.
You can claim another reward by [voting again\](https://top.gg/bot/$botID/vote) in **12 hours** from the time you last voted.]
$footer[Thank you for the vote ❤️]
$color[$var[success_color]]
$image[https://top.gg/api/widget/$botID.png]

$cooldown[12h;You can claim your next vote reward in **%time%**.]

$else

$title[Vote to claim!]
$description[You need to **vote** to claim your reward, [click here\](https://top.gg/bot/$botID/vote) or the button under this message to vote.
You can vote for the bot and claim your reward each **12 hours**.]
$addButton[no;https://top.gg/bot/$botID/vote;Vote for me!;link;]
$color[$var[normal_color]]
$endif

$image[https://top.gg/api/widget/$botID.png]
small tangle
#

because why should the container keeps on running if the bot is down

sharp geyser
#

easy way to do it

sharp geyser
#

what you are doing is a hacky solution that I don't recommend

rustic nova
#

you cant execute that within the container

#

unless you passthrough the docker socket

#

which exposes all of your containers

small tangle
#

i tried doing that from within yea

lyric mountain
#

yes I saw it

rustic nova
lyric mountain
small tangle
#
version: '3.6'

name: alpagotchi
services:
  database:
    container_name: database
    image: postgres
    restart: on-failure
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    volumes:
      - pg-data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  bot:
    container_name: bot
    build:
      context: .
      dockerfile: Dockerfile
      args:
        TOKEN: ${TOKEN}
        POSTGRES_USER: ${POSTGRES_USER}
        POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
        POSTGRES_URL: ${POSTGRES_URL}
    depends_on:
      - database
    restart: on-failure

  adminer:
    container_name: adminer
    image: adminer
    depends_on:
      - database
    restart: on-failure
    ports:
      - "8080:8080"

volumes:
  pg-data:
    name: pg-data

thahts my config

wooden jungle
#

Yes

small tangle
#

because the bot needs to wait for the db on startup

lyric mountain
#

are u trying to check votes for your own bot?

sharp geyser
wooden jungle
#

The whole token

small tangle
#

no bot, adminer is postgres GUI

rustic nova
#

ohh yeah forgor

#

oh nvm bot is

sharp geyser
#

yes that does make sense

#

lmao

rustic nova
#

so you want to:

shut down database and adminer when the bot container shuts down right?

small tangle
#

yes :D

sharp geyser
#

then yea do what Aurel says

#

use depends_on

rustic nova
#

then depend_on both the database and adminer on bot

sharp geyser
#

if one shuts down the others do as well

wooden jungle
#

So if i do claim it will say u havnt voted.. if you have it will send the message u have voted. And there will be 12hr cooldown

rustic nova
#

might get issues on the depend of database on the bot service tho

#

just see what happens

lyric mountain
#

well, I dont see any issue with it, try sending a raw http request to see if you missed something

wooden jungle
#

Only after it gets that if the user vited the cooldown would work

lyric mountain
#

like through wget

small tangle
#

yea i was wondering if its a circular dependency

sharp geyser
#

I don't understand why people even use docker for bots no offense to you SirTimme

wooden jungle
#

Like?

rustic nova
wooden jungle
#

Raw http? Means?

rustic nova
#

see if it explodes

lyric mountain
#

...just said it

small tangle
#

cycle found: database -> bot -> database welp

wooden jungle
#

:/

lyric mountain
#

wget, for example