#development

1 messages Β· Page 2049 of 1

sharp geyser
#

My main issue in programming is I get bored easily when working on something on my own

#

I never liked doing something by myself, i'd rather enjoy it with someone else

ancient nova
#
    if (member.permissions.has("KICK_MEMBERS")) permissions.push("Kick Members");
    if (member.permissions.has("BAN_MEMBERS")) permissions.push("Ban Members");
    if (member.permissions.has("ADMINISTRATOR")) permissions.push("Administrator");
    if (member.permissions.has("MANAGE_MESSAGES")) permissions.push("Manage Messages");
    if (member.permissions.has("MANAGE_CHANNELS")) permissions.push("Manage Channels");
    if (member.permissions.has("MENTION_EVERYONE")) permissions.push("Mention Everyone");
    if (member.permissions.has("MANAGE_NICKNAMES")) permissions.push("Manage Nicknames");
    if (member.permissions.has("MANAGE_ROLES")) permissions.push("Manage Roles");
    if (member.permissions.has("MANAGE_WEBHOOKS")) permissions.push("Manage Webhooks");

how would yall optimize this KEKW

earnest phoenix
#

πŸ’€ wtf

wheat mesa
#

That's rough

#

That's really rough

royal portal
#

its already optimised angeryBOYE

ancient nova
sharp geyser
#

Just have an object of readable permissions that you can grab from ez

earnest phoenix
#

Define an object with the keys as the permission flag names, and values as the formatted flag names, or map to get the value from the object by key, or just replace if you don't want to manually declare the formatted permission flags in an object

royal portal
#

[object Object]

sharp geyser
#

hey volty

#

what does Object.freeze do again?

royal portal
#

freezes the object

sharp geyser
#

Does it just make it so it is read only?

#

It can be accessed but not written to?

ancient nova
#

const perms = {
KICK_MEMBERS: "Ban",
... etc etc
};
perms[...];

#

is this what you mean misty?

earnest phoenix
#

It makes the object read-only, preventing new properties from being added or changed

dusk vault
#

uh

#

kick members is for kicking

earnest phoenix
dusk vault
#

not banning

#

there's ban members lmao

ancient nova
royal portal
#

why mozilla cryangeryBOYE

dusk vault
#

mozilla docs are the best docs for JS

royal portal
#

mozilla php docs

sharp geyser
#
const ReadablePermissions = Object.freeze({
  KICK_MEMBERS: 'Kick Members',
  BAN_MEMBERS: 'Ban Members'
  // etc
})
#

is how I do it

ancient nova
#

btw how do you check if a person is boosting the server?

dusk vault
#

how does php have anything to do with this @royal portal

sharp geyser
#

let me verify that tho

ancient nova
dusk vault
#

given the avg person here, i couldn't tell

#

lmfao

royal portal
sharp geyser
#

No

#

premiumSince is to check when they last started boosting the server

royal portal
#

so much has changed

sharp geyser
#

you can't have access to a user's nitro subscription from the guild member that'd be user iirc

earnest phoenix
#

Although if you don't want to format all the permissions yourself manually, you can just iterate through the existing permission flags, replace underscores, and convert the cases to proper

sharp geyser
#

you and waffle think alike volty

ancient nova
#

isn't there a bool to just check if member is boosting wtf??

#

what is discord thinking

dusk vault
#

there's a booster role...

ancient nova
earnest phoenix
#

You literally check if the premiumSince or premiumSinceTimestamp properties are not null

sharp geyser
#

Just check if it s null

#

if they don't boost it will be null

ancient nova
#

alright fair

sharp geyser
#
  get premiumSince() {
    return this.premiumSinceTimestamp ? new Date(this.premiumSinceTimestamp) : null;
  }
#

Literally all they do is return null if it isn't a thing

earnest phoenix
#

Although it varies on the server, if you actually want to check if the member is boosting regardless of server, all you can do is to iterate through your bot's guilds and check if the user is boosting one of them by that property, but it would be extremely inefficient if you have a lot of guilds

#

Checking if the user is boosting a server or has Nitro is all dependent on luck if you want to display badges

ancient nova
earnest phoenix
#

Then you're good to go

ancient nova
#

ty

sharp geyser
#

@earnest phoenix Give my bot a name

#

I need a name

#

you get 0 context as to what the bot is going to do

earnest phoenix
sharp geyser
#

What the fuck do those even mean

earnest phoenix
#

Nothing, names don't need to have a meaning

sharp geyser
#

Nifko it is

ancient nova
#

can u give my bot a name

#

something shady sounding

earnest phoenix
ancient nova
#

ik that's kind of a bold word

earnest phoenix
ancient nova
#

Harmak is decent

lyric mountain
#

Morbotum

wheat mesa
#

bottum

sharp geyser
#

cringe

pale vessel
#

good morbing

sharp geyser
#

good night

lyric mountain
#

In 2016 we had hugh mungus, in 2018 it was big chungus, 2020 was amongus

#

2022 it's morbius

#

What comes next

earnest phoenix
#

mongius

wheat mesa
#

hugh mong us

ancient nova
#

guys say u in a race and u pass the person on the 2nd place. What place are you in now?

lyric mountain
#

Depends, if it was a lone run you're in mental clinic now

earnest phoenix
#

Why do you think of that in the first place?

sharp geyser
#

if you pass someone in 2nd place you are then in 2nd place and they become 3rd (to answer his question btw)

earnest phoenix
#

Heh I know it's that, was trying to make that joke but I guess it doesn't work out mmLol

lyric mountain
#

Did ya read the file btw?

sharp geyser
#

I did indeed read it

lyric mountain
#

Hope I explained well

sharp geyser
#

You explained it pretty well

#

I just decided to work on a bot in ts rn instead and come back to java later

lyric mountain
sharp geyser
#

I am not entirely sure how I wanna do argument parsing yet

#

I know i will use regex but not entirely sure how I want the pattern to look

lyric mountain
#

You can also simply use slashes if u wanna skip that

sharp geyser
#

slashes?

#

as in slash commands?

lyric mountain
#

Ye

sharp geyser
#

Fuck nah

#

Not ready for that yet

lyric mountain
#

Lmao

sharp geyser
#

My ass would wanna be making a full on handler for slash commands

lyric mountain
#

I do hate slashes for how half-assed they were implemented

sharp geyser
#

I guess argument parsing would be rather easier with slash commands tho

#

As in giving types to the arguments given to the command

lyric mountain
#

I mean, it'll already come parsed

sharp geyser
#

Mmm will it?

#

I haven't fucked with slash commands yet

lyric mountain
#

Jda converts to the discord data type

sharp geyser
#

Ah

lyric mountain
#

If u set an argument to be mentionable, jda will give u a mentionable

sharp geyser
#

o I see

#

Kinda like this theme

#

It isn't overbearing even tho it is a lighter theme

earnest phoenix
#

The color scheme kinda gives the vibe of writing code on a physical document

sharp geyser
#

lol

#

I am now rethinking this permission system tho

#

Eh whatever ima go with what I currently have

#

I can change it in the future if I think of a more efficient way

lyric mountain
#

🍞

sharp geyser
#

Actually no this permission system is bothering me a bit

#

cause it isn't how I wanna do it

#

πŸ˜”

#

How should I structure it though, cause I wanna make it so there are permission groups that server owners can make that house permissions for that group and a user can be added to it giving them the permissions in that group.

lyric mountain
#

I just noticed, but ur still using community edition right?

sharp geyser
#

Nope

#

I am using the licensed version

lyric mountain
#

Ah, I thought u were cuz missing left tabs

sharp geyser
#

I removed some of the ones I didn't need

lyric mountain
#

Was gonna mention u could probably get a free license from active open-source repos

sharp geyser
#

I am planning on doing that

#

but no one actually actively contributes to any of my repos

lyric mountain
#

Oh no no, it's the other way around

#

Those who actively contribute are eligible for free license

#

Even if you're the only one

sharp geyser
#

So I can be eligible even when I am the owner

#

sweet

lyric mountain
#

The project just needs to be older than 3 months

sharp geyser
#

I see

lyric mountain
#

And obviously, be open source and non commercial

#

I somehow got our PM to consider migrating all our environment to jetbrains tools

#

Since we're moving from delphi to flutter

sharp geyser
#

I honestly might make this bot open source

#

I see no reason not to

lyric mountain
#

As long as you properly hide sensitive data ye, not much reason not to go OS

sharp geyser
#

I wonder if anyone will contribute πŸ€”

#

I'd like to see that happen

lyric mountain
#

Who knows

sharp geyser
#

It'd be nice mmLol

lyric mountain
#

It's also good as a portfolio should you need one

sharp geyser
#

I plan on building up my portfolio over the summer

#

I hope to put a lot of my effort into this and another project I am working on but we will see

#

:p

#

I now think I have the ability to make permission groups in the database

lyric mountain
#

PSA: right click -> inject language
when using idea database manager

#

Nice to have language parsing and editor tools when editing fields

sharp geyser
#

Okay I am fucking this all sorts of up

#
import { NifkoInteractionCommandClient } from './InteractionCommandClient';
import Redis from 'ioredis';
import { PermissionToGroupEntity } from '../database';
export class PermissionManager {
    private client: NifkoInteractionCommandClient;
    private redis: Redis;
    constructor(client: NifkoInteractionCommandClient) {
        this.client = client;
        this.redis = client.redis;
    }

    async getPermissionsForUser(
        groupId: string,
        userId: string
    ): Promise<PermissionToGroupEntity | string> {
        let permission: PermissionToGroupEntity | string | null =
            await this.redis.get(groupId);
        if (permission === null) {
            this.client.logger.warn(
                'No permission for that group/user ID in cache, trying database'
            );
            permission =
                (await PermissionToGroupEntity.findOne({
                    where: { groupId, userId },
                })) ?? 'No permissions found';
        }

        return permission;
    }

    async setPermissionsForUser(
        groupId: string,
        userId: string,
        newPermissions: Permissions
    ) {
        const permission = await this.getPermissionsForUser(groupId, userId);
        if (permission === null) {
            this.client.logger.warn(
                'Cannot set permissions for a user/group that does not exist'
            );
            return null;
        }
    }
}

interface Permissions {
    canBanMembers: boolean;
    canKickMembers: boolean;
    canMuteMembers: boolean;
    viewBanList: boolean;
    viewPermissionsOfUsers: boolean;
    canManagePermissionGroups: boolean;
}

Right now I am trying to make a permission manager to make it easier to get and set permissions for a user.

#

But this is obv not a good way to do it any ideas on how I can?

lyric mountain
#

bitfieds

#

permissions are always "yes" or "no", you can pack up to 32 permissions inside a single integer

#

WAY more compact than using 32 booleans, about 8 times smaller

sharp geyser
#

Are you saying have something similar to discord's permissions?

#
export enum NifkoPermissions {
    CAN_BAN_MEMBERS,
    CAN_MUTE_MEMBERS,
    CAN_KICK_MEMBERS,
    CAN_MANAGE_PERMISSION_GROUPS,
    VIEW_BAN_LIST,
    VIEW_PERMISSIONS_OF_USERS,
}

I did end up making an enum for my permissions

#

I do have a question on why discord uses bit shifting or whatever for their permissions?

#

What is the benefit of doing such

#

like why CREATE_INSTANT_INVITE = 1 << 0

quartz kindle
#

smaller and faster

#

you store 32 permissions in a single 32bit number instead of 32 booleans

sharp geyser
#

What is the difference of just doing what I did above and doing what discord did with the bit shifting

sharp geyser
quartz kindle
#

yes

sharp geyser
#

Wdym

quartz kindle
#

for example, an 8 bit number has 8 bits that can be 0 or 1

#

you can take 8 booleans, and put them together to form a number

#

true false true true false false true true

10110011
= 179

sharp geyser
#

πŸ‘€

#

This sounds a bit confusing

#

I don't quite understand the concept behind what you are saying

quartz kindle
#

the number 179

#

is made from those specifc 8 bits

#

an 8bit number (0-255) contains all possible combinations of 8 bits

#

if you deconstruct the number into bits, you get a sequence of booleans

sharp geyser
#

πŸ˜”

#

I kind of understand now

quartz kindle
#

like

#

its kind of an array

#

you can make the first ine correspond to X, the second one correspond to Y, etc

#

but instead of [true, false]

#

you convert it into a single number

#

10 (in binary)

sharp geyser
#

Mmmm

#

Understandable

#

Though I am still questioning why does discord do

SomePermission = 1 << 0
AnotherPermission = 1 << 1
AnotherOne = 1 << 2

Would this end up as the same way or?

quartz kindle
#

the syntax is not much different from array indexes

#

1 << 0 = first bit
1 << 1 = second bit
1 << 2 = third bit

#

if first bit is 1, then first permisson is true

#

if first bit is 0, then first permission is false

sharp geyser
#

I see

quartz kindle
#

from a storage perspective, most databases store booleans as bytes, due to byte alignment, meaning storing multiple booleans in an integer is much more efficient, basically uses 8x less storage

sharp geyser
#

So basically I could just store the result of the bit shifting into the database over a bunch of booleans

quartz kindle
#

from a transmission perspective, imagine sending a number in json, vs an array of booleans

#

the number is gonna be several times smaller

sharp geyser
#
    async hasPermission(
        userId: string,
        guildId: string,
        permissions: Array<NifkoPermissions>
    ): Promise<boolean> {
        const permission = this._calculatePermissions(permissions);
        const user = await UserEntity.findOne({ where: { userId } })
        const perm = await PermissionGroupEntity.findOne({ where: { guild: { guildId } } })
        
        if(user === null) throw new Error("Could not find the user with the specified ID")
        
        if(!perm) throw new Error("Could not find a permission group belonging to that guild")
        
        if(perm.user.userId !== userId) throw new Error("User does not belong to that permission group")
        
        return perm.permissions === permission;
    }

Could I make this easier to do?

#

I feel like typeorm allows me to do it easier but I can't think of a way to do so

#

Actually might of just made it a bit better but still feel like I could check if they have the permission better

    async hasPermission(
        userId: string,
        guildId: string,
        permissions: Array<NifkoPermissions>
    ): Promise<boolean> {
        const permission = this._calculatePermissions(permissions);
        const perm = await PermissionGroupEntity.findOne({
            where: { guild: { guildId }, user: { userId } },
        });
        if (!perm)
            throw new Error(
                'Could not find a permission group belonging to that guild/user'
            );

        return perm.permissions === permission;
    }
#

Also now that I think about it, doesn't throwing an error kill the process ?

sharp geyser
#

So this won't work, it doesn't go past the const perm

#

It is failing for some reason

#

I am starting to think my database design is going to be an issue and not be as easy to query permissions for a user

fossil charm
#

hi anyone here who uses python shell package?

woeful pike
#

that's why throwing errors is not a good idea imo

#

honestly bitfield permissions are a waste of time

#

I don't see a point to having them until space starts to become an issue

#

just do regular one to many relationship with string permissions

sharp geyser
woeful pike
#

ye i didn't mean as in redo it

sharp geyser
#

My only issue now is how inefficient it seems to check if the user has a certain permission in a guild's permission group

woeful pike
#

why inefficient

sharp geyser
#

The way it stands now is, a guild can create permission groups that have different permission sets. A user can then be added to said group but when running commands that check if a user has a certain permission for that guild I feel I am doing it in a way that is going to end up not being very performant in the long run, but this could just be me overthinking things

woeful pike
#

why do you have things like ban members tied to your own permission system anyways?

sharp geyser
#

Because the user's role may never have the permission to ban, but the user's permission group may.

#

If the permission group has permission to ban members & the user is of a higher hierarchy then the user they are trying to ban then a successful ban will occur

#

Actually now that I think about it

woeful pike
#

ok but if I demod someone in my server I don't want them to have permissions to ban on the bot

sharp geyser
#

I was planning on actually switching from giving individual users permissions but rather the roles they will have. So you can set different roles to have different permission groups tied to them. So when a user is added to the Mod role they will have Mod level permissions for the bot. and if they are removed they no longer have those permissions

#

Though now that I am thinking about it, if a user doesn't have ban members perm via discord they won't necessarily be able to ban them anyway right?

woeful pike
#

if I have to remember to do something on your bot after removing a user's mod permission that sounds really unintuitive and problematic imo

sharp geyser
#

Likely end up with a Missing Permissions error from discord

woeful pike
#

well no because your bot will be the one doing the ban

sharp geyser
#

Ah okay

sharp geyser
cinder patio
#

why don't you use the user's permissions for this? Why do you need your own permission system

woeful pike
#

sure but if you have your own permissions system inside the bot then someone either has to remember to remove a role on ur bot or you rely on constantly keeping discord permissions in sync with your own db which isn't a good system

sharp geyser
#

Mmm, I could yes, but I will still end up needing a permission system of my own though for non discord related permissions

woeful pike
#

Im just talking about discord stuff like bans

sharp geyser
#

Yea

cinder patio
#

Check the member's discord permissions when doing something discord-related and your permission system otherwise

sharp geyser
#

I completely agree it will be annoying to keep up with the user in case you demod them and such

rocky dagger
earnest phoenix
wheat mesa
#

Invite your bot with the applications.commands scope

earnest phoenix
#

Yeah

rocky dagger
#

its in a guild im not in

wheat mesa
#

Nothing you can do then

#

Make sure your bot’s invite link includes the applications.commands scope

#

Other than that you just need to handle the error and move on

rocky dagger
split hazel
#

ima try again in a bit πŸ’€

wheat mesa
#

Wherever you register your commands, just try..catch it

split hazel
#

i want to cop that 24gb of ram

pine nova
#

rajesh πŸ’€

split hazel
#

πŸ’€

#

probs from india

#

definitely

#

at that time it was midnight i doubt anyone would be working night shift chat support

#

oracle please take my 80p

#

im begging you

spark flint
#

lol

#

it will be your bank blocking it

#

i have like 3 oracle accounts now lmao

split hazel
#

the bank said they're not blocking it tho

#

they prob blacklisted my card bc i tried twice

spark flint
#

i use the same card for all my accounts

split hazel
#

idk then

#

mfs are racist

spark flint
#

lol

#

their support is funny

split hazel
#

im trying again

split hazel
#

bruh

pine nova
split hazel
#

now i see why people have a problem with oracle running mysql

#

yeah declined again

#

might try another card

#

fuck oracle man

cinder patio
#

why are you paying them

split hazel
#

such a shit company

split hazel
pine nova
#

skem

lyric mountain
#

oracle is know to be a dick to everyone

dry imp
#

true

split hazel
spark flint
#

why the fuck are you spamming hi in all channels

#

ok

#

and

#

just don't spam hi in all channels lmao

#

thats like something a 10yr old would do πŸ’€

#

ok

split hazel
#

stop being a discord mod

spark flint
#

43

#

wbu

#

no

#

how old are you

#

16 Chad

#

you either need to boost or have an approved bot

split hazel
#

lmao bro said you first then just ghosted him

spark flint
#

why

split hazel
#

so forceful

quartz kindle
#

dafuq is this 10 year old

spark flint
#

EXACTLY

#

how old are you @earnest phoenix

quartz kindle
#

then stop acting like a 10 year old?

spark flint
#

well

#

how old are you

#

why

#

i said my age

#

i thought we were friends Sadge

#

ok and

dry imp
#

damn i feel you bro

spark flint
#

are you under 13

#

so you are?

quartz kindle
#

createMessageComponentCollector

spark flint
#

@winter pasture @real rose found an under 13

quartz kindle
#

yes

spark flint
#

because deleted

real rose
#

@earnest phoenixAre you actually under 13?

spark flint
#

sorry for using the channel for the wrong reason mods

spark flint
dry imp
#

why care so much about a kid anyway

real rose
#

?

spark flint
real rose
#

-b @earnest phoenix Under 13, against Discord ToS

gilded plankBOT
#

upvote P.A.I.Nツ#4041 was successfully banned.

real rose
#

airing the question was worse than saying no sadge

spark flint
#

lol

distant tree
#

get message ID's report it to discord get there account banned

#

Β―_(ツ)_/Β―

spark flint
#

they deleted message

#

so

lyric mountain
lyric mountain
#

basically they don't care what you want, they put money over relationship with their clients

spark flint
#

oracle?

lyric mountain
spark flint
#

their prices are pretty good

winter pasture
spark flint
winter pasture
#

Lost internet while I was in the tunnel

spark flint
#

ah

#

it said you were online but not in member list so wasn't sure if you were active lmao

lyric mountain
#

you can't await inside a sync function

quartz kindle
#

you need to make your function async

lyric mountain
#

idk if ur being sarcastic

quartz kindle
#

show code

lyric mountain
#
() => {
  await ...;
  // CAN'T
}

async () => {
  await ...;
  // CAN
}
wheat mesa
quartz kindle
lyric mountain
#

done

quartz kindle
#

yes

lyric mountain
#

then is an async chain btw

#

whatever ur waiting can be done on the next then

quartz kindle
#

but preferably try not mixing awaits and thens

lyric mountain
#
<Promise>
  .then(a => get stuff)
  .then(stuff => make deal)
  .then(deal => you get it)
  .then(it => see?)
quartz kindle
#

im in phone

lyric mountain
quartz kindle
#

yes, you can do that with await

quartz kindle
#

lmao

#

let me get on pc

#

.>

lyric mountain
#

kekw

cinder patio
#

use await on the first promise

lyric mountain
#

don't put then inside then, just go to the next chain

#

that way it executes sequentially in the promise's context

quartz kindle
#

as kuuhaku said, you can do this ```js
promise
.then(a => get stuff)
.then(stuff => make deal)
.then(deal => you get it)
.then(it => see?)

```js
const a = await promise;
const stuff = await a.getStuff();
const deal = await stuff.makeDeal();
const it = await deal.getIt();
lyric mountain
#

ah that's what u meant KEKW

quartz kindle
#

so preferabily chose one of them and stick to it, dont mix them both up unless you know what you're doing

lyric mountain
#

do note tho, should one of the steps hang, that entire flow will hang too

#

idk whether djs uses node's pseudo-threads, but if it's ran in a single "thread" it'll make your bot freeze

#

that if one of the steps hang, not necessarily that they will

quartz kindle
#

async is made with timers and events

#

only the real async code goes into the node threadpool

#

real async being i/o

#

disk/network

#

because programs are fast, stupid fast

#

so 99% of the time, your program is idle, not doing anything, just waiting

solemn latch
#

one after the other

quartz kindle
#

you receive two commands at once, even if you cannot process both at the exact same time, they still take on average less than a couple milliseconds to complete

#

the actual code that you run your commands on, is single threaded, and starts with whichever event came in first

#

but the actual data you send back, is passed to the node threadpool

#

so the job of actually sending data across the network is multithreaded by node

lyric mountain
#

where it simulates having threads

quartz kindle
lyric mountain
#

ye, that

#

then a hanging await will indeed freeze the bot

quartz kindle
#

you can use them with sharding tho

solemn latch
#

I don't really know how that works though.

If two requests come at the same exact time, how does it handle one while also receiving the other or receive both at once?
wouldn't the processes be blocked and not receive that info?
or is i/o separate?

lyric mountain
#

as soon as the lock is lifted the next request will pass through

quartz kindle
#

but the node threadpool is still accepting and queueing incoming requests

solemn latch
#

makes sense, good to know

lyric mountain
#

a millisecond is still very long for a computer

#

like, you can't fathom how fuckin fast a computer is

quartz kindle
#

depending on the job yes

lyric mountain
#

it's like trying to comprehend how big the universe is

quartz kindle
#

most cpu operations take a few nanoseconds

#

or less

lyric mountain
#

a nano is one millionth of a second btw

split hazel
#

speaking about cpu operations-

lyric mountain
#

or 1s = 1.000.000ns

solemn latch
#

these are the really good topics ^_^

split hazel
lyric mountain
split hazel
#

its so slewwwwwwwwwwwwww for graphics

#

especially modern displays

solemn latch
#

any chance of using a gpu then?

#

πŸ‘€

split hazel
#

i wish

quartz kindle
#

thats why gpus have like 512 computing cores lmao

split hazel
#

unfortunately gpu manufacturers are very greedy people and like to keep implementation details up to them and them only

#

SO MY OS CANT MAKE USE OF THEM

solemn latch
#

oh for the OS?

#

yeah

lyric mountain
#

SpeedyOS

split hazel
#

i might port something like vulkan

#

i can try but like

#

it might take a while

#

or something better/easier

quartz kindle
#

ye

solemn latch
#

I think nvidia and amd have open source drivers now

#

or well nvidia was forced to recently

#

and amd has for awhile iirc

split hazel
#

still the problem is supporting other manufacturers and gpus

#

theres a lot of them

#

so using an open source alternative is better

#

its better than nothing

solemn latch
#

true

split hazel
#

because other tasks are using so much cpu time that it starves other tasks

#

so they get no cpu time

#

making things slower since it takes more time for them to get cpu time

lyric mountain
#

it's...complicated

split hazel
#

its either better or worse with different scheduling algorithms

#

but in theory its that

lyric mountain
#

you can check how many threads the cpu is running atm by pressing ctrl + shift + esc and going to Performance

#

this is mine

#

yet only 10% cpu usage

quartz kindle
split hazel
#

lol you guys suck 2000+ threads

quartz kindle
#

windows at its stupid amount of shit running in the background 24/7

split hazel
#

i think i ran a tool which slightly debloats windows

#

hence the lower threads and processes

lyric mountain
quartz kindle
split hazel
#

what is a handle

quartz kindle
#

heavily debloted

split hazel
#

i really dont know

lyric mountain
#

like, pointers

quartz kindle
split hazel
#

ah right

#

weird to group everything together

quartz kindle
#

A process handle is an integer value that identifies a process to Windows. The Win32 API calls them a HANDLE; handles to windows are called HWND and handles to modules HMODULE.

Threads inside processes have a thread handle, and files and other resources (such as registry keys) have handles also.

The handle count you see in Task Manager is "the number of object handles in the process's object table". In effect, this is the sum of all handles that this process has open.

If you do not release your handle to a resource, other people may not be able to access it - this is why you sometimes cannot delete a file because Windows claims it is in use (check out this article on handle leaks and Process Explorer).

Also, there is a per-process limit on various handles. Here is an example.

In general, if you are opening handles and not closing them, it is analogous to leaking memory. You should figure out what is going on and fix it. There is a good CodeProject article on handle leaks.

lyric mountain
#

also as an even more mind-exploding fact, multi-threading isn't really "doing X things at once", more like "doing X things alternating"

#

a cpu can only do 1 operation at a time

#

it just does it so fast, but so fast, that it happens almost at the same time

#

the only constraint is light speed

quartz kindle
#

actually multicore cpus can physically do multiple things at once

#

but those things are very limited

split hazel
#

thats because threads dont always run and do something

#

most of the time they sleep

#

or should anyways

#

waiting for something to happen or some data to arrive

#

such as a mouse click

#

kind of

#

usually the operating system puts the threads to sleep

#

when some data happens like the mouse moves the operating system wakes up the relevant threads

#

gets a bit complicated but thats the simplest explanation

quartz kindle
#

cpus have many layers of memory and caching, aka the L caches

#

if you run a job that takes very small memory, and it fits in those caches, a single cpu core can do its job alone, at the same time other cpu cores do other jobs

#

but if the job requires more memory, then it needs to connect to ram, and this includes waiting

#

so the work is then done in interleaved steps with whatever cpu core is available over a certain amount of time

split hazel
#

hate it when i cant connect to ram

quartz kindle
#

a separate larger amount of memory

#

outside of the cpu

pine nova
split hazel
#

and do note reading/fetching data from memory/ram takes a long time

#

the cpu sits around doing nothing while it waits for it

#

hence why i call variables a bad practice and use registers

quartz kindle
#

this is a nice diagram from wikipedia

#

all of this is inside a single core

#

so whenever the pc can, it will run as much calculations as possible that fit in that memory alone, to make it fast and truly parallel

split hazel
#

what if it runs out of memory 😱 😱 😱

quartz kindle
#

yes

#

here's an AMD bulldozer server cpu

#

there are many levels of memory, starting with very small ones that sit right inside the cpu core, that are ultra fast

#

and bigger memories gradually sitting further and further away from the cpu core

split hazel
#

make the big ones closer ez

quartz kindle
#

so whenever a certain job requires more memory than the smaller one, it tries using the next bigger one, until it finds one that fits

#

so the smaller the job, the faster it is

#

the smallest memories are usually only used for math

#

not much you can do with 16kb

#

but cpu is stupid fast at doing math

#

it can do thousands/millions of math calculations at once inside those 16kb

#

cpus come with a list of standarized "instructions", names you see around like SSE, AVX, etc

#

and low level programming languages such as C can directly run those instructions

#

and that ensures the fastest possible performance

#

since those instructions are special functions that are designed to run inside that 16kb ram

lyric mountain
#

basically why people pick low-level languages, not because they are faster, but because they allow doing direct operations which are faster

quartz kindle
#

yes

#

compilers can often do a good job at converting your code to use these functions when appropriate, but they are not always accurate

#

no, lua is a high level language, much like js and python

lyric mountain
#

lua is very high level, somewhere around js and python

#

a

quartz kindle
#

but luajit might be able to make use of some of that

lyric mountain
#

low level would be c, asm, cpp, rust, etc

#

the closer to english, the higher the level

quartz kindle
#

these days a lot of languages are "turboed" by using JITs and other optimizers

lyric mountain
#
    <--------------------------------------------------------------------->
1011 1010                                                             Hi there!
low level                                                            high level
quartz kindle
#

these optimizations take parts of your code, parts that the program detects its running a lot of times, and tries to compile those functions into lower level programs inside the program

#

and these lower level programs can some times make use of those special cpu instructions

#

to make it faster

lyric mountain
#

until you stop to think that a cpu is so dense that a single transistor is 70 atoms wide

quartz kindle
#

exdee

lyric mountain
#

and we cant go any smaller because quantum shit start happening

quartz kindle
#

cpus are something that us humans will not be able to manufacture again if for some reason we lose the technology employed to create them

lyric mountain
#

oh and a cpu has billions of transistors

quartz kindle
#

like if a giant solar flare fries every single electronic on earth, it will likely take decades to be able to produce a new cpu again

lyric mountain
quartz kindle
#

exactly

lyric mountain
#

people make cpus on minecraft all the time

quartz kindle
#

we are soo many layers deep into computer that creates computer that creates computer that creates computer

#

we use old computers to create new and faster computers

#

because we need computers to be able to produce something on an atomic level of precision

#

machines and lasers run by computers

#

partially yes

#

we dont exactly need to use a gen 6 to manufacture a gen 7 intel processor

#

we could probably manufacture all intel gens using an old pentium or something

#

but a lot of the cpu design history came from trial and error over time

#

and this trial and error required a lot of machinery and lasers and science

#

and these machinery and lasers and science in turn required a lot of other machinery and lasers and science to produce

#

which end up in a long ass chain of technological dependencies

#

similar to npm

#

lmao

lyric mountain
#

computers are the closest to alien technology we have at earth, and as they say: "Any sufficiently advanced technology is indistinguishable from magic"

quartz kindle
#

like, we dont have that many actual cpu factories in the world

#

there are very few actual chip manufacturers

#

and every single company just buys from them and rebrands them

#

thats why whenever something happens to those factories, prices go up everywhere in the world and suddenly there is a chip shortage

#

because its extremely complicated to do them, and only people who have been in business for decades know how

#

you know boston dynamics right? you see videos about their robots on youtube all the time

#

i've been watching their videos for over 10 years, and their improvement is amazing

#

i dont see anyone else doing anything remotely close to what they are doing

#

they are like so far ahead, that everyone else in the world will be more likely to buy from them that to attempt to compete against them

lyric mountain
#

if we really achieve sentient robots, it'll definitely be boston rob to do it

quartz kindle
#

exactly

#

chip manufacturers are so far ahead that there are very few of them

#

for a competitor to appear, it would need to go through much of what they already went through

#

which would take years

#

and the same thing can be applied to almost everything else in terms of industries

lyric mountain
#

behold the big silicon chungus

quartz kindle
#

that are factories that are just so far ahead of everyone else, that its cheaper to buy from them than to try to make your own produce

#

be it with cheese, beer, tuna cans, etc

lyric mountain
#

which becomes

#

which is cut into

quartz kindle
#

all those different tuna can brands you see in the market are usually all from the same factory

#

same thing with almost everything else

#

different brands all buying from the same factories because its cheaper

#

because how are you gonna create a new factory to compete with other factories, when they already have stupid efficient designs and machinery to be able to produce millions of items per day extremely cheaply?

lyric mountain
#

producers would be L1 cache KEKW

#

they can get fish fast, but cant do much with it

#

then factories are the next cache level, which can process those fish into more complex products

quartz kindle
#

honestly this is something that should be taught in schools lmao, the sad/amazing reality of the world and how things are actually produced

#

basically always buy the cheapest brand

#

because the expensive brand is 90% of the time going to be the exact same product

#

like, even car manufacturers do this

lyric mountain
#

the only difference is usually how the product is filtered

quartz kindle
#

they have 3-4 different car models all runing the exact same engine and internals, with only slight exterior differences

lyric mountain
#

like, cheaper brands are more prone to letting inferior quality products pass through

#

so they can sell more for cheaper

quartz kindle
#

yeah sometimes the factory only does the bulk job and sells you the unfinished product for you to do the final touches

lyric mountain
#

cof cof ikea cof

quartz kindle
#

like imagine if coke and pepsi came from the same factory, but then they just add like the final 1% of the ingredients in their own factories

lyric mountain
#

in coke's case it's cocaine (the plant, not the powder)

quartz kindle
#

xD

lyric mountain
#

afaik they're the only legally allowed company to use it in a commercial beverage

quartz kindle
#

too big to fail

#

also, these days the way most newcomers enter the market is all the same

#

they dont bring a new product

#

they find the cheapest factory, buy from there, add their own new brand, and enter the market as a "new alternative"

lyric mountain
#

here in brazil we have a soda called "Jesus"

#

it's tutti-frutti flavored, but the biggest selling point is that it's a pink soda

#

like, literal pink

quartz kindle
lyric mountain
#

and it's expensive af

#

a can of jesus is more expensive than a can of coke

quartz kindle
#

lmao

lyric mountain
quartz kindle
#

this country's evangelism is stupid big

#

they are probably make money from the evangelics

quartz kindle
#

didnt like it xD

lyric mountain
#

ah, just noticed "Coca Cola" to the side of it

#

so they bought it

quartz kindle
#

i've had to repair a few positivo laptops some years ago

#

they used gigabyte motherboards with a modified bios to hide the gigabyte brand

#

so it was impossible to find drivers online

lyric mountain
#

positivo is shit lmao

quartz kindle
#

in china

#

there is this HUGE market

#

like a giant warehouse with hundreds of shops

#

where you can buy all kinds of raw chips and components and parts

#

you can walk in there and literally build your own android phone

lyric mountain
#

ah I saw it in news once

quartz kindle
#

you buy an android SoC, a camera, a touch screen, a case, etc, and fit it all together

#

android is an operating system

#

and its open source, like linux

#

in this video hes actually building a samsung s10

#

but you could build a brandless phone

#

you just need to find parts that are standarized and fit well together

pallid zinc
#

Got a question tho, ig most of the os use the same programming language (c asm etc) and same type of hardware, what makes there os slow and compairtively fast

quartz kindle
#

stuff like memory allocators, cpu scheduler, etc

#

but how you put all of these together in an operating system can influence how performant it will be

#

modern operating systems are pretty much all the same these days, the internal differences are not that big

pallid zinc
quartz kindle
#

thats not the oprating system itself

#

its all the bloat that they ship it with

#

a raw pure windows is not much different from a raw pure mac or a raw pure linux

#

what you're seeing is more the differences between the stuff that the system is shipped with

#

and how many things the system is shipped with

earnest phoenix
#

Windows is probably the operating system with the most bloat shipped with it

pallid zinc
#

I tried some lite versions of windows too they still consume more then linux or mac

quartz kindle
#

linux is pretty minimalistic, depending on the distribution, usually they ship very minimal things with it

pallid zinc
#

Mac os performance better then linux

quartz kindle
#

mac is very restricted in terms of hardware, so they ship very minimal drivers and programs that are designed and tested in specific hardware only

#

windows ships with everything and anything just so it can run anywhere and do everything out of the box

earnest phoenix
#

Windows is fun and games until it randomly skyrockets the disk usage to 100% for absolutely no reason

lyric mountain
#

oh that's superfetch/sysmain usually

quartz kindle
#

and windows update

#

and defender

lyric mountain
#

especially notable if u still use hdd

quartz kindle
#

and those schduled optimizers that windows runs

#

performance experience and what not

lyric mountain
#

that's superfetch/sysmain

#

it "optimized files you're most likely to use"

quartz kindle
#

ye

earnest phoenix
#

So much shit running in the background oldEyes

quartz kindle
#

next format im installing ghostspectre's version

#

without update and without defender

earnest phoenix
#

Just use Linux like a chad

cinder patio
#

windows defender is good

#

it's just that it's always goddamn scanning everything

#

like fuck off

pallid zinc
cinder patio
#

like any other antivirus programs do shit lol

#

windows defender is good

pallid zinc
#

I dunno how, but everytime i heard of a new virus they say it can easily bypass the defender

slender thistle
#

It's caught plenty of suspicious stuff for me

earnest phoenix
#

Therefore bypassing the security layer, although anti-viruses nowadays are mostly sharing their investigations and patterns found in thousands or millions of viruses found every week, month or year

#

So it's mostly unlikely for that to happen, unless it of course finds a new pattern

quartz kindle
#

the only problem i've had with defender is false positives (and its performance cost)

#

i've never had a bad thing that wasnt caught by it

#

but next time im gonna remove it, and get something that i can use to scan specific files only

#

24/7 av is slow af

earnest phoenix
#

There are way too many anti-virus programs though, which one are you gonna choose?

quartz kindle
#

its like blocking the entire system until it green lights

#

for every single suspicions thing

quartz kindle
#

but its been a few years since i last used it

#

idk if its more bloated now

earnest phoenix
#

Malwarebytes is pretty good

quartz kindle
#

i used to run a cracked version

royal portal
#

i heard that its getting worse

quartz kindle
#

but it doesnt work anymore

pine nova
#

isnt malwarebytes free tho

royal portal
#

no

#

only for 14 days

pine nova
#

I see

earnest phoenix
#

I once found an anti-virus that marked itself as a virus πŸ’€

pine nova
#

lmao

cinder patio
#

All anti-virus have some kind of a virus

quartz kindle
#

malwarebytes is free for scanning, just not free for 24/7 protection

cinder patio
#

and that's a fact

quartz kindle
#

at least it used to be that way

cinder patio
#

except windows defender

#

but windows itself is a virus so 🀑

quartz kindle
#

windows defender is just a memory hog

#

xD

earnest phoenix
#

Windows Defender is a worse memory hog than Google Chrome

quartz kindle
#

this looks like a nice test

earnest phoenix
#

I've never heard of Total Defense, but it's doing a pretty good job as it seems

quartz kindle
#

bigger is worse

earnest phoenix
#

Oh KEKW

#

Then it's K7, never heard of it either

quartz kindle
#

its from india lmao

#

why is "top in japan" even relevant?

#

lmao

earnest phoenix
#

Heh, I guessed as much, those Indian people who have a tutorial on literally everything, but with either the worst camera, quality or microphone I've ever seen

#

Those Indian tech support people actually doing something good mmLol

quartz kindle
#

oh panda is spanish

#

i though it was chinese

#

eset is from slovakia

#

gdata is german

vivid fulcrum
pine nova
#

πŸ’€

lyric mountain
quartz kindle
#

lmao

lyric mountain
#

ah, Trask

quartz kindle
#

xD

split hazel
#

bro i cant with my os

#

i left it for a month and now everything works

#

nah i have some major undefined behaviour going on

quartz kindle
#

lmao

split hazel
#

and i cant tell if its in my critical assembly code or c++ code

#

tf is this code

lyric mountain
#

type-punned

split hazel
#

tf does that mean

#

wait ok

#

the compiler actually knows im trying to circumvent it

#

thats clever

#

wait can you insert conditional code

#

so if the template value is x insert this code

lyric mountain
#

uh oh, slowmode inbound

earnest phoenix
#

Nodejs, html, css

#

Yes

lyric mountain
#

pretty much any language can make web dashboards

#

the standard are react, flutter, html (html + js + php) and python

earnest phoenix
split hazel
#

:o forgot i made a uuid generator for my os

still storm
#

why i cant change h7 tag color??

#
  h7 {
    color: black !important;
  }
``` i put this in css
wheat mesa
#

h7 isn't a real thing

uneven plover
#

H7 doesnt exists

wheat mesa
#

it's only h1-h6

uneven plover
#

Headings are till 6th level

still storm
#

oh

#

k

quartz kindle
#

epic games launcher is detected by 1/72 in virustotal lmao

lyric mountain
#

that 1 is fortnite

lyric mountain
fossil bone
#

Can one work a bot without the need to download discord packages?

lyric mountain
#

kinda

fossil bone
#

O.O

#

I am curious

lyric mountain
#

you can use any api without downloading any wrapper

#

you just need to send requests manually

wheat mesa
#

(it'll most likely be a pain though)

lyric mountain
#

for sure it will

fossil bone
#

So it's doable!!

winter pasture
wheat mesa
#

It is possible yes. Recommended without knowing what you're doing though? Not really

royal portal
wheat mesa
#

But if that's a project you want to do, then go for it

#

Just a fair warning that the discord api is very vast though

winter pasture
wheat mesa
#

^

#

There's a lot of library options out there, many of which took a lot of time and research to create

#

And many people

lyric mountain
#

like, anything that currently exists is possible

#

there's only a vertical learning curve to deal with

#

and by vertical I mean like 90Β°

fossil bone
#

.-.

winter pasture
#

Has good type safety and rate limiting

fossil bone
#

I mean u did get me hyped up for this crazy idea that just crossed my mind

#

Hope this doesn't fuck me up in the first time lol

#

Wish me luck

wheat mesa
#

gl

winter pasture
#

lol, have fun

wheat mesa
#

I'll tell you now that discord's gateway is very annoying but starts to make sense after you work with it for a little while

lyric mountain
wheat mesa
#

lol

lyric mountain
#

at least for the first time

wheat mesa
#

yeah it's by no means a simple task

fossil bone
#

Guys guys c'mon.. think of the gains

wheat mesa
#

just letting you know what to expect πŸ˜‰

#

never said it wasn't a good experience to have

fossil bone
#

I just thought of the best idea ever as a poor dude lol i can't afford a bot server forever so i already have a forever free code based web server and everyone subconsciously uses but it's just it belongs to Google and u can't download anything so u just only can code and make it run

lyric mountain
#

if it supports node it supports libraries

fossil bone
#

Therefore ... The solution :) Running the bot without a need to buy a server or downloading packages just making my way coding it

wheat mesa
#

sounds like a really bad google cloud server if it doesn't let you download npm packages

fossil bone
fossil bone
#

You can download from playstore

wheat mesa
#

I'd recommend using any other free server than that

#

even replit is probably better than using cloud storage as a webserver somehow

fossil bone
#

Idk really i never tried that

fossil bone
#

I tried it

wheat mesa
#

there's lots of options out there

#

I wouldn't recommend trying to get a hacky setup to work, it's better to have a proper environment to some extent

#

otherwise you'll probably encounter more issues

fossil bone
#

Do you like have a free vps in mind to recommend?

wheat mesa
#

oracle

spark flint
#

oracle

cinder patio
#

Nothing's free

fossil bone
#

I was just about to say thank you

#

Thanks guys i just checked it

lyric mountain
#

great quality: not free
free: low quality
great quality & free: limited time
free & unlimited time: you're the product (either ads or data selling)
great quality & free & unlimited time: you're being scammed

fossil bone
#

I mean i'm not like gonna run an online Os bot that hacks the world or something it's a simple bot with only 1000 line code not much '-'

boreal iron
fossil bone
#

So no need for supreme quality

lyric mountain
#

use replit then

#

with uptime robot

fossil bone
#

-_-

wheat mesa
#

rust is amazing, just converted an entire type-unsafe visitor pattern into a 23 line match expression that is completely safe

fossil bone
#

To the ones that keeps recommending me replit

#

A very long error about replits users-shared ip that causes my bot to keep crashing

#

U can hit send '-'

#

I see you keep typing

#

Anyway i'll try Oracle if it works i own you something you can ask me for anything because you'll be my life saviour from all the brain suffering i could have had from my old crazy idea ^-^

#

Matthew.#1403 | 9/5/20, 07:00:51 PM

Any free hosting is/will either:
1. Not actually suitable for hosting for bots
a. Allow you to host bots but does not have enough specs
2. Not actually free
a. Is only a free trial
3. Get your data/token stolen
a. This issue is practically removed when getting from a trusted source (e.g. AWS / Google Cloud (the free (trials) are relatively bad for hosting bots))
b. A token is a string you use to login to a bot, if your token is stolen/leaked your bot can be hacked, think of it as a password, just for a bot account. A bot token allows anyone to do anything with your bot, whether it be mass DM or banning everyone it can or just plain out abusing the API.

<Below is entirely written by @golden condor>
Most free hosts have some sort of catch, limit, security flaw or are ineffective for discord bots

Generally speaking, most free hosts have one or more of these flaws, but not all do, some are fine:
1. Limits - they may limit storage, ram or CPU and sometimes these limits can be reasonable

2. Are a scam - many hosts promise free hosting but they never actually give it to you

3. Have catches - might have a lot of downtime or require you to watch ads or might sell your data etc.

4. Incompatible with some libraries - most free hosts can't use things like sqlite, ffmpeg or others meaning you can't store data or play music which can be bad but is not bad unless your bot does any of these things (e.g Heroku)

List of good hosts: https://discordapp.com/channels/264445053596991498/272764566411149314/576818380498010112

I just noticed this pinged lol

golden condor
#

what

fossil bone
#

I quoted

golden condor
#

oh

fossil bone
#

You were pinged in the quote

golden condor
#

ok

fossil bone
#

Sorry for accidentally summoning you

golden condor
#

that's ok

pine nova
#

aye can someone explain partials to me (in discordjs) and how do they work?

#

πŸ’€

winter pasture
#

In short, DiscordJS caches messages, channels, reactions etc.
Sometimes cache gets evicted(cleared), or the bot may have been down and therefore never put the message/channel/reaction/etc in cache

By default, DiscordJS will just ignore the event if (like a reaction on a message it does not have in cache)

#

Partials allows you to enable the ability to still get events on things it does not have in cache

pine nova
#

oh

#

i see

winter pasture
#

So you can detect a partial like this

#

But a lot of the data will still not be avalible

#

So you use this to get the missing data/structure

pine nova
#

oh

#

thank u

simple stump
#

How can I resize/re-center iframes? When I use width: 100% or height: 100%, the frame becomes extremely small. I want to set the size to the original frame of the page (let's say 100vh), but without having a white space at the bottom and/or have it be responsive. I'm using set values (for example 55vh as the width and height as 100%), but this value doesn't work on all devices such as my phone. Also, 100vh seems to add a white space at the bottom. I'm not sure how to fix this. This is the code I'm working with:
HTML:

<div id="container">
  <iframe srcdoc="html here" id="frame" />
</div>

CSS:

#container {
  position: "relative";
  width: "100vh";
  padding-top: "56.25%"; /* Attempt at using aspect ratios */
  height: 0;
}

#container iframe {
  position: "absolute";
  top: 0;
  left: 0;
  width: "100%";
  height: "100%";
}
quartz kindle
#

you're using width: 100vh?

#

vh is height, not width

#

oh you tried using the padding trick for aspect ratio

#

put everything inside another container and make it a flexbox

slender thistle
#

Is it wrong to make body a flexbox? πŸ˜†

quartz kindle
#

i doubt it would be "wrong", but its rarely used

#

unless your page is really simple and only really contains one thing

slender thistle
#

Got it

quartz kindle
#

you could make a vertical flexbox and have header, body and footer be the flex items

slender thistle
#

True

#

On another note, I'm supposed to find out the model of the mouse I'm using. The thing is, the information on the bottom of it has been completely erased by now, and Speccy isn't reporting anything other than the manufacturer

boreal iron
#

Risk something, go with a new model

slender thistle
#

Eh

#

True

boreal iron
#

Choose a one with adjustable DPI

wheat mesa
#

whoops...

#

guess who forgot to advance in the string after finding the parenthesis

slender thistle
#

lol

wheat mesa
#

I love how incredibly easy it is to model an AST in rust tho

#

This is my entire AST ```rs
pub enum Node {
Number(f64),
UnaryExpr {
operator: TokenType,
child: Box<Node>,
},
BinaryExpr {
operator: TokenType,
lhs: Box<Node>,
rhs: Box<Node>
},
GroupingExpr {
child: Box<Node>
}
}

#

amazing language

#

I was fighting the borrow checker earlier but I realized I was using a lifetime for something I don't need to use a lifetime for

slender thistle
woeful pike
#

Box moment

simple stump
split hazel
#

can i steal something in rust instead of borrowing it

simple stump
#

Aight I just tried it but then everything disappears. I'm assuming it's because the frame has position: absolute, but when setting the extra div to position: relative, everything is still hidden. I'm using React, so I also tried wrapping everything in <Flex position={"relative"}>, but that didn't fix the issue either. I'll mess around a bit more but this is what I have right now:

<div position="relative">
  <div id="container">
    <iframe srcdoc="html here" id="frame" />
  </div>
</div>
simple stump
split hazel
#

@quartz kindle my os is getting async/await support

#

or well not my os but its being added to the software toolchain

boreal iron
#

PHP support when?

split hazel
#

the basis is pretty simple wrap anything that takes long in a class and then call .await() on it / .isdone etc

split hazel
boreal iron
#

Bitch do it!!1!

#

How can you refuse to implement modern technologies

split hazel
#

stupid

#

oh nooo i have to use templates to make this

#

for some reason intellisense switches off as soon as you make a template

#

which is like one of the selling points of c++

#

like its completely off

split hazel
#

fun fact modern opreating systems dont have this function

#

threads are expected to kill themselves

wheat mesa
split hazel
#

bro really stole something in rust

wheat mesa
#

stole the entire call stack too

quartz kindle
#

wtf is that

#

just looks like an infinite loop

split hazel
#

i'll see what the rust community has to say about that

wheat mesa
#

But at least it takes ownership of the string!

split hazel
#

tim reacting for the first time in his life?

quartz kindle
#

nop

#

me has reacted before

#

have you guys seen those mythic ai chips? that shit's amazing

#

analog cpu for ai

solemn latch
#

analog cpu's are so cool

sharp geyser
#

So Xetera brought up a point of not wanting to think about it when it comes to demodding a user. They shouldn't have to do anything after removing their role that gives them those moderator permissions. So I am trying to think of a way to handle permissions for my bot. Not only are there discord permissions to manage but I also have custom permissions myself and guild owners or anyone who has the MANAGE_SERVER permission can create permission groups that can have a permission set. My original idea of just adding/removing users from those permission groups just seem a annoying as Xetera said, you'd have actively think about removing them from the permission group so they no longer have those permissions which can be really annoying having to constantly remember to remove someone once you no longer want them to be mod. Any ideas on how I can design a system that leaves as little as possible for the bot user to do and more so let the bot handle majority of the work.

royal portal
#

are you just demodding the user on a discord server?!?!1

sharp geyser
#

Well no, because I have my own permission system as well. Essentially a server owner can make a permission group, set the permissions it has, and as of right now add a user/role to it. But I feel like having to remember if you want that user/role to have perms or not and then removing it like Xetera was explaining last night is a bit annoying to do. I want to leave the user to do as little work as possible

royal portal
#

maybe create permission group templates

#

which creates the roles and perms

sharp geyser
#

I don't like the idea of a bot creating roles and managing the permissions of said roles tbh

#

That could be very nefarious

royal portal
#

but what if the server owner could change the perms after

#

the template is there to make it easier

sharp geyser
#

Mmmm, but that would end up being pointless in this case here.

#

The permissions of the group has nothing to do with discord rather my own internal permissions

royal portal
#

what are internal permissions used for?!?!1

sharp geyser
#

They make it so if you do not belong to a permission group in that guild with the permission the command requires to run then you can't use it

#

So for example, a ban list of all the users banned in the server would require the VIEW_BAN_LIST permission

royal portal
#

dont see how removing them from the group is an issue

sharp geyser
#

Well right now it is setup so individual users are added to the group. Which is rather annoying to have to remember to remove the user from the group after you already take their discord permissions away. So I am wondering if using roles would be a better alternative

royal portal
#

it would be better with roles

#

because you no longer have the permissions once your role is removed

solemn latch
#

I dont see why you need your own permissions then

royal portal
#

isnt it easier to just give someone a role and remove it?!?!1

solemn latch
#

I'm going to be honest, 99% of the time your own permission system will 100% line up with discords

royal portal
#

unless its used for a site

ancient nova
#
    setInterval(() => {
        client.user.setActivity(`hating ${client.guilds.cache.size}/100 servers.`, { type: "COMPETING" });
    }, 300000);
``` why doesn't my bot have any activity?
#

this block of code is in the ready event so how come it's not working?

sharp geyser
sharp geyser
#

ban list would be the ban record specific to your guild.

ancient nova
#

and yea it is

sharp geyser
#

So it lists every single person that has been banned, and the reason why, the person who did so, the day it happened, etc

solemn latch
#

doesnt discord include that?

royal portal
#

yes they do

sharp geyser
#

It is custom data so no

ancient nova
#

no error

sharp geyser
tawdry path
#

How to change the coins you earn from Topgg ?

#

Is this where you ask?

sharp geyser
#

Essentially the ban list the bot has should be private to only those who have the permission to view it. Server owners may not want everyone with BAN_MEMBERS to view the list of people who've been banned

spark flint
ancient nova
#

so like

sharp geyser
#

It is a bad example tbh I suck at explaining things woo

sharp geyser
#

No

#

Ban members does not give access to audit logs if you are talking bout that

solemn latch
#

nope, just ban logs

sharp geyser
#

Which gives you virtually nothing

ancient nova
sharp geyser
#

Well ofc

ancient nova
#

how to?

spark flint
#

#Privacy

sharp geyser
#

Key thing here is though I won't be fetching banned users from discord just from my database

ancient nova
#

I remember it was something like this in v11 ```js
message.guild.fetchBans()

solemn latch
#

so it wont be the actual banned members list, just something else?

spark flint
#
message.guild.fetchBan("USERID")``` works now iirc
spark flint
ancient nova
#

or the owner

sharp geyser
ancient nova
#

Β―_(ツ)_/Β―

sharp geyser
#

So it has users banned from other servers as well

#

Which ofc you don't want just anyone seeing mmLol

ancient nova
#

ok so js message.guild.bans.fetch()

#

?

sharp geyser
#

don't think fetch returns all bans in the server but πŸ€·β€β™€οΈ

#

Something you will have to READ THE DOCS to figure out

solemn latch