#development
1 messages · Page 1399 of 1
lmao
i am not feeling entitled or anything.
I'm trying to setup webhook listener using express of nodejs. But the test button isnt sending anything! ||no auth key is used cuz the webhook doesnt ask for it||
you posting your stuff for a week already its not interupting at all
through what did you make the listener
express module
okay jet pump it up
Anyways if you don’t use a command handler, just check if your content includes your command prefix, then splitting the content and use the array elements as your args will do the job for you
express module and also, i tried with online webhook listener, but 
ye, online webhook listener is not good in your case
why not
But it’s like impossible to give you an example on mobile, but I’m sure someone will help you how to use split
well if i'm hosting an express module to get the post requests, thats online too?
In the case you don’t know.
Can someone help me ? my bot has a streaming problem I can't solve, it works normally on my computer, on vps it doesn't work like it doesn't play music, and a music bot
give some code so we can see how we can help you 
how i can download a video of youtube and send the file in .mp4? 🤔
sorry, i'm new to this can i send the error that appears in visual studio?
sure
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); in this whats the password?
Just whatever auth token you're using i assume
nvm
your password can be whatever you want. It's just to verify it's coming from DBL and not some third party
{
title: "hi",
url: "https://google.com/"
}```
I think
For embed Javascript
That's how it'll be sent to Discord. You may be using something else. I don't know what embed JavaScript is referring to.
Pato you didn't show us the error
you showed us the stacktrace
but didn't include the actual message
const embed = new Discord.MessageEmbed()
.setTitle(A HYPERLINK TEXT)
Hamood, set the embed's url
I think .setURL
Doesn't the setTitle allow two args?
txt i think
const embed = new Discord.MessageEmbed()
.setTitle('title')
.setURL('url')
they want to set the title zeph
here
yea
i mean you can check in https://discordjs.guide/popular-topics/embeds.html#using-the-richembedmessageembed-constructor if you want
I want the title hyperlinked.
The title is the "Freshstart"
To remove the undefined, do .setDescription(description)
const embed = new Discord.MessageEmbed()
.setColor(colors.cyan)
.setTitle("Freshstart")
.setURL("https://www.google.co.uk/")
.setDescription("Hello")
message.channel.send(embed)```
I did that.
Ignore google link
Ok now
That will work
What did it give
This is what's hyperlinked
The same picture above.
That’s what it’s supposed to do man
How can I remove the undefined thing
setURL() is used to do a hyper link to a title, so that's what you're asking
There’s no way to hyperlink description through “.set”
just remove ```js
.setDescription()
If you want to put inline urls, do [some text](https://google.com)
Ok soz, it worked! 🤦♂️
Nice
I'm sorry.
the problem is that it doesn't work with embed titles
Bot Developer
this is what ```js
.setURL
Bro, I just woke up @tribal siren
😂
Ill need to have coffee after checking an error my idiots sent.
lmao ok lemme believe

Peace.
Anyone know how to make a rob command on bdfd
Wtf is bdfd?
"bot developer for discord" which is a shit app on mobile phone for pretend devs.
ask in the bdfd support server
Alright, so whenever I shard my bot, the server's data is still there. BUT, a couple of hours later, a lot of people are dming me that their data is gone. But then a couple hours later, it's back. This is because I have 3 shards on my bot. And for some reason, every few hours, servers change shards. As an example, a server changes from shard 1 to shard 2, which means their data is still in shard 1, but not shard 2, then a few hours later their servers moves back to shard 1. How do I shard my bot where you keep the same shard forever?
I thought it wasn't supposed to switch shards
Can I use djs properly with latest version of node15.x??
you mean completely kills the process
yes
ok I'll to try to catch that 😁
Lul node is becoming a lot closer to java
and thats actually a good thing, in my opinion
why though
but I use typescript, so nothing new for me
JavaScript is already very weakly-typed
java in 2020 lul
Java yesterday, java today, java forever
2 billion devices
I don't like writing Java myself but it's okay
Actually, I abandoned oracle JDK a long time ago
So it's been a time since I've seen that billion devices screen
and most of those devices were shitty contracts in 2005 for phone manufacturers to have some shitty java games lmfao
oracle sucks ass
Like, that "you cannot use jdk commercially" is what I call a strategic dick move
give us your address, DNA sample, iris and your hand to download JDK 8
And the only advantage of jdk over openjdk is the ease to install
internally oracle distribs have some very very small performance advantages
but it can be looked over cause of how small it is
Why canvas is not working?
Details plz
cuz ur not good in Math
Details plz
it just dont install, with node1.15
Errors?
dude, i tried before to install canvas on nodejs 1.15, but i got errors! i downgrade it too 1.14 and errors fixed
i tried them in 2 vps, but same error
Ig node 15 has some breaking changes
1.15?
You either downgrade or search if someone made a node 15 compatible canvas
and y homebrew doesn't install the node-lts
yes, there is much more
can you upload it to a site like hastebin
3x more as of that image
Java naming system 
minecraft
java 17 lts 
17 is still in development ain't it?
Will it have major features?
the current one is 11 so everyone sits on that
Like, 15 got text blocks
they have virtual threads
which are useful
for keeping an imperative code base with other languages doing coroutines or async/await
Nice
There's a lot of other stuff but virtual threads are the only things that interest me
A thing I've been waiting forever is inline variables in strings
oh yes I do wonder why java doesn't have that
17 versions and we still use String.format
@rocky hearth aye gg on your bot accepted lmao
Fun fact is that kotlin has it
I use Kotlin more than Java but still don't like it. I feel like it tries being easy then it quickly jumps
I still don't understand its coroutines system
Yeah
yeah, but do I know you?
Also they try to convince u that functions are funny /s
Yes you helped me like trillion times here
nah, funky
Btw, do you remember how not to use lambdas?
Like, I definitely forgot how to write codes without lambdas
H
I can live without them, but convenient. I like being able to place the function to pass outside argument list. kotlin call([1, 2, 3]) { nums -> nums.forEach { num -> println("$num!") } }
Swift has it too and uses it so much in SwiftUI over methods in classes
how i can download a video of youtube and send the file in .mp4? 🤔
Yo don't ping admins for your questions
carefully

my bot is logging this in console
StatusCodeError: 400 - {"message":"checkpoint_required","checkpoint_url":"/challenge/43857146388/KWBY7RX9pJ/","lock":false,"flow_render_type":0,"status":"fail"}```
what is this?
no idea.
400 being a bad request
looks like an instagram error from what google is saying
so why it comes
really?
Because you're trying to do something with the Instagram API? PRobably?
Well, there's a problem with it.
insta api is the worst
Check the Instagram api docs for more info on potentially why your request is bad.
Sounds like you're mis-using or abusing that API and they don't like it.
Sounds like instagram got rid of a lot of legacy api stuff. Potentially you're just using deprecated methods.
pretty much nobody will support the use of the private api
no one uses insta command
it's private for a reason 🤷♂️
i use the npm package of insta api
if not one uses the insta command then use, you can definitely just delete it 😄
Hello, I want to delete from a message all reactions that aren't from my bot (I'm using discord.js). Here what I've done:
// fetch previous message
message = await channel.messages.fetch(this.messageId)
// remove reactions
for (const reaction of message.reactions.cache.values()) {
console.log(reaction.users.cache.values()) // for debug purpose, it shows an empty object
for (const user of reaction.users.cache.filter(user => user.id !== client.user.id).values()) {
await reaction.users.remove(user)
}
}
But it removes nothing
@quartz kindle Quick question because I forgot, map first or slice first?
Do you wanna remove an element before mapping the array or not?
If you wanna purge your original array (returning the new array) and you wanna map that new array, then yes, use slice() as first
let array = ["Who","fucking","cares","this","shit"];
array.slice(0,3).map(element => { console.log(element + ".. \n"); });
would map the new array (["Who", "fucking", "cares"]) you can work with
but of course doesn't change the original array var
Oh that's what you mean
Ye
No mapping first doesn't work
Because slice returns your sliced array, map will use
Using map before slice will slice nothing
Map returns a value
Maybe you're thinking about forEach?
Your example suits forEach more tbh
Since it doesn't return a value
aye since I dunno what you're trying to do, lel
that's why I said
would map the new array (["Who", "fucking", "cares"]) you can work with
Which requires to use .slice() first and .map() after
I meant as in js ["Who","fucking","cares","this","shit"].slice(2).map(x => x + "\n"); ["Who","fucking","cares","this","shit"].map(x => x + "\n").slice(2);do the same thing
Anyone know how to make like a hunt command?
Define "hunt" command
Like u need to have bought a pistol then u go into the forest kill animal sell flesh for money
errr nope, it's not the same thing
first would skip the first two elements of your array, second example would not
can't u do that yourself
Tried but failed
yo skipping is just another word
try harder lol
How to make that the bot reacts and when the user reacts to that.. it deletes the message
Like the bot reacts a message and if the user reacts it. The message deletes
So it doesn't matter which order you do first (slice first or map first)
I mean just use an editor and try it out, but belive me it's not the same
It depends if you wanna (skip) REMOVE the first to elements of the array you wanna map (later) or if you wanna slice the map later
How to make like the bot reacts a message and when the user reacts it. The message delete
Does that not return the same value?#development message
reaction collector check if reaction is whatever emoji if it is delete message
It spammed errors.. that's why
Now my pc froze wow
what's the code you used
Js
Hello, how can i print all my args without put all with ","
That's actually incorrect, regarding to your example it will return
["Who","fucking","cares","this","shit"].slice(2).map(x => x + "\n");
cares
this
shit
["Who","fucking","cares","this","shit"].map(x => x + "\n").slice(2);
Who
fucking
cares
this
shit
Like this
I can't give the code cuz pc ded and time to sleep.. I can send the code tomorrow
What is that ?
Is your slice() not working? lmao
args.Join(",")```
Joins all args with a ,
lmao
it is
Oof

I have no idea what you're on about
It's this simple
I already got my answer anyway so that's fine
@queen needle Thx
well dunno what's going on in my editor... running a rm -f * to search the issue 
I already got my answer anyway so that's fine
aye
does map have a limit? (v8)
The Map() constructor? I don't think so
i got an error when trying to set a value above 16777216
well amount of keys
might try increasing heap
yeah stops at the same number RangeError: Value undefined out of range for undefined options property undefined
Same here
Why do I have the following error ?```py
for filename in os.listdir("./cogs"):
if filename.endswith('.py'):
client.load_extension(f"cogs.{filename[:-3]}")
Traceback (most recent call last):
File "c:/Users/Shaal0wFR/Desktop/Bot Discord/Unconnected Bot _BETA_/test_on_Atom.py", line 547, in <module>
for filename in os.listdir("./cogs"):
FileNotFoundError: [WinError 3] Le chemin d’accès spécifié est introuvable: './cogs'
i might surpass that amount in some cases so i'll probably stick to objects
it's not really documented anywhere other than one stack overflow post
yes
so you would do
@client.command
i dont know what the check for owner is
async def eval(ctx):
await ctx.send(eval(ctx))
or something

idfk how to make a stupid eval
anyone ever worked with crc32 ?
crc32?
yeah crc32 checksums
oh i havent
how do I do a refresh of my os.listdir directory ?
i need help with something. how do i code for javascript that if i input 100k ill get the value 100000 instead of 100 when i do parseInt()
doesn't work
@river wing check out https://www.npmjs.com/package/humanizer.node#metric-numerals
I've ran into this really annoying issue... So my friend and I made a database manager wich allows me to use db.get(), db.find(), etc and it basically turns into SQL and communicates with my sqlite databse. Now I need to find the data from a user where a certain key has a certain value now the issue is the way the database is stored is like this:
KEY | VALUE
user-<ID> { level: 0, money: 0, ... }
Now I need to get user-<ID> where level is 0 for example, is there any way to do that?
SELECT key FROM database.table WHERE value LIKE '%level: 0%'
if you just need the raw query call
alright ty
But having a user id as table key and searching for a random value just destroyes the concept of a database
?
No the level: 0 is an example
as the users have a uuid as one of the keys
thats what I need to find
SELECT key FROM MoneyMoves WHERE value LIKE '%uuid: ${value}%'; this returns undefined
oh and I'm also doing that as they have ALOT of data and the compressing algorithm I'm using compresses more of the string is longer so having seperate keys would take more space
Does the string uuid: xxx even exist?
instead of using this library do i have any other options because the library doesnt suit my applications.
in your db
what do you mean "doesn't suit my applications" 🤔
by using 100m it gives 0.1 and not 100 million
because it's using metric conversion
m means milli
i guess steal the logic from the library
and adjust it
ok means that the highest it can go is T?
try it and see
i mean Y
user-259776081316282368 {"uuid":"be8329ba6e084d2d80c23223ef9b7ebf","ign":"Vigintillion"}
yes it does
SELECT key FROM MoneyMoves WHERE value LIKE '%"ign":"Vigintillion"%';
I used ign here to hardcode it to be sure it works
you don't need the entire library anyways so you can steal the logic from humanizer and adjust it to work the way you want to
ok thank you
@boreal iron if u want to see this is how the data gets inserted:
INSERT INTO MoneyMoves (key, value) VALUES ('${key}', '${value}')
user-259776081316282368 {"uuid":"be8329ba6e084d2d80c23223ef9b7ebf","ign":"Vigintillion"}
SELECT key FROM MoneyMoves WHERE value LIKE '%uuid: ${value}%';
%uuid: is not your saved value
Is see "uuid" in your db being a JSON string not the value you're searching for (uuid:)
Saving a whole JSON string and searching for parts of the string completely destroyes the being of a database but okay
Search for "uuid":"${value}"
If the uuid is an unique hash anyways, just search for the hash itself, not needed to put "uuid": before
SELECT key FROM MoneyMoves WHERE value LIKE '%${value}%';
SELECT * FROM MoneyMoves WHERE value LIKE '%"${key}":"${value}"%'; works
But if I change * to key it returns undefined
Is the column name key?
oh lel yeah I see your message above
Question How do you change your bots page Colour I see people doing that but I wonder how?
u can add css to ur bot page
@tulip ledge that's weird, try to add the table name to test it
SELECT MoneyMoves.key FROM MoneyMoves WHERE value LIKE '%"${key}":"${value}"%';
But how would I make the full page a colour it would only make it the text box place
Just get the right element and change it's style
Most browsers having an element inspector and allow you to manipulate the source code to see the results
I used
<style>
body{
background: Hex code;
}
</style>
still returns undefined
well then select all in this case, dunno your code
well
the issue is
it returns this { uuid: 'be8329ba6e084d2d80c23223ef9b7ebf', ign: 'Vigintillion' }
not the key ;-;
when i try to use peerjs behind my nginx server it always appends /peerjs:443? to the end of the uri. is there a way i can stop this behaviour?
Well without being able to see the code... I can assume only
with me or...?
nope
ah
The result should be an array or object (depends on the program language by default)
I cant Dm u
It's not needed to see the whole code, just these few lines
Guess this will deserialize your JSON string
which is not what you wanna do
Just post the whole line
Think he said sqlite but dunno which lib
I wonder why he doesn't wanna post the whole line of code where he's querying the database
(or lines)
Regarding clusterization, what's the methodology of performing seamless deployment rollover during re-sharding?
Currently, I'm spinning up the new clusters as the old clusters are brought offline, but it feels janky.
@tulip ledge Not much we can do without these lines of code, sorry
hi, is there any solution to this
t h i s ?
perhaps
i have a server in nodejs, it receives clients and it works just fine, however, im trying to send custom data to each client manually
can you help me sdlkgndslkgn
manually?
Also is there another Discord server regarding the gateway I can ask questions in 
misly you expect me to know how to do this
yes
as far as i know, all shards should be taken down before changing shard count, otherwise there is a chance the new shards will overlap guilds with previous shards causing duplicated commands
you are very funny
nword o plenty
wrong channel
Yeah, that's fair point as well, I might need to implement queue de-duplication when bringing up clusters. I remember the gateway not allowing different num_shards, I suppose that has changed for larger bots.
so can someone help me with this, heres the code
Perhaps, I'll stop old clusters from issuing additional events while transitioning, that sounds better, and avoids duplication of events at the cost of a slight (noticeable?) downtime.
@earnest phoenix is there a frontend?
ho ho ho happy chrismas friends
yes
ho ho ho
c# application
ah
i dont know cs but i can try and help
do you have the necessary libs at the front?
yes everyting works fine
however, i need to manually send data to client (c# app)
ah
I'm assuming the gateway resume session_id is binded to the num_shards? Not sure if I can reuse to resume another cluster with different num_shards. That would help avoid hitting the ratelimit ceiling.
dont worry about c#, problem is with node
when you say manually send, what do you mean?
lets say when client connects, node opens a console that lets me input data to that client
id assume it is that
@idle mountain Hey, how big is coinbot now 
nothing, it will prompt in the same console
@keen drift big big
and only allow me to send to 1 client
i mean, guilds
yes, I was going to ask about your deployment method if it's big
it's up to 40k
about
deployment is ezpz, just build to linux, move files, and run
not sure where to ask regarding my questions 😛
this is probably the right channel for it, I just thought you were in the wrong channel by accident 
doesn't seem like anyone is doing distributed sharding so far here
hey guys so umm, the description containing a "\n" from DB doesnt go to the next line, but the mark ups like asd works
discordjs
@keen drift don't even know what that is, so nope 
my question: #development message
not sure why thats happening.
ah, yeah, i don't really use several clusters- just one server running is good enough for me. only 40 shards, so while deployment isn't seamless, I don't really mind it being offline for like... five minutes
can someone help?
lucky, I'll just mess around until I find something that doesn't break then
Hey is there a way to hook up my Discord bot to UptimeRobot so I can get uptime/downtime stats and notification?
Helpful Stuff```
`UptimeRobot.com Account`: `Free`
`Discord Library`: `discord.py`
`Language`: `Python`
`Python Version`: `3.?`
[this doesnt work please help me](https://alebot.is-inside.me/LxmyDqYo.png)```
open port
*on
and ping your ip:port
as
Shows the Global Market to find the Cards based on your requirements.\nUse filters to find the card you are looking for.\n[Example] iz market -n jett->Finds all cards that includes the name 'jett.'\n[Example] iz market -cls assassins->Finds all the cards that belong to the class 'assassin'.\nYou can use iz market buy/sell/remove to buy/sell/remove a card from the Global Market.\n[Example] iz mk buy <cardID>->Will purchase the card from the Global Market.\n[Example] iz mk sell <cardID> <price>->Will put up the card from your inventory on the Global Market.\n[Example] iz mk remove <cardID>->Will remove the card you've put up for sale on the Global Market
basically this string is coming from DB and it doesnt seem to be going to the next line... any help appreciated!
what is your db
what is that doing on mongo
Do I need to port forward?
yes
hmm
im fetching the string from db
its pretty easy
but when i send it in the embed
it doesnt detect the \n markdown
but it picks up the `` markdown
asd
Is port forwarding ever a security risk
Well you can costumize your port of course and allow specific IP sources only, in your case the IPs/DNS of uptimerobot
My WiFi goes down sometimes so it'd be helpful lol
Oh
anyone can ping your ip and port but you can reject it ez
probably not
I think my router supports most of the fancy stuff just with a horrible website
Well thank you
I have experience with Flask
well port forwarding is one thing, it has nothing to do with your firewall
doubt
Assuming your "self" host project is running on Windows/Linux you will have to allow the webserver/app to pass the firewall
there has to be a firewall
At least the port you selected
;-;
Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required.
xd
ouch
i dont think its a good idea
Port forwarding with it?
someone pls help?
with what
With Termux
this
@regal locust dont port forward on termux
with this
bad format
can u show the code
js?
yeah
idk xd
;-; sad
post the code, my magical glass ball doesn't work anymore
it has nothing to do with code
var command = await getCommand(args[1]);
const newEmbed = createEmbed(message)
.setTitle(Command: ${command.name})
.setDescription(command.description)
literally
all im doing
is getting something from DB
setting the description
desc = "Asdasdasdasd \n asdasdasd sdasd"
literally
sad
this works
but the "\n"
isnt working
Did you escape the string before inserting into the database?
xD
Even Discord escapes the string
Just replace \\n with \n
Because you're editing the database by hand, right?
wat buhr i legit inserted a string using postman
collector.on("remove", (r,u) => {
console.log(u)
})
it's printing the user that reacted instead the user that removed the reaction, what to do?
discord.js btw
you can't get the user who removed the reaction iirc
discord doesn't send it
what do i do with the markdown TwT
Once again, adding a string to the db including special chars like \ requires to escape the string which probably happens automatically due your lib.
yes but it isn't working
That means the value you will get from the database is an escaped value \\ is this case
ah
Discord doesn't show the 2nd \
so my \n from db will be converted to \\n?
yeah i got that
but my db has only "\n"
not \\n
so
from db
im getting \\n
That's why I said, replace \\n with \n
?
That's what you see not how it's saved
@earnest phoenix would you know how to help le me with peer?
can't right now
see the log from db
all good dw
Saved as escaped string \\n but shown as \n
ah i see
brb
it worked :)) thanks a lot!! today yet again i learnt something new!
Hey when im doing internal css it doesnt change the detailed description. It changes the regular back ground. How do i fix it?
use the element inspector to find the correct css selectors
Thank you
do you know peer
never used it
im really stuck here and its not fun
dam
its not even the internal shit
its just connecting to the server

whats the issue?
im trying to connect from my frontend to a peer server behind my nginx server
const myPeer = new Peer(undefined, {
host: "https://dice.ryadev.xyz/peer"
});
el here
and ive started the server with this
peerjs --port 9000 --path /peer --proxied tru```
<div class="content">
this?
@broken matrix Put !importantbehind all attributes which are already defined by top.gg
This will overwrite the prev set ones
@pure lion host is not supposed to have the full url
only the domain name
the rest of the url goes into path
@boreal iron could you show me an example
div.longdescription div.content
{
background-color: #ffffff !important;
}
ty
:D
how do i write somebody's username but not mention them: for example, "Hello, user, how are you" without doing @User#0000
I am trying to make a no prefix feature but have no idea. Can anyone help me?
@earnest phoenix either use another message event or call it before checking the content
What library are you using
discord.js
Then factor out checking if the message starts with a prefix.
If you already have a command handler it's just commenting out some code.
Instead your code should check if the message starts with the command name
@boreal iron this?
<style>
html, body { background: linear-gradient(to bottom, #9900cc 60%, #fdca00 100%) }!important;
</style>
not outside the attribute
inside
background: linear-gradient(to bottom, #9900cc 60%, #fdca00 100%) !important;
uh oh, im struggling with js here
im trying to loop something, but
gg
Okay, I will see if this works.
while (true) 😔
while data?
also it multiplies response everytime i send it
then if X has no prefix feature enabled, don't check for prefix
@earnest phoenix why the loop
i need it to send messages forever
Price are you forgetting to break out of the loop
setInterval(() => {/*code goes here*/}, timestamp)```
if you don't know yet, () => {} specifies an arrow function
its just a normal function but a shorter way of add
i keep running out of memory
but i need to manually enter a message
you can send a message every x ms
so it has to wait
then wait for user input
i tried this
bruh idk js, it odd
o wait
maybe im just retarded
i have 2 loops in both apps
ok it worked now, but every time i sent a message it multiplies it
server
that while is an infinite loop
tiMmMmM
its trying to connect via wss but i want to specify https
and i am passing in .pems at the server side but shit doesnt wanna connect
i like that debug message
you have yourself an infinite loop
use setInterval to stop el this
theres a client in other app pinging node server, server sends a message to client
but message gets duplicated
client code
yes, but c# waits right here
it doesnt go after that line until server has responded
ah
its adding clients for some reason, even tho its the same one
you're nesting events
so every time theres a connection, there is a new data listener
so if you called the connection event more than say, 11 times, you'd run into that error
idk is there anything better
yeah
as i said im new to js
so right now im making a webrtc app
is express.js same thing
im using express and the built in node http server
it functions fairly the same
everytime client is connected button gets added to a page
mmm?
send message to cilent
sounds good
i need just an example, will figure out other things
tru
actually i used to do it long ago
writing buttons and shit webpage with fs
and it bloody worked
but how do i connect that button to trigger an event? 😭
on a webpage?
ye, button on a webpage triggers event in node (For specific client only)
a form element
<form action="path" method="POST">
<input type="submit" value="send message">
</form>```
not a function but a file
yeah path is a path
i dont
put /
to your file which receives the POST request
should i use like ejs or
na c# has nothing to do with server
i like the ejs icon more 
node is the bad guy here
its not the oceans fault the boat broke
it does suck but everyone uses it
use deno 
still sucks. begone javascript
ts go brrr
high level javascript
js doesnt even use ; 🤮
it does
na i tried without it worked
we don't care
Unless you understand the specific rules of ASI, you shouldn't be omitting semicolons. They're not optional in ECMAScript, you can just omit them because the JIT compiler fixes them for you.
^
epic
btw does express support sockets and client shit
cs?
c#
Gotta post this, sorry :D
Semicolons in JavaScript are NOT optional.
A few examples to prove the point:
let a, b, c, d
const arr = [1, 2, 3, 4]
[a, b, c, d] = arr
(function test() { console.log(a) })()
ReferenceError: arr is not defined
(function() {
(function() {
console.log('Hello')
})()
(function() {
console.log('World!')
})()
})()
TypeError: (intermediate value)(...) is not a function
const someModule = require('some-module')
(async function() {
const thing = await someModule("blah")
console.log(`Hello, ${thing}!`)
})
a dont bring cs into this
I use semicolons myself, but I believe it's a choice for the developer because the times you do run into issues with semicolons are not often.
My point is they're not always optional, so unless you know what you're doing, you can't claim they are and not just use them.
fair point
so, my bot's dev version isn't resolving a user, me. can't understand why
it doesn't even launch
do you have intents enabled
are you looking in the cache or asking discord
has your bot been verified now
but you don't have it enabled
yes
bot.users.resolve('myID')
returns null
.resolve looks in the cache.
You'll need to use .fetch
which will return a promise resolving to a user
native deps are a pain in node pls
ok so when i try to start a peer server and pass in the ssl key and cert it returns 502 but when i dont pass in cert it uses wss and not https
the clientside uses wss but when i get through chrome it decides to work
actually it launched, but goes down after that xD
why?
show the url pls
Hello, could anyone send me a tutorial or explain how is it possible to make conversation with bot in dms. I want to do application bot, so it takes converation messages and send it as an embed in certain guild channel.
Discord js v12
If you want to do something every time the user sends a message in the DM, you might as well just listen to the message event and filter the channel if it's a dm
is there a way to connect via ws through nginx
@sudden geyser I'm pretty new to this, how can I do it?
Check if message.channel.type is equal to "dm"
^
ok thanks, I will try
what should you do if node canvas gives you
[Unhandled Rejection] Error: Server responded with 503
that isnt a canvas error
@broken matrix try using inspect element on the bot description
it is a canvas error
After that?
node_modules/canvas/lib/image.js:56:28
Which element do you wanna costumize now? @broken matrix
longdescription
did you just add?
the selector is .longdescription .content
the background value
that should change your description background
depends what u wanna edit
no, it's been on top.gg for a while
probably a cache issue
ok
Ok brb
div.longdescription div.content
{
background: linear-gradient(to bottom, #9900cc 60%, #fdca00 100%) !important;
}
Based on the background you mentioned
looks weird but I mean... why not
anyone know how to fix this, error:
C:\Users\gaute\OneDrive\Skrivebord\StatsBot\commands\weather.js:25
}).catch(err => {
^
TypeError: Cannot read property 'catch' of undefined
at Object.execute (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\commands\weather.js:25:7)
at Client.<anonymous> (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\index.js:35:34)
at Client.emit (node:events:329:20)
at MessageCreateAction.handle (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (node:events:329:20)
weather.find doesn't return a promise.
it returns undefined
You're probably supposed to do your checking in the callback.
In the callback, check if err is equal to null. If it is, do what you have in the callback right now. If it's an error, do what you're supposed to be doing in the catch block.
I still dont know how i can do it
In function(err, result) {...}: js if (err === null) { // stuff to do if there was no error } else { // stuff to do when there was an error. }
but it is with the args
C:\Users\gaute\OneDrive\Skrivebord\StatsBot\commands\weather.js:18
.setTitle(result[0].location.name)
^
TypeError: Cannot read property 'location' of undefined
at C:\Users\gaute\OneDrive\Skrivebord\StatsBot\commands\weather.js:18:31
at Request._callback (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\weather-js\index.js:49:18)
at Request.self.callback (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\request\request.js:185:22)
at Request.emit (node:events:329:20)
at Request.<anonymous> (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\request\request.js:1154:10)
at Request.emit (node:events:329:20)
at IncomingMessage.<anonymous> (C:\Users\gaute\OneDrive\Skrivebord\StatsBot\node_modules\request\request.js:1076:12)
at Object.onceWrapper (node:events:435:28)
at IncomingMessage.emit (node:events:341:22)
at endReadableNT (node:internal/streams/readable:1294:12)
i get this
and it cant get a result because the args is wrong
Then you should check beforehand if results is empty.
If it's always empty, you may want to revisit and debug your code to see if you did something incorrect.
I've not used the weather-js module.
hey @boreal iron i had a question about our conversation we had a few hourss back.
your suggestion was that i should remove the commandlineargs and work with normal args?
how would i do that
@earnest phoenix You can use express and ejs or react or vue to display variables in your website
Getting back to you tomorrow.
I’m on way right into my bed
Just split your message.content and use the array split returns to get your command parameters
Whatever they are
Splitting by whitespaces (split(" ") for example)
let params = message.content.trim().split(/ +/g);
params[0] is your command
Etc @eternal osprey
Difficult to type on mobile 
Ey, if i want what someone do @serverbooster and my bot say something, what do i need?
Search for the string in the emitted message event
Like this?
client.on('message', message => {
if (message.content.toLowerCase().includes("mati")){
message.reply('Tremendo come gordas ese');
}
}
For example yeah
@amber trellisbooster?
Lmao
@boreal iron is not running Hahaha
The others funcs
remove "@"
Isn't it a role?
Looks like so
Roles are formatted like this: <@&ROLE ID>. You can use let role = msg.mentions.roles.first(); and compare the role ID/name perhaps.
If someone mentions the role
if(msg.mentions.roles.first())
if(msg.mentions.roles.first() && msg.mentions.roles.first().name == "Server Booster")
Not sure if you need the first condition, will it throw a warning or not.
Yeah since if it doesn't exist it'll return undefined
If you use Node 14+ you can just slap an optional chaining operator mentions.roles.first()?.name == "Server Booster"
Damn didn't know about that, yet I use Node 14. Thanks!
Thx
@boreal iron thanks man!
Now if i want what someone @torn hollow and writes something?
Np
@torn hollow you want to detect if a role is mentioned and additional message is written or?


