#development
1 messages Β· Page 2049 of 1
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 
π wtf
its already optimised 
lies
ikik
Just have an object of readable permissions that you can grab from ez
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
yeah that's better
[object Object]
freezes the object
const perms = {
KICK_MEMBERS: "Ban",
... etc etc
};
perms[...];
is this what you mean misty?
It makes the object read-only, preventing new properties from being added or changed
Essentially yes
The Object.freeze() method freezes an
object. A frozen object can no longer be changed; freezing an object prevents new
properties from being added to it, existing properties from being removed, prevents
changing the enumerability, configurability, or writability of existing properties, and
prevents the values of existing properties from...
yeah it's just pseudo code
why mozilla 
mozilla docs are the best docs for JS
mozilla php docs
const ReadablePermissions = Object.freeze({
KICK_MEMBERS: 'Kick Members',
BAN_MEMBERS: 'Ban Members'
// etc
})
is how I do it
btw how do you check if a person is boosting the server?
how does php have anything to do with this @royal portal
premiumSince on the member object iirc
let me verify that tho
i was joking

alr
thats to check for nitro i think
No
premiumSince is to check when they last started boosting the server
so much has changed
you can't have access to a user's nitro subscription from the guild member that'd be user iirc
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
you and waffle think alike volty
isn't there a bool to just check if member is boosting wtf??
what is discord thinking
there's a booster role...
it's different for each server
You literally check if the premiumSince or premiumSinceTimestamp properties are not null
alright fair
get premiumSince() {
return this.premiumSinceTimestamp ? new Date(this.premiumSinceTimestamp) : null;
}
Literally all they do is return null if it isn't a thing
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
nah no need, I'm just checking if the user is boosting the server the command is executed in
Then you're good to go
@earnest phoenix Give my bot a name
I need a name
you get 0 context as to what the bot is going to do
Misferious, Ampolo, Pinaty, Maltra, Nifko, Curatox
What the fuck do those even mean
Nothing, names don't need to have a meaning
Nifko it is
you're good at this
can u give my bot a name
something shady sounding

Well "shady" has a couple different meaning, so maybe narrow it down?
mischievous maybe?
ik that's kind of a bold word
Troubola, Playpar, Trafas, Annipala, Issaky, Harmak, Culox
Harmak is decent
Morbotum
bottum
cringe
good morbing
good night
In 2016 we had hugh mungus, in 2018 it was big chungus, 2020 was amongus
2022 it's morbius
What comes next
mongius
hugh mong us
guys say u in a race and u pass the person on the 2nd place. What place are you in now?

Depends, if it was a lone run you're in mental clinic now
Why do you think of that in the first place?
Cause you are dumb (jk love you volty)
if you pass someone in 2nd place you are then in 2nd place and they become 3rd (to answer his question btw)
Heh I know it's that, was trying to make that joke but I guess it doesn't work out 
Did ya read the file btw?
Hope I explained well
You explained it pretty well
I just decided to work on a bot in ts rn instead and come back to java later


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
You can also simply use slashes if u wanna skip that
Ye
Lmao
My ass would wanna be making a full on handler for slash commands
I do hate slashes for how half-assed they were implemented
I guess argument parsing would be rather easier with slash commands tho
As in giving types to the arguments given to the command
I mean, it'll already come parsed
Jda converts to the discord data type
Ah
If u set an argument to be mentionable, jda will give u a mentionable
o I see
Kinda like this theme
It isn't overbearing even tho it is a lighter theme
The color scheme kinda gives the vibe of writing code on a physical document
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
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.
I just noticed, but ur still using community edition right?
Ah, I thought u were cuz missing left tabs
I removed some of the ones I didn't need
Was gonna mention u could probably get a free license from active open-source repos
I am planning on doing that
but no one actually actively contributes to any of my repos

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
The project just needs to be older than 3 months
I see
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
As long as you properly hide sensitive data ye, not much reason not to go OS
Who knows
It'd be nice 
It's also good as a portfolio should you need one
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
PSA: right click -> inject language
when using idea database manager
Nice to have language parsing and editor tools when editing fields
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?
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
Wait wut
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
ah kuuhaku said
smaller and faster
you store 32 permissions in a single 32bit number instead of 32 booleans
What is the difference of just doing what I did above and doing what discord did with the bit shifting
into a single 32bit number?
yes
Wdym
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
π
This sounds a bit confusing
I don't quite understand the concept behind what you are saying
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
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)
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?
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
I see
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
So basically I could just store the result of the bit shifting into the database over a bunch of booleans
from a transmission perspective, imagine sending a number in json, vs an array of booleans
the number is gonna be several times smaller
yes
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 ?
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
hi anyone here who uses python shell package?
if you don't catch it yes
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
Ima just go with it as I already set it up, it will waste more time redoing it entirely
ye i didn't mean as in redo it
My only issue now is how inefficient it seems to check if the user has a certain permission in a guild's permission group
why inefficient
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
why do you have things like ban members tied to your own permission system anyways?
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
ok but if I demod someone in my server I don't want them to have permissions to ban on the bot
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?
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
Likely end up with a Missing Permissions error from discord
well no because your bot will be the one doing the ban
Ah okay
Also I don't see how you'd have to remember to do anything. Naturally if you are demoding someone you'd remove their mod role
why don't you use the user's permissions for this? Why do you need your own permission system
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
Mmm, I could yes, but I will still end up needing a permission system of my own though for non discord related permissions
Im just talking about discord stuff like bans
Yea
Check the member's discord permissions when doing something discord-related and your permission system otherwise
What would you recommend then? I wanna make it as easy as possible to manage user's permissions within the bot. As a lot of things I plan on doing will require the user having custom permissions to execute certain commands.
I completely agree it will be annoying to keep up with the user in case you demod them and such
i keep getting this error, how can i fix it? https://sourceb.in/0KS3iPeZpg
The bot doesn't have the permission to create slash-commands on that guild
Invite your bot with the applications.commands scope
Yeah
its in a guild im not in
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
it does
how can i do that?
ima try again in a bit π
Wherever you register your commands, just try..catch it
i want to cop that 24gb of ram
thanks
rajesh π
π
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
the bank said they're not blocking it tho
they prob blacklisted my card bc i tried twice
i use the same card for all my accounts
im trying again
bruh
100%
now i see why people have a problem with oracle running mysql
yeah declined again
might try another card
fuck oracle man
why are you paying them
such a shit company
80p for 24gb ram forever
skem
oh if you knew java's backstory
oracle is know to be a dick to everyone
true
tell me more
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
stop being a discord mod

43
wbu
no
how old are you

16 
you either need to boost or have an approved bot
lmao bro said you first then just ghosted him
so forceful
dafuq is this 10 year old
then stop acting like a 10 year old?
damn i feel you bro
createMessageComponentCollector
@winter pasture @real rose found an under 13
yes
@earnest phoenixAre you actually under 13?
sorry for using the channel for the wrong reason mods
watch him say no 
why care so much about a kid anyway
?
they tried to befriend me 
-b @earnest phoenix Under 13, against Discord ToS
P.A.I.Nγ#4041 was successfully banned.
airing the question was worse than saying no 
lol
I don't remember all from the top of the head, but this sums it pretty well https://www.reddit.com/r/linux/comments/2e2c1o/what_do_we_hate_oracle_for/
basically they don't care what you want, they put money over relationship with their clients
oracle?
ye
Already sniped π¦

Lost internet while I was in the tunnel
ah
it said you were online but not in member list so wasn't sure if you were active lmao
you can't await inside a sync function
you need to make your function async
idk if ur being sarcastic
show code
() => {
await ...;
// CAN'T
}
async () => {
await ...;
// CAN
}
Wouldnβt it be async () => {}
yes lmao
done
yes
but preferably try not mixing awaits and thens
<Promise>
.then(a => get stuff)
.then(stuff => make deal)
.then(deal => you get it)
.then(it => see?)
now show the async await version for comparison
im in phone
<Promise>
.then(async a => await (await (await (await get stuff) make deal) you get it) see?)
yes, you can do that with await
wtf no
lmao
let me get on pc
.>
kekw
use await on the first promise
don't put then inside then, just go to the next chain
that way it executes sequentially in the promise's context
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();
ah that's what u meant 
so preferabily chose one of them and stick to it, dont mix them both up unless you know what you're doing
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
js is almost always single threaded, djs included
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
one after the other
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
ik, I mean node's pseudo-threading system
where it simulates having threads
djs doesnt use worker_threads if thats what you mean
you can use them with sharding tho
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?
make the first to reach hold a lock until done
as soon as the lock is lifted the next request will pass through
the theadpool manages the network, and gives the events to the js context one by one, for each event that it gives to js, it waits until js is done with it, so yes while js is running, the process is blocked
but the node threadpool is still accepting and queueing incoming requests
makes sense, good to know
a millisecond is still very long for a computer
like, you can't fathom how fuckin fast a computer is
depending on the job yes
it's like trying to comprehend how big the universe is
a nano is one millionth of a second btw
speaking about cpu operations-
or 1s = 1.000.000ns
these are the really good topics ^_^
once you try processing millions of pixels in a very short amount of time you start hating the cpu
I do already
, although not at cpu-level
i wish
thats why gpus have like 512 computing cores lmao
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
SpeedyOS
i might port something like vulkan
i can try but like
it might take a while
or something better/easier
ye
I think nvidia and amd have open source drivers now
or well nvidia was forced to recently
and amd has for awhile iirc
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
true
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
it's...complicated
its either better or worse with different scheduling algorithms
but in theory its that
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
lol you guys suck 2000+ threads
windows at its stupid amount of shit running in the background 24/7
i think i ran a tool which slightly debloats windows
hence the lower threads and processes
IJ and delphi open atm
next time i format, im gonna install ghostspectre's versions
what is a handle
heavily debloted
i really dont know
handles are used for many things, including which files the process has opened
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.
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
actually multicore cpus can physically do multiple things at once
but those things are very limited
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
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
hate it when i cant connect to ram

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
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
what if it runs out of memory π± π± π±
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
make the big ones closer ez
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
basically why people pick low-level languages, not because they are faster, but because they allow doing direct operations which are faster
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
but luajit might be able to make use of some of that
low level would be c, asm, cpp, rust, etc
the closer to english, the higher the level
these days a lot of languages are "turboed" by using JITs and other optimizers
<--------------------------------------------------------------------->
1011 1010 Hi there!
low level high level
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
until you stop to think that a cpu is so dense that a single transistor is 70 atoms wide
exdee
and we cant go any smaller because quantum shit start happening
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
oh and a cpu has billions of transistors
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
I mean, maybe but we'll have to restart from building-sized cpus
exactly
people make cpus on minecraft all the time
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
computers are the closest to alien technology we have at earth, and as they say: "Any sufficiently advanced technology is indistinguishable from magic"
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
if we really achieve sentient robots, it'll definitely be boston rob to do it
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
behold the big silicon chungus
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
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?
producers would be L1 cache 
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
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
the only difference is usually how the product is filtered
they have 3-4 different car models all runing the exact same engine and internals, with only slight exterior differences
like, cheaper brands are more prone to letting inferior quality products pass through
so they can sell more for cheaper
yeah sometimes the factory only does the bulk job and sells you the unfinished product for you to do the final touches
cof cof ikea cof
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
in coke's case it's cocaine (the plant, not the powder)
xD
afaik they're the only legally allowed company to use it in a commercial beverage
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"
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
and positivo laptops
lmao
this country's evangelism is stupid big
they are probably make money from the evangelics
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
positivo is shit lmao
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
ah I saw it in news once
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
Thanks to iFixit for sponsoring this video. You can learn more about the iFixit Pro Tech toolkit and buy your own at https://ifix.gd/2K2B6wI
I built a Samsung Galaxy S9+ entirely from parts I bought in the cell phone parts markets of in Shenzhen, China. And it works and runs Android!
How I Made My Own iPhone in China: https://youtu.be/leFuF-z...
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
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
most operating systems these days use the same basic programs that have been designed decades ago and are pretty much deemed as good as it can get
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
Like windows can hire people who can do it the best, but windows uses like 50% of the ram
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
Windows is probably the operating system with the most bloat shipped with it
I tried some lite versions of windows too they still consume more then linux or mac
linux is pretty minimalistic, depending on the distribution, usually they ship very minimal things with it
Mac os performance better then linux
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
Windows is fun and games until it randomly skyrockets the disk usage to 100% for absolutely no reason
oh that's superfetch/sysmain usually
especially notable if u still use hdd
and those schduled optimizers that windows runs
performance experience and what not
ye
So much shit running in the background 
next format im installing ghostspectre's version
without update and without defender
Just use Linux like a chad
windows defender is good
it's just that it's always goddamn scanning everything
like fuck off
In defending nothing π₯Ί
I dunno how, but everytime i heard of a new virus they say it can easily bypass the defender
It's caught plenty of suspicious stuff for me
It's usually because it uses patterns to attack the target devices/machines that most anti-virus programs are unfamiliar with
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
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
There are way too many anti-virus programs though, which one are you gonna choose?
its like blocking the entire system until it green lights
for every single suspicions thing
i've had good results with malwarebytes
but its been a few years since i last used it
idk if its more bloated now
Malwarebytes is pretty good
i used to run a cracked version
i heard that its getting worse
but it doesnt work anymore
I see
I once found an anti-virus that marked itself as a virus π
lmao
All anti-virus have some kind of a virus
malwarebytes is free for scanning, just not free for 24/7 protection
and that's a fact
at least it used to be that way
Windows Defender is a worse memory hog than Google Chrome
I've never heard of Total Defense, but it's doing a pretty good job as it seems
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 
oh panda is spanish
i though it was chinese
eset is from slovakia
gdata is german
they probably have contracts to have the av preinstalled on a lot of devices so they flex that π
π
I swear I saw that guy in a movie
lmao
ah, Trask
xD
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
lmao
type-punned
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
uh oh, slowmode inbound
pretty much any language can make web dashboards
the standard are react, flutter, html (html + js + php) and python
@lyric mountain can you come in #topgg-api
:o forgot i made a uuid generator for my os
why i cant change h7 tag color??
h7 {
color: black !important;
}
``` i put this in css
h7 isn't a real thing
H7 doesnt exists
it's only h1-h6
Headings are till 6th level
epic games launcher is detected by 1/72 in virustotal lmao
that 1 is fortnite
Can one work a bot without the need to download discord packages?
kinda
you can use any api without downloading any wrapper
you just need to send requests manually
(it'll most likely be a pain though)
for sure it will
So it's doable!!
Yeah, follow the discord API docs https://discord.com/developers/docs/intro
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
It is possible yes. Recommended without knowing what you're doing though? Not really
now make it work without the api

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
And so easy to mess up rate limiting buckets, typings etc
^
There's a lot of library options out there, many of which took a lot of time and research to create
And many people
like, anything that currently exists is possible
there's only a vertical learning curve to deal with
and by vertical I mean like 90Β°
.-.
I personally use https://github.com/DasWolke/SnowTransfer and https://github.com/DasWolke/CloudStorm
Super "low level" and light wrapper around the Discord API
Has good type safety and rate limiting
But yeah, not an official endorsement. A few of the libs are listed here https://github.com/advaith1/libs and https://discord.com/developers/docs/topics/community-resources#libraries
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
gl
lol, have fun
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
well...yk...it'll be like dark souls if it was 5x harder
lol
at least for the first time
yeah it's by no means a simple task
Guys guys c'mon.. think of the gains
just letting you know what to expect π
never said it wasn't a good experience to have
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
if it supports node it supports libraries
Therefore ... The solution :) Running the bot without a need to buy a server or downloading packages just making my way coding it
sounds like a really bad google cloud server if it doesn't let you download npm packages
Idk really i just got the idea didn't dig much of all it has
It's basically a cloud storage that some geniuses found a way to use as a web server
You can download from playstore
I'd recommend using any other free server than that
even replit is probably better than using cloud storage as a webserver somehow
Idk really i never tried that
No replit keeps crushing
I tried it
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
Do you like have a free vps in mind to recommend?
oracle
oracle
Nothing's free
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
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 '-'
Death is free, at least for you not so for others
So no need for supreme quality
-_-
rust is amazing, just converted an entire type-unsafe visitor pattern into a 23 line match expression that is completely safe
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 botsGenerally 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 reasonable2. 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
what
I quoted
oh
You were pinged in the quote
ok
Sorry for accidentally summoning you
that's ok
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
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
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%";
}
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
Is it wrong to make body a flexbox? π
i doubt it would be "wrong", but its rarely used
unless your page is really simple and only really contains one thing
Got it
you could make a vertical flexbox and have header, body and footer be the flex items
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
Risk something, go with a new model
Choose a one with adjustable DPI
lol
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

Box moment
Okay! Thank you.
can i steal something in rust instead of borrowing it
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>
copyright moment
@quartz kindle my os is getting async/await support
or well not my os but its being added to the software toolchain
PHP support when?
the basis is pretty simple wrap anything that takes long in a class and then call .await() on it / .isdone etc
bro i aint adding php
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
fun fact modern opreating systems dont have this function
threads are expected to kill themselves
fn main() {
let test: String = String::new();
fucking_steal_it(test);
}
// Steals your stack memory too!
fn fucking_steal_it(string: String) {
run();
}
fn run() {
main();
}
bro really stole something in rust
stole the entire call stack too
i'll see what the rust community has to say about that
It indeed is
But at least it takes ownership of the string!
tim reacting for the first time in his life?
nop
me has reacted before
have you guys seen those mythic ai chips? that shit's amazing
analog cpu for ai
analog cpu's are so cool
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.
are you just demodding the user on a discord server?!?!1
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
I don't like the idea of a bot creating roles and managing the permissions of said roles tbh
That could be very nefarious
but what if the server owner could change the perms after
the template is there to make it easier
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
what are internal permissions used for?!?!1
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
dont see how removing them from the group is an issue
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
it would be better with roles
because you no longer have the permissions once your role is removed
isnt that already included in ban members?
I dont see why you need your own permissions then
isnt it easier to just give someone a role and remove it?!?!1
I'm going to be honest, 99% of the time your own permission system will 100% line up with discords
unless its used for a site
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?
This is entirely separate
COMPETING is a type??
ban list would be the ban record specific to your guild.
iit was introducted like a year ago
and yea it is
So it lists every single person that has been banned, and the reason why, the person who did so, the day it happened, etc
doesnt discord include that?
yes they do
It is custom data so no
any1 know why the activity does not show up then
no error
It is really hard to explain
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
you can only use them for auctions (https://auctions.top.gg)
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
so like
It is a bad example tbh I suck at explaining things woo
but they already can
nope, just ban logs
Which gives you virtually nothing
is it possible to create a command to list all banned people?
Well ofc
how to?
probably not something to add tho
#Privacy
Key thing here is though I won't be fetching banned users from discord just from my database
I remember it was something like this in v11 ```js
message.guild.fetchBans()
so it wont be the actual banned members list, just something else?
message.guild.fetchBan("USERID")``` works now iirc
a global ban database
only for people with admin perms
or the owner
No it is a global ban list
Β―_(γ)_/Β―
So it has users banned from other servers as well
Which ofc you don't want just anyone seeing 
don't think fetch returns all bans in the server but π€·ββοΈ
Something you will have to READ THE DOCS to figure out
wouldnt that be considered public data then?


