#development

1 messages · Page 188 of 1

craggy pine
#

Derp, yeah you're not wrong. After work brain is mush right now 😓

sharp geyser
#

@wheat mesa sir, you've used opengl right?

humble gyro
#

omg the goat @craggy pine

crude totem
# humble gyro omg the goat <@160679942319767552>

Hello, as the new owner of top.gg I was wondering if you could get someone to update the python sdk that interact with the top.gg api? A user added malware to the library weeks ago and we was told someone would be made aware of it and fix it but this isn’t the case

humble gyro
#

can you show me where?

crude totem
#

Let me find it

#

@humble gyro

#

I was also informed someone on pycord did a deep dive and turns out it is indeed malware

spark flint
#

yep malware downloader

#

fake downloader

#

how were they able to commit?

crude totem
#

I don’t think no one ever looked into it from top.gg

#

Still a very good question

spark flint
#

oh this person has perms for another repo

#

ok

#

cc @earnest phoenix

#

since its your github account

#

want to explain the malware KEKW

earnest phoenix
#

what’s up

earnest phoenix
spark flint
#

your github account commited malware to the top.gg python lib

earnest phoenix
#

huh

#

hold on

#

i haven’t even contributed to that repository

spark flint
#

verified commits from your github

#

maybe compromised?

earnest phoenix
#

i’m only contributing on the c++ one

spark flint
earnest phoenix
#

bro what

humble gyro
spark flint
#

i think your github account was compromised then

earnest phoenix
#

i’m so confused but how am i able to revert it back when i didn’t even do that

#

i think yes

humble gyro
#

if its your github acc then you are able to

real rose
earnest phoenix
humble gyro
#

git revert (hash)

real rose
#

i reported internally when it came up wawa guess it wasnt sorted

crude totem
spark flint
#

buffer i think you ran an info stealing malware

earnest phoenix
#

apologies, i think my github account was indeed compromised. Can someone remove my access to every repository

humble gyro
#

i can't yet lol

#

yea looks like all the commits are garbled nonsense

earnest phoenix
spark flint
#

thats part of the malware to hide the commit

#

it just adds into random places

humble gyro
#

yea

#

zzz

real rose
#

there is a lovely concise list of people with access to those public repos KEKW

earnest phoenix
#

is there a chance that the possible malware is still on my computer rn

spark flint
#

lmfao its hosted on galaxygate

humble gyro
#

atleast no new version was added

spark flint
#

info stealers scrape your creds

#

problem is, since its from code and not like a file you've downloaded idk what to suggest 😭

humble gyro
#

enjoy rotating every single password you own

earnest phoenix
spark flint
#

lemme get someone who knows more to help

earnest phoenix
#

thank you

#

im opening my pc rn

spark flint
#

oh someone beat me to it

#

thats a different IP to what i can see tho KEKW

humble gyro
#

ig we can just ff to the latest non-buffer commit then

#

good thing there's no release since chad

spark flint
#

i dont think it released publicly on pypi

humble gyro
#

pretty sure it is

spark flint
#

so the affected user count will be absolutely minimal

humble gyro
#

we have a pip acc

spark flint
#

oh

#

ueah but this was only commited to github

#

andn ot published

humble gyro
#

yea

#

unless ppl use the repo directly

spark flint
#

the malicious package is down anyways

crude totem
#

So the issue is

spark flint
#

so the malware won't execute

humble gyro
#

great

crude totem
#

So anyone using any other library had to download the one from GitHub

spark flint
#

yeah

earnest phoenix
#

how can i revert the multiple commits

spark flint
#

that was another commit someone wanted to make

earnest phoenix
#

or something

spark flint
#

im happy its not affected any other libs

humble gyro
#

force push to the commit latest non-you commit

crude totem
#

Discord.py requirement should be removed from pip version.

#

And just let the user install what library they want to use. Cause it does clash with forks of discord.py that uses the import discord part I guess

humble gyro
#

ig open an issue

#

it's community maintained cute_flush_owo

crude totem
#

It is on the GitHub version just needs pushed to pip

humble gyro
#

ah

crude totem
#

After the malware is removed

humble gyro
#

yea i can prolly release a new ver whenever i have access

#

until then no bueno

crude totem
#

And whoever have access to the pip

lyric mountain
#

since there has to be a minimum AND maximum versions

#

since dpy changes some things ever so often that break compat

earnest phoenix
#

the requirements.txt was already fixed

lyric mountain
#

also buffer, enable 2fa on ur acc

earnest phoenix
#

will do

lyric mountain
#

enable everywhere possible tbh

earnest phoenix
#

its already enabled via login but let me do it again

#

pc is cleaned

#

but they need to remove my access on the repository

#

weird only the topgg python sdk was attacked

lyric mountain
#

probably the weakest link

#

this is some 4d chess move, breach into maintainer's account so you can harvest bot tokens that use dpy + topgg

real rose
#

and they dont have a npm module for it or smth KEKW

#

eventho those do exist be warned !!

wheat mesa
earnest phoenix
#

weird

#

i ran a safety check commandline

#

and it outputted this

#

not sure if this is helpful enough lol

#

but yeah i think its all resorted

earnest phoenix
#

ill be more alert when installing something now

lyric mountain
#

I kinda now understand why it's so godamn bureaucratic to post packages to maven central

#

even if someone breaches my machine, and get my key, they still need the pass to said key

#

it's like 3fa

lyric mountain
#

discord url?

earnest phoenix
#

im still finding it out

modern sable
#

the last commit that removed the packages was signed with the same gpg key as the malware commits btw

lyric mountain
#

gotta change it yeah, in case the invader got ur key

earnest phoenix
#

ill revoke and rotate my gpg key

eternal osprey
#

is this TCP protocol with fast retransmits correct?

#

i don't fully get it yet. Like, suppose we fast retransmit a failed package after 3 duplicate acknowledgements, so we resend that data segment, the server receives it, but what do we do in the client side after receiving acknowledgement 1001?

#

Like do we just stop as that was all data, or do we need to resend all data from 1001 -> 2500?

sharp geyser
#

I’d thought at least the cms had control over it thinkEGG

sharp geyser
lyric mountain
#

"Pain, suffering and a hint of insanity" - Waffle

wheat mesa
#

I’d highly recommend making sure you understand memory and how to manage it before doing opengl though

#

Because opengl is another layer of memory management, you have to manage RAM but also manage VRAM

dusky idol
#

Life update, it doesn't any you for any legal documents for getting 2nd bot verified ze_thumbsup

deft wolf
#

Because they already have them, why would they require them a second time

tulip ledge
#

I'm trying to count the amount of comparisons of merge sort and plotting on a graph. This is my merge sort implementation

fn merge_sort(arr: &mut Vec<i32>, comparisons: i32) -> i32 {
  let length = arr.len();
  if length <= 1 {
    return comparisons;
  }
  let mid = length / 2;
  let mut left: Vec<i32> = Vec::new();
  let mut right: Vec<i32> = Vec::new();
  for i in 0..mid {
    left.push(arr[i]);
  }
  for i in mid..length {
    right.push(arr[i]);
  }
  let mut comparisons = merge_sort(&mut left, comparisons);
  comparisons = merge_sort(&mut right, comparisons);
  merge(arr, &left, &right, &mut comparisons)
}

fn merge(arr: &mut Vec<i32>, left: &Vec<i32>, right: &Vec<i32>, comparisons: &mut i32) -> i32 {
  let mut i = 0;
  let mut j = 0;
  let mut k = 0;
  let left_length = left.len();
  let right_length = right.len();
  while i < left_length && j < right_length {
    *comparisons += 1;
    if left[i] < right[j] {
      arr[k] = left[i];
      i += 1;
    } else {
      arr[k] = right[j];
      j += 1;
    }
    k += 1;
  }
  while i < left_length {
    arr[k] = left[i];
    i += 1;
    k += 1;
  }
  while j < right_length {
    arr[k] = right[j];
    j += 1;
    k += 1;
  }
  *comparisons
}

But when plotting it I get a linear graph, so there's something wrong with how I'm calculating the comparisons

solemn latch
#

Does anyone know of a bitvise(ssh/sftp client which supports a dark mode.

I'm tired of being blinded by bitvise

sharp geyser
#

I use it

#

You have 3 options with it iirc

solemn latch
#

Thanks ❤️

sharp geyser
#

System, Dark and Light

solemn latch
#

I'll download it the second I get a chance.

sharp geyser
#

np

#

Only annoying thing about it is the constant updates

#

but shrug

#

do what you have to do to remain secure

eternal osprey
#

i basically manipulated an image from my host pc and add it as a MessageAttachment to the embed setImage field by using attachment://file.png.
After a few months it basically removed this file from the setImage, displaying a greyish image.
But other people seem to upload images and it permanently stays. Is this because a normal image does not get deleted while an embed image does? You can for example see the ephemeral-attachment instead of normal attachment.

spark flint
#

hm

#

it should auto refresh

lyric mountain
#

ephemeral embed images however...maybe

#

since the whole point about ephemerals is that they only exist for a while

ebon inlet
#

Hey, I want to make a dashboard for my bot. Is it smart to program an API where the bot and the dashboard can access it? So that I have a large Redis cache and everything then goes together to the database at certain intervals.

lyric mountain
#

it's not "smart", it's the only way you'd be able to make a dashboard lul

#

as for redis, you dont really need it unless you expect to have a VERY large flow of data

#

also depends on the size of said data

ebon inlet
#

I would like to add a Redis cache so that I am prepared for the future.

#

Atm it is not alot of data

lyric mountain
#

adding a cache layer without the need for one can be detrimental to the performance

#

also you need to handle syncronization between cache and database properly as to not lose nor show stale data

#

databases are well within confortable zone at 10k reqs/s

#

you'll inevitably have to rewrite the bot along its growth, dont be too preemptive

ebon inlet
#

One side question: How can I get the „Bot Developer“ role?

lyric mountain
#

have your bot aproved on top.gg

ebon inlet
#

Yes

lyric mountain
#

wasn't a question lul

sharp geyser
#

huh

lyric mountain
#

if you have a bot there, then ask some mod for it

#

since luca might (will) break and not give the role automatically

ebon inlet
sharp geyser
#

talk to @harsh nova (if he remembers to do it)

eternal osprey
lyric mountain
#

remove what?

harsh nova
#

I am here

eternal osprey
#

well, how can i turn it into a normal attachment

lyric mountain
#

did u put the image in an ephemeral embed?

eternal osprey
#

no

lyric mountain
#

that's weird then

#

oh wait

#

is that a thread?

#

might want to check whether images sent in threads are temporary

sharp geyser
harsh nova
eternal osprey
#

no nvm

#

it'sjust a regular channel

#

i will post the code here soon

#

maybe something goes wrong in there

sharp geyser
#

its dinner

#

😋

#

🍽️

harsh aspen
#

hello, how can I code a discord bot

#

im using js

eternal osprey
#

i just realized that prisma is actually dating back all the way to fucking 1990

real rose
#

prisma is amazing

eternal osprey
#

i've never used it but read a dutch article dating back from 1990 where they noted that it was ran for database queries on a shared nothing dfs with 100 nodes.

wheat mesa
#

That’ll give you a “good” start (I don’t agree with everything they say to do)

eternal osprey
#

though each node only had 16 mb of memory

harsh aspen
#

ok

#

thx wfaffle

radiant kraken
surreal sage
#

nobody:
my phone's termius session that i forgot to close 3 days ago: ☹️

pale vessel
#

"its termius time"

lament rock
#

I love the part of the ssh where he said "its termius time" and started termius-ing everywhere

pale vessel
#

can u send some to me?

sterile lantern
#

lol so random

wheat mesa
#

Dropshippers when they find out they provide nothing to humanity, actually raise prices, and promote child labor: 😱

sharp geyser
#

Mmm my favorite

solemn latch
#

@drifting chasm no ads please

sharp geyser
#

@solemn latch uwu

solemn latch
#

OwO

sharp geyser
#

clipped turned into an emoji

muted pollen
sharp geyser
muted pollen
#

asip bored

slender wagon
#

quick question, i am working with a vue project and by default all the console logs go in the browser's console. Is there a way to move them to the machine's console or editor's console?

lyric mountain
#

only if vue has a "Run" option instead of "Build"

#

else you're packing everything into production, there's no vue at that point, only html + css + js

#

it does, npm run dev

slender wagon
#

i see

slender wagon
#

unlike nextjs

lyric mountain
#

you probably cant then

slender wagon
#

😭

lyric mountain
#

that said, you could try webstorm

#

jetbrains usually go out of their way to add qol features

slender wagon
#

Are you aware of a way to organize the logs in the console at least?

slender wagon
lyric mountain
slender wagon
#

like can i use a custom logger?

lyric mountain
#

console.error, console.trace, console.debug, etc

slender wagon
#

with colors and allat

lyric mountain
#

doubt it

slender wagon
#

on my strapi backend i used winston

lyric mountain
#

you could, however, output to a file

slender wagon
#

no not an option

#

I'll just see if i can organize the console logs

#

maybe create a middleware for th logs

#

and handling logging properly?

lyric mountain
#

did u try running through "debug" instead of "run"?

#

also, are u running from ide buttons or terminal?

slender wagon
#

all of them run dev

lyric mountain
#

webstorm doesn't have it by default?

slender wagon
#

but i changed them

#

look how beautiful the backend ones are, i am proud of these

lyric mountain
slender wagon
#

they use npm by default but i have added yarn in the configs. so it does run on yarn as develop

lyric mountain
#

wait did u create a js project or vue project?

slender wagon
#

this is vue

#

and the backend is strapi

lyric mountain
#

I meant when creating the project in webstorm

slender wagon
#

I am not the one who created it, but i am pretty sure it was created with the create vue app thingy

#

is that what you want to know?

#

or am i getting it wrong

lyric mountain
#

I mean this

#

webstorm add facets to the project when you create through there, perhaps your project isn't being detected as a vue project but as a regular js one

slender wagon
#

could be, but still not everyone runs the project on webstorm

#

so i should not base it on the editor

#

yk what i mean

#

i think i am better off just formating the browser logs and making them clean

#

since as you said in production it comes as just html js and css

#

unlike the backend

lyric mountain
#

for now u can just use the different levels of logging js has

#

console.log is just the generic INFO level

slender wagon
#

yes i know that

#

but i'll also need some sort of formater

slender wagon
#

so for example when there is an error thrown, i'll get rid of the non important info and only keep some of it

#

will do

#

thanks

#

now it's time for a little break

lyric mountain
#

@wheat mesa can't say how much I hate people who do this

#

like, ffs don't deploy alpha/beta versions as releases

charred nest
#

ok i need help, because i have been hititng my head against the wall abt this for days. my interactions keep doubling as per my console logs. for background info:

  • there is only one instance being run
  • i use an event handler -> separate files for events. other events do not double
  • the interactionCreate event is only listened to once
  • i defer reply for one command, but every command is affected
  • this applies to every interaction, including buttons (where i noticed this issue)
    interactionCreate.js:
const pool = require('../bot')
const config = require('../config.json')

module.exports = {
    name: Events.InteractionCreate,
    async execute(interaction) {
        console.log(`interaction type: ${interaction.type}`);
        
        if (interaction.isChatInputCommand()) {
            await handleChatCommand(interaction);
        } else if (interaction.isButton()) {
            await handleButtonInteraction(interaction);
        } else if (interaction.isAutocomplete()) {
            await handleAutocomplete(interaction);
        }
    }
};
async function handleChatCommand(interaction) {
    const command = interaction.client.commands.get(interaction.commandName);
    if (!command) {
        console.error(`No command matching ${interaction.commandName} was found.`);
        return;
    }
    await command.execute(interaction, pool);
    console.log(`${interaction.user.username} used a command | ${interaction.commandName}`);
}
async function handleButtonInteraction(interaction) {
    if (interaction.customId === 'nextPage') {
        //handle buttons. too long and not related to issue
    }
}
async function handleAutocomplete(interaction) {
    const command = interaction.client.commands.get(interaction.commandName);
    await command.autocomplete(interaction).catch(err => {
        console.log(err);
    });

    if (!interaction.deferred && !interaction.replied && interaction.isChatInputCommand()) {
        interaction.reply({
            content: `uh oh, an error occurred.`,
            ephemeral: true
        }).catch(console.error);
    }
} //added to try to mitigate issue. did not make a difference
charred nest
#

jk i fixed it

#

something in my main.js was duplicating shards

#

do i know what? no

#

will i ever know? no

solemn latch
#

I was going to blame

        if (interaction.isChatInputCommand()) {
            await handleChatCommand(interaction);
        } else if (interaction.isButton()) {
            await handleButtonInteraction(interaction);
        } else if (interaction.isAutocomplete()) {
            await handleAutocomplete(interaction);
        }

for not being a switch case ;p

charred nest
#

nerp just something fucking up the shards LOL

wheat mesa
solemn latch
#

Discordjs is so abstracted it makes better code harder here.

#

Even if the performance benefit here is basically 0

#

I'd do the same thing, if statements

charred nest
#

tbh i moved them to functions bc i could not keep scrolling up and down checking those if/else

#

coz im like Did i put a bracket somewhere wrong???

frank saffron
#

Hey, so I was told to head here from the lovely people over on the SRA discord (SomeRandomAPI).

I am developing a bot, which in short will send an "OfTheDay" each day at 10pm. You can select 5 options from a list of selections, for example: "Dog Of The Day", "Question Of The Day" etc etc.

This can all be customised via a /setup command
(See photo below)

So far, I only have three commands:
/setup, /userinfo, /ping.
Whilst these commands do what is required of the bot, I want some more stuff to add and I just cannot think of anything.
Does anyone have any sort of ideas or challenges for me that I could add to the bot?

|| On a side note, this bot is made for a specific purpose.. I don't want it to be one of those really common multi-purpose moderation bots. ||

wheat mesa
# charred nest tbh i moved them to functions bc i could not keep scrolling up and down checking...

better than my handling of just slash commands ```ts
if (payload.isCommand()) {
if (payload.isChatInputCommand()) {
const slashCommand = client.commandManager.getSlashCommand(payload);
let shouldRun = true;
try {
if (payload.inGuild()) {
shouldRun =
(await slashCommand.userPermissionCheck(client, payload)) &&
(await slashCommand.botPermissionCheck(client, payload));
}

                shouldRun = shouldRun && (await slashCommand.onBeforeRun(client, payload));

                if (shouldRun) {
                    await slashCommand.run(client, payload);
                } else {
                    await slashCommand.onCancelRun(client, payload);
                }
            } catch (e) {
                if (e instanceof CommandRunError) {
                    await slashCommand.onRunError(e, payload);
                } else {
                    await slashCommand.onUnexpectedError(e, payload);
                }
            }
        }
    }
#

back when I actually did discord dev

charred nest
solemn latch
#

oh man 👀

wheat mesa
#

though I was quite happy with this result

#

it led to very nicely structured commands

#

Like so ```ts
export class TestSubCommand extends BaseCommandOption {
constructor() {
super({
name: 'subcommand',
description: 'desc',
permissionsClient: [],
permissionsUser: [],
});
}

async run(client: PaperClient, interaction: ChatInputCommandInteraction) {
    await editOrReply(interaction, 'yay');
}

}

#

heavily inspired by detritus

charred nest
#

i'll stick with my silly code thanks LOOOL

solemn latch
wheat mesa
#

had permission checking built in and optionally overridable functions for extra pre-run checks

charred nest
#

ppl will ask me for dev advice and all i can say is.... augh.... im a silly dev pls dont rely on me

solemn latch
#

But all the async calls 👀

wheat mesa
#

What's wrong with that :c

frank saffron
#

Oh, wait. Is it even possible with a cronjob?

solemn latch
#

You would likely want to move away from cron there.

The way i would handle it would be a 10 second interval, checking the database for upcoming requests, then setting a timer to handle each one as it comes up(or just handling them in bulk, they might be off by 10 seconds, but not a big deal)

wheat mesa
#

timer 😰

solemn latch
#

Puts every async call at the end of the event loop

wheat mesa
#

eh I'm too lazy to care about the ins and outs of the event loop in terms of a discord bot

#

I don't usually use js/ts much anymore

solemn latch
#

I think understanding the event loop has made me over concerned with it tbh.

wheat mesa
#

Plus if I was interested in high performance code, I'd be using a different language

solemn latch
#

In a bot these days I'd make everything callback based inside the command handler

#

yeah fair ^-^

wheat mesa
#

Just made it because it was ease of use

mild swallow
fringe nova
#

ello
im updating my server count every 30 minutes ish, i used the token from the topgg site itself
but nothings happening 💀

sharp geyser
#

why is intellisense in vscode broken for rust 😭

wheat mesa
#

Are you using rust-analyzer

sharp geyser
#

yes

wheat mesa
#

sometimes it spazzes out

#

restart vsc

sharp geyser
#

yea no its spazzing out a lot

#

I'm constantly having to refresh

neon leaf
#

Why is computer craft so complex

#

Took me like 4 hours to make a working wireless network with access points and signal strength detection

humble gyro
#

hiya

#

finally got access to the github, removed the commits on python sdk

#

anyone using those specific commits should get an error and re-install to the latest commit hash

radiant kraken
humble gyro
#

ye

#

first fixing the site tho

radiant kraken
#

aight

humble gyro
#

😭

#

top.gg servers are so old that if i want to update nodejs i need to manually build and install glibc

acoustic bough
#

wtf lmfao

#

what version does it run rn?

humble gyro
#

u dont wanna know

acoustic bough
#

12-16?

#

idk I thought it would run in docker containers lol

humble gyro
#

they will soon

acoustic bough
#

lol nice

#

me like updating a all deps every few weeks

spark flint
#

lol

sharp geyser
#

you said this in the dev channel

#

big mistake

true star
#

Not enough caffeine in the universe to help me fix these messes‽

deft wolf
#

Huh?

rugged dawn
#

smh

#

wall spammer

harsh aspen
#

hi

#

how are

deft wolf
#

Weird question for development chat

sharp geyser
#

Hi how are you NyNu

harsh aspen
#

sorry lost my internet connection while typing this

#

so, how can I make a modal pop up with html & css
so if I clicked on a button it will pop up

wheat mesa
#

You’ll need js for that as well, granted it’s a small amount that you can just inline it

harsh aspen
#

thank you

#

but gpt helped me better

sharp geyser
#

💀

#

the AI + Copy and Paste era is going to kill the tech industry

harsh aspen
#

"enhance the tech industry"

wheat mesa
#

If it works for you then who cares but AI is definitely not going to enhance the tech industry (at least for programming quality) for a very long time

harsh aspen
#

idc

#

if it works then Im happy

wheat mesa
#

Battleless vibes

sharp geyser
#

are we certain its not?

wheat mesa
#

Wouldn’t be 100% surprised but this account is 3 years old

sharp geyser
#

trying to use diesel_cli on mac is annoying

limpid rain
#

Hi

lament rock
#

to be fair, I did ask chatgpt to help me with my unity game a few times, but its knowledge is quite outdated and it produced quite a few errors, but got me on the right track

queen needle
#

I usually use it for small mundane tasks, like replacing a variable or some small math I can't think of right away

sharp geyser
#

Replacing a variable?

#

Your IDE can do that for you

#

💀

queen needle
#

I realized after I sent it I didn't know what exactly I meant to say but it wasn't that

#

I swear I know about find and replace

sharp geyser
past field
#

if anyone has time today, can i get a little help with utilizing sqlite lol

harsh aspen
#

dontasktoask

#

.com

deft wolf
#

Funny

lyric mountain
#

this is an excellent example as to why you shouldn't ask to ask

#

2 hours already and neither the question nor the solution are known

pale vessel
#

it's a bad habit of theirs

grim aspen
#

good example for not specifying the issue

eternal osprey
#

does anyone understand the difference between them?

lyric mountain
#

I dont get it, what ur supposed to do?

#

implement findElement?

eternal osprey
#

no thats ez, i am trying to understand this theory
but i don't get it at all

#

like wat'ss the difference betweeen the 2 characteristic creations

lyric mountain
#

without context it's pretty hard to understand what those powerpoint slides are saying

past field
rose warren
#

When I moved all my projects from a VPS to a dedi my RAM usage went from 25GB on the VPS to 15GB on the dedi. Like wtf? I didn't change any code.

deft wolf
#

Maybe better RAM? PepoThink

rose warren
#

yeah but 10GB?!?!

#

could it really be that much of an improvement?

solemn latch
#

It stabilized at 10gb? 👀

rose warren
#

was my vpe really that bad? mayaLaugh

solemn latch
#

or at 15

rose warren
# solemn latch It stabilized at 10gb? 👀

yeah! my bot has been up for a 3 days now and it's stabilised at 15GB total usage for the whole server (my mod bot, my main bot, my db, my microservices...). It used to all use 25 to 28GB out of the 32GB it had on my vps and now it's all using 15GB total

solemn latch
#

👀 thats so weird.

rose warren
#

this was before

solemn latch
#

Do VPS's have some overhead that happens within the VPS itself?

rose warren
#

this is on the dedi

solemn latch
#

This feels like a question for dylan ;p

rose warren
pale vessel
#

did u compare the processes too?

rose warren
#

but 10GB of efficiencies seems huge

rose warren
#

but what's insane is i went to town with cache allowances on the dedi since i have the space. I doubled the cache my db is allowed to store and i doubled the max node memory or whatever it is (this is not my field)

#

and yet it's still using 10GB less

#

i don't understand kekw

lyric mountain
#

sqlite is easy for beginners because it has very low complexity regarding features, and is really fast

#

there are a lot of tutorials and courses around regarding how to use sqlite on every language

rose warren
#

Also if you wanna know how fast a dedi is vs a vps @solemn latch

#

A bump in 2 versions of postgres + the new dedi hardware

quartz kindle
#

the best one around is better-sqlite3

#

the library will take care of managing sqlite itself, you just give it the sql commands

#

now, SQL is a separate language as a whole, different from JS. its the language that defines what sqlite should be doing

#

so its a good idea to learn a little about the SQL language itself

#

basically what you will be doing in JS, is loading better-sqlite3, then with the library, you send commands to sqlite, for example like this:
database.prepare("SQL command here").run()

#

with the SQL language, you can create and run all sorts of commands, like create a database, write data, read data, etc...

#

the good thing about SQL is that its an independent language, meaning it works the same way in JS, in python, in C# and in any other programming language

#

so its always a good thing to learn

solemn latch
#

I swear we need to make a website called timanswers

#

Just copy paste the questions and answers

pale vessel
quartz kindle
#

lmao

lyric mountain
#

except it's already a site

quartz kindle
#

lmao

solemn latch
#

^-^

quartz kindle
#

dedi literally means grandpa in slovenian

sharp geyser
#

on a vps they are shared and not dedicated to you, so it might be a cause for such high ram usage as the ram has to pickup slack I assume anyway

rose warren
#

Seems a little crazy

sharp geyser
#

indeed

#

what provider?

rose warren
#

Pulseheberg

sharp geyser
#

never heard of em

rose warren
#

They're a small French company

#

Honestly I've been super impressed with their services

quartz kindle
rose warren
#

But I've outgrown them

quartz kindle
#

maybe the dedi is swapping more

rose warren
#

There's nothing in swap cache

#

and i did have swap configurated on the vps

quartz kindle
#

the os image is the same?

woeful zenith
#

So I used this API

from discord.ext import tasks

import topgg

# This example uses tasks provided by discord.ext to create a task that posts guild count to Top.gg every 30 minutes.

dbl_token = "Top.gg token"  # set this to your bot's Top.gg token
bot.topggpy = topgg.DBLClient(bot, dbl_token)


@tasks.loop(minutes=30)
async def update_stats():
    """This function runs every 30 minutes to automatically update your server count."""
    try:
        await bot.topggpy.post_guild_count()
        print(f"Posted server count ({bot.topggpy.guild_count})")
    except Exception as e:
        print(f"Failed to post server count\n{e.__class__.__name__}: {e}")


update_stats.start()

It said on my end that it posted the server count, I go to the top.gg page and it hasnt updated?

solemn latch
#

Whats the ID of the bot?

woeful zenith
#

I've even tried this snippet of code

import topgg

# This example uses topggpy's autopost feature to post guild count to Top.gg every 30 minutes
# as well as the shard count if applicable.

dbl_token = "Top.gg token"  # set this to your bot's Top.gg token
bot.topggpy = topgg.DBLClient(bot, dbl_token, autopost=True, post_shard_count=True)


@bot.event
async def on_autopost_success():
    print(
        f"Posted server count ({bot.topggpy.guild_count}), shard count ({bot.shard_count})"
    )

deft wolf
woeful zenith
#

And a direct request to their API

import aiohttp
import asyncio
async def updateStats():
    url = f"https://top.gg/api/bots/1177973930225569802/stats"
    headers = {
        'Authorization': ""
    }
    payload = {
        'server_count': 49956
    }
    async with aiohttp.ClientSession() as session:
        async with session.post(url, data=payload, headers=headers) as resp:
            if resp.status != 200:
                print(f'Failed to update server count: {resp.status}')
            else:
                print('Server count updated successfully.')
            
asyncio.run(updateStats())
#

None worked

woeful zenith
solemn latch
#

is 49k not right?

woeful zenith
#

but i need it to update automatically

lyric mountain
#

press ctrl + f5

#

on the page

woeful zenith
#

right now we need to go into edit, press save

solemn latch
#

Thats likely just site cache

#

It will update over time

woeful zenith
woeful zenith
deft wolf
#

I'm totally lost in this situation guys kappalul

lyric mountain
#

if ctrl f5 didnt work, then it's likely yet-another-topgg-cache-issue

#

probably the expiration aint working

solemn latch
#

👀

woeful zenith
#

Ye

#

It does that

#

But dosent update on the site

solemn latch
#

have you edited in the past hour?

woeful zenith
#

Yes

#

I just edited right now

woeful zenith
#

I used that

#

It didnt update

solemn latch
#

dblstatistics checks the backend, and should tell us if the backend is updating or not.

woeful zenith
#

Okay

#

ill leave it auto updating

solemn latch
#

If you use the direct api code youll have to run it every 30 minutes with a timer, or just manually run it.

woeful zenith
#

If I leave it like this, its good?

dbl_token = ""
    bot.topggpy = topgg.DBLClient(bot, dbl_token, autopost=True, post_shard_count=True)
solemn latch
#

You need the

@tasks.loop(minutes=30)
async def update_stats():
    """This function runs every 30 minutes to automatically update your server count."""
    try:
        await bot.topggpy.post_guild_count()

code too iirc

#

I dont know python, its over my head on how it works.

woeful zenith
#

Alright

rose warren
quartz kindle
#

really weird then

#

the only things i can think of that would explain a 10gb difference is either ram compression, swapping or the workload not being the same

eternal osprey
#
 let embed = EmbedBuilder.from(interaction.message.embeds[0]);
          embed.setDescription(
            `> Profit report posted by ${interaction.member}.`
          );
          embed.setTitle("🚀 | Profit Submission");

          let k = await outputChannel.send({
            embeds: [embed],
          });```
why is my discord bot sending ephemeral embed images such that they eventually dissappear after a few months?
#
 const attachment = new AttachmentBuilder(await canvas.encode("png"), {
      name: "report.png",
    });
    const actionRow = new ActionRowBuilder().addComponents(
      new ButtonBuilder()
        .setLabel("Accept")
        .setCustomId("complete")
        .setStyle(ButtonStyle.Success)
        .setEmoji("✅"),
      new ButtonBuilder()
        .setLabel("Decline")
        .setCustomId("discard")
        .setStyle(ButtonStyle.Danger)
        .setEmoji("❌")
    );
    const botInfoEmbed = new EmbedBuilder()
      .setColor("DarkButNotBlack")
      .setFooter({ text: `🚀 Report Bot | Profit System` })
      .setTitle("🚀 | Are you sure?")
      .setDescription(
        "# Image Metadata" +
          "\n\n> ``Name:`` " +
          `${name}` +
          "\n> ``Quantity:`` " +
          `${quantity}` +
          "\n> ``profit:`` " +
          `$${profit}\n\nPlease click on one of the buttons below to send this image to the ${outputChannel} channel or to discard it.`
      )
      .setImage("attachment://report.png")

      .setTimestamp();

    let z = await interaction.reply({
      ephemeral: true,
      fetchReply: true,
      embeds: [botInfoEmbed],
      components: [actionRow],
      files: [attachment],
    });```
sterile lantern
#

if youre asking why its sending ephemeral messages, it's because youre sending it as an ephemeral message

acoustic bough
#

discord only stores files for ephemeral replies as long as the reply exists

#

(a bit longer than that but no guarantees)

eternal osprey
#

i got it working but what's this type of bullshit?

#

embeds[0].image.url returns me this a link, that once you click on it downloads a random ass file

lament rock
#
A:\Windows\Documents\GitHub\Amanda\packages\runtime-worker>yarn start
A:\Windows\Documents\GitHub\Amanda\node_modules\backtracker\dist\index.js:32
    try { throw new Error(); } catch (e) { stack = e ? e.stack : ""; }
                                                         ^

[getStack (A:\Windows\Documents\GitHub\Amanda\node_modules\backtracker\dist\index.js:32:58),getPrefix (A:\Windows\Documents\GitHub\Amanda\packages\logger\dist\index.js:1:227),post (A:\Windows\Documents\GitHub\Amanda\packages\logger\dist\index.js:1:609),getStack (A:\Windows\Documents\GitHub\Amanda\node_modules\backtracker\dist\index.js:38:13),getPrefix (A:\Windows\Documents\GitHub\Amanda\packages\logger\dist\index.js:1:227),post (A:\Windows\Documents\GitHub\Amanda\packages\logger\dist\index.js:1:609),getStack (A:\Windows\Documents\GitHub\Amanda\node_modules\backtracker\dist\index.js:38:13),getPrefix (A:\Windows\Documents\GitHub\Amanda\packages\logger\dist\index.js:1:227),post (A:\Windows\Documents\GitHub\Amanda\packages\logger\dist\index.js:1:609),getStack (A:\Windows\Documents\GitHub\Amanda\node_modules\backtracker\dist\index.js:38:13)]

Node.js v20.8.0
#

The fuck is this supposed to mean lmao???

#

even just new Error().stack does that so dont get me for syntax

#

Error is from line 55 (there are some changes I made while trying to rapid iterate fix, but nothing made any effect on the error)

#

oddly, works in the repl

#

Oh wait. It was console.logging which I overwrite so circular reference. I'm dumb

tired jay
#

hullo... i am trying to post the server installs for my bot using the following code:

def update_installs(install_count: int):
    response = requests.post(
        url=f"{BASE_API}/bots/{BOT_ID}/stats/",
        headers=_headers(),
        data=json.dumps(
            {
                'server_count': install_count,
            },
        ),
        
    )
    response.raise_for_status()
    return response.json()

def _headers():
    return {
        'Authorization': BOT_TOKEN,
    }

the POST call doesn't return an error, but also doesn't seem to have updated my servers count:

>>> from services import top_dot_gg
>>> response = top_dot_gg.update_installs(50)
>>> response
{'shards': []}
>>> top_dot_gg.get_installs()
{'shards': []}

(consistent with https://dblstatistics.com/bot/1186494834446454784)

could anyone point me towards what i'm doing wrong?

solemn latch
#

application/json

tired jay
# solemn latch You're missing the content-type header

ty... i just added that and tried again with the same results:

def _headers():
    if not settings.TOP_GG_BOT_TOKEN:
        raise Exception("missing TOP_GG_BOT_TOKEN")
    return {
        'Authorization': settings.TOP_GG_BOT_TOKEN,
        "Content-Type": "application/json",
    }
>>> from services import top_dot_gg
>>> response = top_dot_gg.update_installs(50)
>>> response
{'shards': []}
>>> top_dot_gg.get_installs()
{'shards': []}
tired jay
solemn latch
#

its been awhile since I've posted using the raw api, you might need to provide all three values.

shardId and shardCount, and serverCount.

#

Its been awhile, so I could be wrong

#

Nope, I was wrong

tired jay
#

yah... same results with:

def update_installs(install_count: int):
    response = requests.post(
        url=f"{BASE_API}/bots/{BOT_ID}/stats/",
        headers=_headers(),
        data=json.dumps(
            {
                'server_count': install_count,
                'shard_count': 1,
                'shard_id': 0,
                'shards': [install_count],
            },
        ),
        
    )
    response.raise_for_status()
    return response.json()
solemn latch
#

I'll play around with the API and see if I can figure out what we're missing ^-^

tired jay
#

tyvm!

solemn latch
#

hmm

solemn latch
#

url=f"{BASE_API}/bots/{BOT_ID}/stats/",
to
url=f"{BASE_API}/bots/{BOT_ID}/stats",

tired jay
#

huh. i think that was it. ty!

Python 3.11.7 (main, Jan 17 2024, 06:37:55) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from services import top_dot_gg
>>> top_dot_gg.get_installs()
{'shards': []}
>>> top_dot_gg.update_installs(50)
{}
>>> top_dot_gg.get_installs()
{'server_count': 50, 'shards': None, 'shard_count': None}
>>> 
solemn latch
#

goofy api

sharp geyser
#

hey woo

sharp geyser
solemn latch
#

hungry

sharp geyser
#

same lol

#

I want to do some open source projects

#

Any ideas?

solemn latch
#

Hows your nextjs skills?

sharp geyser
#

anything frontend

#

is terrible

solemn latch
#

Well, this is in between ^-^

#

lol

sharp geyser
solemn latch
#

Just make it open source, ezpz

#

kek

sharp geyser
#

you got 5$?

solemn latch
#

$3

#

I'm bored and making a description builder.

#

And I want to let users use whatever font they want

#

But it sucks 😦

sharp geyser
#

uh

#

I mean

#

you can just import everything from that lib

#

and just search it like an object

#

I think

#

so import Fonts from 'next/font/google' then Fonts["Inter"]({})

solemn latch
#

If I restrict them to variable fonts only that might work

#

Better than nothing

sharp geyser
#

import * as Fonts from 'next/font/google' if it doesn't have a default

#

I don't see making a lib for something like this being super helpful tbh

#

no offense

solemn latch
#

Ah, I remember why this wont work.

sharp geyser
#

I might work on my i18n project again

solemn latch
#

Fonts need to be defined as a const, its a restriction on the next/font/google thing

sharp geyser
#

Better yet, I will make an entire discord js framework trollface

solemn latch
#

ask tim for help ^-^

sharp geyser
#

oh god

#

tim would demolish me and essentially rewrite the entire project 😭

#

I just want something to do on the side so I don't get bored of just one thing

quartz kindle
#

wat

pale vessel
#

do something outside of discord

quartz kindle
#

nein

green kestrel
earnest phoenix
fringe nova
#

ello
my server count does not get added on the top.gg website ;-;
this is the code i use, i based it on what the api said:

    const body = [
      { server_count: client.guilds.cache.size },
    ];
    await fetch(`https://top.gg/api/bots/939565109787902052/stats`, {
      body,
      headers: { Authorization: "token removed due to security reasons" },
      method: 'POST',
    }).catch((err) => console.error(`#${cache.index + 1} ${this.name}: ${err.stack}`));
#

im pretty sure its not an issue with your api, just im probably doing something wrong ;-;

acoustic bough
#

also, you have to stringify the body before sending it

fringe nova
#

oh

#

oh okay my bad i was reading docs wrongly

#

if its arrayed it acts like shards

#

and my bot is not sharded

#

thank you :D

acoustic bough
#

yw

fringe nova
#

once i post it, would i need to refresh data? or would it load automaticly

solemn latch
#

It updates over time on its own, but you can encourage it to happen faster by editing and saving.

rancid parcel
#

What Is The Best Hosting?

solemn latch
#

best in terms of what?
Just raw performance ignoring price?

sharp geyser
#

Has anyone here integrated stripe into their platform? If so what did you use? I was reading the documentation on it and they quite frankly have a lot of different options. Payment links, Checkout, Connect, etc. I know I will likely need to use a combination of Checkout and Connect if I wanted to make my own payment flow with them, meaning I would be making my own customer accounts when it comes to it.

rose warren
sharp geyser
#

oh?

rose warren
#

You can even add other payment processors like PayPal, Amazon Pay etc. It's an excellent product.

sharp geyser
#

hm

rose warren
#

All I deal with is webhooks sent to my bot from Chargebee to update it on the status of people's subs.

#

Everything else is handled by Chargebee

wheat mesa
#

The real struggle is keeping track of taxes on such platforms 😉

rose warren
wheat mesa
#

Oh good

rose warren
#

Chargebee is free up to like €100k in lifetime revenue or something. But honestly I'm nowhere near that but I'd happily pay for it already.

sharp geyser
#

I mean, stripe I can use, I just don't know what flow to go with.

#

My usage will be fulfing orders and shipping to the customer.

rose warren
#

Oh wait it's actually $250k mayaLaugh they increased their free tier

sharp geyser
#

no

rose warren
#

Chargebee doesn't make sense for you then

sharp geyser
#

yea which is why I was about to say chargebee won't work

#

I was just looking at their website

rose warren
#

I haven't worked with the Stripe API so I'm not much help mayaLaugh

sharp geyser
#

all good

#

the stripe discord kinda blows ngl

#

See idk

#

I think I understand what I need to do but please if anyone's ever used stripe's api reach out to me 😭

spark flint
#

Stripe API is amazing

#

I use it for several projexts

sharp geyser
#

teach me the way

#

😭

spark flint
#

I’m at work atm but will help after

sharp geyser
#

ok

spark flint
#

What I do is check if a user has a stripe ID linked to them in the DB

sharp geyser
#

I am free for the next 3-4 days

#

so

spark flint
#

if they don’t, generate one

#

Then generate a checkout session with their stripe ID and assign an order ID in metadata

sharp geyser
#

Well here's the thing. I plan on making comissioner accounts with my platform, wouldn't I need to integrate stripe connect into my workflow as well?

spark flint
#

Then use stripe webhooks, and watch for incoming payment events matching that stripe ID and match the custom meta data

#

Ah true

sharp geyser
#

How would that play out with the whole payment stuff

spark flint
#

Pretty sure stripe checkout works with that

sharp geyser
spark flint
#

IIRC you pass a stripe connect ID too and it will link to their stuff

sharp geyser
#

I think I will first need to work on integrating stripe connect which is something I didn't plan on doing until later cause comissioner accounts wasn't something I was worried about yet

#

it seems like the most viable thing tho to get it out of the way

#

Then I can work on payment processing and figuring that out.

sharp geyser
#

I am using rust for this, so the package I am using is kinda wack.

spark flint
#

Stripe makes everything easy asf when you figure it out

sharp geyser
#

It's docs page is a mess

sharp geyser
spark flint
#

Fsirrs

#

Fairs

sharp geyser
#

My workflow is like this

Customer creates an account on my platform -> I think I use stripe here? -> They browse the products -> They comission a design to go on those products (or choose to just take the design as an image file or smth) -> Checkout -> Pay -> Order ships or is emailed to them if they choose the second option

#

Now the thing is

#

I have no fucking clue on how to define products. I know stripe has a products page, but that seems very limiting

spark flint
#

I wouldn’t use that

sharp geyser
#

I'd rather have a json file of the products we offer

#

and have defined values there

spark flint
#

It’s quite slow and buggy and some adblocksrd stop it

sharp geyser
#

Man making a service is a lot harder than I thought when it comes to planning this shit out

#

I might need to rework my auth flow to work with stripe connect

sharp geyser
sharp geyser
#

I was saying i'd prefer that over the stripe products page

frank saffron
#

Hey. I know this may be simple js but whatever..
If I want to map every role that a user has (apart from @ everyone), would i do:

<member>.roles.cache.map(role => `<@&${role.id}>`).filter(role => role.id !== interaction.guild.id);
#

Or does the filter have to come first

real rose
#

filter first

#

because you want to filter out the everyone role

#

then map over the result

frank saffron
#

Okay cool, thank you!

wheat mesa
#

Yeah, filtering here would be filtering over a list of strings that doesn't have an id property

#

So in practice your filter predicate would always return true

sharp geyser
#

@spark flint

#

excuse me sir may I bug you?

stiff dust
#

@green kestrel well im here

spark flint
sharp geyser
# spark flint sure

trying to figure out how to make a table relation rn.

Essentially there are two tables. students and campuses. A campus can have multiple students, but a student can only belong to one campus. How would this be modeled in sql?

#

raw sql table relations are new to me, I usually had an orm like typeorm handle this for me KEKW

#

I was thinking that the foreign key on the students table that references the campus e.g campuses_id had to be unique but if I do that, then that means that campus_id cannot appear anywhere in the table again

spark flint
#

hm

sharp geyser
#

wait

#

I just need to make the student id unique

#

ez

green kestrel
#

hmm a ping was deleted

pale vessel
rancid parcel
pale vessel
#

hetzner?

deft wolf
#

Personally, at the moment I am using datalix (https://datalix.eu/) to host the bot and databases and contabo (https://contabo.com/en/) to host photos/videos because they had a promotion in which they did not charge the setup fee at all

#

Both work without major problems and contact with support is very pleasant and easy flushedCat

spark flint
#

i use datalix and hetzner

#

and a few others

charred nest
#

i use digital ocean for both my vps and cloud db

stiff dust
deft wolf
green kestrel
green kestrel
#

i could take a quick look and stab a guess at what discord didnt like

#

no promises 🙂

slender wagon
#

question

#

is it ok if i store images and files uploaded by a user on the file directory on my vps

#

Not for mass usage only used by admins

#

i only store the directory on the postgres so i can retrieve it easily later

charred nest
#

storing would need to be stated in the privacy policy, usage of uploaded data im not sure. i also recommend having some sort of filter on user uploads

slender wagon
deft wolf
#

If it's included in your privacy policy, there shouldn't be a problem

slender wagon
#

Like what else could be there besides storing in the file system

charred nest
#

as long as its stated in the privacy policy, it should be fine imo

slender wagon
#

oop practices as in speed etc etc

charred nest
#

oh my bad HAHAHA

slender wagon
#

I am storing files uploaded by the owner of the site so a policy isn't important

#

it's a webite

charred nest
#

i don't think it would be slow ? not sure though since im not the most knwoledgable on that

slender wagon
#

oh that's fine, yeah it aint that slow. I'd have to wait for production though and i really need some strict rules as someone could fuck my entire vps with a few uploads

charred nest
#

i store my images/files on cloudflare and havent had any speed issues in retrieving tbh

slender wagon
#

you're going to wonder if the endpoints are secure

#

nope

slender wagon
#

we could be talking about 100mb + files

#

so

charred nest
#

i think for cf its $5 for 100k images stored

#

$5 a month*

slender wagon
#

what about files?

#

like size

charred nest
slender wagon
#

ty

charred nest
#

nppp

acoustic bough
#

I use r2 and love it

slender wagon
#

i don't get the 10gb/month

#

like i can store 10gb worth of data this month and another 10 next month lmfao?

#

or 10gb all time storage

acoustic bough
#

nah

#

10gb is always free

slender wagon
#

so i can have up to 10gb stored on cloudflare

acoustic bough
#

with aws you only have 10gb free for the first year

slender wagon
#

i see

acoustic bough
#

that’s what i’m doing

#

optimize all uploads to be 200kb

#

and just live off the free tier

slender wagon
#

Can't i got a bunch of large files

#

so i think i will continue with the vps storage

#

but i will def use it on some other project

acoustic bough
#

well I only store webp’s

#

100-200kb on average

slender wagon
#

i see

#

that's cool

surreal sage
#

@solemn latch consider contabo for vps'

pale vessel
#

galaxygate is better than contabo

#

contabo has those specs for cheap because they oversell

#

that tends to cause cpu steal

slender wagon
solemn latch
#

👀

slender wagon
#

Its weird it just timesout logs you out and makes you struggle

#

So i quit

solemn latch
#

Have you poked dragon about it?

slender wagon
#

No

#

This was a few months ago

#

But i might give it another shot as they are cheap

charred nest
#

dumbassery here

solemn latch
charred nest
#

its client that's undefined tho no?

solemn latch
#

Client would be undefined in your sharding file right?

#

Since it has no bot client

charred nest
#

ah yeah, true

solemn latch
#

It's been a long time since I've thought about sharding I don't remember much about it tbh ^-^

charred nest
#

no worries ! any ideas on what would be best practice then to get the user? im trying to fetch the user that voted -> send a dm but obv only the currency update portion works KEK

solemn latch
#

If that's all you really want to do, use client.users.send(userID, standard message stuff)

#

You'll want to eval that into your first shard

charred nest
#

ahhh gotcha !

solemn latch
#

I forget how, to eval to a specific shard, but you'll figure it out ^-^

charred nest
#

i haven't touched vote stuff in a hot min so im like EGGsweat

#

this helps a lot, thank u !!

surreal sage
#

nah

#

63% battery gone in an hour

#

discord doesn't optimize shit 💀

wheat mesa
#

the react native experience

surreal sage
#

and all new messages get sent to you

#

doesn't matter if you haven't looked in that guild for a month

#

used like 230mb in a hour

#

celular

harsh aspen
#

that doesn't make sense

surreal sage
#

like 1-2yo phone

#

2022? release

pale vessel
# surreal sage

double the screen time, half the battery, and on an even less stable version of discord

pale vessel
#

yeah i got a good phone

harsh aspen
#

what is it

#

I assume that you both have the same OS

pale vessel
#

it's the red star OS

#

my government made it mandatory to use it

harsh aspen
#

oh bruh

#

||they are tracking u, made it spoiler so they can't read it, Idk if I'm dumb like that||

wheat mesa
#

you've gotta be trolling right

deft wolf
#

My first guess would be Russia kappalul

stiff dust
green kestrel
#

which government

#

you're not in dprk unless your surname is Kim and you're part of the ruling elite

#

nobody else has internet enabled phones iirc that can get outside services

pale vessel
#

i'm an exception

lament rock
#

Flaze is next in line to be the world ruler

pale vessel
#

the world suler

lament rock
#

Lmao

pale vessel
frosty gale
#

i swear they said react native would save battery better than their native app

#

but thats what happens when you insist on using javascript and react everywhere on platforms not designed for it

#

you have more translation layers than good code

#

actually not surprised they dont care bc they can get rid of their java native developers and only keep their web dev react team that can also develop the app

#

theyre saving money and were paying in terms of battery usage and performance

sharp geyser
#

@lyric mountain hey buddy are you busy?

#

I heard you know a lot about sql databases EYES

stiff dust
twilit beacon
deft wolf
#

Because the bot does not have this value

#

You never sent the number of servers through the top.gg api so this information does not exist on the top.gg side

surreal sage
#

native webview x rust

surreal sage
wheat mesa
#

That would defeat the purpose

lament rock
#

You could theoretically transpile it into assembly

#

Though would likely need to be TypeScript based

#

and you'd lose the benefits of being runtime interpreted

#

err I guess asm could be interpreted

radiant kraken
lyric mountain
sharp geyser
#

I just had some questions regarding my table setups and was wondering if you could give me some insights

lyric mountain
#

Sure

past field
#

lord

nova zephyr
#

how can i change the color of the main theme of my bot page?
whenever i try it only seems to change the bg color of the content in the long description

nova zephyr
# solemn latch What css are you using?

<style>
body {
background-color: black !important;
font-family: Manrope;
color: #f3f3f3;
}

    img {
        max-width: 100%;

    }

    blockquote {
        border-left: 4px solid #3498db;
        padding-left: 10px;
        margin-left: 0;
    }

    .image-container {
        display: flex;
        justify-content: space-between;
        margin-bottom: 20px;
    }
</style>

this to test

solemn latch
#

Looking at your bot page, you're including things that are unneeded.

The website itself already has html, head, body tags.

<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
  </body>
</html>

^ I think by including these things you're creating your own "scope" within the description, which means your css cant affect the right things outside of the description.

sharp geyser
#

Does anywhere here know about docker and iptables? I was looking at setting up mailcow again and they have a new warning on their page

#

Is this important to do or is it fine to still go with ufw ?

grizzled raven
#

Is pairing ufw and docker known to cause common issues? Because I'm new to docker and I'm running into an issue that causes apk packages to not install at all unless I disable ufw

#

perhaps it's a dns issue or a skill issue but idk thought i'd ask

sharp geyser
#

Well

#

Apparently docker has issues with the ufw or firewalld from what i've been reading, but I don't have any clue on how iptables work and its a more intimate aspect to controlling your firewall where ufw abstracts you away from all that mess.

harsh aspen
#

I recommend using windows

sharp geyser
harsh aspen
tulip ledge
#

Anyone who might have a clue why this merge sort implementation is doing way more comparisons than expected?

fn merge_sort<T: Ord + Copy>(arr: &mut [T], aux: &mut Vec<T>, low: usize, high: usize, comparisons: &mut usize) -> usize {
  // Base case: if low is greater than or equal to high, the array is sorted
  if low < high {
    let mid = (low + high) / 2;
    // Recursively sort the left and right halves
    merge_sort(arr, aux, low, mid, comparisons);
    merge_sort(arr, aux, mid + 1, high, comparisons);
    merge(arr, aux, low, mid, high, comparisons);
  }
  *comparisons
}

fn merge<T: Ord + Copy>(arr: &mut [T], aux: &mut Vec<T>, low: usize, mid: usize, high: usize, comparisons: &mut usize)  {
  // Copy the array into the auxiliary array
  for i in low..=high {
    aux[i] = arr[i];
  }

  let mut i = low;
  let mut j = mid + 1;

  // Compare the elements of the two halves and merge them into the original array
  // The smaller element is always copied into the original array first
  for k in low..=high {
    if i > mid {
      arr[k] = aux[j];
      j += 1;
    } else if j > high {
      arr[k] = aux[i];
      i += 1;
    } else if aux[j] < aux[i] {
      arr[k] = aux[j];
      j += 1;
      *comparisons += 1;
    } else {
      arr[k] = aux[i];
      i += 1;
      *comparisons += 1;
    }
  }
}

It's supposed to do ~nlogn comparisons in worst case but measuring this I find that it does ~1.6nlogn comparisons

wheat mesa
#

O(1.6nlogn) is nlogn

#

Big O notation does not take into account coefficients

#

It cares about the way things grow

spark flint
#

...then don't reply?

sharp geyser
#

how would you handle authorization of endpoints?

spark flint
#

using middleware

sharp geyser
#

okay but I mean

#

what concept, like jwts, or some other kind of auth model

spark flint
#

jwt works

#

i usually just use uuid

sharp geyser
#

huh

#

uuid?

#

🤔

spark flint
#

every language has a package to generate a UUID

sharp geyser
#

I know what a uuid is

spark flint
#

yes

#

good

sharp geyser
#

I am wondering what you mean when you say you use uuids

#

that doesn't quite track with me

spark flint
#

its just a random unique token

#

pass as an authorisation header

sharp geyser
#

okay

spark flint
#

match to a user

sharp geyser
#

That could work yes.

#

I orignally had that idea

solemn latch
#

Isnt that just jwt with extra steps?

sharp geyser
#

no

#

jwt has embeded data and is meant for short lived authorization

#

they can expire.

solemn latch
#

You want them to expire no?

sharp geyser
#

Nope

solemn latch
#

oh api

#

mb

sharp geyser
#

The only thing that should expire is the login session.

#

I think ima just make a token for each user when they signup for the service and use that to authenticate routes.

#

I just don't know how to do this with rocket

#

😭

#

I wish I could just implement an auth system like discord and just call it a day

lament rock
#

Yeah I'd just generate a token like Discord does

#

can embed the user ID in the token

silk flame
#

Can I run two node.js client instances? One for a slash command and one for a prefix?

pale vessel
#

ideally you should be combining them to one instance

vale moss
silk flame
#

How would I combine them then?

lyric mountain
#

Just listen to both event types

craggy pine
#

Those being interactionCreate and messageCreate

craggy pine
tulip ledge
#

Then we do care about factor

lament rock
#

Need opinions on how to get stuff ordered in sql or if I'm already doing the best thing.
Currently, I have tracks in a playlist and the structure is a little something like: { playlist_id: number; video_id: VARCHAR(50); next: VARCHAR(50) | null; }
The next is obviously linking to a video ID that's next in the track list if any and to get all the tracks in order, I need to go backwards starting from where next is null and then searching the entries where the next field is the current video_id until there is none left. Cannot be recursive. I have to be able to reorder the tracks at any time and updating all entries after an index wouldn’t be a good idea if I went with another number field to indicate index. Any ideas on improvements? (The searching is done in code rather than on the sql server's side)

sharp geyser
#

Im not sure if I was misreading your question, or if I am not quite understanding what you are trying to achieve.

#

You said you need to figure out how to order stuff in your sql?

#

Well, the simplest solution is to follow spotify's example.

The way they have playlists is you add songs to them, and they immediately get pushed to the back. You can use a numerical index to track this as if its an array starting at 0 (or 1) if you prefer. Now the next would be an id to the song directly after it, if there is one. Simple enough to achieve this I trust you to be able to do this. You'd need a numerical index to be able to make sure that no matter what if you were to visually load this playlist, it'd remain in the same order. You can ofc allow them to reorder it if you want, which is when you figure out the logic yourself and set it's new "place" value

#

Again, not sure if I misunderstood what you are trying to achieve.

glacial acorn
#

Please make for me a profile with ROYAL GHOST 111

solemn latch
deft wolf
#

At least he wrote "please" weirdsip

charred nest
#

any ideas as to why a message the bot sends wouldn't be found in the cache? im trying to edit my bot's starboard message when an additional reaction is added but it returns unknown message

  • it is the correct msg id
  • verified that the bot has the correct channel permissions
  • the bot sends the msg thats trying to be edited
  • it isnt restarted in between
  • logging the message shows that it isnt in the cache ?? idk why
#
                const channelID = '964997630910427197';
                const channel = client.channels.cache.get(channelID);
                        client.starboard.set(message.id, {
                            originalMessage: message,
                            count: count,
                            author: message.author.username,
                            authorURL: message.author.avatarURL()
                        });

// .... other code here

try {
                    const fetchedMessage = await channel.messages.fetch(msgID);
                    console.log(`Fetched message: ${fetchedMessage.content}`);
                } catch (error) {
                    if (error.code === 10008) {
                        console.error(`Message with ID ${msgID} not found.`);
                    } else {
                        console.error(`Error fetching message with ID ${msgID}:`, error);
                    }
                }
#

sorry if the code is a bit all over the place, ive tried dozens of things atp

pale vessel
#

fetch also grabs it if it isn't in the cache, so are u sure u got the correct message ID and channel?

charred nest
#

yep, i already double checked

#

channel and msg id are correct and match to what's being logged, i double checked permissions and those are fine as well

pale vessel
#

what's msgID?

charred nest
#

oop, shit, sorry i thought i included it

                const msgID = starboardData.messageID
#

i checked what it logs and it does log a string

pale vessel
charred nest
#

yeah

pale vessel
charred nest
#

yeah LMFAO me too

#

i legit dont know wtf is happening

pale vessel
#

u have an error check there, but what's the actual error message if it's 10008?

#

is it really just "Message not found"?

charred nest
#

unknown message

#

yeah

pale vessel
#

ah

#

does the bot have read message history perm? that might give a different error though

charred nest
#

yeah it does

#

i thought i was going crazy so i asked the owner of the server to give me perms to double check the channel perms and theyre fine

#

i used a msg content cmd too and it works so i know its reading msgs there

pale vessel
#

a full code might help

charred nest
#

one sec

#
client.on(Events.MessageReactionAdd, async (reaction, user) => {
    console.log(`reaction added`)
    const reactionThreshold = 1;

    if (reaction.emoji.id == '1041127014066835590') {
        const message = reaction.message;
        const count = reaction.count;

        const channelID = '964997630910427197';
        const channel = client.channels.cache.get(channelID);

        let starboardData = client.starboard.get(message.id);

        if (count >= reactionThreshold) {
            if (starboardData) {
                console.log(starboardData.originalMessage.id)
                const footerText = `♡ ${starboardData.count}`;
                const embed = new EmbedBuilder()
                    .setColor('#f0deda')
                    .setAuthor({
                        name: `${starboardData.author}`,
                        iconURL: starboardData.authorURL,
                    })
                    .setDescription(`· ·  ![f2_hrtbow_DNS](https://cdn.discordapp.com/emojis/1146941520239394816.webp?size=128 "f2_hrtbow_DNS")   new heart  !!  + ⁺ .\n\nʚ・"${starboardData.originalMessage.content}"・ɞ\n\n![f2_hrtbeat_DNS](https://cdn.discordapp.com/emojis/1146941657095340052.webp?size=128 "f2_hrtbeat_DNS")   [jump to source](${starboardData.originalMessage.url})   ![f2_hrtbeat_DNS](https://cdn.discordapp.com/emojis/1146941657095340052.webp?size=128 "f2_hrtbeat_DNS")`)
                    .setTimestamp()
                    .setFooter({ text: footerText });

                const msgID = starboardData.messageID
                console.log(`Attempting to fetch message in channel ${channelID}`);

                console.log(`Channel permissions for bot: ${channel.permissionsFor(client.user)}`);
                console.log(`Is message in cache? ${channel.messages.cache.has(msgID)}`);

                await new Promise(resolve => setTimeout(resolve, 1000)); // even tried delaying to see if that would help give more time to get it cached

                console.log('Cached messages:', channel.messages.cache.map(msg => msg.id));
                try {
                    const fetchedMessage = await channel.messages.fetch(msgID);
                    console.log(`Fetched message: ${fetchedMessage.content}`);
                } catch (error) {
                    if (error.code === 10008) {
                        console.error(`Message with ID ${msgID} not found.`);
                    } else {
                        console.error(`Error fetching message with ID ${msgID}:`, error);
                    }
                }
            } else {
                console.log(message.id) //returns correct msg id
                client.starboard.set(message.id, {
                    originalMessage: message,
                    messageID: message.id,
                    count: count,
                    author: message.author.username,
                    authorURL: message.author.avatarURL()
                });

                const footerText = `♡ ${reaction.count}`;
                const embed = new EmbedBuilder()
                    .setColor('#f0deda')
                    .setAuthor({
                        name: `${reaction.message.author.username}`,
                        iconURL: reaction.message.author.avatarURL(),
                    })
                    .setDescription(`· ·  ![f2_hrtbow_DNS](https://cdn.discordapp.com/emojis/1146941520239394816.webp?size=128 "f2_hrtbow_DNS")   new heart  !!  + ⁺ .\n\nʚ・"${reaction.message.content}"・ɞ\n\n![f2_hrtbeat_DNS](https://cdn.discordapp.com/emojis/1146941657095340052.webp?size=128 "f2_hrtbeat_DNS")   [jump to source](${reaction.message.url})   ![f2_hrtbeat_DNS](https://cdn.discordapp.com/emojis/1146941657095340052.webp?size=128 "f2_hrtbeat_DNS")`)
                    .setTimestamp()
                    .setFooter({text: footerText});

                channel.send({embeds: [embed]})
            }
        }
    }
});```
lyric mountain
#

why don't you try fetching the message instead of using cache?

#

for messages it too unreliable to use cache

pale vessel
#

they're doing that

lyric mountain
#

where?

pale vessel
lyric mountain
#

ah

#

can you fetch messages globally? or must you do it on a channel?

pale vessel
#

must be in a channel

charred nest
#

im doing it ina channel for the starboard

lyric mountain
#

in java at least we do client.retrieveMessageById(), being able to do it on a channel too

#

the issue might not be on the message itself, but on the channel being wrong

#

log the fetched channel name to be sure

charred nest
#

logs the correct name
id: '964997630910427197',
name: '♤﹒﹒﹒﹒',
rawPosition: 24,
parentId: '964372181880553532',

pale vessel
#

why are u fetching the message though?

sharp geyser
#

its a starboard command or smth no?

#

you need the message you're going to starboard

pale vessel
#

you're also storing the user message not the starboard message

#

unless the starred message was sent inside the starboard channel it won't work

pale vessel
#

maybe u meant to send the message first and store the ID of this message instead

sharp geyser
#

they are storing/getting the message that is reacted to no?

pale vessel
#

it won't work if they want to edit the starboard message since the message ID is the reacted message's ID which wouldn't be from the bot

#

u can't edit someone else's message

#

messageID should be different, it should be the bot's sent message ID

pale vessel
#

but right now it's the same message ID as originalMessage

charred nest
#

ah shit u right, i meant to do that