#development
1 messages · Page 1959 of 1
You gotta define a max width of 100% to the parent element
Which also needs to be aligned properly of course
Also for tables exceeding a specific size it’s recommended to realign them, showing the columns in an vertical view (like rows)
As scrolling on mobile sucks hard
If that’s nothing you like you can also use horizontal scrolling for specific elements
not the entire site
Only for the content exceeding your screen size

if i force a bot to be sharded and its only in two servers, will each server have its own bot? or is that not guaranteed?
Question: For what I have here related to Discord Menus (javascript)
const row = new MessageActionRow().addComponents(
new MessageSelectMenu()
.setCustomId('testMe!')
.setPlaceholder("Click on me!")
.addOptions([
{
label: "First option",
value: "first",
description: "First option!"
}
]))
How would I properly forEach and array to automatically add .addOptions values, lables, ect. Been at it for a minute, could use a little hand. 🙂
Note: The array already has value: lable: description: already in it. It's created from an api call I store
not guaranteed
what does your current array look like?
menuOptions[
{
value: someValue,
description: someDescription,
label: someLable
}
]

but multiple items
Why don’t you simply add the lines to the object in a loop instead of using the shitty builder tools
how many muiiltiple?
tbh idk. Just the first time I really toyed around with them so I just kinda copy pasta'd it from docs. 
Hi
Your helper functions just create the object for you, the API wants, nothing else.
You can see that yourself when logging row after building the component.
https://discord.com/developers/docs/interactions/message-components#select-menus-select-menu-example
were can i learn on how to start coding with discord.js
@harsh tusk
I see. I didn't really consider logging row tbh. Ty
By writing the object yourself as the API requires it, it should also be easy to add priorities or options the objects in a loop or per hand
ye I gotchu now. Appreciate the info
i just dont understand, if there is an array with objects that have the 3 properties: label, description, and value. cant you just do addOptions(the_array) ?
Well
Yeah you will see it’s just a formatted object like in the example I mentioned
I did, but it complains trust.
you can only have i thinks 24/25 items. it would complain if you have more.
Something Something != string error something something
but can confirm, they are indeed strings
show your error? 🙂
no worries 🙂
but I will likely just do what Fake suggest
fair enough 🙂
might wanna post the entire error message lol
C:\Users\Kaden\Desktop\Discord-Bot-Integration\node_modules\discord.js\src\util\Util.js:413
if (typeof data !== 'string') throw new error(errorMessage);
^
RangeError: SELECT_OPTION_LABEL
at Function.verifyString (C:\Users\Kaden\Desktop\Discord-Bot-Integration\node_modules\discord.js\src\util\Util.js:413:41)
at Function.normalizeOption (C:\Users\Kaden\Desktop\Discord-Bot-Integration\node_modules\discord.js\src\structures\MessageSelectMenu.js:184:18)
at C:\Users\Kaden\Desktop\Discord-Bot-Integration\node_modules\discord.js\src\structures\MessageSelectMenu.js:198:54
at Array.map (<anonymous>)
at Function.normalizeOptions (C:\Users\Kaden\Desktop\Discord-Bot-Integration\node_modules\discord.js\src\structures\MessageSelectMenu.js:198:35)
at MessageSelectMenu.addOptions (C:\Users\Kaden\Desktop\Discord-Bot-Integration\node_modules\discord.js\src\structures\MessageSelectMenu.js:144:43)
at buildMenu (C:\Users\Kaden\Desktop\Discord-Bot-Integration\src\commands\general\pokemon.js:85:10)
at C:\Users\Kaden\Desktop\Discord-Bot-Integration\src\commands\general\pokemon.js:69:9
at processTicksAndRejections (node:internal/process/task_queues:96:5)
PS C:\Users\Kaden\Desktop\Discord-Bot-Integration>
sec
Ah you know what.
I see the problemo now.
So I did let menuOptions = [{}] so 0 = {}. Derp
But ya that menu limit will be problematic for what I was trying to achieve anyways
submenus?! 😛
Hmm. Yeah I was thinking about that actually. Do something like First option = next page type thing
Did you solve your issue?
I lost the context
Yeah I did actually 😄
Can a Interaction (button) be used in DM's?
Yes interactions can be used anywhere
Yeah
Except guild commands of course 
So if its in dms, can I just use interaction.reply?
You wrote all that faster than me writing one word
lmfaoo
lmfao
Y'all got me 
Fun fact while driving home
Yes the object you get doesn’t change much except there’s no guild property available
Ahh, makes sense, was so is the channel thingy still available?
interaction.channel
I'd assume thats a guild property right?
Cause DM is a channel o-o
eh
Imma just use reply tbh 🤣
Also no member property but an user property is still present
Of course a DM is also just a channel
Makes sense ty
yess, thought so
Reply will response with a webhook to the interaction, channel.send just sends a common message to a channel
ah yeah
Deferring in DMs is also present
If you can’t respond to the interaction within 3s you need to defer it
cough cough better go do that
I mean just responding with a channel message instead of a webhook will most likely cause an interaction error anyways
iirc
Can I do this:
let mguild = client.guilds.cache.get(m_guild)
let muser = mguild.members.fetch(m.author.id)
muser.roles.add(guild_role)```?
Yes, but there's a simpler way to accomplish this:
m.member.roles.add(guild_role);
Assuming the message is from the same guild
If not your current implementation almost works
Issue is you aren't awaiting that .fetch
and we don't know the value of m, mguild, or muser
m_guild 
The message is in dms o-o
What’s the actual goal?
It adds a role to the user.
It's like a verification
User clicks
I alr got all that down
You may wanna check if the fetched user actually is a member of the guild
Just need it to add a role in a specific guild
they are
Always check things, if he leaves or gets kicked or if the guild is unavailable you will get an error
How do I fetch that tho?
didn't I do that here: let muser = mguild.members.fetch(m.author.id)
Yes but await it in the first place, then check if muser exists before going on
o-o
huh
mk lemme try sum things
await let muser

let mguild = client.guilds.cache.get('925273545322426400')
await mguild.members.fetch(m.author.id)
let muser = mguild.members.fetch(m.author.id)
muser.roles.add('925274047170904135')```
let user = await fetch(…)
mhm it is indeed.
Promises need to be awaited (in a async function)
Huh wut, where, when, why?
I mean you can also work with a then() clause if you prefer that style
help me create bot game pls
You have to ask a question in order to receive an answer
trueeeee
Don’t teach him this he’s gonna have 20 .then()s nested 😩
Shhh don’t publish my evil plan

Yeah it's about 25h a week on top of my job and running 2 companies
But I definitely enjoy dev discussions and I'll be trying to take time to hang out more here again 
There isn't. You have to vote on the site.
My events/messageCreate.js (It works I have checked with console.log)
module.exports = (client, message) => {
// Delcare Prefix
const prefix = process.env.PREFIX;
// Ignore all bots
if (message.author.bot) return;
// Ignore messages not starting with the prefix (in env)
if (message.content.startsWith(prefix)){
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/g);
const command = args.shift().toLowerCase();
// Grab the command data, check it and execute
const cmd = client.message_commands.get(command);
if (!cmd) return;
cmd.run(client, message, args);
}
};
The way I register message commands:
/** Registering Message Commands -- Start */
const commands = fs
.readdirSync("./commands/message")
.filter((file) => file.endsWith(".js"));
for (const file of commands) {
const commandName = file.split(".")[0];
const command = require(`./commands/message/${file}`);
console.log(`Attempting to load command ${commandName}`);
client.message_commands.set(command.name, command);
}
/** Registering Message Commands -- End */
My commands/message/ping.js
exports.run = (client, message, args) => {
console.log(`handling ${message.content}`); // Debuging
message.channel.send(`Pong! API Latency is ${client.ws.ping} `).catch(console.error);
}```
The ping command doesnt work and logs nothing
module.exports.run
since you are using CommonJS as import syntax (require)
specify the button and embed within the options
djs v13 no longer supports direct embed send via just passing it into the function
okay
okay ty
thnx
why the fuck does my bot shows 0 guilds even though if it is in 3-4 servers?
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.NON_PRIVILEGED,
"GUILD_MEMBERS",
]
});
it no worki
'BITFIELD_INVALID'
Intents.FLAGS?
public async registerCommands(){
this._client.guilds.cache.forEach((guild) => {
console.log(guild.id);
});
}
My code if anyone wants to help 😭
uhhh
nope NON_PRIVILEGED isn't part of that
oh thanks
@pale vessel ayo?
ayo what am I supposed to help with 😭
make sure that's ran after the ready event
let guild = await client.guilds.cache.get(GUILD);
user = req.user
if (guild.members.cache.find(user)) {
console.log("The user is in the server!");
}else{
console.log("The user is not in the server!");
}
uhhhh
e is not a function
did i do a typo or what
hmmmm
i don't understand
Collections have the find method https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
2022-01-13T09:21:55.122828+00:00 how do i convert this to a valid datetime to calculate with
are you using JS?
if yes new Date("2022-01-13T09:21:55.122828+00:00");
py
datetime.fromstrtime(str, pattern) if i remember
Guys I need help
not a thing iirc
strtime definitely is a thing
i just cant remember what order the parameters go in
As nobody else is online…
@rose warren Why does this bot above have permissions to write in here?
Thought they are all locked into #commands
You simply add a message component (the button) and if an user interacts with it you delete the message.
The message object containing the button is available as property of the interaction.
thnx
Good Day. Since im not really sure where i should put this Question i will type it here. I am looking for a programmer for a frontend component which i can easily copy & paste to my project afterwards. Would anybody interested to help me out? I can also explain more in detail once interested. Thank you and have a great day 
@harsh nova -needdev
-needdev
@worthy meteor
You seem to be asking for something you don't have experience for or something that hasn't been done yet, but really need for your bot/server.
You can hire developers from Fiverr or Freelancer to code the things you need for your bot/server.
Yes, exactly. Thanks but i figured i will just ask here first if anybody is interested in getting the job 😦 I guess i will go to fiver or freelancer. Thank you very much.
who is this btec giveaway bot


Thanks. Looks like someone forgot to role it properly!
👍
they roled it without the proper barrel
smh
Go on Tim, do some progress, we're waiting!
no i'll go play league
i setup geocoding and elevation with 4 different providers to my api
but now im considering rolling my own offline geocoding solution
so not rely on third parties
but shit's hard yo
What do you understand as "geocoding solution"? Geolocation detection?
name -> coordinates
Ah alright
im thinking of making a simple sqlite with fts5 db from geonames
but idk exactly how i'll handle multiple languages yet
a proper geocoding server like nominatim takes like 200gb of disk space to setup
my vps is like 40gb
I somehow guess you have to rely on third parties for that amount of data and options users can provide
i wanna offer something simple and cheap for the free version of my api
and then paid users can access the better solutions via third party integrations
also
mapbox is fast af
how to have much more detailed logs on node js? because for example on this error we do not know where it is committed. I use interaction a lot and suddenly it is difficult to find where it is https://media.discordapp.net/attachments/927570218551754753/930854223061590116/Screenshot_882.png
because the error happens in an async function
the only way to obtain proper stack traces of async functions is to await all promises
Would JS respect return await ()...
icon= str(message.guild.icon_url)
GA_msg.set_thumbnail(icon)
error = set_thumbnail() takes 1 positional argument but 2 were given
return await is redundant
because you have to await the parent function anyway
rule 1 of #development; never try and out smart tim
help please 😞
are you sure the problem comes from there? that code looks correct
show full error
that's the only thing updated but wait a min
it was going so well until you posted that screenshot


- replit
what
isn't the pic readable
hardly
I can read it properly well nevermind
we need the full error
if "GIVEAWAY" in message.content:
if message.author.id == 294882584201003009:
if message.guild.name in db.keys():
link = db[message.guild.name]
else:
db[message.guild.name] = str(
await message.channel.create_invite(max_age=0))
link = str(db[message.guild.name])
msglink = "ttps://discord.com/channels/" + str(message.guild.id) + "/" + str(message.channel.id) + "/" + str(message.id)
GaTimeone = message.embeds[0].description.split("Ends:")
GaTime = GaTimeone[1].split("Hosted")
for guild in client.guilds:
channel = discord.utils.get(guild.text_channels,
name='giveaway-index')
if channel:
GA_msg = discord.Embed(
title="Treasure Hunting",
url="",
description="\n---------------------- \n giveaway==>" +
message.embeds[0].author.name +
"\n---------------------- \ntime==>" + str(GaTime[0]))
GA_msg.add_field(name="join link", value="["+message.guild.name+"]("+str(link)+")", inline=False)
GA_msg.add_field(name="message link", value="[msg link]("+str(msglink)+")", inline=False)
icon = str(message.guild.icon_url)
GA_msg.set_thumbnail(icon)
await asyncio.sleep(1)
await channel.send(embed=GA_msg)
Ignoring exception in on_message
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 118, in on_message
GA_msg.set_thumbnail(icon)
TypeError: set_thumbnail() takes 1 positional argument but 2 were given
File "main.py", line 118, in on_message
does str() somehow return two things? idk how py works
line 118
anyway according to the dpy docs, it should be like this:
idk it shouldn't since guild only have one icon
set_thumbnail(url=message.guild.icon_url)
Do you create and send another embed in the event?
GA_msg.set_thumbnail(url=icon)
no idea
DiscordAPIError: Missing Permissions
ffs
IT'S NOT MISSING ANY PERMISSION FUCKING DISCORD

lol
Admin perms 
You’re changing nickname right? Is there some sort of channel permission override for change nickname (I would think not, seeing as that’s a server-wide thing)
- light mode
- python
my god that dude is so powerful, he comments his code
This is a stupid question for you fake but are you 10000% sure you’re changing your nick in the right server
and that there are no higher roles overriding the perms
^^
interaction.guild.me.setNickname(...)
I'm sure, yes
Who knows who me is... probably a traitor
its mee6
we do a little tomfoolery
Some social trickery that results in some mild confusion
mee6 just trolled you
This is some tomfoolery I’ve never seen before
skill issue
double check your permissions and try again
Don't try that command on owner.
why not
I double double checked them, which makes 4 checks already

It should work on lower roles.
is the target member an owner or the role is above the bot
It obivously renames the bot as the IDs show... For renaming users you would require different permission(s)
Are you kidding me?
interaction.guild.me is the guild member object of the bot itself my gosh
no?
nyeo?
go use default emojis somewhere else
helikopter helikopter
paracofer paracofer
imagine paying for to use emojis
🗿
imagine paying to use wifi
Fake just use Java instead 😉
NO
Java is the closest thing I can get to C# while I’m at school
GO AWAY YOU EVIL DEMON
Yes Discord is trolling me
idk how permissions can get fucked up
waffle sucks
kicking, clearing permissions and reinviting seems to fix
Maybe it's not bot. It's the one who interacted.
Not that I already tried this process 3 times
dm nodes
But here your code is missing user. Sorry I am just beginner in Python and don't know anything about JS. 😆
Sorry I am just beginner
We noticed. 
Just don't say anything then man
But here your code is missing
Because an user has no nickname in that context, a guild member has.
I still wonder how permissions in guilds can be fucked up out of nowhere just like that, without touching them
Looks like that's the world we're living in
blame dicksword
ayo stop copying me
Yeah, just started recently in Python. 🙂
how to add 2 buttons in a component?
Question tags: discord.js, js, plshelpme
was a skill issue after all
kthxbye
copy and paste this to your code:
por favor, add 2 botões em componente, kthxbye
Ah it was kthxbye ... yee I remember now
Pass multiple component objects to your message like you do with embeds
...reply({ embeds: [embed1, embed2, embedBanana], components: [component1, component2, componentApple] })
ok
tysm Tim
What a stressful channel today...
allow me to post a PROPER question for once
no
anyone worked with packed moment-timezone files before? i dont feel like using the whole moment-timezone library just to access this data, but they use a weird ass format
what the fuck
Holy shit
unfortunately i fixed my own issue so can't post proper question here
isn't moment deprecated
kthxbye
working with timezones is so damn lackluster, there is not a single library out there that actually queries the raw tzdata files properly
this seems like some format specific to moment isn't it?
not deprecated, just in maintenance mode
Timezones | Computerphile
tim scott's decent into madness
ye i'll figure it out from their source
sounds like a big pain, good luck
good luck on fixing top.gg
ty
why do you need all that data anyways
my problem with timezones is that my project always needs the latest up-to-date timezone data, and every single good solution out there relies on built-in system/browser/env timezone data which is always outdated
node.js 17.3 uses tzdata v2021a, latest is 2021e
use an api that is always updated
moment-timezone is like the only project out there that actually keeps their own updated tzdata files
why do you need to update timezones
because i need up-to-date timezone info
how is time outdated
outdated timezones = random country decides to remove or change the dates of their daylight savings start/end times
daylight savings
boom, "what time is it in x place at x date" is now incorect
sounds like a british problem
I wonder if it can be up tp date then anyways, you will always expect some difficulties in 3rd world countires
Our Indian tech scammer knows what I'm talking about

outdated timezones are a real issue with a lot of things, like embedded systems and outdated OSes
governments often accidentally break banking systems by introducing timezone changes without prior warning
I wonder how perfect your API requires to be to keep track of all of that
Did you actually use the ref link for the cloud server?
india doesn't have daylight saving
the sun is always trying to fry us
I never received a fucking penny yet
often
i mean, its main purpose involves a person requesting info about the planets in the sky at a specific time and place, and time is usually their own local time
so "where was the moon in the sky yesterday noon at my town"
would be 1 hour off with incorrect timezone offsets
I will remember when I stand still in front of my fireplace to warm up my body from the fucking cold and rainy weather outsite
except if your calendar completely depends on the moon
i believe i did? i dont remember anymore
Wouldn't it make sense then to allow people to pass the timezone or offset as query argument when doing an API request?
No passing it means to try to get it by the request IP.
question: how do i generate a pseudo-random string of a certain length
uuid is too long
there will be an option to set a specific timezone by name or offset minutes, but most people will want it to be autodetected from the city/place they chose
i cannot do it via IP because its not always for their own location
random != random
PHP has a crypto-save function to generate random bytes, I doubt JS has one
you can look up stuff for other places and other people
That sounds like a website, not the pure API anymore?!
require("crypto").randomBytes(how many bytes do you want here).toString()
nodejs but JS doesn't a native one, does it?
nah its the api the runs my bot basically, im doing a full rework
and open it to public usage
Polyfill

js has webcrypto, but idk if webcrypto has randomBytes
Oh it's about a bot...
You're building the API interface the bot just sends requests to like I do
But how do you wanna detect the locale/timezone then, just by someone selecting his city/country?
yes but my api is not only for bots, it can be used for websites, apps, etc
Yeah like mine
yes, the user has to pass the location as a parameter
hence why geocoding
Well I now know why autocomplete is a useful feature for u
the process is like this:
location name -> geocoded to coordinates -> coordinates to get elevation data -> coordinates to get timezone data -> timezone data to get utc offset -> get utc time -> get planetary positions for utc time as seen from coordinates xy at height z
Ah I see
as much of that i can have offline without relying on third parties, the better for me
geocoding and elevation data requires datasets of hundreds of gb tho
timezone is much smaller, i can have an offline version for that
planetary positions is also offline for the most part, with fetching extra files as needed
so, a lil math question (L = 22):
i dont speak math
if I were to reverse that and get the value o L, I use this (X = 177110):
but if I divide by log(l), how would I add that to reversing formula?
I never really understood how to reverse a log
I somehow feel like you will have to subscribe a service like that, https://www.maxmind.com/en/geoip2-city#features to download and update your local database file in order to keep it offline
Log is just the inverse of an exponential, if that’s what you mean by reverse here
I know but it also includes the data you need
im currently subscribed to the free versions of several different geocoding and elevation services tho
like google maps api
mapbox
so do I just ^ l?
but if my api starts getting used a lot, i will have to start paying for them
and they are expensive af
log base n of x = y is the same thing as saying n^y = x
I mean if you already picked one accurate enough you can scale with after...
geocoding is super expensive financially wise
with mapbox for example
100k monthly requests = free
200k monthly requests = 80 dollars a month
uh
You might wanna cache the data for a specific amount of time, maybe to try stay in the limit as long as possible
caching wont be very effective
how often will people search for london uk
when they have the entire world at their disposal, and several different ways to find london anyway
and in many languages as well
"londres" instead of "london"
hmm good point
Kinda scared to see how much I have used this month...
are you using mapbox as well?
Google maps api
Geocode*
I mean it's still possible to cache the shit, using autocomplete fetching the data of your cache/database
Somebody entering lon could receive the choice london uk
you know
If you only care about countries catching is appropriate
Not perfect tho but still more effient than calling an API request for every single input
i guess, but the raw api will not have autocomplete, i dont want people doing multiple requests for no reason
200$ free credits per month, 5 usd per 1000 requests = 40k free per month
100k requests per month to google geocode would cost 300$ lol
can a js function use variables before they're actually declared
no
im not running the function before declaring
if you use var, you can use the variable before its declared, its value will be undefined tho
still no
const and let no, they need to be declared beforehand
no var
you'll get an error even before your code runs AFAIK
what if the function was declared outside the scope where it's run in which declares the variables
function spaghetti() {
bruh();
}
function jajaja() {
const bruh = () => console.log("bruh");
spaghetti();
}
@quartz kindle
You gotta cache the user input, e.g. london uk locally (in your bot environment) if the request to the API was successful.
If another user now enteres lon you gotta use autocomplete to suggest london uk.
He still can enter his own value tho but if he picks london uk you gotta have one request less.
If he picks his own choice, e.g. londres you gotta cache that one, too if the API request was successful.
If any other user then enters lon you can already show both choices which increases the chance an user picks one of it - which lowers the amount of (paid) API requests, once your bot is large enough.
the variables need to be defined at least in the same scope as the function
or outer scopes ofc
the variables wouldn't even be available right
no
ok
to a function that is used 100 times with the exact same parameters
that would be code-breaking scope pollution
gameLoop({ io, players });
you could define the function in the same scope the variables are defined in
ok
ty
hmm its a good idea, but the bot is just one of the api's clients, ideally all other clients, both free and paid, would need to come up with their own caching solutions as well. but what im thinking is that if i make my geocoding cost more, they would be incentivised to use their own third party geocoding instead of relying on my api's geocoding
like, my api is very complicated so i cant charge per requests, i have to use a credits system where the cost of each request depends on the parameters
i can make requests that require geocoding be more expensive in terms of credits
so that users would be incentivised to hire their own geocoding
tim profiting from code copied from this channel
but the bot is just one of the api's clients
Yee thats why reducing the API requests if possible should be a good idea as I mentioned.
I just not aware of the amount of parameters... but yeah, one entering london will request the moons position, one another star constellation, ... which makes caching like impossible
why is time so complicated
my bot actually already does caching similar to what you described
but it caches complete api requests, including time, location and parameters
so if two users input the exact same command, only 1 request will be made
yeah it actually is, but now I need to charge money from you, copying my idea
hey i implemented that idea before you came up with it, so i have to charge you for copyright infringment
lmao
and stealing company secrets
damn capitalist
Was watching a video and someone said fungal network so I edited some video to look resident evil like and made this real quick lmao
i'll have you know that my business is worth a whole 10 dollars
Guys
Wrong, plus white, plus didn't ask? PLUS Angular?
and im ranked 873658736487 in forbes
plus svelte
I Want To Get User Has Been Voted ?
@commands.Cog.listener()
async def on_dbl_vote(self, data):
"""An event that is called whenever someone votes for the bot on top.gg."""
print("Received an upvote:", "\n", data, sep="")
nice
stop... I'm close to die... laughing my ass off
data["user"] ?
there are 7,500,000,000 people in existence
you are lower than all of society
you made your own mouse driver? looks cool

Super Early Alpha² Release when?
v0.0.0.0.0.0.1
:P
it all falls into place with my process event dispatching
SlowOS
its actually quite fast with my optimisations
the mouse is just jerky and needs some offsetting
and smoothening
its an OS that just runs an art program ofc it will be fast
in my eyes, low level programmers are the real "linux hackers"
sooner or later i'll be contributing to the linux kernel
Hmm
or tim
no, im not even close to that
hmmMMm
because you're light years better than that?
only problem with the mouse is that it is using the PS2 interface which are these really old and large cords and its 50 50 whether the bios will emulate the mouse or not
and mine does not so i'll have to write a USB driver for it to work
playstation os
yes
polystation
and i've been warned usb drivers are difficult to write
HmmMamm😂
prettyspeedy os
you poor boy
who even uses these anymore
3 billion devices
do they run java as well
Speedy OS release date: 2076, Windows 199 release happens in the same year
they run java and that's why they use that
7 years after karlson release
no wonder its clunky
only 1 year after my api release

tim why does your pfp look cursed
also fun fact events from mouse and keyboard do not contain any data they just inform you that something happened
you have to actually query the device for the data yourself
fun fact: windows can work with 14 keyboards plugged in at the same time
sounds like absolute pain if you ask me
didn't ask
fun fact the devices can only send 1 byte across the IO ports
shhh, your Indian tech tips aren't useful here 
p a i n
though you can up that to 2 bytes per transfer
so if you want to get the data from the mouse you have to query it 3/4 times
because i am cursed
should i change it again?
first packet contains the buttons pressed, second the X axis, third the Y axis
but a keyboard has only ~104 keys which can fit in 1 byte
holy shit lmao
the keyboard is the easiest to operate because the characters fit in a single byte
what the fuck does scroll lock even do
oh and dont even get me started on how the mouse lets you know if the axis is negative or not
thats using the P2 port right?
lmao
Windows idling CPU usage, 50%, because of sending 1000 requests/ms to the mouse
well it might be less intense if you're using the usb interface
hello are you alive
yes i am
ok ty
the io ports take about 10-15ns processing time each to send or receive data
actually more than that
i forgot the amount
How can you fuck yourself with such a pain of OS development?
sounds faster than an ipc port via unix domain socket
its the funnest thing i've done in my life
yeah well
you're even more crazy than Tim
the data busses are connected to the cpu
How can I set this as a thumbnail instead of an image?
you have to give it a try
by setting it as thumbnail of the embed?!
its so fun
Indeed.
its hard and makes you want to kill yourself half the time but its great
you don't need the part after | in the title
If I will ever find a few seconds I can offer I will will not, no, never, nope, nada, nyet
I configured that on my update.
Although, I am unsure how I can set the image as the thumbnail of the embed.
one of the reasons its hard is because of the predecessors
<meta property="og:image" content="https://www.hamoodihajjiri.com/assets/images/hamoodihajjiri.png" />
<meta name="twitter:image" content="https://www.hamoodihajjiri.com/assets/images/hamoodihajjiri.png" />
they made shitty design choices and now they have to stay because of backwards compatibility
Honestly if you write "created my own OS" on your resume most interviewers would assume you just followed some tutorial
and because of hardware limitations at the time
back when you could only address up to 64kb of memory
Looks like there's no meta tag for thumbnails
Oh, how was this done?
i only really got a head start with a skeleton thats as basic as "hello world"
Just look at the source code of the website lmao
I did.
and got some help from existing resources
Set the height and width to 64 maybe
<meta property="og:image:width" content="64">
<meta property="og:image:height" content="64">
I tried that, didn't work. :/
writing my own string implementation and dynamic arrays was very fun
and maps
It made the image, of the embed, the size of 64.
oh he was faster already
hmm idk what else would make it like that
Make the size of the image itself 256 x 256
Oh... well embedThumbnail-2nTasl it actuall is
only other thing I could think of
this is probably it
Worth a try, let me see.
i figures out moment-timezone packed file uses base60 with a few extras for fractions lol
؟؟
data["user"] ?
But I see changing the meta tags on your website will not take in place immediately
The data (and meta tags) are cached by Discord it seems
You can force Discord to update the cached meta tags by changing the query arguments in your URL
Just add a random query string
https://your.domain/?speedIsCrazy
Sped
io.to(players.find(({ id }) => id === currentPlayer)).timeout(10000).emit("playerTurn", ({ card, action }) => {
if (!card || !["deal", "draw"].includes(action) || (action === "deal" && players.find(({ id }) => id === currentPlayer).cards.includes(card)) || (/* card.type !== "wild" && */ card.type !== currentCard.type && card.color !== currentCard.color)) return;
SERVER-SIDE VERIFICATION AT 3 AM (GONE WRONG)
feels aimed
and they told you to STOP it now?
what
you talk to Paul Allen or whoever the guy was that did the heavy lifting for windows
Nobody wants competitors... 

true but think of it as you helping a poor turkish boy get his bot to run after an invalid token error
you dont give a shit about competition
yee true
gib token C:
keep watching this channel if somebody wants to copy my bot and my 900gb database to sabotage him
there are also huge gaps in resources (especially the difficult parts_ so i do end up needing to ask others for some advice
You know looking at your OS I wouldn’t be impressed but I’ve seen what it takes to make something even remotely close to that and I applaud you
Much more difficult than it looks
graphics cards are very annoying to work with because 90% of the features are not standardised
and manufacturers refuse to release documentation
they just write drivers for windows and let others reverse engineer it
I wish you a lot of patience then
Who needs docs when you can spend 12 hours a day fucking around with graphics cards and drivers to make barely any progress!
Way better than docs

if i want to get hardware acceleration working i'd need to spend a lot of time porting open source drivers which is just not practical
At least more challenging
it is very tricky
especially since you need to write dangerous code all the time
and when you make a mistake in that dangerous code it might take hours or days to debug
i was once stuck on an issue for an entire month
because i fucked up some of the assembly code for cpu tasking
Saw that one guy who built his own OS to run Tetris and one simple mistyping fucked over his entire OS later on in the project and he had to spend like 3 days debugging through assembly that’s difficult to read
Especially difficult considering it requires a considerable amount of knowledge about how to natively interface with hardware
Lots of tiny details that can mess everything up
does anyone has some cool ideas for commands?
But keep the image width/height at 64 x 64
Also try to remove the type and what I mentioned above to get rid of Discord's cache
Remove the type, change the meta tag order, ... idk
you can set thumbnail
Not that it would make sense but try it
2 secs i'll get the tag
I remove the og:type and the og:image:width and height?
<link rel="shortcut icon" type="image/jpg" href="https://www.hamoodihajjiri.com/assets/images/hamoodihajjiri_256.png" /> try this
its what i use for https://communism.pro
just the type
That overwrites your site favicon, bad idea tho
(if he has set one)
True
What was the link you sent, FaKe?
Also accurate favicons come with a manifest and more tags supporting each client
the f.ck discord's cache link?
What did you write after /.
The image you put isn't actually 256x256, it's
lol
OH..
Let me try that.
Same thing. :/
You removed the image width and height but not the type wtf
HOLY, THERE'S ANOTHER ONE.
Wait, I updated at some part and forgot the other.
Yup, refreshed, same thing.
very weird
I can view the source code myself opening your site
My bad, although, how do you want me to organise it.
Change the order as I suggested (now a 4th time)
Also try a different image meanwhile
Also you have the og:image tag twice
hmm idk... try a completelly different image and REMOVE the comments
Now the image is bigger againb
my gosh... try to use my image
https://i.imgur.com/Yb6zDwN.png
at least it has an accurate aspect ratio
LMAO, it yet didn't work. 😂
pov you see the words "network error" when downloading a 2gb file
Again.
Try that with no other og meta tags in exactly this order
<meta property="og:image:width" content="64">
<meta property="og:image:height" content="64">
<meta property="og:image" content="https://i.imgur.com/...png">
<meta property="og:description" content="Hey there, I'm Mohammad Hajjiri. I'm a Software Developer & a Content Creator.">
<meta property="og:url" content="https://www...com/">
<meta property="og:title" content="HamoodiHajjiri">
Didn't work.
figured out the stupid ass moment-timezone format
Well idk then...
That shouldn't be there, too
<link rel="shortcut icon" type="image/jpg" href="https://i.imgur.com/Yb6zDwN.png" />
If you haven't set a favicon, then remove it, also the image type obviously isn't jpg
Until they decide to change it 
ty
❤️

I'm shocked
instanceof is the fastest out of these 3 for checking if a object is a specific class
@boreal iron now here's where I'm stuck
L = 7
everything I tried didn't result in 7
ik the inverse of g ^ l is
or at least I think it is
oh wait
that's probably wrong
yeah, should've used log there
mb
When/Where should i do the global slash commands deployment? Once In my shardingmanager or again in every shard?
I'm trying to set the permissions of a channel, but for some reason the role "Ranked Player" can still see it.
newState.guild.channels.create(newState.member.id, {
type: "GUILD_VOICE",
permissionOverwrites: [
{
id: newState.guild.roles.everyone,
deny: ["VIEW_CHANNEL", "CONNECT", "SPEAK"], //Deny permissions
},
{
id: "877244655866093638",
deny: ["VIEW_CHANNEL", "CONNECT", "SPEAK"],
},
],
}).then((channel) => {
channel.setParent("877034374720274454");
newState.setChannel(channel.id);
});
let channelThing = newState.guild.channels.cache.find(name => name.name === memberID);
if (channelThing) {
channelThing.permissionOverwrites.set([
{
id: newState.channel.guild.roles.everyone,
deny: ["VIEW_CHANNEL", "CONNECT", "SPEAK"],
},
{
id: "877244655866093638",
deny: ["VIEW_CHANNEL", "CONNECT", "SPEAK"],
},
]);
}
The name of the channel is the user's ID, and creating the channel is no problem. However, the permissions are automatically set to the category which is confusing.
A Registration is a **one time process **
It would make sense then to use the patch method and associated resource instead of deleting and registering it again
But even if you can, yes it’s not really the recommended scenario
yay it worked

i have no idea what im looking at
20 + 2 means you’re adding 2 to 20, Tim
You can try it yourself…
Raise 3 fingers, then raise (add) one more and you magically got 4

Just ask, we’re here to help you, Sir
i see a number that became a trampoline that became two trampolines on top of a log that became a pool with a boat propelled by a log with a trampoline on top
lmfao
turns out I cant use log(l * 2) cuz l is undefined on the inverting part
welp, I'll find something better to use
If it somehow helps, log(l * 2) is the same as log(l) + log(2)
Perhaps it helps to separate the two
All my homies love Markdown
i found this guy on an osdev forum and he is obsessed with USBs
he is trying to convince me to write a USB driver
They've been pulling a Scheme

does anyone know a good react package that is compatible with nextjs that does this? https://img.censor.bot/131VoPuK.gif
i found react-animated-numbers but it doesnt work with nextjs seemingly because it only works when directly rendered on browser, and i get a self is not defined error
also the package just breaks half the time https://img.censor.bot/eV5ethbg.gif
I think you're supposed to use this, not that
https://www.npmjs.com/package/react-animated-number
Hi I'm just doing
channel.members.each(member => usernameList.push(member.nickname))
//after some code...
member.setNickname(`[${count}] ✋ ${username}`)
//count is the number of "✋" counted
//username is the nickname of a user or his username if he's got no nickname
on a command
But it seems to work "a step back"
For example i have two users on voice channel.
When the 1st uses this command (assuming they have no nicknames) the output would be
[ null, null ]
But if I execute this command again the out will be
[ null, '[0] ✋ >///<' ]
Can someone tell me some possible clues of why is this happening?
I am having problems for channel override permissions cause I think there is an issue with my checking of channel permission overrides. javascript const overridepermissions = new Permissions(message.guild.me.permissionsIn(message.channel)); if (overridepermissions.has(Permissions.FLAGS.VIEW_CHANNEL) == false || overridepermissions.has(Permissions.FLAGS.READ_MESSAGE_HISTORY) == false || overridepermissions.has(Permissions.FLAGS.SEND_MESSAGES) == false && !message.member.guild.me.hasPermission("ADMINISTRATOR")) return;
And what's the problem?
Error for missing permissions.
I also already have a permissions check for actual roles. if (!message.member.guild.me.hasPermission('SEND_MESSAGES') || !message.member.guild.me.hasPermission("VIEW_CHANNEL") || !message.member.guild.me.hasPermission("READ_MESSAGE_HISTORY") && !message.member.guild.me.hasPermission("ADMINISTRATOR")) return;.
What exactly are you trying to do there? The way you're phrasing it doesn't really make sense, are you trying to set the nicknames of all the members in the voice channel? Or what?
But I don't think the roles permission check is the problem cause when I attempt on a channel with no overrides, but does not have then needed role permissions it does not give an error and is successfully returned.
I'm trying to create a "raise hand" command where the person raising hand would be given a next number in their nickname couting from 1
And for that I'm trying to parse everyone who has rasied their hand by couting number of emojis
You’re pushing each member nickname to your array, even if the member hasn’t a nickname, means you’re pushing null to it
Or undefined
Whatever djs spits out
Yeah but it's dealt with
It dosen't give the "live" values for the nicknames
Just the previous ones used
this doesnt have the animation im looking for
it just changes the number
Also we don’t see if your member actually is a guild member and how the var username being defined
If they are in a voice channel, than they are guild members right
I'm refering to this
https://discord.js.org/#/docs/main/stable/class/VoiceChannel?scrollTo=members
Do you have the GUILD_VOICE_STATES intent enabled (1 << 7)
Ah ok wasn’t aware the member obj is available when joining a voice channel
Yes i have
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES],
allowedMentions: { parse: [`users`], repliedUser: true }
});
I mean the output does change the second time since you don’t push/edit your array
But that small snipped doesn’t show what’s actually going on
Just show more associated code
I mean we can just see the array you’re pushing nicknames to which is different the second time as the members nickname has changed (after changing it lol)
Here's like the full code
https://sourceb.in/xQ7YKhH7jZ
Is this what you're looking for?
https://www.npmjs.com/package/react-number-ticker
There's also this if that doesn't work
https://www.npmjs.com/package/react-flip-ticker
requires react 16
doesnt work

Just a few notes
channel.id.toString() isn’t needed as the ID is a already a string
Pushing the member nickname to your usernameList is okay
Turning the array into a string after is absolutely nonsense
(remove that line)
Instead of doing a regex search for emojis use array.filter() - also I have no clue if regex would even support that chars
let count = usernameList.filter((name) => name.includes("👍")).length;
That’s the most important things
Will continue later…
doesnt work
have u tried making it work
Regex does support all unicode chars
You just need to pass unicode instead of a character
Like [\u0000-\uffff] will match all chars from 0000 to ffff
Yee but not like so
That's a valid unicode
Editor shows as an emoji, but that's just a fancified unicode
Depending on your ide, u can switch between fancy and raw character
For intellij it's alt + enter
Idk how sourcebin does that’s why I was wondering if that even works
But yeah it might just show the unicode as actual emoji
Who knows…
Anyways what I wrote is better anyways than using regex
Tiranosauregex
Who knows how sourcebin handles it and what’s the guys raw code, could be shown as emoji and didn’t replace the escape char, idk, nobody knows
Thanks for such an insight 
Didn't thought of array filter so I just tried to hack that converting to string an then using includes (yeah, I knew that was bad and still used it)
It was working fine with an emoji btw, just channel.members.each is working in a weird way, idk if that can be influenced by the other pieces of code but I'd take a guess that that's not the case
I spelled defer wrong ._.
Could anyone help. Each time my bot gets reviewed it gets these discord.js errors like. Bad gateway on requesthandler
Nobody can help you with that Information alone, provide code related to ur problem or the actual full error
Or both
That is everyting. Its an error of discord.js
Ok then sorry I can't help you
we will never know
Answer is DLC-Content
output: { detections: [ [Object] ], nsfw_score: 0.7178798913955688 }
how to get the detections
and show them
output.nsfw_score
output.detections[x], x - index
if (guild.members.cache.find(user => user == user.discordId)) {
console.log("The user is in the server!");
this is not working for some reason even when the user is in the server
user = MemberObject
user.discordId => Doesn't exist, it's user.id
you're comparing a member object to undefined, that would never return true
it's discordId
since it's a webapp
and yes it's defined
i've logged it
so what should i do
I don't know what you're trying to do in the first place
check if a user is in a certain server
user.discordId is the id you're searching for?
yes
user.id === user.discordId
or you can just
Why is it attached to the user?? That makes no sense
You're doing something wrong
ofc i am doing something wrong
don't you need p flag for unicode
Hello! I'd like to ask how I can publish a bot's slash commands globally and not to a server. I have it as this..
bot.on("ready", () => bot.guilds.cache.get("737011108954505267").commands.set(commandsArray.flat()));
Thanks!
how can i bypass this?
if (!somehow.owner.of.bot && !interaction.member.permissions.has(cmd.userPermissions || []))
I can't leave my file. Hosting ssh on terminal for mac using vim. None of the key-binds that I search up work.
kids, this is why you don't use vim
vouch
But seriously I do need help 
Pfff… cool kids are using nano
Uncaught TypeError: $(...).submit(...).then is not a function
Using ajax to submit the form without refresh 
<script>
function genURL() {
$('#generateURL').submit(function(event) {
event.preventDefault();
var form = $(this);
console.log(form.serialize());
$.ajax({
type: form.attr('method'),
url: form.attr('action'),
data: form.serialize()
});
}).then(res => {
console.log("Request complete! response:", res);
document.getElementById("urlID").value = `${res}`;
//document.getElementById("urlID").href = `${res}`;
});
}
</script>``` The code
is #generateURL a <form> element?
does the <form> already exist when the page is loaded?
Yep
or is <form> created with js?
its already there
try logging $('#generateURL') in dev tools
ok
and $('#generateURL').submit shows a function?
👀
then something is making it not be found at page load
the form ID is unique right?
there is no other form with the same id
Yep its unique
try logging eveything inside the script block
from $ to $('#generateURL').submit
to see what it logs at runtime
The script is probably executed before the dom is loaded
dom means house in polish
in almost every other slavic language as well
Yee while your site elements are the house and the drunk guy nobody invited is JavaScript
lol
and yeah i need to write a usb driver in order to get mice to work on real hardware
i barely know anything about usb
i only know there are different protocols and different speeds
and different types of data transfer
my first goal is to even be able to detect that the device is connected
I would say poor Speedy but no, you choosed this way, Sir!
i wrote a long thing
get ready
I am thinking about the best way to store elo scores for players and teams. I want to be able to place players into teams based on their individual elo score, but also store an elo rating for the team. This is my current idea.
Ever player and team has a default elo rating of 1200. The first 2v2 match is recorded between winner1, winner2 and loser1, loser2.
2v2s rating for team (winner1, winner2) 1200 -> 1210
2v2s rating for team (loser1, loser2) 1200 -> 1190
2s rating for team (winner1, winner2) 1200 -> 1210
2s rating for team (loser1, loser2) 1200 -> 1190
2s rating for player winner1 1200 -> 1210
2s rating for player winner2 1200 -> 1210
2s rating for player loser1 1200 -> 1190
2s rating for player loser2 1200 -> 1190
The second match is a 2v2v2 match.
2v2v2s rating for team (winner1, winner2) 1200 -> 1210
2v2v2s rating for team (second1, second2) 1200 -> 1200
2v2v2s rating for team (loser1, loser2) 1200 -> 1190
2s rating for team (winner1, winner2) 1210 -> 1219
2s rating for team (second1, second2) 1200 -> 1200
2s rating for team (loser1, loser2) 1190 -> 1181
2s rating for player winner1 1210 -> 1219
2s rating for player winner2 1210 -> 1219
2s rating for player second1 1200 -> 1200
2s rating for player second2 1200 -> 1200
2s rating for player loser1 1190 -> 1181
2s rating for player loser2 1190 -> 1181
I’m gonna need some caffeine before I even try to think about this
Too bad there’s no coffee at school :C
imagine being at school in the evening
It’s 2pm for me 
you are fake news
Ok Mr Trump
little rocket man
