#development

1 messages · Page 1959 of 1

boreal iron
#

Except images

#

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

spark flint
#

alrighty

#

ty

boreal iron
#

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

split hazel
neat ingot
#

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?

craggy pine
#

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

neat ingot
craggy pine
#
menuOptions[
  {
    value: someValue,
    description: someDescription,
    label: someLable
  }
]
#

but multiple items

boreal iron
craggy pine
muted patrol
#

Hi

boreal iron
harsh tusk
#

were can i learn on how to start coding with discord.js

neat ingot
#

@harsh tusk

craggy pine
boreal iron
#

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

craggy pine
#

ye I gotchu now. Appreciate the info

neat ingot
#

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) ?

craggy pine
#

Well

boreal iron
craggy pine
#

I did, but it complains trust.

neat ingot
#

you can only have i thinks 24/25 items. it would complain if you have more.

craggy pine
#

Something Something != string error something something

#

but can confirm, they are indeed strings

neat ingot
#

show your error? 🙂

craggy pine
#

shrug sure

#

give me a minute to replicate it

neat ingot
#

no worries 🙂

craggy pine
#

but I will likely just do what Fake suggest

neat ingot
#

fair enough 🙂

craggy pine
#

There ya go

neat ingot
#

might wanna post the entire error message lol

craggy pine
#
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> 
neat ingot
#

are you sure the label your passing is actually a string?

#

you said they are before

craggy pine
#

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

neat ingot
#

submenus?! 😛

craggy pine
#

Hmm. Yeah I was thinking about that actually. Do something like First option = next page type thing

boreal iron
#

Did you solve your issue?
I lost the context

craggy pine
#

Yeah I did actually 😄

earnest phoenix
#

Can a Interaction (button) be used in DM's?

boreal iron
#

Yes interactions can be used anywhere

winter pasture
#

Yeah

boreal iron
#

Except guild commands of course freerealestate

earnest phoenix
#

So if its in dms, can I just use interaction.reply?

winter pasture
#

You wrote all that faster than me writing one word

earnest phoenix
#

Y'all got me 8463_blobdead

boreal iron
boreal iron
earnest phoenix
#

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 🤣

boreal iron
#

Also no member property but an user property is still present

boreal iron
earnest phoenix
earnest phoenix
boreal iron
earnest phoenix
#

ah yeah

boreal iron
#

Deferring in DMs is also present

#

If you can’t respond to the interaction within 3s you need to defer it

earnest phoenix
#

cough cough better go do that

boreal iron
#

I mean just responding with a channel message instead of a webhook will most likely cause an interaction error anyways

#

iirc

earnest phoenix
#

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)```?
sudden geyser
#

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

boreal iron
#

What’s the actual goal?

earnest phoenix
#

It adds a role to the user.

#

It's like a verification

#

User clicks

#

I alr got all that down

boreal iron
#

You may wanna check if the fetched user actually is a member of the guild

earnest phoenix
#

Just need it to add a role in a specific guild

boreal iron
#

Always check things, if he leaves or gets kicked or if the guild is unavailable you will get an error

earnest phoenix
#

How do I fetch that tho?

#

didn't I do that here: let muser = mguild.members.fetch(m.author.id)

boreal iron
#

Yes but await it in the first place, then check if muser exists before going on

earnest phoenix
#

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')```
boreal iron
#

let user = await fetch(…)

earnest phoenix
#

hmmmmm

#

ohhh

#

hahaha

#

makes sense

boreal iron
#

What am I supposed to answer here? freerealestate

#

Yes the error is correct

earnest phoenix
#

mhm it is indeed.

boreal iron
#

Promises need to be awaited (in a async function)

earnest phoenix
#

thanks mr. error lol

#

Ahhhh

boreal iron
#

Huh wut, where, when, why?

#

I mean you can also work with a then() clause if you prefer that style

celest thorn
#

help me create bot game pls

boreal iron
#

You have to ask a question in order to receive an answer

dry imp
#

trueeeee

wheat mesa
boreal iron
#

Shhh don’t publish my evil plan

earnest phoenix
umbral skiff
#

Hi! Is there any command exist to vote for a server with Top.gg bot?

rose warren
#

Yeah it's about 25h a week on top of my job and running 2 companies dog_Joy But I definitely enjoy dev discussions and I'll be trying to take time to hang out more here again dog_Happy

rose warren
delicate shore
#

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
bronze socket
#

What's wrong here?

civic scroll
#

since you are using CommonJS as import syntax (require)

civic scroll
#

djs v13 no longer supports direct embed send via just passing it into the function

bronze socket
civic scroll
#

like

#
<object>.send({
    message: <MessageObject>,
    embeds: [...],
    // ...
});
bronze socket
#

okay ty

delicate shore
#

thnx

earnest phoenix
#

why the fuck does my bot shows 0 guilds even though if it is in 3-4 servers?

slender wagon
#
const client = new Client({
   intents: [
      Intents.FLAGS.GUILDS,
      Intents.NON_PRIVILEGED,
      "GUILD_MEMBERS",
   ]
});

it no worki
'BITFIELD_INVALID'

pale vessel
#

Intents.FLAGS?

earnest phoenix
#
    public async registerCommands(){
        this._client.guilds.cache.forEach((guild) => {
            console.log(guild.id);
        });
    }
#

My code if anyone wants to help 😭

slender wagon
pale vessel
#

nope NON_PRIVILEGED isn't part of that

slender wagon
#

oh thanks

pale vessel
#

ayo what am I supposed to help with 😭

earnest phoenix
#

my bot shows 0 guilds

#

whereas i have it in 3 servers

pale vessel
#

make sure that's ran after the ready event

earnest phoenix
#

oh

#

thanks!

#

that worked!

slender wagon
#
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

pale vessel
eternal osprey
#

2022-01-13T09:21:55.122828+00:00 how do i convert this to a valid datetime to calculate with

cinder patio
#

if yes new Date("2022-01-13T09:21:55.122828+00:00");

eternal osprey
#

py

modest maple
#

datetime.fromstrtime(str, pattern) if i remember

delicate shore
#

Guys I need help

eternal osprey
modest maple
#

strtime definitely is a thing

#

i just cant remember what order the parameters go in

delicate shore
#

Any idea how to add a Delet ebutton

#

delete button*

boreal iron
#

As nobody else is online…
@rose warren Why does this bot above have permissions to write in here?

boreal iron
delicate shore
#

thnx

worthy meteor
#

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 topggWink

spark flint
#

@harsh nova -needdev

gilded plankBOT
#

@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.

worthy meteor
#

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.

split hazel
#

who is this btec giveaway bot

boreal iron
spark flint
rose warren
boreal iron
#

👍

quartz kindle
#

they roled it without the proper barrel

spark flint
#

smh

boreal iron
#

Go on Tim, do some progress, we're waiting!

quartz kindle
boreal iron
#

smh

#

API release 2022 2052

quartz kindle
#

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

boreal iron
#

What do you understand as "geocoding solution"? Geolocation detection?

quartz kindle
#

name -> coordinates

boreal iron
#

Ah alright

quartz kindle
#

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

boreal iron
#

I somehow guess you have to rely on third parties for that amount of data and options users can provide

quartz kindle
#

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

wicked pivot
quartz kindle
#

the only way to obtain proper stack traces of async functions is to await all promises

boreal iron
pulsar bone
#
icon= str(message.guild.icon_url)
GA_msg.set_thumbnail(icon)

error = set_thumbnail() takes 1 positional argument but 2 were given

quartz kindle
#

because you have to await the parent function anyway

spark flint
boreal iron
#

my gosh you posted that less than 1 minute ago

#

patience...

quartz kindle
#

show full error

pulsar bone
split hazel
#

it was going so well until you posted that screenshot

boreal iron
earnest phoenix
spark flint
#
  1. replit
pulsar bone
#

what

spark flint
#
  1. screenshot the pc, not a picture on a pohne
#

phone

pulsar bone
spark flint
#

hardly

pulsar bone
quartz kindle
#

we need the full error

pulsar bone
#
    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)
quartz kindle
#

the error

#

not the code

#

copy and paste it from the console

pulsar bone
#
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
boreal iron
#

File "main.py", line 118, in on_message

quartz kindle
#

does str() somehow return two things? idk how py works

boreal iron
#

line 118

quartz kindle
#

anyway according to the dpy docs, it should be like this:

pulsar bone
quartz kindle
#

set_thumbnail(url=message.guild.icon_url)

boreal iron
#

Do you create and send another embed in the event?

woeful monolith
boreal iron
#

py syntax eww

#

Hey @quartz kindle you got any idea why Discord is trolling me?

quartz kindle
#

no idea

boreal iron
#

DiscordAPIError: Missing Permissions

#

ffs

#

IT'S NOT MISSING ANY PERMISSION FUCKING DISCORD

quartz kindle
#

give it server ownership

#

:^)

boreal iron
pulsar bone
boreal iron
#

That must be some sort of advanced trolling

wheat mesa
#

Admin perms mmLol

boreal iron
wheat mesa
#

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)

boreal iron
#

Let's see if that helps

#

W H Y

#

DiscordAPIError: Missing Permissions

wheat mesa
#

Time to go to last resort

#

Transfer ownership 😈

boreal iron
earnest phoenix
#

my god that dude is so powerful, he comments his code

wheat mesa
#

This is a stupid question for you fake but are you 10000% sure you’re changing your nick in the right server

quartz kindle
#

and that there are no higher roles overriding the perms

wheat mesa
#

^^

boreal iron
#

interaction.guild.me.setNickname(...)

#

I'm sure, yes

#

Who knows who me is... probably a traitor

quartz kindle
#

its mee6

lyric mountain
wheat mesa
#

Some social trickery that results in some mild confusion

split hazel
#

mee6 just trolled you

boreal iron
#

Ok so... I'm sure it's not a traitor

#

Member and guild ID is correct

wheat mesa
#

This is some tomfoolery I’ve never seen before

earnest phoenix
#

skill issue

split hazel
#

double check your permissions and try again

woeful monolith
earnest phoenix
boreal iron
woeful monolith
#

It should work on lower roles.

split hazel
#

is the target member an owner or the role is above the bot

boreal iron
boreal iron
#

interaction.guild.me is the guild member object of the bot itself my gosh

split hazel
#

no?

boreal iron
#

nyeo?

split hazel
#

you lost control

#

you're doing something wrong

#

goodbye

boreal iron
#

ktxbbhagd

#

or something like that

earnest phoenix
boreal iron
#

lemme try to update the packages

#

Go minimod somewhere else, Indian man

#

pepowot 🔫

earnest phoenix
#

go use default emojis somewhere else

quartz kindle
#

helikopter helikopter

earnest phoenix
#

paracofer paracofer

boreal iron
lyric mountain
#

🗿

earnest phoenix
#

imagine paying to use wifi

wheat mesa
#

Fake just use Java instead 😉

earnest phoenix
wheat mesa
#

Java is the closest thing I can get to C# while I’m at school

boreal iron
#

Yes Discord is trolling me

#

idk how permissions can get fucked up

earnest phoenix
#

waffle sucks

boreal iron
#

kicking, clearing permissions and reinviting seems to fix

woeful monolith
boreal iron
#

Not that I already tried this process 3 times

quartz kindle
#

lmao

#

LOL

#

that was a first (fake girl offering dm nudes ad)

earnest phoenix
woeful monolith
# boreal iron

But here your code is missing user. Sorry I am just beginner in Python and don't know anything about JS. 😆

boreal iron
#

Sorry I am just beginner

We noticed. freerealestate

cinder patio
#

Just don't say anything then man

boreal iron
#

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

quartz kindle
#

blame dicksword

earnest phoenix
boreal iron
#

the empire strikes back

woeful monolith
sharp saddle
#

how to add 2 buttons in a component?

Question tags: discord.js, js, plshelpme

split hazel
#

kthxbye

quartz kindle
boreal iron
boreal iron
#

...reply({ embeds: [embed1, embed2, embedBanana], components: [component1, component2, componentApple] })

boreal iron
#

What a stressful channel today...

earnest phoenix
boreal iron
#

no

quartz kindle
#

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

boreal iron
#

what the fuck

slender thistle
#

Holy shit

earnest phoenix
#

unfortunately i fixed my own issue so can't post proper question here

boreal iron
#

kthxbye

quartz kindle
#

working with timezones is so damn lackluster, there is not a single library out there that actually queries the raw tzdata files properly

woeful pike
#

this seems like some format specific to moment isn't it?

quartz kindle
earnest phoenix
quartz kindle
woeful pike
#

sounds like a big pain, good luck

earnest phoenix
woeful pike
#

ty

cinder patio
#

why do you need all that data anyways

quartz kindle
#

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

earnest phoenix
quartz kindle
#

moment-timezone is like the only project out there that actually keeps their own updated tzdata files

earnest phoenix
#

why do you need to update timezones

quartz kindle
#

because i need up-to-date timezone info

earnest phoenix
#

how is time outdated

quartz kindle
#

outdated timezones = random country decides to remove or change the dates of their daylight savings start/end times

cinder patio
#

daylight savings

quartz kindle
#

boom, "what time is it in x place at x date" is now incorect

earnest phoenix
boreal iron
#

Our Indian tech scammer knows what I'm talking about

quartz kindle
#

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

boreal iron
#

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?

earnest phoenix
boreal iron
#

I never received a fucking penny yet

quartz kindle
#

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

boreal iron
earnest phoenix
quartz kindle
boreal iron
#

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.

earnest phoenix
#

question: how do i generate a pseudo-random string of a certain length

#

uuid is too long

quartz kindle
#

i cannot do it via IP because its not always for their own location

boreal iron
#

random != random
PHP has a crypto-save function to generate random bytes, I doubt JS has one

quartz kindle
#

you can look up stuff for other places and other people

cinder patio
#

Node.js has randomBytes

#

crypto module

boreal iron
quartz kindle
#

require("crypto").randomBytes(how many bytes do you want here).toString()

boreal iron
#

nodejs but JS doesn't a native one, does it?

quartz kindle
#

and open it to public usage

pale vessel
boreal iron
quartz kindle
#

js has webcrypto, but idk if webcrypto has randomBytes

boreal iron
#

Oh it's about a bot...

quartz kindle
boreal iron
#

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?

quartz kindle
boreal iron
#

Yeah like mine

quartz kindle
#

hence why geocoding

boreal iron
#

Well I now know why autocomplete is a useful feature for u

quartz kindle
#

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

boreal iron
#

Ah I see

quartz kindle
#

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

lyric mountain
#

so, a lil math question (L = 22):

quartz kindle
#

i dont speak math

lyric mountain
#

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

boreal iron
quartz kindle
#

i dont need geoip

#

i dont use ip addresses

wheat mesa
boreal iron
#

I know but it also includes the data you need

quartz kindle
#

like google maps api

#

mapbox

quartz kindle
#

but if my api starts getting used a lot, i will have to start paying for them

#

and they are expensive af

wheat mesa
#

log base n of x = y is the same thing as saying n^y = x

boreal iron
quartz kindle
#

geocoding is super expensive financially wise

#

with mapbox for example

#

100k monthly requests = free

#

200k monthly requests = 80 dollars a month

boreal iron
#

uh

#

You might wanna cache the data for a specific amount of time, maybe to try stay in the limit as long as possible

quartz kindle
#

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"

boreal iron
#

hmm good point

winter pasture
quartz kindle
#

are you using mapbox as well?

winter pasture
#

Google maps api

quartz kindle
#

ah

#

google maps api is even worse

winter pasture
#

Geocode*

boreal iron
#

Somebody entering lon could receive the choice london uk

#

you know

cinder patio
#

If you only care about countries catching is appropriate

boreal iron
#

Not perfect tho but still more effient than calling an API request for every single input

quartz kindle
#

i guess, but the raw api will not have autocomplete, i dont want people doing multiple requests for no reason

boreal iron
#

TIM STUPID

#

LOCALLY CACHED or as DB with your bot, not the API

quartz kindle
# winter pasture Geocode*

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

earnest phoenix
#

can a js function use variables before they're actually declared

cinder patio
#

no

earnest phoenix
#

im not running the function before declaring

quartz kindle
#

if you use var, you can use the variable before its declared, its value will be undefined tho

cinder patio
#

still no

quartz kindle
#

const and let no, they need to be declared beforehand

cinder patio
#

you'll get an error even before your code runs AFAIK

earnest phoenix
#
function spaghetti() {
  bruh();
}

function jajaja() {
  const bruh = () => console.log("bruh");
  spaghetti();
}
boreal iron
#

@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.

cinder patio
#

the variables need to be defined at least in the same scope as the function

#

or outer scopes ofc

earnest phoenix
#

the variables wouldn't even be available right

cinder patio
#

no

earnest phoenix
#

ok

cinder patio
#

why would you ever even consider this as an option

#

just pass it as a parameter

earnest phoenix
cinder patio
#

that would be code-breaking scope pollution

earnest phoenix
#
gameLoop({ io, players });
cinder patio
#

you could define the function in the same scope the variables are defined in

quartz kindle
#

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

earnest phoenix
#

tim profiting from code copied from this channel

boreal iron
#

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

earnest phoenix
#

why is time so complicated

quartz kindle
#

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

boreal iron
#

why the fuck did I write all the shit then

quartz kindle
#

because its fun to think about and talk about

#

:^)

boreal iron
#

yeah it actually is, but now I need to charge money from you, copying my idea

quartz kindle
#

hey i implemented that idea before you came up with it, so i have to charge you for copyright infringment

boreal iron
#

lmao

quartz kindle
#

and stealing company secrets

boreal iron
#

damn capitalist

round cove
#

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

quartz kindle
#

i'll have you know that my business is worth a whole 10 dollars

long herald
#

Guys

round cove
quartz kindle
#

and im ranked 873658736487 in forbes

earnest phoenix
long herald
#

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="") 
split hazel
boreal iron
long herald
#

data["user"] ?

earnest phoenix
quartz kindle
long herald
boreal iron
quartz kindle
#

v0.0.0.0.0.0.1

boreal iron
#

:P

split hazel
#

it all falls into place with my process event dispatching

earnest phoenix
#

SlowOS

split hazel
#

its actually quite fast with my optimisations

#

the mouse is just jerky and needs some offsetting

#

and smoothening

earnest phoenix
#

its an OS that just runs an art program ofc it will be fast

split hazel
#

a lot is happening behind the scenes

#

but in essence yes

earnest phoenix
#

in my eyes, low level programmers are the real "linux hackers"

split hazel
#

sooner or later i'll be contributing to the linux kernel

quartz kindle
#

low level programmers are either gods or robots

#

they are not human

edgy seal
#

Hmm

earnest phoenix
quartz kindle
#

no, im not even close to that

earnest phoenix
earnest phoenix
split hazel
#

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

earnest phoenix
#

playstation os

split hazel
#

yes

quartz kindle
#

polystation

split hazel
#

and i've been warned usb drivers are difficult to write

edgy seal
earnest phoenix
#

prettyspeedy os

boreal iron
split hazel
#

who even uses these anymore

earnest phoenix
split hazel
#

do they run java as well

boreal iron
#

Speedy OS release date: 2076, Windows 199 release happens in the same year

earnest phoenix
#

they run java and that's why they use that

earnest phoenix
split hazel
#

no wonder its clunky

quartz kindle
boreal iron
earnest phoenix
#

tim why does your pfp look cursed

split hazel
#

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

earnest phoenix
boreal iron
#

sounds like absolute pain if you ask me

earnest phoenix
split hazel
#

fun fact the devices can only send 1 byte across the IO ports

boreal iron
split hazel
#

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

quartz kindle
#

should i change it again?

split hazel
#

first packet contains the buttons pressed, second the X axis, third the Y axis

earnest phoenix
#

but a keyboard has only ~104 keys which can fit in 1 byte

split hazel
#

the keyboard is the easiest to operate because the characters fit in a single byte

earnest phoenix
#

what the fuck does scroll lock even do

split hazel
#

oh and dont even get me started on how the mouse lets you know if the axis is negative or not

quartz kindle
#

thats using the P2 port right?

split hazel
#

yes

#

well the IO ports

#

just realised i put my pants on the wrong way round

quartz kindle
#

lmao

boreal iron
split hazel
#

well it might be less intense if you're using the usb interface

earnest phoenix
split hazel
#

the io ports take about 10-15ns processing time each to send or receive data

#

actually more than that

#

i forgot the amount

boreal iron
#

How can you fuck yourself with such a pain of OS development?

quartz kindle
#

sounds faster than an ipc port via unix domain socket

split hazel
#

its the funnest thing i've done in my life

boreal iron
#

you're even more crazy than Tim

split hazel
#

the data busses are connected to the cpu

feral aspen
#

How can I set this as a thumbnail instead of an image?

split hazel
boreal iron
#

by setting it as thumbnail of the embed?!

split hazel
#

its so fun

feral aspen
split hazel
#

its hard and makes you want to kill yourself half the time but its great

earnest phoenix
boreal iron
feral aspen
#

Although, I am unsure how I can set the image as the thumbnail of the embed.

split hazel
#

one of the reasons its hard is because of the predecessors

feral aspen
#
<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" />
split hazel
#

they made shitty design choices and now they have to stay because of backwards compatibility

cinder patio
#

Honestly if you write "created my own OS" on your resume most interviewers would assume you just followed some tutorial

split hazel
#

and because of hardware limitations at the time

#

back when you could only address up to 64kb of memory

boreal iron
feral aspen
split hazel
boreal iron
feral aspen
split hazel
#

and got some help from existing resources

cinder patio
#
<meta property="og:image:width" content="64">
<meta property="og:image:height" content="64">
feral aspen
split hazel
#

writing my own string implementation and dynamic arrays was very fun

boreal iron
split hazel
#

and maps

feral aspen
#

It made the image, of the embed, the size of 64.

boreal iron
#

oh he was faster already

cinder patio
#

hmm idk what else would make it like that

boreal iron
#

It's just not a thumbnail

#

But an inlined image

cinder patio
boreal iron
#

Oh... well embedThumbnail-2nTasl it actuall is

cinder patio
#

only other thing I could think of

cinder patio
feral aspen
#

Worth a try, let me see.

quartz kindle
#

i figures out moment-timezone packed file uses base60 with a few extras for fractions lol

boreal iron
boreal iron
#

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

earnest phoenix
#

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)

split hazel
boreal iron
#

imagine paying for emojis

split hazel
#

yeah

#

by the way i spend my time talking to professional os developers

boreal iron
#

and they told you to STOP it now?

split hazel
#

what

wheat mesa
#

you talk to Paul Allen or whoever the guy was that did the heavy lifting for windows

boreal iron
#

Nobody wants competitors... freerealestate

wheat mesa
split hazel
#

you dont give a shit about competition

boreal iron
#

yee true

wheat mesa
#

gib token C:

boreal iron
#

keep watching this channel if somebody wants to copy my bot and my 900gb database to sabotage him

split hazel
#

there are also huge gaps in resources (especially the difficult parts_ so i do end up needing to ask others for some advice

wheat mesa
#

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

split hazel
#

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

boreal iron
#

I wish you a lot of patience then

wheat mesa
#

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

split hazel
#

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

boreal iron
#

At least more challenging

split hazel
#

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

wheat mesa
#

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

feral aspen
#

What did I do wrong?

cinder patio
#

The image itself

#

not the metadata

#

make the image 256 x 256

boreal iron
#

Nah mine is 512 x 512

celest pine
#

does anyone has some cool ideas for commands?

boreal iron
#

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

feral aspen
#

Oh my god, did I do it wrong?

#

Yup..

boreal iron
#

Remove the type, change the meta tag order, ... idk

spark flint
#

you can set thumbnail

boreal iron
#

Not that it would make sense but try it

spark flint
#

2 secs i'll get the tag

feral aspen
spark flint
#

<link rel="shortcut icon" type="image/jpg" href="https://www.hamoodihajjiri.com/assets/images/hamoodihajjiri_256.png" /> try this

boreal iron
#

(if he has set one)

spark flint
#

True

feral aspen
#

What was the link you sent, FaKe?

boreal iron
#

Also accurate favicons come with a manifest and more tags supporting each client

feral aspen
#

the f.ck discord's cache link?

boreal iron
feral aspen
#

What did you write after /.

boreal iron
#

Just adding any random query string

#

As I mentioned above?!

feral aspen
#

Example, real quick.

#

Yes.

#

Just send me that example you sent.

cinder patio
boreal iron
feral aspen
#

Let me try that.

#

Same thing. :/

boreal iron
#

You removed the image width and height but not the type wtf

feral aspen
#

HOLY, THERE'S ANOTHER ONE.

boreal iron
#

Dude you need to read what I write

feral aspen
#

Wait, I updated at some part and forgot the other.

boreal iron
#

Remove the type, change the meta tag order, ... idk

#

As I showed in my screenshot

feral aspen
#

Yup, refreshed, same thing.

cinder patio
#

very weird

boreal iron
#

alright, change the order then

#

last thing I can think of even if it makes no sense

feral aspen
#

Here's the source, how do you want me to organise it?

boreal iron
#

I can view the source code myself opening your site

feral aspen
#

My bad, although, how do you want me to organise it.

boreal iron
#

Change the order as I suggested (now a 4th time)

#

Also try a different image meanwhile

cinder patio
#

Also you have the og:image tag twice

feral aspen
#

Check it, now.

#

I changed it again.

boreal iron
#

hmm idk... try a completelly different image and REMOVE the comments

cinder patio
#

Now the image is bigger againb

boreal iron
#

my gosh... try to use my image

#

https://i.imgur.com/Yb6zDwN.png

#

at least it has an accurate aspect ratio

feral aspen
#

LMAO, it yet didn't work. 😂

boreal iron
#

wtf

#

og:image:url

#

Remove that

split hazel
#

pov you see the words "network error" when downloading a 2gb file

feral aspen
#

Again.

boreal iron
#

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">
feral aspen
#

Didn't work.

quartz kindle
#

figured out the stupid ass moment-timezone format

boreal iron
#

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

boreal iron
round cove
#

Cringe.

#

@modern sable (scam)

modern sable
#

ty

round cove
#

❤️

split hazel
cinder patio
#

I'm shocked

#

instanceof is the fastest out of these 3 for checking if a object is a specific class

lyric mountain
#

@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

viral spade
#

When/Where should i do the global slash commands deployment? Once In my shardingmanager or again in every shard?

simple stump
#

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.

boreal iron
modest maple
#

Unless you need to update stuff

#

In which case its a one plus process

boreal iron
#

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

lyric mountain
#

yay it worked

boreal iron
quartz kindle
#

i have no idea what im looking at

boreal iron
#

Just ask, we’re here to help you, Sir

quartz kindle
#

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

boreal iron
#

lmfao

lyric mountain
#

turns out I cant use log(l * 2) cuz l is undefined on the inverting part

#

welp, I'll find something better to use

boreal iron
#

m_e_th very complicated

#

Markdown, too lol

wheat mesa
#

If it somehow helps, log(l * 2) is the same as log(l) + log(2)

#

Perhaps it helps to separate the two

sudden geyser
#

All my homies love Markdown

split hazel
#

i found this guy on an osdev forum and he is obsessed with USBs

sudden geyser
#

All my homies love Markdown

#

Wish it was more compatible

split hazel
#

he is trying to convince me to write a USB driver

sudden geyser
#

They've been pulling a Scheme

split hazel
slim heart
#

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

earnest phoenix
paper hound
#

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?

fresh verge
#

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;

paper hound
#

And what's the problem?

fresh verge
spark flint
#

Then you do not have permissions

#

or the bot does not

fresh verge
#

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;.

earnest phoenix
fresh verge
#

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.

paper hound
#

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

boreal iron
#

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

paper hound
#

Yeah but it's dealt with

#

It dosen't give the "live" values for the nicknames

#

Just the previous ones used

slim heart
#

it just changes the number

boreal iron
#

Also we don’t see if your member actually is a guild member and how the var username being defined

paper hound
#

If they are in a voice channel, than they are guild members right

wheat mesa
boreal iron
#

Ah ok wasn’t aware the member obj is available when joining a voice channel

wheat mesa
#

If you don’t have that intent, members won’t be updated

#

(In voice channels)

paper hound
#

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 }
});
boreal iron
#

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)

earnest phoenix
split hazel
#

pov you use react

boreal iron
# paper hound Here's like the full code https://sourceb.in/xQ7YKhH7jZ

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…

wheat mesa
#

have u tried making it work

lyric mountain
#

You just need to pass unicode instead of a character

#

Like [\u0000-\uffff] will match all chars from 0000 to ffff

boreal iron
lyric mountain
#

That's a valid unicode

#

Editor shows as an emoji, but that's just a fancified unicode

boreal iron
#

Oh yeah that might be the case

#

Haven’t thought about that

lyric mountain
#

Depending on your ide, u can switch between fancy and raw character

#

For intellij it's alt + enter

boreal iron
#

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…

lyric mountain
#

Actually...that might not match

#

Due to trailing \

boreal iron
#

Anyways what I wrote is better anyways than using regex

lyric mountain
#

Tiranosauregex

boreal iron
# lyric mountain Due to trailing \

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

paper hound
#

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

earnest phoenix
#

I spelled defer wrong ._.

boreal iron
#

deferReply is a method not a property

#

Aka function

gray bronze
#

Could anyone help. Each time my bot gets reviewed it gets these discord.js errors like. Bad gateway on requesthandler

marble juniper
#

Or both

gray bronze
#

That is everyting. Its an error of discord.js

marble juniper
#

Ok then sorry I can't help you

boreal iron
#

Does that happen when receiving a specific event?

#

Or do the errors appear randomly?

boreal iron
#

we will never know

small tangle
#

Answer is DLC-Content

delicate shore
#
  output: { detections: [ [Object] ], nsfw_score: 0.7178798913955688 }
#

how to get the detections

#

and show them

slender thistle
#

output.nsfw_score
output.detections[x], x - index

delicate shore
#

yeah thanks

#

got it

#

I ran a for loop

slender wagon
#
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

cinder patio
#

user = MemberObject
user.discordId => Doesn't exist, it's user.id

#

you're comparing a member object to undefined, that would never return true

slender wagon
#

since it's a webapp

#

and yes it's defined

#

i've logged it

cinder patio
#

still... comparing an object to a string

#

it'll never return true

slender wagon
#

so what should i do

cinder patio
#

I don't know what you're trying to do in the first place

slender wagon
#

check if a user is in a certain server

cinder patio
#

user.discordId is the id you're searching for?

slender wagon
#

yes

cinder patio
#

or you can just

#

Why is it attached to the user?? That makes no sense

#

You're doing something wrong

slender wagon
#

ofc i am doing something wrong

earnest phoenix
feral aspen
#

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()));
feral aspen
#

Thanks!

lethal trout
#

how can i bypass this?

earnest phoenix
#
if (!somehow.owner.of.bot && !interaction.member.permissions.has(cmd.userPermissions || []))
icy marlin
#

I can't leave my file. Hosting ssh on terminal for mac using vim. None of the key-binds that I search up work.

earnest phoenix
#

kids, this is why you don't use vim

icy marlin
icy marlin
boreal iron
spark flint
#

Uncaught TypeError: $(...).submit(...).then is not a function

#

Using ajax to submit the form without refresh pain

#
    <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
quartz kindle
#

is #generateURL a <form> element?

spark flint
#

its the form id

#

it works with my other site so i'm confused af

quartz kindle
#

does the <form> already exist when the page is loaded?

spark flint
#

Yep

quartz kindle
#

or is <form> created with js?

spark flint
#

its already there

quartz kindle
#

try logging $('#generateURL') in dev tools

spark flint
#

ok

quartz kindle
#

and $('#generateURL').submit shows a function?

bitter adder
#

👀

quartz kindle
#

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

spark flint
#

Yep its unique

quartz kindle
#

try logging eveything inside the script block

#

from $ to $('#generateURL').submit

#

to see what it logs at runtime

boreal iron
#

The script is probably executed before the dom is loaded

split hazel
#

dom means house in polish

quartz kindle
#

in almost every other slavic language as well

boreal iron
#

Yee while your site elements are the house and the drunk guy nobody invited is JavaScript

split hazel
#

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

boreal iron
#

I would say poor Speedy but no, you choosed this way, Sir!

proven lantern
#

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

wheat mesa
#

I’m gonna need some caffeine before I even try to think about this

#

Too bad there’s no coffee at school :C

boreal iron
#

imagine being at school in the evening

wheat mesa
#

It’s 2pm for me mmulu

boreal iron
#

no no... can't be true

#

timezones don't exist

quartz kindle
#

you are fake news

boreal iron
#

Ok Mr Trump

slender thistle
#

You're FIRED!

#

Covfefe

sudden geyser
#

little rocket man

split hazel
#

alright guys hear me out

#

i wanna get into microcontroller development and looking for something not overpriced

#

im looking at the raspberry pi pico which looks good but i know nothing about this kind of crap

#

and 90% accessories are overpriced for it