#development
1 messages · Page 31 of 1
by posting your server count frequently to their API
-servercount
To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.
by adding some CSS code to add/edit the content background
alr
Hello!
hello
i tried doing that but it failed do you know if this code is correct?
</a>```
what's the </a> from
try removing the </a> and adding alt="image failed to load".
<html>
<img src="https://cdn.discordapp.com/attachments/942561812946239530/1010980379504676864/unknown.png" alt="image failed to load">
</html>
Yeah you need an alt attribute, most of the time it's required iirc
alt is basically just the text that appears if the image couldn't load or deleted/not found
hey guys i recently built my exe app using electron
the build however came with lots of other files
I don't want any people to see these files
how can i remove/private them?
do note, it's very possible (and easy) to decompile your exe
^
I did that last time to see how game scammers do it (and shame the guy in pv)
all you need is 7zip
electron exes aren't real exes (as in, binary), they're just compressed files like java jar
if (interaction.user.id === 'id') {
// ...
}```
How many ID's can I have in one of these or if I was using a role to make it easier?
That what i was thinking
arrayOfIds.includes(interaction.user.id)
depending on what ur doing, I'd even use a database to hold the ids
like, filter by a specific row value
Thanks!!! Would it be easier to use a role if all people are group up in that role and just add a guild limit to the command too?
How can I make an image a circle with Canvas? Using node-canvas and trying to make discord avatars round 
I am creating a badge system so it like emote then badge earned
what
Example: :moderator: Moderation Departement
I am already setting up a database to begin currency
I know
but fuck that
i just need 1 exe file
the only issue is, my code actually needs some files so i can't compile it fully to exe
then don't or embed it
embed it?

I have one file that's called for example, test.json
I want it to be hidden, but it should be usable by the exe file
If i now make a singular exe file it just is incapable of finding the json file
u coiuld encrypt the files and decrypt inside the code, but then again, anyone who has the exe will have the decription key
heck they could simply edit the exe to show them the file contents
if u need to keep things secret, electron definitely isn't an option
Right now it literally doesn't matter as only me and a few friends will use it
How would i encrypt/decrypt?
Is there any package for that?
search
also make sure to cache their contents inside the runtime because...you'll not want to decrypt it everytime
The only true way to keep things secret is to have a server give a response that is crucial to your application that your app doesn’t have access to natively. Anything can be decompiled, after all it needs to have instructions executed on the CPU at some point in the pipeline, no matter what level of “encryption”
I mean, yeah but barely anyone would try to decompile a real exe
for electron all u need is to right click -> extract
I’m just saying that if true security is your goal, it’s likely not going to be achieved
Yeah exactly
but that's why i don't give a fuck about security with this particular program
only me and my friends will be using it
so they can decompile, eat or lick their screen
For the people curious, I actually found an electron lib that saves data FOR you, all encrypted.
Really cool. That way i won't need to require any files next to the exe and it still saves the data you need
Yeah it's encrypted with sha tho
the package automatically encrypts/decrypts whenever reading/writing to the data
ok so i store timestamps of bans in a Mongodb database, how could I filter by last 7 days?
timestamps are stored in the format of ok so i store
nvm i found out about $gt
I want to do something like this in Konva, but I can't get the middle point of the top line because I can change the size and location of the text.
generalTransformer.findOne('.top-center').position()
```When I looked on the internet, I found something like this, but this does not affect because I changed its location, so the x position and y position are wrong.
When is Discord removing text commands?
As far as I remember, they announced that all applications must use slash commands
september 1st
No they aren’t required to use slash commands
Either they have the message content intent or the bot can get mentioned to receive the message content
wasn't u going to make a fixed-size boundary box?
At first I did that but then I made the box adjustable and after adjusting the size of the box I changed the font size automatically (default fontSize * scaleX) it's more user friendly to use like this
u have the box size saved somewhere don't u?
I solved the problem```js
deleteButtonGroup.position({ x: x + (width / 2), y: y });
Is this coding? https://cdn.hamoodihajjiri.com/fZdIqZmhOT
Cause I find it as normal english. ;-;
I mean yes and no
yes it it, a shitty way to code in javascript but it is
they even tried to mimic how we do in groovy
Tf is that
this is testing
is it really code?
no not really
it's code that tests your code
Can someone help me? I don't get what this issue is from. It was working perfectly before.
"service_worker": "page.js"
},```
Error: `Service worker registration failed`
The top code is for manifest.json and the error is what chrome is throwing at me
Hey anyone has idea about how i can send mail via Gmail app from my custom domain
I bought domain from zyro.com and using improvmx.com for forwarding emails
^
- "It was working perfectly before" why do everyone always say this? it wasn't, if it was it'd not break out of nowhere
- Details: where are you hosting? what language? what framework? Is it a bot or what?
- No need to bump if the original message is 1 message away
simply login with it I guess, emails with custom domains should work normally
What to input there?
that's not gmail is it?
having a domain doesn't give you a custom email
all it gives you is the domain itself
It gives
i am receiving mails by improvmx.com
"bought"
you didn't buy anything if it was "free"
I bought domain from zyro.com
I am just using improvmx.com for forwarding emails and yes it's free
zyro.com is paid
did you buy a domain or a professional email?
I bought a domain name
priyansh.xyz
And i have mail
contact@priyansh.xyz
I am receiving mails through it
improvmx.com is forwarding emails
On my gmail address
But i ain't send it
well, idk exactly how improvmx works (tho I'd never use it because "free" is never free), but can't you just create a rule in your gmail?
like, redirect any email received in yours
yes, doesn't make it less sketchy
no
why do you need to mask your email btw?
Mask?
Wdym
Learn how to create an email alias address that forwards your Google Domain's email to your personal inbox (in this case, Gmail). Not only will you be able to receive email to an address with your custom domain (i.e. you@example.com), but you'll also be able to send mail from that address as well. Best of all, this is free for up to 100 email al...
redirecting is basically the same as masking
This one i tried
doesnt google charge $10 a month for sending emails through smtp?
I own my domain and I pay $10 a month
owning a domain doesn't give you the right for a custom email
for what you're asking for
it only gives you the right to the domain
on google domains I think it comes included
Yes
which contributes to why it's expensive
I bought from zyro.com
then I think to use gmail in the way you intend to youll need to pay $10 a month
👀 did google get rid of the individual workspace plan?
If I understood what they want, it's basically:
- Someone sends an email to
thedomain.xyz - The email gets forwarded to
personalemail@gmail.com
is that right?
the other way around
sending an email
No i don't want that
I did already setuped it
his mx record route the mail to google
please explain what u want exactly
cuz I'm confused af
once you buy an account they link to their guide on how to do it
so it's basically making a custom email domain?
I want to send email through contact@priyansh.xyz
To any mail
no it's simply using a different mail server than your own
it'd be cheaper to just buy the email no?
you can literally lead the mx record to any FQDN
that always gets caught in spam filters
unless u send a ton of emails per month
for me
and then use the mail server/service of a third party provider
nope
big companies use Google or Amazon as relayer in general
to NOT land in spam
Nala u here?
I'm always around
u still wanna make sure to have valid spf, dmarc and dkim records
if the reciever checks the origin
(once provided in the mail headers)
ah yes, the email spiral of madness
Ic
See this video from 4:45
I want to setup that
But as i bought domain from other website
It give require some other values
And i just confused about that values
well using third party mail service providers is the common way if you dont wanna host your own mail server
This form simply sets a custom reply-to header
Hm
You send emails from ANYWHERE adding any email address as sender u want
or simply add a custom reply-to header means the sender email will be shown as the relayer email (gmail) but once somebody clicking reply the recipient is your domain
that's all you enter there
a custom name and your email address
What values to put here
In SMTP server
Username and password
Password of what?
🐔
you don't have an own smtp server
In present i am using improvmx.com to forward mails to my gmail
By that domain mail
that isn't an email server
smtp(rotocol) is used to send mails
and is part of your own mail server u don't have
whatever form ur filling out there isn't the one u need
if you own a gmail account, then u enter your gmail account data here
Yeah
to use it as sender
should be smtp.gmail.com
Ok i try
sometimes I think people nowadays trust way too much "free" services to put their own credentials there
just a heads up, when using smtp.gmail.com google will flag those emails as spam
to anyone who receives them
errr...
it is
google generates a password when you request one.
nope
Then what 🥲
could be possible gmail doesn't allow auth outsite it's own domain without whitelisting it
huh?
its not your google account password.
gmail smpt use tokens
its just that field is labeled password
From where i get the token?
gmail used to use pass but changed last year iirc
interesting
why not making things more complicated than needed
I mean, using tokens for sensitive internet stuff if pretty standard
with tokens you can restrict what kind of operations it can do
he should just have bought his domain incl a webhosting package
usually including mail service
domains are cheaper, yes, but you also need to consider the fuckton of trouble you'll have for being cheap
at least regarding custom emails
you aren't forced to use google a mail relayer
yea
oh
i didnt know that
i think you cna still do that though
nope, they don't allow pass anymore for non-site requests
my work uses gmail in the software, and we had to refactor a shitton of code due to that
feels bad
my work uses gmail in the software
civilized place
they also concat sql queries, but what could go wrong right?
Barbaric!
Hey guys, someone know why when I grab data from my JSON file and put them in an array, when I edit it, it updates my JSON file in the cache?
(I do not grab the whole file only some parts and im working in class)
Confused. Can you describe your situation more clearly?
yep
I get my json file to create a temporary data array that I will use in my class.
const f = require(`../json/Floor`);
After i build the temporary data array
let mobs = [], maxMobs = await this.getMaxMobs();
for (let index = 0; index < maxMobs; index++) {
let rand = getRandomInt(1, 1001);
for (const key in this.floorData["random"]) {
if(this.floorData["random"][key] >= rand) {
mobs.push(this.floorData["mobs"][key])
break
}
}
}
And after that i modify this array. however once I made the edits I see that it has edited the json file in my cache and considering that im not only using this class only one time my cache is "Broken"
Where is f being used in your code?
I imagine the issue could be with mutating the objects since they're likely passed by reference rather than value (and hence changed in multiple places)
-
It was working perfectly. My friends came over the day before it stopped working but they didnt mess with it.
-
It’s a chrome extension..
-
Ik that, I’m just sending another message just as a reminder. Since I’ve been ignored way too many times if I don’t do that
public async getFloorData() {
return f[this.playerFloor.floor]
}
My code works just i got this "cache issue"?
yep its that
this is what made me straight up fall on some good concrete when I discovered that after a few hours in python
immutable objects for the win
considering the second answer, it feels like some chrome update broke it
do you maintain it regularly?
Oh alr
Yep, it’s been a little over a month but I’ve been testing it almost every day
Never gotten that error before
Stack over flow said you need a script manager or something? I never did that it doesn’t work still
I don't know much abt extension development, and ig you're in shallow water in this server
Yeah
isn't there a chrome server on discord?
I’ll wait like a few days ig
I doubt it
I’ll check tho
Nope, or I don’t think so at least
hey guys, i was wondering is it against discord's rules if you log the username and stuff when the user uses a command and you contact them to ask them how they like the bot?
if you keep the log private (as in, only you have access to it) I don't think it's against ToS, it's actually recommended to have a log of command usage should you need proof someone did something
as for the last part, that's not allowed at all (I believe), you should never prompt an user without request
But the request would be a friend request
again, no
the users are in their own islands (server), you cannot invade their island without explicit authorization
it should always be user <--> bot, isolated
But I won't go in the server, I just want to speak to a user by sending him a friend reuest
yes, you can't unless you're already in that server
because the user doesn't know you, you cannot use your bot to send invites to strangers
Yeah but bro, If I have his username and # I will just go send him a friend request, if he doesn't accept that ends there no?
*sigh*
imagine there's a wall between you and the users
you can see everything on the other side, but no matter what, you cannot pass that wall unless the user allows
as a dev, you can see all but must not interfere unless required
if something is only possible because your bot has said data, then you shouldn't do that something, simple as that
ayt thx
I am creating a if statement to determine if a person has a role to display a message.
I ran into a slight issue: ```js
else if (interaction.member.roles.has = '1005932952993136680')
I have tried `=` `==` and `===` it only displays the correct message on `=` but for everyone even if they do not have that role
Have I made an error?
Hello, I would like to know how can I fetch message in the DMS channel? (discord.js)
if you're using discord.js v12+ they changed it to .roles.cache.has
do you know the message id?
V13 so it explains why
or you want to fetch the last X messages?
Yea
you need to get the DMchannel first
you can use await user.createDM()
this method returns the DMchannel
then you can do DMchannel.messages.fetch(id)
Thanks Tim!
👍
Hello, so I tried this:
const user = client.users.cache.get("id");
const message = user.dmChannel.messages.fetch("id")
const verify = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('verify')
.setLabel('verify')
.setStyle('SUCCESS')
.setEmoji('✅')
);
message.edit({ components: [verify] })
and it doesnt work.
Error:
TypeError: message.edit is not a function
You need to await fetching the message
Usually any sort of functions with “fetch” in the name return Promise<Something>
Also need to create the DM channel as Tim wrote above
In this case it’s Promise<Message>
More like Promise<Collection>
only if you fetch multiple
And at the point it would be Promise<Collection<Snowflake, Message>>
I don’t see any limiting option?!
He’s fetching one of
Id*
Skill issue
// use fetch instead of .cache.get because the user might not be cached
const user = await client.users.fetch("id");
// use createDM because user.dmChannel might not be cached
const channel = await user.createDM();
// thanks to the above, here the channel is guaranteed to exist
const message = await channel.messages.fetch("id")
Actually it’s not guaranteed they exist
well yeah, guaranteed provided the channel id is valid and exists
you can still fetch messages
for example messages from before you got blocked
afaik
you just cant sent new ones
It works without createDM();
Ah
it works but its not guaranteed
it only works if the user is active and already sent messages to your bot since it started
if you restart your bot and try using user.dmChannel without the user being active in the bot dms it will not work
Hmm interesting
Can you fetch the messages if you send a message to the user in DMs?
Like older ones
you should be able to yeah
So then it should be recommended here to catch the createDM() promise I guess
Thanks Tim ☕
lmao
This
The alternative is writing no comments like I do
I and only I understand my code and that's ok
The best code is the one that documents itself.
can anyone help me with something in my server?
i added a new slash command and for some reason i cant see it
Was it local or global
it was local
got someone to check, they also cant see it lol
shows up in integrations but doesnt in chat
deleted it and created it again and it works now
nothing a good old "turn it off and turn it on again" doesnt solve
Its always important to remember the difference between possible and a good idea.
how to i time something in js
like asin make a time stamp then do some stuff and make another time stamp?
then subtract them
i want to know how long it takes for an operation to happen
like my ping command makes a time stamp when it sends a message then subtracts it from when my message was sent (and then devides it by two so its not round trip)
bacically that but eithought needing the message timestamp
^
yeah i know how the math works
idk how to do that in code
the only other way ive times stuff is using console.timer or whatever its called
how to i get the date in the first place
thats not the time in ms is it?
Date.now()
it is
oh nice
cool
if you crave for precision, there's another method for getting nano
but it might be too precise for a ping command
its not for ping that was just me explaining how i times stuff in the past
its for timing how long it takes to run commands and reload them
fair enough
i usually use performance.now()
that's the nano thing
but process.hrtime is technically the best option
just not as straightforward to use
performance.now() returns milliseconds with decimals, process.hrtime returns two separate values: seconds and nanoseconds of a second
theres also process.hrtime.bigint() which returns total nanoseconds
but bigints are slow so... xd
bruh whilst the more random diagnostic data the better most of that went over my head
ima just stick with ms
its enough resolution to have an idea on whats happening
nice
all working
thx guys
and yes i use code blocks instead of embeds im sorry
You can also use ANSI color codes to make it look way better
Without the usage of those []
true but that looks really bad on mobile last time i checked atleast liek this on mobile its the same just not coloured
cuz mobile shows all the escape characters and that in the text
Yeah I guess, Discord iOS builds never supported syntax highlighting so that's a bummer, but the Discord Android builds do support it
they did
its reverted now
well my old phone it works but my new one it doent
some how
Probably a version mismatch
yeah
didnt they unify the platforms?
but its updated on my new phone
made android the same as ios
as far as i know ios is still lacking the syntax stuff
Yeah, the Android clients are rewritten in React-Native, but at least the Android builds still support syntax highlighting unlike the iOS builds
well ill have to see if i can reinstall it
my old phone was like some 5 year old bargin brick
always thought it was my bad internet that images took a bit to load on discord and instagram
but no was just the cpu and dying storage
1gb ram moment
is it possible if a mod can change my bots id on the website?
why did your bots id change?
i kind of deleted my bot but then i regret deleting it so i dont wanna resubmit it and wait days
guess what?
you guessed it right!
Is there any way to give 1 message for cooldown after that ignore if the user is spamming a command
you can store the users who used the command in a map, and if they exist in the map before the cooldown is over just ignore execution. Ofc after the cooldown is over you wanna remove said person from the map somehow
This is one method I could think of
Ty it's done!
nice
the ANSI format looks very different when entered from the phone
ansi isnt supported on mobile
https://mystb.in/DepartureAdaptorGpl
Why do i get this error
ANSI highlighting isn't even supported on Discord mobile clients, I've talked about it the next few messages
Hello, how can I get description of this embed? (discord.js)
I tried message.embeds[0], but it just gives me error
Error: TypeError: Cannot read properties of undefined (reading '0')
Without the error your question is useless
if it gives this then you're not printing the same thing as the one you're tying to access
the data sturct of this is a collection
Collection does not have property embeds
so it's undefined
and you tryna read 0 from it
ofc it's gonna error
you wanna get the first element of that collection <Collection>.first() then you may access the embeds field
messages.first().embeds[0]

hello, i need help with express
i use express for my verify bot, and i set a reverse proxy with nginx
it upload the file is on the directory assets (css and js) but it doesn't upload the js directory
why?
i tried to put the js directory into the css, but it doesn't upload it
are you actually importing the js anywhere in your html?
ie
<script src="js/myscript.js"></script>
<script type='text/javascript' src="../js/particleground.min.js"></script>
<script type='text/javascript' src="../js/particles.js"></script>```
Check the console
what does ../ do in src 👀
up one directory
I believe /js would look at the root folder called js
while ../js would go up one directory and inside js
I usually see that for icons 'n assets, relative paths are blessed
I'm not a web developer flaze :p
flaze? 💀
this is the express line:
app.engine('html', require('ejs').renderFile);
app.use(express.static(path.join(__dirname, '/assets')));
app.use(express.static(path.join(__dirname, '/assets/js')));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));```
oh yeah sorry we got distracted
the issue is where ur html is looking for stuff
it's looking for an url, not filepath
i don't know very well html, in this method it's not correct?
<script type='text/javascript' src="/js/jquery.min.js"></script>
<script type='text/javascript' src="/js/particleground.min.js"></script>
<script type='text/javascript' src="/js/particles.js"></script>```
why does new Date() always return the same date in my case?
did u change the code since ur last snippet?
and why css load and js not
are u reusing the instance?
i dont think so
show code
did u try both with ../js and /js?
? I remove the ..
i mean, there is a lot of other code in there so i cant show it at once
same error on both cases?
show only the relevant part
yes
the relevant part is mixed up in the other code
show your file structure
damn show the part where u get the date
console.log({ msg: "test", time: new Date() });
And what does that log for you?
Tue Aug 23 2022 17:04:09 GMT+0200 test
no matter when you call it, it logs the date of when the process was started
one possible reason date might not update is some platforms lock it.
I hope you put it inside a function
windows?
nope thats not one of them ^_^
weird
I meant stuff like cloudflare workers
Node.js is independent of those time locks
You're probably doing something very obscure, can you show the code around the part where you're getting the date?
And is it inside a function?
i think it's a problem of express, maybe i need to specify the file to pubblicate?
it's different occasions
i do use a replaced console.log function though
Then that can probably be the reason, it could be using the older logs for whatever reason
oh dang it
i found the issue
i was using an older date instead of the new date
lol, thanks for all the help
how can i resolve?
is there anyway to put SubcommandGroup in a SubcommandGroup?
Nested sub-command groups are not yet supported, so nope
I don't think so
then i cant make my bot to slash command💀
I'm back
where is the js folder?
ah nvm
try using the very same path as your css
just replacing the folder name
On assets
I wish it was supported, I think it's a great format
SyntaxError: Unexpected token < in JSON at position 0
const data = await response.json();
anyone know of a good way to prevent this error?
see what response is returning
< tells me it's returning an html page instead of a json
what are u trying to fetch?
oh maybe that's an error page of the API I'm using
probably
it's the phishing API db
you should be checking the status returned before u try to parse it
anything that's not in 1xx/2xx range should be treated as error
I see
tbh even 1xx because those are informational statuses
I'm not sure how to check for them now as the error only happens sometimes, it's kinda annoying when it does happen tho
should I just check if the status isn't 200?
check if status % 200 < 100
or Math.floor(status / 100) === 2
that's probably better
alright thanks
Is there a way to check if a user is a server administrator OR has a specific role with the convenient decorators, without creating a custom one?
Example:
@commands.is_owner() # Either this
@commands.has_permissions(administrator=True) # OR this
async def somecommand()
discord.py rewrite? (2.0.0)
Dont owners inherently have admin?
actually yes i think they do
but not the other way around
just keep the @commands.has_permission then
if I'm the owner of the bot but not an admin in the server where it's used, will it work just with the admin check?
oh isowner checks bot ownership?
I thought it checked guild ownership
Well, generally speaking bypassing permissions because you are the bot owner is a bad idea.
for example if you happen to join a server your bot is in you're giving yourself access to permissions you should not have
I see. I don't really mean this in a malicious way but more so I can execute some commands in the bot DM and it would recognize that I'm the owner, and also administrators would be able to run the same commands in their servers
yes it is bot ownership
so basically I want to allow any admin to use the commands, but in DM I want only me to be allowed
I imagine discordpy wont even let you do it.
If your account gets hijacked and some random guy takes advantage of this and reeks havoc
What about allowing either a specific role or any admin (without that role)?
Do you really need dpy's decorators to accomplish this?
So the admin of a server would not have to have the "bot admin" role assigned to them
no idea
I wanted to use decorators since I'm moving to prefix commands now and wanted it to be clean and efficient
moving to prefix? 👀
it would be a bad time to swap to prefix
haha nah I was simply checking message prefixes before, that's why I'm changing it cause it was bad and I know it was
Especially since its now going to be basically impossible to get the content intent
You'd need a super valid reason
You're right but I'm not gonna have to move to slash cause I got the message content permission from Discord
I had a super valid reason 😛
What does your bot do?
I wouldnt be surprised if they start forcing slash commands one day
even with the intent
I don't see why not
There is virtually 0 reason to use the other option
My bot learns what to reply to messages so it needs to be able to look at every message
You are quite literally making your life a living hell
it's a really unique bot I haven't seen anyone else do it
and the functionality cannot be accomplished otherwise
Unless I literally take every message that it learned and make it a dynamic prefix which would be horrendous
Not to mention, with prefixes people are constantly having to remember what your prefix is
especially if its customizable
so the prefix is not customizable
Either way I don't wanna have to remember how to use your bot
I want all commands to have the same prefix, and then whatever doesnt get caught with the prefix will simply go through inspection of the content
Did you asked after the users consent?
I'd rather it be easy and just type / and look for your bots icon
everyone is so worried about my bot. It got verified for a reason. The users choose exactly what to teach it
It's not a trojan horse
not everyone is a criminal
I dont think anyones accusing you of anything
No one said you were
sure, just sounds like everyone is trying to find what I did wrong lol
With a bot like yours viewing every message
ofc
Especially if you store those messages
idk if you do
Any new user using discord today will only know slash commands.
it wont be long until a large percentage of users dont know what prefix commands are
but if ya do
anyone who has the message content intent does
I do appreciate ur feedback regarding slash, I tried it but had a few issues, probably since this isn't really stable or I was missing something
slash is very stable
I mean you said "with a bot like yours viewing every message"
i say many bots do
Viewing every message isn't really the concern
its a matter if you store those messages or not
Storing them is a completely different topic
but guys, I was just asking for now if u know whether I can allow a server admin - or - a specific role to invoke a command 😅 how are we discussing the malicious ways my bot can be used
Messages are private to people outside the server or who doesn't have access to them
so if you store them not saying you do be careful
You have to hash the content, when you store them
oh I thought someone gave the answer already
We already answered that
this one
yeah but the command won't get invoked if I do one of the checks with the decorators
as for how you do it, I haven't used dpy in a while so I have no idea just read the docs
it would be inconvenient to divide my commands to certain roles and then have one without any decorator at all, checking them inside the code
Does it matter if it gets invoked if you stop the execution of the important bits?
wdym?
Well, before you execute any of the actual code that does something
do logic checks before it
they're stored safely, I did dicuss this thoroughly with Discord u can rest assured
inside the command block
so if you find they don't have admin or that special role
halt execution of any further code in that block
I see no other way unless someone knows of a decorator to do it
or the other way would be to create a decorator that checks for either bot server admin or specific permission
Also, it may of been annoying to talk about how malicious your bot could end up being, but I would take what we said to heart. We aren't bashing you, we just want to make sure you never get bit in the ass
You could do that as well, the world's your oyster
mmm oysters
oh that's fine mate I'm just used to lots of cynical talk in this server so I'm already assuming people are trying to find my evil intents
and I will take that feedback as well to see if I can improve it even more
It's always good to talk to new people about that kind of stuff. Get a fresh input for a change
Your terms of service looks good, would make the privacy policy more detailed + describe the process of data deletion
Confuzzled.
This seems misleading, just saying
Sounds like you work for Facebook, WhatsApp, twitter, and Instagram building their APIs
I would say “I work with popular social media APIs”
Not “I work on popular social media APIs”
"with" sounds like one is formally affiliated with it.
If one were creating libraries that use said social media APIs, it would probably make more sense to write "I work on libraries that interact with social media APIs (..., etc.)"
Maybe then “I interact with popular social media APIs to build tools for others”
"I use popular Social Media API's to create various projects" how about if i write like this
but I still don't know how to move the portfolio span next to the sentence
do you have any default css on the span element?
sounds like its being set to block instead of inline
Same for tag a, same for tag p
try adding display: inline
its normal for p to be block, but a and span should be inline by default
unless you have some css that changes it globally
Is anyone aware of the weird way to use && in js? Like somewhere i saw (true condition) && (code to execute) I don't mean the ternary operation though
&& means "and" in JS and runs left to right, short-circuiting when one of the conditions are falsely.
So true && false && console.log("Nay") will result in true and false being evaluated, but not the console.log(...) (it returns false since that's where it ends).
You see the pattern sometimes in React apps where there isn't support for proper if conditions so people use that instead.
Or sometimes by people who want to write compact code
I wouldn't recommend using && as a replacement for if statements or ternary expressions unless you have to.
i use it a lot
you can do things like: ```js
return promise.then(x => console.log(x) || x)
average ternary enjoyer
spy style
function spy(x) {
log(x);
return x;
}
return promise.then(spy);
promise.then(!return)
headers: {
...headers,
...body && typeof body === "object" && !Buffer.isBuffer(body) && { "Content-Type": "application/json" }
}
why not
It's an awkward way of accomplishing the same thing as if.
Yeah that's true
Plus, && eventually returns a value (either the first falsely value or the last value in the chain since everything was truthly), which may be annoying in some contexts where it's not appropriate (e.g. React's notorious "0" when rendering).
Okay 👍
Is it possible to create forum channels with Discord.js?
I'm pretty sure you can, just pass the type option with the GuildForum enum
I'm gonna build a basic web api with rust, should I use actix-web or rocket
I'd say try Rocket
(I'm down to use either, just gonna try making the same basic student API in both and compare experiences for yall)
Last time I used Rust it was still in development while actix-web was production-ready
So Rocket may have new interesting ideas
I believe both are prod ready now
I'll try it tonight and get back to you on the experience
I feel like it's fun to try out different frameworks and compare the pros and cons between the two in a language I enjoy with a task that is pretty simple at its core
Generally Actix-Web is more mature than Rocket as it has received a lot of fixes and web-related implementations
But Rocket can also be interesting, so I'd say give both of them a go, do a few tests
Though Actix-web had that one incident where the dev quit due to the community
Hmm, show code maybe?
(async () => {
await message.guild.channels.create("forums-test", {
type: 15,
permissionOverwrites: []
})
})()```
evalling that
Wait, what discord.js version are you using?
Why not update to v14? Or is that in-progress already?
Damn
what the fuck is invalid or unexpected token with this:
const sprite=require(`../assets/locations/dungeons/${ randDung }/${ randEnemy }.png`);
@earnest phoenix
I suppose Discord doesn't allow creation of forum channels through the public API yet
just asked someone and they said its because my server isn't in the rollout yet
You're importing a PNG file, do you really think any mainline programming languages allow that?
probably not
They would have to read the PNG file and return a bitmap of some sort, what you're looking for is probably canvas
To load the image, use the loadImage() function
I mean this is normal with webpack but yeah
im just trying to send an attachment in an embed
Then you can just pass the path of the PNG file to the attachment
aye but then i get this hmm
alright, on my way to resolve imports of files in my language to read their contents if they’re not .breakfast files
which of these doesnt use current dir as starting point
its supposed to be ...\Documents\RPG-Bot\assets\ ...
tried in a server with 316k and it still didnt work 
You aren't supposed to the path to the file in your local drive to the attachment:// prefix, only the attached file name
ohho kay
i kinda forgot how to code since ive had copilot
i cant just tab to win
its still reading the dir incorrectly
oh i think ik why
i got it
but it failed to put the image inside the embed hmmm
Zamn
honestly it's not a terrible idea
although I'm sure there's some sort of argument to not be doing that
why is it failing to put the image inside the embed ive had this issue before but i dont remember the solution
just return an object with like ```
{
metadata: someFileMetadataHere
contents: rawFileContentBuffer
}
petition for @earnest phoenix to add this into js
You're supposed to do this, this is just an example
import { AttachmentBuilder, EmbedBuilder } from 'discord.js';
...
const attachment = new AttachmentBuilder('../images/cat.png', 'cute-cat.png');
const embed = new EmbedBuilder()
.setImage('attachment://cute-cat.png');
await channel.send({
attachments: [attachment],
embeds: [embed]
});
Then replace AttachmentBuilder with Attachment, and EmbedBuilder with MessageEmbed
the concept is still the same
oh its attachments not files
never mind
attachments isnt valid outside modals
or i did something wrong
await first.edit({
embeds: [{
title: `You have encountered a ${ randEnemy }!`,
fields: [{
name: "Health:",
value: `${data.enemies[randEnemy].health}`
}],
thumbnail: `attachment://${randEnemy}.png`
}],
files: [`./assets/locations/dungeons/${ randDung }/${ randEnemy }.png`]
});
too lazy to trim indents
Mmm maybe 
You're supposed to give the attachment a name
elaborate
For example
files: [
{
attachment: `./assets/locations/dungeons/${randDung}/${randEnemy}.png`,
name: `${randEnemy}.png`
}
]
oh whattt since when does that exist
And then you're supposed use the name you've given to the attachment after the attachment:// prefix
that was a fail as well. still put the image outside the embed
Show code
Does the value of the randEnemy variable contain spaces?
nope
figured it out
turns out thumbnail needs to be formatted like this now:
thumbnail: {
url: `attachment://${randEnemy}.png`
}```
This is why you should use builders such as the MessageEmbed class, there's literally no reason to not use them
Literally no reason to use em
Not only do they look cleaner but they can also avoid things like this
Chaining methods over multiple lines as well as adding their arguments over multiple lines looks cleaner than an object/array with accurate brackets?

hey volt do you remember how to filter out button pressing from people who didnt start the cmd
like inside of this
compare the interactor id with the original user id
i think there was a way to do that
wait, a built-in method?
They're cleaner to the reader, and definitely help the developer just set what they need instead of having to remember the Discord API's structure for multitude of objects
d.js users have it too easy
no i dont think theres a built in method for that
The button has a message property as reference to the original message and it’s author
why not just use interactionCreate instead of awaiting it 
because i need to collect it one time why would i make my event listener longer
All you need to do is compare the ID of the user who started used the command, and the ID of the user who used the message component
ive done this somewhere i dont remember where though
For example, interaction.user.id === i.user.id
I wanna say remembering the API structure is the same as remembering the methods itself while it’s usually obvious that for example addFields is the equivalent to the fields property
But yeah
Anyone know of some good REST API planning tools/software? I'd prefer to just have something online but if I have to download a tool I'll bite the bullet if it's appealing
Especially Since djs enforcers the API structure as arguments builders have become more useless
Not really, some of the builder methods do other things and set the given value to nested properties/options, which makes it easier for the developer, that's the only reason the builders exist in the first place
Just trying to keep my plans organized here so I can ensure I build the exact same api in each framework
For example, the setColor() method does conversions for easier setting of the colors, the setAuthor() method sets to nested properties that the developer may not be aware of, some others also do validation, and other things
Guess we have different opinions about that like always
Well I’m not saying I don’t use any util
For colors there’s an util resolveColor()
That's what the setColor() method uses
Yeah so doesn’t actually matter which method I call here
Unless I’m passing my colors like the api expects anyways
But yeah I get what you're saying, the way you mention is straightforward if you know exactly what the structures look like and don't really need validation then you're free to throw the builders away, while thinking that you won't forget how the structures look like
Builders are just there to make things easier and better 👀
Like I said while I have to remember the structure I do also need to remember the equivalent builder methods
Something I have to check the docs in cases I forgot
No matter which docs I check
And still I don’t suffer ridiculous name changes of djs versions
As the api structure most likely doesn’t change
That's what the IntelliSense is for, usually when you're working with objects that have no references to the typings then you'd have to remember the properties/options, while for the builders it's always there, regardless of you remembering or not
And it always guides for the values you need to provide as well, while also performing validations
Well ok that’s a different perspective tbh
I don’t have intellisense used ever before
Do you know what IntelliSense is?
Usually when you write code, it can suggest the variables you've declared, or the functions, a list of the things you've imported, and suggest methods based on the typings, that's what IntelliSense is
It's available in almost every code editor and IDE, and usually enabled by default
Working with the methods it auto completes for u might be easier then
Well connection lost

Fucking trash country
not today
It’s most likely how you grew up with things
As I never used that auto complete feature I tend to prefer the raw object structure as I’m needed to study the docs anyways
And it however still looks cleaner in my opinion
But i get your point especially when it comes to code validation any typing checks
It doesn't really auto complete, but rather suggest the things that already exist, almost everyone uses IntelliSense (except for the folks that use text editors that don't really support it, such as GNU nano, Vim, etc etc)
But I suppose it's just preference I guess
Yeah suggesting … auto complete … I mean when you click the suggested option
It’s auto complete for me while yeah it’s just a suggestion
You have to confirm or not
If that's what you meant by autocomplete in this case then yes that's kinda autocomplete
The conclusion here is just preference I suppose
Yeah
what is this
^
Error [ERR_REQUIRE_ESM]: require() of ES Module
import instead
how do I get a free domain? anything with butler in it is fine
just want do have a domain so I can make a sub for my dashboard
instead of having the domain be a sub of an already existing website
the most free domain is just free for one year
you're likely not going to find any permanently free domain
ah I see 😭
not working
import ms from "pretty-ms";
``` what is not working?
import * as ms from "pretty-ms";
cry about it

import * as ms from "pretty-ms";
^^^^^^
SyntaxError: Cannot use import statement outside a module
any alternative for pretty-ms
anything else i can use
or can i down grade pretty-ms
how to check if a variable is number or not for my timeout cmd
isNaN
I can't write a good decription for my bots about me
can anyone help 
I want to keep it short and concise, that's what I initially come up with
"The Best Discord bot" when will you stop being so bold?
it's bad to self-elevate like that
no work
if (isNaN(duration)) return message.reply({ embeds: [timeEmbed] }).then((sent) => {
setTimeout(() => {
sent.delete();
}, 10000);
});
if i say !mute @member 1m it will say not a number
here is my code
https://pastebin.com/MiN0njuQ
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
read what I just said
isNaN will return true if it is not a number
you have the condition inverted
I didn't know what else to put
All this effort will be obsolete at September 1st

Im curious if it makes more sense to tell people to move to slash commands instead of solving common command issues
Especially if people state they don’t have the privileged intent anyways
i need developer guys
for what
for my serveur
but for what
as in to do
to help with a problem you're having or to work on a bot for you
creat room and rols
I don't understand much about the settings
Do you need help with a specific bot you already have?
And I want to have a server and I want help on this my friend
yes
You may want to check if that bot has a support server
God is special to understand you
So much so that I grew up and became a materialist
Accept a friend request to show you and help me
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at new NodeError (node:internal/errors:371:5)
at defaultResolve (node:internal/modules/esm/resolve:1032:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
at ESMLoader.import (node:internal/modules/esm/loader:332:22)
at importModuleDynamically (node:internal/modules/cjs/loader:1036:29)
at importModuleDynamicallyWrapper (node:internal/vm/module:437:21)
at importModuleDynamically (node:vm:381:46)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at MyClient._loadCommands (C:\Users\-\Desktop\Dank-Assistant-TypeScript-Rewrite\dist\src\structures\client.js:68:70)
Why would I get this erorr when trying to run this code in it’s compiled state
const moduleMeta = (await import(resolve(metaPath, moduleMetaFileName)))
.default as ModuleMetaPayload;
i’m using the v18 node
logged the path and it is js C:\Users\-\Desktop\Dank-Assistant-TypeScript-Rewrite\dist\src\commands\chat-input\module.meta.js
You must prepend "file://" to any and all imports with the dynamic import statement
is this like a bug with node:path or just an inconvenience
Neither as iirc, you can import modules over the network. The api is to be similar to the web import statement as that one is all about web requests
without a handle, I'm guessing it assumes it's a web url
Unless you're using esm because "insert library here" is esm only, then I'd probably just stick to cjs as esm isn't where it needs to be and seems to only further divide the js ecosystem with all of its nuances and requirements that need to be fulfilled specifically for that purpose
Which is faster? n === 0 or !n?
they're the same, if n is treated as a boolean and not a number
you won't notice a difference
does this work?
no
thats not what i asked
in vps
what is webhook-topgg.com?
never used that service, did you configure it correctly?




