#development
1 messages ¡ Page 1965 of 1
replaces the escape character
what does an @ string do?
string literals but literally literal
so you can write windows paths like @"C:\Windows\System32\" for example
A lot of languages just have helper methods for formatting strings
which gets rather annoying
surprised java doesn't have built in string interpolation at this point
fr it's annoying having to memorize what formatters do what
and some cases it gets werid using formatters
it really pisses me off that java can't do that but they can add other modern shit like switch expressions
like bruh???
you can't tell me that copying C#'s $ string would break backwards compatibility
you can implement it as a compiler hack that just replaces it with a String.format call
which is literally what c# does
(or at least used to do)
Having to do
formattedText := "There is " + fmt.Sprintf("%d", someNumberGotten) + "days left of school"
is annoying
what lang is that?
laughs in js
golang
figured
It was the first lang that came to mind that I know how to make formatted strings

But the concept is there of what I was trying to get across
can't you do fmt.Sprintf("There is %d days left of school", someNumberGotten)
Mmm true it was a bad example
But in some cases you have to concat a formatted string
which gets rather annoying
it's 2021 can't we do away with the old C methods in favour of compiler stuff
and yea memorizing the different types for the formatter
Mmm, we could make our own implementation 
if i was going to that length i'd just write my own language
i've explored the idea before
might do it as a passion project when i actually find the motivation to do anything
i'm quite interested in the concept of language design as a whole
If you do i'd be down to fuck with it
I surprisingly have a lot of free time most of the time so like
I really just work on side projects or watch anime
i know something i'd like to include in a language is some sort of way to mark functions as pure
wdym by pure?
a lot of compilers do that for optimization but there's no way to signal to a compiler that you want a function to only be pure ever
as in it only operates on inputs
Mmm ic
like a mathematical function, one input equates to one output
well yeah the compiler would still be detecting it
but the idea would be to encourage making functions pure
you'd have to explicitly mark impure functions ideally
whats regex
regular expressions
sounds like a monad
I mean like what is it used to
it's used to write search patterns for text
Hmm
for example you can make one for testing the "strength" of a password making it so it has to include this and that
eg find where a certain sequence of letters is used
or what parm said
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions here's a good guide if you use javascript
Regular expressions are patterns used to match character combinations in strings.
In JavaScript, regular expressions are also objects. These patterns are used with the exec() and test() methods of RegExp, and with the match(), matchAll(), replace(), replaceAll(), search(), and split() methods of String.
This chapter describes JavaScript regu...
I use python
Python has a lot of support for regexps
https://realpython.com/regex-python/
Someone help me?
Well... đ¸
if(!interaction.guild.me.permissions.has(Permissions.FLAGS.CONNECT)) return interaction.reply({content: "Eu nĂÂŁo posso conectar no canal de voz", ephemeral:true});
if(!interaction.guild.me.permissions.has(Permissions.FLAGS.SPEAK)) return interaction.reply({content: "Eu nĂÂŁo posso falar no canal de voz", ephemeral:true});
```
This
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Target user is not connected to voice.
They aren't connected to a voice channel
no
a coincidence
What?
if(!interaction.member.voice.channel) return interaction.reply({content: "ð§ | Entre em um canal de voz"});```

Depends on where that is in the order of checking
Oh yeah
Wait a sec
if(!interaction.guild.me.permissions.has(Permissions.FLAGS.CONNECT)) return interaction.reply({content: "Eu nĂÂŁo posso conectar no canal de voz", ephemeral:true});
if(!interaction.guild.me.permissions.has(Permissions.FLAGS.SPEAK)) return interaction.reply({content: "Eu nĂÂŁo posso falar no canal de voz", ephemeral:true});
if(!interaction.member.voice.channel) return interaction.reply({content: "ð§ | Entre em um canal de voz"});â
Well if it truly is coming fro myou checking their permissions then ig for some reason it requires them to be in a vc to check for that permission (which I don't see why) so if this is the case try checking if they are in a channel before checking for permissions
Ok
@earnest phoenix ```js
if(!interaction.member.voice.channel) return interaction.reply({content: "đ§ | Entre em um canal de voz"});
if(!interaction.guild.me.permissions.has(Permissions.FLAGS.CONNECT)) return interaction.reply({content: "Eu nĂŁo posso conectar no canal de voz", ephemeral:true});
if(!interaction.guild.me.permissions.has(Permissions.FLAGS.SPEAK)) return interaction.reply({content: "Eu nĂŁo posso falar no canal de voz", ephemeral:true});
try it ig
ok
I dont see why it would matter tho but maybe discord is just weird
Need some privileged intent for this?
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Target user is not connected to voice.
Yea I didn't think that would matter
Are you sure the erorr is coming from there?
Yes, because this error is from a command
Every time when this command is called, this error happens
Just because its from a command doesn't mean it is comming from you checking permissions
All code?
Shit...
Wait a sec
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed, MessageActionRow, MessageButton } = require("discord.js");
const { joinVoiceChannel, createAudioPlayer, createAudioResource, getVoiceConnection } = require('@discordjs/voice');
const config = require(".././config");
const { Client, Collection } = require("discord.js");
const client = new Client({ intents: config.bot.intents });
const { Permissions } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName("play")
.setDescription("Toca a rĂĄdio ao vivo"),
run: async (interaction ) => {
console.log(interaction.guild.me.permissions.has(Permissions.FLAGS.CONNECT))
if(!interaction.member.voice.channel) return interaction.reply({content: "đ§ | Entre em um canal de voz"});
if(!interaction.guild.me.permissions.has(Permissions.FLAGS.CONNECT)) return interaction.reply({content: "Eu nĂŁo posso conectar no canal de voz", ephemeral:true});
if(!interaction.guild.me.permissions.has(Permissions.FLAGS.SPEAK)) return interaction.reply({content: "Eu nĂŁo posso falar no canal de voz", ephemeral:true});
const channel = interaction.member.voice.channel;
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
selfMute: false,
selfDeaf: false,
});
const player = createAudioPlayer();
const resource = createAudioResource(process.env.stream_relay);
connection.subscribe(player)
player.play(resource);
interaction.guild.me.voice.setMute(false)
interaction.reply({content: "đ§ | Tocando rĂĄdio Lo-Fi Brasil", components: []})
},
};```
Well..
I will sleep rm
Rn
Well that error only occurs when you do something to the user when they aren't in the vc
the error could come from .setMute?
Nope
Oh
Wait
Yes
But...
It's showing that it's connected to the channel playing the song, but it's not actually @earnest phoenix
There you go
If it isn't connected to a vc you can't manage properties for it
As to how all this actually works anymore no idea. Ever since they made voice its own package I stopped messing with voice stuff
Im afraid you'll have to wait for someone else to help with why its not joining
Ok.
try to console log channel of js const channel = interaction.member.voice.channel; and interaction.member and check if they are correctly fetched .
(||I'm not good at djs so ignore if i said something stupid||)
or try to fetch the user by some other method
like
const user = interaction.guild.members.cache.get(`${interaction.user.id}`)
//then fetch channel
const channeltobeconnected = user.voice.channel
That assumes the member is cached
const user = await interaction.guild.members.fetch(`${interaction.user.id}`)
``` will this work in non cached case? (||i guess it will||)
ye
ok
Also thereâs no need to fetch a guild member as the interaction comes with the member obj as long as the command is used in a guild
That's very straight for me
English is aligned up a little bit
Mmmm could be because of text-align
Non-monospaced fonts can have variable heights
English might be 2px lower than the rest
So it centers a big higher
Try setting it to display: block
That way it transforms the text into a single box
inline-block
Ah yeah
As you donât wanna simulate another div with 100% width
Also u could not center the text
And wrap the whole thing inside another div with centering enabled
That way the text itself is contained in a normal div
Also y u have margin-left for subject?
Can u do it tho?
No I mean, u already added space on the earlier text
Sure using span
Spam
đ¤Śââď¸
I dont see a reason why it wouldnt work
If anything else, the margin should be the same size as the font, else it looks odd
But back to the subject, try span
Or inline block
Or an outer centering div
Yw
Itâs a weird font
The O is aligned well, the L isnt
The W of where is also aligned up a pixel
The font is just shit
If youâre worried about that, sure why not
Use superior monospace fonts
Almosâ˘ď¸
Consolas, best font
I donât see whatâs wrong with it
Thatâs what FakE said but who cares
<p>Where you can find notes for <span style="color:red;">Math</span></p>
Sorry who u?
Iâm me
Not anymore
Idk, but can you try wait for a few hours or 2 days, then try it again? It looks like its a new domain.... Just try it
anyone know how to use a variable in a string in powershell
can someone help me with buttons and stuff
i am trying from discord.ui import Button but it is saying no module called discord.ui
pycord?
i dont know whats that i just watched a video on internet and he used the above method nothing about pycord
well you might aswell install pycord cuz discord.py is dead
cuz buttons exists in discord.py 2.0 or pycord 2.0 and etc
doesnt replit autoinstall things?
yep thats why it sucks
and discord.py 2.0 is alpha
and its dead and replit doesnt install alpha
so what should i do
either migrate to pycord(literally dont need to change anything abt your code) or to nextcord(change a little bit on the import)
and buttons in pycord is also in alpha but will be stable in 29 january
i mean how do i migrate to pycord
uninstall discord and discord.py
and do this
https://namantech.me/pycord/installation/#replit
How to install the Py-cord library - Pycord Guide
if you wanna ask more go to their server
discord.gg/pycord
hi can i just ask tf is wrong with discord dev portal I can't make an invite link for my bot
this is for stable, for the alpha use this:
pip install -U git+https://github.com/Pycord-Development/pycord
wtf is wrong
code grant enabled?
The fact that no bot requires admin permissions is wrong 
oop
ty
no no bot needs admin
you can just give them all perms besides admin UwU
wdym fake my pong commands needs admin
ye
And build in a proper permissions check and error handling or that bot will never be accepted on topgg
lol I'm not even gonna ask for admin it was jsut to show u it didn't work without needing to config perms for 5 mins
lol auto correct
u should lol
question how can u like add that ppl need to do capthca befor being able to invite the bot
Well you can on your own site but as soon as one has passed the captcha, the discord invite URL is public
And can in theory be shared and used by anyone directly without your captcha
why do you need captcha anyway
If you plan to have your bot available only for specific users, you should use Discord oauth
To restrict access to users you whitelisted only requiring them to login via discord
What do you guys think of this NPM?
https://distube.js.org/
.. and do you think I should use it?
Of this n(ode) p(ackage) m(anager)âŚ
You probably mean what we think of this package 
Yeah, my bad.
I will never understand the existence of music bots and how thatâs supposed to be useful if you can browse and listen to the music yourselfâŚ
But thatâs just my opinion
Although, is this a good package? Seriously speaking... nvm
Well good question for somebody actually using it
If thereâs someone in here
You should probably ask in general
just seems cool
true
being annoying is cool, and i respect that 
distube is a good one
I used it once long ago
That d in used means it's no longer used. đ (especially the once)
no
I shoul've said I've used it once long ago
idk dyslexia
but I'm pretty sure used is the right word
its the right word
why do i need this
iirc just if you wanna be listed on Discordâs new app list
why does my bot with ping commands needs safety
Because even with just a ping command you can collect lots of infos?! 
Selling the data to North Korea
damn i never realised i have such powers
Yeah thereâs an easier way to earn cash instead of working for it
damn imma steal 2 server infos that uses my bot
You never know when it starts off
It may has 4 tomorrow - 200% of today
Imagine that growth
Is it an issue w python-sdk because I keep getting issues with having to install discord.py even though it was discontinued
why do u need discord.py
Are there any services that do the following;
Server connects to a socket to the service, the server gives a url (ex: ssh.example.com)
I would ssh into that url
Basicly a redirect but the server connects to the service
um hi
Wouldn't that be a normal AA record?
The server would connect to a service
I would connect to the service and the service sends the data to the server via a socket or so
That seems unnecessarily complicated, what's the reason for it?
just make an ssh tunnel
mention?

anyways, this isn't working what's wrong? It worked before but after a slight change of code (just some comments and that stuff were added for human-readability)
Message:
let msg = `**:silver: Silver chests** - \`${silver}\`\n\
**:golden: Golden chests** - \`${golden}\`\n\
**:nocrate: Gold crates** - \`${crates}\`\n\
**:pcrates: Plentiful Gold crates** - \`${pcrates}\`\n\
**:crate: Overflowing Gold crates** - \`${ocrates}\`\n\
**:epic: Epic chests** - \`${epicchest}\`\n\
**:legend: Legendary chests** - \`${legchest}\``;
I'm separating the string with \ (saw it in stackoverflow and used it because in some commands, I have too long strings.
if (silver <= 0) {
msg = await msg.replace(`**:silver: Silver chests** - \`${silver}\`\n\ `,"")
}
if (golden <= 0) {
msg = await msg.replace(`**:golden: Golden chests** - \`${golden}\`\n\ `, "")
}
if (crates <= 0) {
msg = await msg.replace(`**:nocrate: Gold crates** - \`${crates}\`\n\ `, "")
}
if (pcrates <= 0) {
msg = await msg.replace(`**:pcrates: Plentiful Gold crates** - \`${pcrates}\`\n\ `, "")
}
if (ocrates <= 0) {
msg = await msg.replace(`**:crate: Overflowing Gold crates** - \`${ocrates}\`\n\ `, "")
}
if (epicchest <= 0) {
msg = await msg.replace(`**:epic: Epic chests** - \`${epicchest}\`\n\ `, "")
}
if (legchest <= 0) {
msg = await msg.replace(`**:legend: Legendary chests** - \`${legchest}\``, "")
}
if (silver <= 0 && golden <= 0 && crates <= 0 && epicchest <= 0 && legchest <= 0) {
msg = "No chests... Come back later..."
}
``` my "function" to recognise the chests and add/remove the ones you have/ don't have. The "No chests..." works but others doesn't work (the ones where I replace)
im gonna call you the clash royale guy from now on
ok
that's no beginner embed fail, that's an advanced embed fail
lol
so what happened
so
lets begin
what are you trying to do
add variables into a message and then send it?
not exactly
yeah i noticed
I'm trying to make a inventory like dank memer
because I have many items added and it doesn't look good in a basic format
can you kind of post a blueprint of what you are expecting
like whats supposed to send
something like this was before
now
it sends all the items/chests without checking if you have it or not
ok
it will then make javascript if statements infer the true/false from the type
which should get rid of the null/0s
unless they are actual strings
before js if (silver <= 0) { now ```js
if (silver) {
yes
then that is worrying because it means the null/0s are strings
now you kind of have to roll with it
if (silver === "null" || silver == 0)
should do it
the last line will work with both string 0s and number 0s
1 hour
ah alr
up to 1 hour
Global commands are available on all your app's guilds. Global commands are cached for 1 hour. That means that new global commands will fan out slowly across all guilds, and will be guaranteed to be updated in an hour.
remove "Assembly of stats "
return interaction.editReply({
content: '',
embeds: embeds
})```not working
Hello! I'm not sure if this is the place for that sorry if it's not.
We are looking to hire an experienced bot developer who could make an anti-raid bot.
The main feature of the bot would be to detect raids to then kick / ban them.
@rustic nova -needdev
Line break on multiline string
Escapes on literal strings
-needdev @orchid sluice
@orchid sluice
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.
when the join time between multiple users in a row is the same, to then kick / ban them
sounds like a good idea 
Ban them all
aye
thanks
Can't have a raid if there are no members to begin with
Honestly... it's not a terrible idea for small servers
Time to make the best anti raid bot ever
if (silver ?? 0 <= 0)
Bans everyone on join
Else negatives will skip that check
yes usually raid bots detect when multiple users join in a small period of time, but the server I work for constantly gets advertisements which brings lot of users at the same time, so it falsely detects it as a raid
Mmm, you could just ban the people who join and then send x amount of messages in x amount of time. (tho idk how useful this idea is for larger servers)
Allow configuration of detection threshold
If it is a private bot for that one server tho haku
Ah
I think he was asking someone to make a bot for his server
so I assume it is a private bot
Well, detecting join frequency is the best method
Cuz it's that what makes a server crash
yeah, as long as raiders don't know it works this way it should work better tahn all other bots ^^
I'd say on join if they start sending a massive amount of messages very quickly its obv a raid of some sort
U could have a "accept rules" step before being able to send messages
Yea
so a join threshold is most effective
also compare the latest user messages as they mostly send the exact same msg
This will kill any spam raid
Also FR raids
Cuz they won't see all members
i do but they DM users, and no feature from Discord seem to be stopping that, they bypass them all
Read above
bots can still see all members
Make it so only non-verified users can see that channel
Even if users aren't listed?
I mean people can just not have their friend reqs on who needs friends anyway
yep

pretty sure last time I checked
Well yea that makes sense ngl
they usually get an account first that gets verified to then see the member list and send it to the other bots
Bots can be used i nprivate channels that no other members can see and still ban/warn/kick them
Then join threshold is your ONLY option
only good one at least
yep!
Anything else won't prevent dm spam
begs the question why discord doesn't automatically handle this effectively
It would probably be too pain in the ass for them
Why discord even HAS a public user endpoint
or they don't care
bc imagine a place bots can live
imagine a place
imagine a place where I dont pull my hair out
they started tagging bot you DM spam as "likely spammers" and you don't see their messages, but that's still nto enough, for example the other day i got a massive raid of 12000 bots, if all of them can send a few messages to users before being flagged it's already too late
yep luckily i had 2 different bots, one reached the limit rate but the other one managed to stay up until the end of the raid so that was pretty lucky
I just straight ban users that enter after antiraid triggers
If someone was just an unfortunate bystander the moderation team can handle them later
rude
if they care enough to message you afterwards of course
Most don't anyway, might be cruel but server comes first
It was pretty effective tbh, didn't have issues with false-positives yet
guys do you have any idea what would be the best language to use to make the custom anti radi bot? Or are any good? I don't really know what are the differences between nodejs, python, etc..
Whatever fits ur boat
gotta learn one
At small scale, language technical stuff won't matter
python and node are good starter languages
Triyng to figure out what i would need from the dev i will hire ^^
what language is node wtf
Don't ask for a specific language then
js
It'll be harder to find and more expensive that way
i can be just as obtuse
dude node is no language
money not really the problem, just need what would be the best
how can you fucking answer that rethoric question
At small scale were talking about nanosecond differences
It REALLY doesn't matter
ok thanks!
only way i would think you'd want to pick a specific language is if you're going to plan on extending the bot later with your own code
Language comparison only becomes relevant when we talk about big data flux and high concurrency
That
i see i see
dont use fortran
And only if going for multi-server
Single server is impossible to make a language struggle
avoid languages with goto support
Funny thing, java has goto as reserved keyword, but it does nothing
Probably a feature long removed
java would do that
I use scratch in all my bots
java 
Drive đż
Learn about reserved words in Amazon DynamoDB
Meanwhile c# async async async async
and no primitive wrappers
i need to learn c# more. i forgot to do that
class InteractiveView(discord.ui.View):
def __init__(self, ctx):
super().__init__(timeout=10)
self.expr = ""
self.calc = simpcalc.Calculate()
self.ctx = ctx
async def interaction_check(self, interaction: discord.Interaction):
if interaction.user != self.ctx.author:
await interaction.response.send_message("Um, Looks like you are not the calculator author...", ephemeral=True)
return False
else:
return True
async def on_timeout(self, button: discord.ui.Button, interaction: discord.Interaction):
button.disabled = True
await interaction.response.edit_message(view=self)
await self.ctx.send("Um, Looks like the calculator has expired!")
i am having a issue on_timeout
the buttons won't get "disabled"
Really, it has to be a bug
Async is a keyword, but not reserved
So u can make huge async chains
When waffle showed me that I was like wtf
huh what's that new fancy error message
đ
18 | {...file.files.map((file, ind) => <FileRender key={ind} file={file} depth={depth + 10} />)}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: Spread children are not supported in React.```
uum this is a first...
that statement is just false
spread an array into an object?
that's jsx syntax
File files map file ind file key ind file file
but the inside
that'd work but it would also render the brackets and commas
not jsx
Pretty sure you don't need the ...
that 100 percent should work
What'd you be spreading it into anyway
yeah, that's simpler, just remove those
it would be an array of elements
wtf is jsx
react's attempt to invent a dsl so you can write html in javascript

Discord server list???
oh and if you want to metaprogram might as well throw that out the window
back to .createClass
I'm 100% sure the spread syntax works too
Pain.
I've always done it with the spread syntax
I've never seen anyone use spread syntax.
I've always seen it without the spreading.
wow
"A collection of elements"
that's weird stuff there
in jsx {} is used to embed expressions into the html
well maps are just glorified arrays
then this is happening right?
ooh I think I know what might be going on... I made this typescript plugin which turns JSX expressions into template literals... and I made it so the spread syntax joins the array... and I've been using that plugin for so long I forgot that it's not how it's done in react đ
bruh
madness
I made this typescript plugin which turns JSX expressions into template literals
example pls
transpilers on transpilers on transpilers
Intense transpilation
what could go wrong?
You get smelly
1 transpiler is enough
it's one transpiler though
It's a typescript transformer
aka typescript uses it and I modify the AST
great replacement for those shitty ass template engines if you ask me
web browsers?
ejs, pug, eta, handlebars
the dom is the worst engine
I meant to say template engines*
Like spits bootstrap
the dom should just be better
success!
It's best to think of the DOM like your databaseâa foreign entity you never want to talk to, using abstractions on top of abstractions to forget its existence.
how do i get subcommand user object using SlashCommandBuilder (djs)
unless you use an orm, in which you suck :)
Blindtests
10 years later
just because you feel old doesnt mean you have to shame others for replying late
shut up and develop your drivers
develop my api for me
im listening
tho i was thinking something related to windows
xD
i have two things im thinking whether i should do or not
because they are quite a hassle
one would be a geocoding system based on geonames + sqlite FTS5
basically he want to build a geo system based on sqlite's full text search system
how do you get owner ID?
<@${guild.ownerID}> (${guild.ownerID})
that doesnt work
returns undefined
geonames has a public database of cities all over the world, about 180k cities, take essential data from those, create an sqlite db from that using the fts5 extension to enable full text searching, aka you search for "abc" and it gets you the city with the closest matching name
Didn't they remove ownerID in favor of owner.id?
oh- never heared of the announcement. Thanks then đ
the opposite
they removed guild.owner
and added guild.ownerId
Ah, lazy searching
Also the world only has 180k cities?
Less than I expected
because it was a getter to the cached owner, which would return undefined most of the time
Ah
instead they added guild.fetchOwner()
thats big cities only
2.4m
geonames has them ordered by population count
cities500.zip : all cities with a population > 500 or seats of adm div down to PPLA4 (ca 185.000), see 'geoname' table for columns
cities1000.zip : all cities with a population > 1000 or seats of adm div down to PPLA3 (ca 130.000), see 'geoname' table for columns
cities5000.zip : all cities with a population > 5000 or PPLA (ca 50.000), see 'geoname' table for columns
cities15000.zip : all cities with a population > 15000 or capitals (ca 25.000), see 'geoname' table for columns
WAYYYY more than I thought
What abt cities with less than 500?
Aren't those considered villages
like google maps, osm/nominatim, etc
all those cities but not one fair government
life aint fair
reject life accept mark zuckerberg as our leader
Mark "The lizard" Zuckerberg
Jeff "Biggus Dickus" Bezos
Elon "Cyberpunk 2077" Musk
dont say anything about Bill
Bill "Nano chips" Gates
nacho chips
Except when filming ufos
i want to test the synchronized clock theory
fucking shit, I'm so bored atm
Then u need a 1864 1.2p 10fps camera
those will be 1 billion fps at 1.2p
That reminds me of a guy who was getting 100% gpu usage with a 3060
He was rendering a triangle
Justa simple triangle
Except he forgot to cap fps
never cap fps
pro
it's crazy how light and time relate to each other
it's magic
i need to test it
Time at equator is slightly slower than at poles
two clocks synced down to the nano second would be off by 1 nano second after being separated by ~1ft
Why not weâre great
But it's a "match closest" search
You put a small fragment and it searches based on that
Ah wait, not lazy mb
Fuzzy
fuzzy searching != full text search
full text searches arent able to do fuzzy searching
they sort a set of documents based on how many times a set of words from a query appear in a document and sometimes based off the positions
fuzzy searching is a different ball game
How do I make the div elements fit so perfectly? They are all the same size all the time but the size still changes when the screen gets smaller. How did they do it? is it something with calculate and just flex-wrap?
Here's the example: ||https://magiceden.io/marketplace/prickly_petes_platoon_og_cactoon_series||
I don't have a current code but I was wondering how they did it because I already struggled with it some time ago..
one of the most common ways to do that is to define min-width
so it auto scales based on size, but once it reaches a minimum, it forces a line break
so min-width = x, width = f.e. 25% and on the parent element flex-wrap
ah okay
hey guys what do you think is the best linux operating system for mongodb?
but like if the width is equal to let's say 3 elements the width isn't 25% anymore... how to do it then?
they're all probably fine
you can use max-width as well
oh okay thanks i think i will use debian
ahhh stupid đ¤Śââď¸ xD thank you
you can also use calc for more advanced control
yeah
width: calc(100px + 20%)
thank you man
so guys
what are my odds of becoming an electrical engineer
i can barely make a simple circuit:(
hmm uh 0/1
just about right
they say programmers dont deal with hardware
but what if they did
would i be the first one
hardware is just boring
software is fun
why spend your time working with logic gates when you could be rewriting your js app every 6 months with the newest coolest framework
not for me
i find making something from scratch fun
from the lowest level to making something high level
whatyamaking
a fucking operating system
tho thats too high level for me
i want to go deeper
bios firmware
@boreal iron
@split hazel try finish / complete something first
something
make a bootloader
have you ever actually written anything very low level before
i remember wanting to do it too, but when i started making my first os i really quickly learned that all the nitty gritty isnât actually that fun lol
and realistically writing a bios isnât any lower level than an operating system because the bios typically only handles the POST and boot process before handing off to the bootloader
and thatâs on more modern uefi bios
you're probably right
what is the meaning of that
no but apart from actually loading the rest of the kernel from the storage device it doesnt sound bad
make some 32 bit preparations and then do a long jump
i mean like
i know a lot of people, myself included, that have wanted to go as low level as possible
but then it turns out itâs not actually that great lol
if you have already experienced it and want to take it further then great
so far in my os im fascinated by it
i want to one day order some pre-built microcontroller, solder components onto it and then control them with some written code
too expensive tbh
i really dont want to overspend
and an arduino + starter components is pricy
its apparently due to the fact you're also funding the project
an arduino nano is like ÂŁ12
i found something like this on aliexpress, a chip which has a display attached to it
for 10 bucks
think its a modified arduino
ig you can try
dont know tho
would i even be able to set it up
i could probably also take a bite and order a lithium battery for it
raspberry pi module
ive heard some blogs about it
do you have a pi
idk looks like you need a pi to use that thing
try to spend as little as possible
and a pi is a lot more expensive than an arduino and a few components
just pick up an arduino uno and a bundle of components or something
itâs basically infinitely hackable
i remember having a lot of fun programming for an Ethernet add-in card for the uno
it would be nice to try and run a very basic discord bot that way one day
i was actually looking at something like a raspberry pi pico
and a starter kit
quite dodgy tho
the rfid is pretty awesome
might take a gamble with it
a lot cheaper on ebay
probably because they take a smaller cut
I have to have 4 servers hosting my code at once
good
ha ha
we have 2 diff things for 1 website
The only thing that's keeping me from buying a pico is the shipping cost... to my country it costs more than the pico itself... đŠ

I had the pleasure of repairing an old server PC donated to the shop I work at and it had 2 xeons in its sockets. Would use that if my boss lets me have it
same as my setup but a single codebase and use of subdomains instead of repl project 
what
your roles
engrish
did you mean "that vibe" or "to vibe to"
FINALLY
THANK YOU MODERATORS
you deserve it
@quartz kindle ||haha ping go <br rrrrr="rrrrr" />|| is it possible to use a <link /> element to load a script based on the media attribute?
i want to load tablet.js on screen sizes bigger than 786px
you can do it via js
loading an entire script only to not run it
no no
inserting a <script> tag into the body using js?
mhm mhm mhm
function addTablet() {
// Check if screen size is bigger than 786px before calling it
const script = document.createElement("script");
script.src = "path";
document.body.appendChild(script);
}
ok
How can I provide API security?
A button in the script section of my website, etc. when pressed i post api
But the api is visible in the right click inspect section
This way, other people can post here (via their own computers)
in this way, they can change the settings on the server that they are not authorized or even a member of.
You'll need to handle authorization on the API server rather than the frontend (the user clicking the button)
For example, session cookies are a basic form of authorization.
Is there a sample place on how I can do it?
Session cookies come in all forms depending on the server
But it would involve sending the user a Set-Cookie header, the browser saving it, and sending it on subsequent requests.
So you look up that cookie in your backend storage and know who that user is.
At least, that's how I've accomplished user auth. In a "pure API" (REST, machine-to-machine, etc.), session cookies may seem inappropriate, but they do work.
I found something about this topic, can it be useful? https://www.section.io/engineering-education/node-authentication-api/
It does work, but the choice of JSON Web Tokens (JWTs) is probably inappropriate.
Of course, if you're willing to bundle express, mongodb, and jwts to make it work.
what @discordjs/rest is used for?
Probably to make REST API calls
And just that
Rather than all the convenience Discord.js provides
do I need it, to make bots with discord.js?
No.
If you use Discord.js directly, you won't need it.
It's useful if you want to make calls to the API directly, albeit the package points to an archived repository
so i guess, discord.js use it internally
maybe
and @discordjs/builders?
Yeah it's here (https://github.com/discordjs/discord.js/tree/main/packages/rest)
Helper tools and trash nobody needs but lots of people are using 
Convenience library for anything that involves "building" a structure
For example, an embed when you call .setTitle
That's the builder pattern.
Or you could use it with slash commands
Which seems to be its popular use case.
Aye ugly and more to type
Builders usually handle the validation for you as well, so if you want that
But I'd personally just use maps
hopefully not Bing Maps
bling bling
ok thanks
First and most important rule, donât handle forms on the client side but in the backend.
Verify that input after and make sure the client didnât manipulate it as client sided code can be changed however you want.
Looks safe and promising
doesn't have to be graphql
graphql is nice is you a have a massively complicated api
Unless Dataloader isn't having it that day
I couldn't figure out how to use it when I wanted to load entities with certain properties (as in options)
I've had success exposing a single query endpoint but having a bunch of separate endpoints for transacting/modifying data
lel


if "trigger" in message.content:
if message.author.id == 294882584201003009:
confirm = discord.Embed(created embed)
button = [Button(style=ButtonStyle.red,label=":cute: BroadCast")]
await message.channel.send(embed=confirm, components= button)
res = await client.wait_for("button_click")
if res.channel == message.channel:
if message.guild.name in db.keys():
link= str(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")
if message.guild.id in premium:
GA_msg = discord.Embed(embed created)
#non premium
else:
GA_msg = discord.Embed(embed crated)
for guild in client.guilds:
channel = discord.utils.get(guild.text_channels, name='channel-name')
if channel:
await asyncio.sleep(0.5)
await channel.send(embed=GA_msg)
discord giving interaction failed (maybe because the event is triggered by bot , which makes the interacted user diff from event triggering user )
any solution?
well technically every question asked is because of skilled issue
you're not wrong
if you are saying inside the loop thats totally diff because they are being broadcasted in diff channels in diff servers
will that be made with interaction response?
Does someone know a library to generate pattern avatars like the GitHub avatars??
theres an api that does it
which one?
i have a question
one sec
I donât speak snakish
But it doesnât matterâŚ
If you donât response properly to the interaction it will always fail
it needs to be in javascript too đ
Yeah, it's an api that is also open sourcr
is this what youre looking for
link pls:)
bruh who uses gravatar nowadays
https://github.com/stewartlord/identicon.js here's the GitHub link too^^ thanks man
i want to make an api like that sounds fun
alright fake
do you have a loan on your car
if so i hope your car breaks down and you have to continue paying back the loan
imagine not pay for open source packages
nice
ayo imagine if supermarket employees got like a 2-5% commission on each order
i'd be loaded

It's joe
who is joe
Joe mama
Imagine developing an OS instead of working to pay your country 50% taxes
tax is the legal equivalent of blackmail

how could i make a folder on a github repo using their api?
you can do that but beware that folders have to contain a file inside of them or another folder otherwise they'll be deleted
just a github feature
i dont usually link to stack overflow answers but https://stackoverflow.com/questions/20045572/create-folder-using-github-api
otherwise if you dont want to use the raw api im sure your language has a package for interacting with the github api
.gitkeep đ
Anyone know how to check for SEND_MESSAGE permissions for the bot
I have this (!message.member.guild.me.permissions.has("SEND_MESSAGES")) But does not seem to work
The interaction already comes with the guild object
interaction.guild
if used in a guild of course
yeah, but i dont want the guild the interaction is in
in that case, not all guilds are guaranteed to be cached iirc
see if the guild is in cache, if it isn't, then fetch it, if it is, then take it from the cache
If you don't pass client as argument to your execute function, then yes interaction.client is what you need
ait thanks, but i know for sure this one is cached
You're good to go then
How i can send image as buffer?
.send({ files: [ { name: "abc.png", attachment: buffer } ] })
ahh, i did it with MessageAttachment but ok
thanks
tim you just got outplayed by a novice
hi bro , can you say me a database for music bot discord.py hosted on heroku
if you're hosting on heroku, your only option is heroku's own database
or a remote database hosted somewhere else
Are you using v12 or v13?
v13 I thought v12 was over
Mmm, then I think they no longer support using a string or at least I think it is no longer advised
You need to use the flags
You'd wanna use the permissions flags
means an http request was canceled
the error stacktrace isn't useful so good luck finding where that happened
but usually the error isn't your direct fault
thanks
how can i add the option servers bot is in
like from where i can get the ids?
you can get them from inside your bot, by console.log or print
or you can right click the server and copy id, if you are in the server and have dev mode enabled
also, for that option to work, that server needs to be listed in the top.gg server list
God I hate interactions timings so much :^)
Why does graphql need a root Query type? Can't I just do:
type User {
id: ID
get(id: ID!): User!
}
instead of:
type User {
id: ID
}
type Query {
getUser(id: ID!): User!
}
nvm I think I found out
...weird design choice if you ask me
oh wait I get it
imagine using graphql in 2022
Is it possible to have 2 applications on the same domain? If they just have diffrent routes?
sure but it gets quite complicated
if you want them to run on the same port you have to use a reverse proxy
because operating systems dont allow two applications to run on the same port
I have NGINX behind
that will do just not sure how you would configure it
subdomains can be configured to use different ports
yes it would be a subdomain
a single domain with different paths cannot, but you could achieve the same thing by routing it
with nginx, just give each subdomain its own server block
I thought you could run an api and then frontend on the same domain (without using subdomains)
How does discord do it if not this way?
routing and proxying
So it is possible to use the same domain without subdomains and just have a path for the api stuff
https://example.com/api/v#/stuff
https://example.com/app
yeah
basically the difference between path and subdomain is the level at which the separation is done
subdomains can point to different ip addresses by dns
I've never used nginx before so idk how all of this works
sub1.example.com -> ip address -> nginx server for sub1 -> root proxy -> your app
sub2.example.com -> ip address -> nginx server for sub2 -> root proxy -> your app
example.com -> ip address -> nginx server -> /app proxy -> your app
/api proxy -> your app
yes
One can run the frontend while the other runs the backend
So then I have a question you'd need to run the front end backend on different ports right?
yes
each proxy is a different port
unless your app handles both simultaneously
then you can just use a root proxy to handle everything in the same app
Mm I see
one advantage of using paths is that you dont need ssl certificates for each app
for subdomain, each sub needs to have its own ssl cert
Or just a wildcard cert
arent wildcards harder to get?
They just require a dns challenge
ah
What does this error mean, and how can I fix it?
/home/container/node_modules/discord.js/src/rest/RequestHandler.js:305
throw new HTTPError(res.statusText, res.constructor.name, res.status, request);
^
Response: Bad Gateway
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:305:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
at async GuildMemberRoleManager.remove (/home/container/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:144:7) {
code: 502,
method: 'delete',
path: '/guilds/877034374720274452/members/758374974708383744/roles/888644358671331338',
requestData: { json: undefined, files: [] }
}
im currently using a single multidomain cert for my subdomains
But without an own dns system or an api of that system an automatic generation is like impossible
yeah
502 is usually a problem on the discord side, or a network issue
Ah. So there isn't too much I can do to fix it? I did notice that it's related to deleting a message tho
its removing a role from a member
ah
I also handle it by sending the pre-hook of certbot to my webserver providing the environment vars containing the domain name and verification key for this challenge and the webserver proxies the request to the dns server internally verifying the request and executing it in the dns console
Once the system is created and automated I can used it anywhere on any OS
Actually not really complicated
sounds annoying to setup
Nah I wanted an internal solution without publically open the dns server firewall
It just accepts requests from my webserver which acts as proxy
And all servers running send the requests to the webserver
Depending on the OS the shell/batch scripts being executed as task/cronjob every day
Whenever certbot decides an update is required it executes the pre-hook (one file) and the magic happens
I somehow feel like I explain it a lot more complicated than it actually is

certbot -> pre-hook -> batch/shell script -> powershell/curl request to my webserver -> proxy to the dns server -> answer
ez pz
Literally built a whole dns API
because itâs useful for many things
Like IP whitelists, VPN services, static hostname for dynamic IP aka. ddns
Etc
went to post a realistic but fake token as an example to my channel and i got this
never seen this before
been around for a while
i guess i never noticed as i dont tend to paste tokens into channel


