#development
1 messages · Page 1984 of 1
huh
you dont use command.data.name in the code you sent
@fallen holly
it looks like it is just command.name
Line 17
You could either push your commands to the commands array or I think you can just use the client.commands collection/map
yea i was just using client.commands let try just using folder > file
insteade of > commands > folder > file
Well you aren't doing anything with the commands array as tim states here
So it is just using an empty array thus no commands are actually pushed to discord
Also tim I might use tiny-discord it looks interesting
Lmao
I might bug you about the code it uses internally tho
I am interested in how the bot keeps a connection alive
your code for tiny-discord is a bit confusing to me (im looking at the websocket stuff)
if theres any specific part you dont understand i can try explaining
I am mainly looking at the connect method in the Websocket file, I assume that makes the initial connection right?
it's your code so the entire thing we don't understand
I won't lie a lot of it is rather confusing to grasp
that is only cause I am not used to using half of what tim is using tho so
yes, the initial connection is a regular http request, thats how websockets work
I don't understand websocketing
the request contains an upgrade header telling the server to upgrade the connection
then once the upgrade is established, the raw socket can be used
basically
you know more or less how http works right?
there is headers, then data
yea
hello please gimme socket
yes here's socket
*shake hands*
every single request needs to create a new connection, send a new copy of headers and the data
a websocket basically is an agreement with the server to not close the connection, and instead keep using it
so both client and server start sending and receiving only the data part
without headers
without methods
how does heartbeating work
without any extras
I see
discord's?
no websockets in general
its up to the server and client to agree
its basically just a way to check for inactivity
for example both server and client agree that the socket should be closed if there is no activity for X time
so if they wish to keep it open, they will periodically send something every X time to prevent it from being closed
usually its the client's job to send it to prove its still connected and alive
the server will usually just watch for inactivity and close inactive sockets
it can be anything
the websocket protocol defines how the data is organized
each message contains a small header identifying what type of message is being sent, how big is it, etc
and the protocol includes a "ping" message type
which is what is usually used
the ping message type may contain optional data
but discord doesnt use the ping message type, it uses normal messages
Ah I see
I am trying to figure out where to go from where I am now to reach my end goal
what is your goal?
Well i've talked to several people about this and i've gotten a lot of good answers but I am still unsure of what to do exactly. My end goal a project I want to do whenever I am ready is to make a platform for people to get exposure and make money for what they do (not disclosing the target audience anymore as I don't trust people not to try and rip my idea)
well, you need a database, a login system, a payment gateway, and the usual stuff
security has a lot of factors, you'll need to spend some time on it
indeed
its not hard to make a secure website, just annoying
I am just not sure where to start and what to focus on learning first
With a project this scale I have a lot to learn
especially when I am doing it alone
start with the basics, for example a simple login page
I think you should handle it securely
So no storing plaintext passwords?
you can use email and password, or you can use several existing oauths like google facebook etc
I prefer to not use any existing oauths
While it would make my life easier
I just don't want it to be a sign in option
for passwords, pick one of argon2, scrypt or bcrypt
I usually use argon2 but I heard it isn't really good to use
they never gave a reason to why tho
it had a couple vulnerabilities found, but has since been updated
Also how should I handle protecting endpoints?
its currently the recommended one for new projects
That was my issue when I was making a prototype then I realized I needed to step back and learn a bit more
either use something like an api key, or use sessions
I was planning on using sessions so they have persisting logins without aving to login every single time they visit the site
person logs in, create session, store it in a cookie, check and validate the cookie on every endpoint request
you also need to track the sessions in your database
if you want
I want to try and do smth without nestjs as it holds my hand too much
Mmm ima use express then or at least try to without hurting my head
Also if I wanted to protect a endpoint i'd have to use middleware right?
its an option
doing it inside the request code for example
Mmm
I would honestly like to find a way to make it so I don't have to keep defining it in every request
If I could pass it down to all requests that'd be nice
middlewares are just a way to organize it
yea
If I can somehow make it so I can pass the protection middleware to all the routes in that group e.g users, posts, etc then that would be nice
you can do that with express Routes
Oh?
oh damn I can use router.use
That is very nice
welp i g2g sleep, see ya
Cya thanks for the talk
whats the difference between proxy url and url of an attachment?
com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message
at com.mongodb.internal.connection.InternalStreamConnection.translateReadException(InternalStreamConnection.java:701)
at com.mongodb.internal.connection.InternalStreamConnection.receiveMessageWithAdditionalTimeout(InternalStreamConnection.java:579)
at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:415)
at com.mongodb.internal.connection.InternalStreamConnection.receive(InternalStreamConnection.java:374)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:216)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:152)
at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:976)
at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)]
at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1444)
at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1048)
at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:109)
at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:131)
at com.mongodb.internal.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:718)
at com.mongodb.internal.connection.InternalStreamConnection.receiveMessageWithAdditionalTimeout(InternalStreamConnection.java:576)
so im using MongoDB Atlas as my DB and my bot is running on my raspberry pi and i get these errors randomly and im not quite sure how i should fix these
because most of the time everything works fine (and after this error it reconnects automatically) but i would like to prevent these errors
java 
final CodecRegistry pojoRegistry = fromProviders(PojoCodecProvider.builder().automatic(true).build());
final CodecRegistry codecRegistry = fromRegistries(MongoClientSettings.getDefaultCodecRegistry(), pojoRegistry);
final MongoClientSettings settings = MongoClientSettings.builder()
.applyConnectionString(new ConnectionString(Env.get("DB_URI")))
.codecRegistry(codecRegistry)
.build();
final MongoClient client = MongoClients.create(settings);
final MongoDatabase db = client.getDatabase(Env.get("DB_NAME"));
``` my connection config is mostly default (the env string only contains retrywrites=true and w=majority)
is there a way i can send DMs without having to client.login? like can i use the client id directly to make some api call and send dm to a specific user?
You will still need a created application but no gateway connection to send a message
But as discord states, this endpoint is heavily rate limited especially if you’re opening multiple DMs
mmm
i only need this to send dms when someone votes
but if too many people vote at the same time, it'll be a problem ig hmmm
any idea on the number of calls to this endpoint per second?
What are the chances many vote at once
very slim but still possible
well one could argue, i could process the votes but just fail to send dms
even if i got rate limited how long will i be blocked? etc wanted to check that
Well a queue and timeouts are your solution then waiting between any DM
you could put dms in a queue, and send 1 per 30 seconds, for example

mhm, that works ig, but it would still be helpful if could see the numbers given by discord xd or atleast the requests they expecting
you could test it yourself
so that i can push 5 - 6 dms in 30sec
make a bot which spams DMs and see how many DMs you can send before you get ratelimited
but will i be unblocked after sometime tho?
You will get rate limited yeah
It should contain the duration until you can use this endpoint again
@sterile olive why not fast
@quartz kindle bro
can you resume an interrupted git clone
I kinda stopped the chromium clone because it took way too long
the object file is still there tho
17gb in size
anyone here that worked with chart.js before?
yesss just ask your question
bruh no way i asked that question in here i just found the answer in google after searching for 8 hours
you kinda already fetched the origin
try simply doing git pull
How can I check if it's me (the developer and owner) accessing my chrome extension when it's downloaded?
ip address maybe
just maybe
or mac
can mac be even exposed to websites?
Oh okay
ping pong peng

Why is three?
because four was scared to go out by himself?
its running on my pc atm
~ latency
there are three because ping now, 5 min average, and 15 min average 🙂
why not use separate charts for all three?
did you ask consent from your users that your client is collecting their data?
... but im not?
Anyove know Svelte ?
but you have over 20 charts worth of data?
I'm sending a request to the API to get the data from the back-end. After the data comes, I assign the object to a variable and display it on the front-end but the loading screen should appear until the data comes otherwise I won't be able to get the data from the object and it will return undefined
so what you're saying is there should be a loading screen then show the data after it has been received?
it should show the loading screen before retrieving the data
Is there a way to check if data is coming?
I also have no idea how to show the loading screen until the data comes in.
i put it to check if data is coming
what does it output?
yes i tried it and it gives 2 outputs (strangely) one is undefined and the other is object (asd)
which one is undefined
one console.log(asd) text return 2 outputs
or, when your data comes in, change the visibility of an html element within your js
just a second i will run my code and send the output
both outputs are output of asd
but my code has one console.log(asd)
yes my aim is to solve this problem
but there is await/async?
but i don't know what i can do
Before defining the asd value, the front-end is also trying to enter { asd.username } in the div
why do you have a function called post but its main function is to GET?
that doesn't matter for site stuff
but its value is undefined because it doesn't equate asd value to object yet
try .then()?
I forgot to edit it, but I don't think the problem is caused by that. 😁
await is only blocking this
ok I think what happens is, when the DOM loads, it gets asd gets consoled. then it will GET, then log response. When asd changed, the div updates, so it is being logged again.
you need to set asd to loading.
yes here is how i can do that
oh yes that makes a lot of sense
<div>
{ asd.username ? asd.username : "Loading..." }
</div>
can't i use it like this?
asd.username ?: "Loading..."
unexpected token xd
elvis isn't supported?
asd is not an object, it will return undefined because there is no username value in it.
isnt it going to automatically update when variable changed
asd?.username ?: "Loading..."
let asd = { username: "loading"} put this onmount
will it update when asd is changed?
yes
yes? there isnt any loops or anything to check
unexpected token xd
try this: let asd = { username: "loading"} put this onmount
oh
const axios = require("axios")
const users = ["935943222411292692", "941521375938642013", "935943222411292692", "941521375938642013", "941519376211935245", "941514790625501194", "941524029066579979", "941517557863686154", "941514790625501194", "941522289864896564", "941521677777526814", "798324345638092863", "941519526846156902", "941523682487062579", "941516578938323024", "941524200181620757", "941523525376811068", "941523945369260042", "941524848876871701", "941525837931491329", "941524815955759106", "941525464080609340", "941525998049034311", "941527422690541658", "941524392813400085", "941531113820655616", "941529411361079377", "941525139126902826", "941531654109921330", "941532802959147058", "941474989641695263", "941531610405298236", "941531268129124353", "941531610405298236", "941531550338646107", "941531235019276311", "941532403023884339", "941527739490500688", "941532678983942186", "941534397063135242", "941534373021360148", "941534296139776032", "941535170933170176", "941526712003461130", "941534730040520704", "941535387229257728", "941511860673466398", "941512335380611132", "941511860673466398", "941512446143787069", "941514475926872074", "941512651475918878", "941507798246756403", "941510543783628810", "941512751036125206", "941512014684106825", "941512205789188196", "941509301225279569", "941510109962567701", "941510716064694364", "941516383739584572", "941508015054524436", "941514761802227752", "941509610358054982", "941514269688741950", "941515671718740068", "941512626452713522", "941510061988139089", "941513783262724138", "941510051938566185", "941510963583143946", "941508375513030696", "941510261649600522", "941508964804358174", "941509054633750569", "941507261946265651", "941509023952425001", "941505075015192576", "941504717958307850", "941507513961041942", "941508790728130580"]
users.forEach(async function(user) {
axios.post(`https://api.blacklister.xyz/add/${user}`, {headers:{Authorization:"api key"}, body:{reason:"Discord phishing scam", "evidence":"https://capy-cdn.xyz/no-evidence.png" }})
})``` why does this give unauthorized but when making the post request myself it works? I replaced api key of course
frameworks like react or svelte update the page when rendered values get updated
The reason that worked is due to the ? Behind the asd which checks if the key exists or not. If it’s a required key I’d suggest doing a check before that so you don’t run into later issues
they basically listen to anything that's visible
@rigid maple
?
holy
maybe because rate limits?
Isn't axios post work like
axios.post(url, data, config)
```?
so when using asd?...., it first checks whether asd has a value, right?
data is an object, data and config both are optional
when the page loads, it checks for the value of asd, then it finds out that there isnt data so it returns undefined
understood thanks
the body and evidence is what the api she made requires, without it, it will return an error 500
it is like the parameters for a function
Yeah i know
But in axios you set it via the data
not body
@spark flint you solved it yet?
no
@sacred aurora
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
});
Exactly
maybe without .post() it requires to be sent as data
is the authorization string a-z with 0-9 or is there any special chars?
cany you also try to set content-type as x-www-form-urlencoded or application/json?
Axios automatically handle that
also why are you using axios
the problem with this is that you literally send {headers: {....}, data: {...} as the body
i got it working
okay nice
const axios = require("axios")
const headers = { Authorization: "apikey" }
const users = ["935943222411292692", "941521375938642013", "935943222411292692", "941521375938642013", "941519376211935245", "941514790625501194", "941524029066579979", "941517557863686154", "941514790625501194", "941522289864896564", "941521677777526814", "798324345638092863", "941519526846156902", "941523682487062579", "941516578938323024", "941524200181620757", "941523525376811068", "941523945369260042", "941524848876871701", "941525837931491329", "941524815955759106", "941525464080609340", "941525998049034311", "941527422690541658", "941524392813400085", "941531113820655616", "941529411361079377", "941525139126902826", "941531654109921330", "941532802959147058", "941474989641695263", "941531610405298236", "941531268129124353", "941531610405298236", "941531550338646107", "941531235019276311", "941532403023884339", "941527739490500688", "941532678983942186", "941534397063135242", "941534373021360148", "941534296139776032", "941535170933170176", "941526712003461130", "941534730040520704", "941535387229257728", "941511860673466398", "941512335380611132", "941511860673466398", "941512446143787069", "941514475926872074", "941512651475918878", "941507798246756403", "941510543783628810", "941512751036125206", "941512014684106825", "941512205789188196", "941509301225279569", "941510109962567701", "941510716064694364", "941516383739584572", "941508015054524436", "941514761802227752", "941509610358054982", "941514269688741950", "941515671718740068", "941512626452713522", "941510061988139089", "941513783262724138", "941510051938566185", "941510963583143946", "941508375513030696", "941510261649600522", "941508964804358174", "941509054633750569", "941507261946265651", "941509023952425001", "941505075015192576", "941504717958307850", "941507513961041942", "941508790728130580"]
users.forEach(async function(user) {
axios({
method: 'post',
url: `https://api.blacklister.xyz/add/${user}`,
data: {
reason:"Discord phishing scam",
evidence:"https://capy-cdn.xyz/no-evidence.png"
},
headers:headers
});
})
afaik it must be
axios.post('uri', {body goes here}, {headers: })
That doesn't make sense but if it works, it works
what doesn't make sense
yeah
Theres nothing changed
I mean the .post disappeared
its in the method option
https://capy-cdn.xyz/Cme5KuY6.png yep it worked
aren't you guys see this while code?
its basically there
you just need to follow it
Whred you put the headers?
config
in the config
already said it right here
But didn't she removed the .post()?
yeah thats another way to write it
there are two ways to make a request
but its just axios(config)
axios.post or axios({method: "post"})
nah theres a lot
it can be get, patch, delete, etc
...
lol
Which ks better to use
well its up to you
both are same ig
Then why did she remove .post()???
why does it matter it's the same thing regardless
let desc = ""
new Promise(function (resolve, reject){
request.get(`SOME_URL`,
(error, response, data)=>{
if(!error && response.statusCode==200){
// console.log(data)
data = JSON.parse(data);
// desc = data.data.article.body.content[1].children.children[0]
desc = data.data.article.body.content[1].children[0].children[0]
console.log("Hello WORLD "+desc)
resolve(desc)
}
reject(error)
}
)
})
// let desc = item.content
console.log("NO MORE"+ desc)
Why does this NO MORE get printed first instead of HELLO WORLD
because promises resolve some time later in the future
Would probably be better you wait for it to resolve first and then print that
e.g. .then or await
Or just moving the console log inside the promise
If you can await it, yes.
Though, are you using request?
Aka that old npm library
yes I'm using request
is it no good or something?
That library's been deprecated for a while.
You could use a newer library, like node-fetch, which has async built-in.
pip install requests -> npm install requests pog
chop off the s
chop off the requests
...?
what does it do?
and I got this error
when using node-fetch
Uncaught Error [ERR_REQUIRE_ESM]: require() of ES Module d:\Upwork\rss-cramer-headlines\node_modules\node-fetch\src\index.js from d:\Upwork\rss-cramer-headlines\index.js not supported.
try using import fetch from "node-fetch"
tried but showing
SyntaxError: Cannot use import statement outside a module
(node:13628) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Waiting for the debugger to disconnect...
d:\Upwork\rss-cramer-headlines\index.js:4
import fetch from 'node-fetch';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
Here's the full error
don't bother with node-fetch if your type is not set to module
https://www.npmjs.com/package/got is pretty good
with a very similar API
Ah... node sucking me at it's finest just cs I dunno basics of it
Also you could use utils.Promisify to make the request function return a promise
so u don't have to do it yourself
npm install got same as npm i got ?
yes
same error
what's the error?
Error [ERR_REQUIRE_ESM]: require() of ES Module d:\Upwork\rss-cramer-headlines\node_modules\got\dist\source\index.js from d:\Upwork\rss-cramer-headlines\index.js not supported.
code: 'ERR_REQUIRE_ESM'
var information = require('./information.json');
can you tell me how can I change this to ESM way?
or module way
You'll have to set type to "module" like someone said earlier, you'll also have to rename all your .js files to end with .mjs. Honestly just use a lib which doesn't use ESM
I can't fathom why all these libraries are making such a breaking change
Currently I get this TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".json" for d:\Upwork\rss-cramer-headlines\information.json
you'll also have to rename all your .js files to end with .mjs
really?
that sounds awful
Not sure if it's required for ALL files, but files which use import need to have the .mjs extension
And I'm guessing also for files which require that file and so on
I want to a JSON file
but wouldn't files requiring mjs files also have to be mjs files
which is information.js
like how using promises goes
you cant code in a json file
ye that's what I said
ah didn't see your followup
Bruh I know
var information = require('./information.json');
That should work, do you still have type: "module" inside your package.json?
that could be causing the issue?
yes I've type: module in package
remove it and see if the error is still there
import Discord from 'discord.js'
const bot = new Discord.Client()
import information from './information.json'
import fetch from 'node-fetch'
would've probably been better they stick using request for now
currently this is how it is
yeah you can't use import to import json files
also, fetch is being added to node natively
So I get it require cannot be used in modules
and import cannot be used outside modules
so I'll just have to use fs.readFileSync as you said to read JSON file
right?
mhmm. Or just get rid of modules and use another http library which doesn't require ESM
you can import json files
import * as config from '../../config.json';
and I use fetch with import just fine as well
import fetch from 'node-fetch'; seems to work
but you can't use it with require
In d.js v13 how can the bot play on a stage channel
As my bot joins but says its playing but it does
Also no errors
bots aren't allowed to speak in stage channels iirc
Kay.. i have an Var that i can only feed with an object in the "ready" event.
So, how the f. can i export this object for use in differend .js files?
I tried exporting it.. it stays undefined
you need a file which only exports an empty object and then assign values to it later.
how can i check if message author has ban permission etc
they can
weird
i tested with a simple music bot code, it worked
Well. They need special perms to speak
Nope they can. I made it work
You need to check all of their roles allow field to see if any of them includes ban
can't you just check if they have ban_members
are you using a lib which handles permission mapping? I'm talking about raw api since that's what I use
Okay, i created a module with an empty object called "manager" i also exported it.
Then i loaded it into my ready event.. but i guess.. it doesnt get "saved"?
Because outside of the ready event, the object still is empty
Error: TypeError: message.member.hasPermission is not a function
ahh its message.member.permissions.has() now
examples from my bot:
https://github.com/AmandaDiscord/Amanda/blob/rewrite/source/index.ts#L17
https://github.com/AmandaDiscord/Amanda/blob/rewrite/source/index.ts#L28
https://github.com/AmandaDiscord/Amanda/blob/rewrite/source/passthrough.ts
https://github.com/AmandaDiscord/Amanda/blob/rewrite/source/modules/EventManager.ts#L6
oh ffs.. i guess i wait until discord.js-lavalink gets updated
Well.. than i will take it down on April 30.
i don't understand anything from that lol
What's difficult to understand?
So.. i use my "lavacordManagerObject.js" for creating the empty object.. required it as a var on the top of my index.js.. so i can export it with all the other Vars/Const/etc
Feeding obj. "manager" in ready.js with data.
Something like that
Manager (index.js): {}
Manager (events/ready.js): {"_events":{},"_eventsCount":1,"nodes":{},"players":{},"voiceServers":{},"voiceStates":{},"shards":1,"expecting":{},"user":"1234567890"}
Manager (structures/Queue.js): {}
and when are you trying to access obj.manager elsewhere? After the ready event?
Jup
Actually. I have a good idea. The token of your bot contains the user ID
One sec to figure out how to reverse it
Uh.. is there a PHP lib for Discord and Lavalink? lol
Thats a scripting language i really know how to use. xd
for Discord, yes. For LavaLink? mmmm. idk
i think i will get cancelled if i use php for that kind of stuff
@slow ibex
const userID = Buffer.from(token.split(".")[0], "base64").toString("ascii");
it has been 2 seconds
Yup, this seems to work. Now my ```js
send: (packet) => {
let guild = this.client.guilds.cache.get(packet.d.guild_id);
guild.shard.send({op: packet.op, d: packet.d});
}
Is the only think that makes some problems
just do guild.shard.send(packet)
Still no guild defined
And if i remove the whole send thingy.. it cries that this.send is not a function
cant read shard or cant read send?
Just ReferenceError: guild is not defined
i mean.. i call that directly under client.login();
Just add a check for if (!guild) return
do you wait for the ready event?
Tim. I need you to review my slimmed down version of your ws shard code
guilds take time to arrive, they wont be there immediatelly after connecting
thats what the ready event waits for
sure
fyi, all of the actual Discord logic is handled elsewhere
let { Manager } = require("lavacord");
//var { manager } = require("../lavacordManagerObject");
const manager = new Manager(config.nodes, {
user: userID,
send: (packet) => {
if(!guild || guild == null) return;
client.cache.guilds.shard.send(packet)
}
})
Idk why... but.. i cant catch get.
Feels like the Movie "Catch me if you can"
You had to add the if (!guild) return underneath the definition of guild
now its never defined
what is this lib
is client even accessible tjere?
whats the point
But.. i never define guild o.O
not using a managed lib like discord.js. This is where the user has total control over the stack
stack?
each part should be separate from another imo so that you can take services offline as necessary
infact... its the first time i directly call guild in "index.js"
you had guild defined here
now its gone
ffs..
is there an easy way to have an imap server lookup the incoming email address and forward to a specific email?
| STACK STRACE:
| TypeError: Cannot read properties of undefined (reading 'guilds')`
Yup.. the old problem
you will need to show more code
where are you defining this entire Manager thing? in what context?
I told them to do it in the ready event, then they said they needed the ref in other files and when I showed my solution, they didn't understand
Code? Sure.. but please... i am not responsible for depression or PTSD or anything else.
https://www.toptal.com/developers/hastebin/ahovumojet.js
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
oh fck
reset your keys
Yuuuup
personally speaking, I don't think a bot should be your first or one of your first projects in a new language because there are tons of nuances
yes so what would i use
import
not valid outside a module
might need to look at the specification for import in webjs
Hello, could you please tell me how to make a message in which you forgot to specify who you want to bite in embed ?
module.exports.run = async (message, client) => {
if (message.channel.type == "dm") return;
let member = message.mentions.members.first();
if (isNaN(member)) return message.reply('You forgot to mention who you want to bite.');
let embed = new Discord.MessageEmbed()
.setColor(`#303030`)
.setDescription(`<@${message.author.id}> made a bite ${member}`)
.setImage(`https://i.imgur.com/Bdf5EKT.gif`)
message.channel.send(embed);
};```
how to make a message in which you forgot to specify who you want to bite in embed
W H A T

You can message.reply with an embed too
return message.reply({ embeds: [{ description: "You forgot to mention who you want to bite." }] });
There you go.
yes, just reply with an embed rather than a message
An embed with just a description.
i wonder what version of discord js they have... message.channel.send(embed);
ok, sql time:
let's say I have a record ((1, 2, 3), obligatory to be a record) and want to retrieve all rows where array_agg(x.column) contains all values in said record
That wont work then
is there a way to convert a record to array?
return message.reply({ description: "You forgot to mention who you want to bite." }); // djs v12
Okay thanks, I'll give it a try.
Or with a specific color... { color: 0xff0000, description: "You forgot to mention who you want to bite." }
Neither the first nor the second option works
It should... on which djs version are you?
could you send your current code with the addition fake gave you?
Ah I see I forgot something
Looks like I didn't remember the old syntax correctly
return message.reply({ embed: { color: 0xff0000, description: "You forgot to mention who you want to bite." } });
There we go
module.exports.run = async (message, client) => {
if (message.channel.type == "dm") return;
let member = message.mentions.members.first();
if (isNaN(member)) return message.reply({ embed: { color: 0xff0000, description: "You forgot to mention who you want to bite." } });
let embed = new Discord.MessageEmbed()
.setColor(`#303030`)
.setDescription(`<@${message.author.id}> made a bite ${member}`)
.setImage(`https://i.imgur.com/Bdf5EKT.gif`)
message.channel.send(embed);
};
Is that correct?
should be
that should work, yeah
Let's hope for the best
reply({ embed: { color: 0xff0000, description: "1" }, embed: { color: 0xffff00, description: "2" } });
But I'm not sure tbh
Yes it works thank you very much
it doesn't like desc only
this looks horrible as well
Since a few weeks, it did before
Is it worth upgrading to version 13 of js?
You will have to anyways
@quartz kindle did you notice any issues btw
what did they do to them?
I prefer the older versions
They fucked up the padding for description embeds only for some reason, it was okay like 1 month ago
:D
I noticed my self, too a few days ago
They are already deprecated

how does the api versioning work with djs, for example does v12 use some older version of the api or does all versions of djs start to use the latest api version?
i think 12 uses api v6 or someting
I dont think it does automatically use the latest API version, that would cause things to break they can't fix within their version
^
well what is the point then to start creating a bot with an old discordjs version
There's no point anymore as older API versions will be shutdown soon anyways
yea
v13 uses api v9
v12 uses api v8
v11 uses api v7/6
v7/6 will be decommissioned and will no longer work. v8 and v9 will work for the time being, but they'll both be deprecated
funny because v9 didn't come out too long ago
@boreal iron Where to get more colors with this designation 0xff0000, I just use a color with # and it is different
v10 will become the default version after the april deadline i believe
google "hex colors"
man mvc pattern is so much typing
I've been writing code the entire day and I'm barely 20% migrated from all the stuff the library I was using autogenerated for me
.setColor("#303030") your color would be: 0x303030
You should see the pattern 
🙂
ookay, ty 👍🏻
yea it seems like it
wait, so a new version of discord js will be coming soon?!
exactly!
I mean regarding their package v14 is in development
I havent even finished updating my junk to v13 😦
lol yea i may have to
Doubt there will be many breaking changes compared to v13... but I literally got no clue
hopefully nothing too crazy
If I'm not wrong you can check their github
I have enough of my own code to be sifting through though 😛

are js { hello } js {hello} js {hello } ```js
{ hello}
if that's inside a string, no
mogus
const hello = "hi";
console.log({hello});
valid
ok
wut? "string" is not the same as "string "
very suspicious
@boreal iron @quartz kindle speedyos board meeting
so uh
how would i implement streams lmao
events
i want to implement something similar to the linux virtual file system with the /dev/xyz
seems inefficient considering you can only send 4 bytes per single event right now lmao
how does linux do it
but i will do it through events if i have to
well
something like cat /dev/random
on a low level, streams are probably made with a circular buffer
If I host my bot on github -> heroku can I use json files and modify them for economy commands?
the writer writes at whatever speed it can until the buffer is full
the reader reads at whatever speed it can until the buffer is empty
pretty sure json is read only in heroku, meaning you cant edit the json file with your bot
ty
how do i make my bot join a voice channel and play a youtube videos audio with djs?
FakE here: urgent dispatch: driving situation is complicated: gotta meet you later
ah, but how does it know what buffer has been read?
theres 2 pointers in a circular buffer
one tells you what has been written, the other what has been read
its this thing i showed you before
I see that's interesting
the bit that probably writes to the circular buffer would have to be a process since it would have to stop and wait for the reader to read
mutex
streams are usually IO anyway
between two processes
if you want a stream inside the same process, just use events
in d.js v13 is it not possible to set the voice volume and bit rate?
connection.subscribe(player, { volume: 1, bitrate: 64000 });
@quartz kindle so streams are kinda only for data where:
- you might only want a certain chunk of data or want to do something one by one without having the whole thing
- you want the data upfront no matter if its complete or not
- you dont know the total size of the data upfront
- theres an infinite stream of data and you only take what you want
for small data like a struct perhaps (information about a process) you could really just return a pointer to a chunk of memory containing that data couldnt you
i mean you could do that for everything in my os since there is no network or disk io
pretty much
Can I add data to users profile in mongo later with the schema?
I don't want to add all at once (a 50% of things aren't added in the bot anyways)
Yes you can
Yes but make sure you handle errors
no worrires
I will be here in some time when I add the rest of the things and need help updating profiles, moved to mongo yesterday
MongoParseError: option usefindandmodify is not supported
at parseOptions (/home/runner/Clash-Chest/node_modules/mongoose/node_modules/mongodb/lib/connection_string.js:289:15)
at new MongoClient (/home/runner/Clash-Chest/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js:62:63)
at /home/runner/Clash-Chest/node_modules/mongoose/lib/connec
why?
Probably deprecated.
how do i use ytdl-core and djs to make my bot play a youtube videos audio?
useFindAndModify deprecated
root@mail:~# node app.js
/root/node_modules/sender-rewriting-scheme/dist/srs.js:20
throw new TypeError('Missing secret');
^
TypeError: Missing secret
at new SRS (/root/node_modules/sender-rewriting-scheme/dist/srs.js:20:19)
at new ForwardEmail (/root/index.js:389:16)
at Object.<anonymous> (/root/app.js:5:13)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Node.js v17.5.0```
hey, how do i get all the user who reacted to a message, without the reactionevent?
Might be possible using fetchmessages? I in fact only will need the emoji, and who reacted to that emoji
you have to manually pipe things through ffmpeg
it's saying client.on is not a function
name: 'interactionCreate',
async execute(client) {
client.on('interactionCreate', async interaction =>{
if(!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
if(!command) return;
try{
await command.execute(interaction);
}catch(err){
if(err) console.error(err);
await interaction.reply({
content: 'an err',
ephemeral: true
})
}
})
}
}
Yup
GuildMember.id is valid. Although it usually points to GuildMember.user.id
either way works
ok
can someone help me i'm lost
yo guys so what is a good server side rendering react framework that isnt nextjs
because nextjs has a stupid thing where the session arent long lived
so you constantly have to reconnect your db and write your code in a way that it expects restarts
What are you trying to do?
Exporting the event listeners into modules?
Remix
Although its not mainly meant for react
And I never used it but I heard its good
just so you know its all gonna be server side only
so you can't mix client side and server side like in nextjs
react isn't a strict requirement for me lol
might be a problem
can you like write code to submit form data?
Idk
just so you know its all gonna be server side only
so you can't mix client side and server side like in nextjs
not to sound rude, but how is that different from a traditional web server?
they meant as in how you can mix client and server side code in nextjs
and it kind of just works
it's very buggy
you can accidentally import server side libs to the client just by not using a library
wtf
Remix is used with express actually lol
Remix is a new react-based JavaScript framework that supports server-side rendering. It comes from the team behind React Router and provides a fresh take on fullstack web app development.
#react #js #firstlook
🔗 Resources
- Remix Docs https://remix.run
- Remix vs Next.js https://sergiodxa.com/articles/remix-vs-next-js-comparison
- Next 12 F...
Here is a video of it
If you wanna know more
why is node so oversaturated with overcomplicated web libs
🔥🚢
idk bro
but ima try remix
because it's easy to publish
Because everyone thinks they can do it better.
watched a bit of the video. looks interesting, though I personally don't like the idea of using a file structure as a router
i think this says something LMAO
I think it's a research problem. So many JS frameworks seek out to solve these "big problems" that have already been solved by other ecosystems with solutions that don't involve building framework on top of framework
yeah nvm its my dns server
idk why but on my arch installation the dns is always fucked up
it says a website doesnt exist when it does or loads forever on some websites
docker run -p 3000:3000 --env EENGINE_REDIS="redis://:THISISAVERYSECUREPASSWORD@localhost:6379/0" andris9/emailengine:v2
why idn't that working
Remix doesn't try to solve any new problem, it tries to solve exisiting problems in new ways
That's true of every most framework though.
literally every js web framework lmao
Speedy I think you're being a bit too rude
No
why
Feels like you're laughing at link to put them down
no?
that was more of a headless statement
its true in general
most new frameworks try to solve different things in different ways
It's less about the statement and more how the response is perceived
That's just what I think
uh im not going to consciously try to soften my responses just because it may offend someone
if you're not happy you can always ignore me
Softening does not require laughing in one's face
On the subject of solving problems, I was considering learning Svelte more recently after watching a video on multi-page apps vs. single page apps. Did some tutorials, then realized it was very similar to existing solutions in other ecosystems
you obviously do not understand my sentiment but okay i dont want to talk anymore about this
anyways ima try remix
Choose PHP, it will solve all your issues Sir
I think JS is having this round trip moment where libraries try to solve simple problems in the most "fabulous, fantastic" forms, which points people away from the fundamental problem.
thats why i dont like the ecosystem
it becomes very saturated and gives you many decisions
good thing in essence but too many simple decisions
i think someone explained in a video i watched it leads to decision fatigue
I'd argue it actually gives you less choices.
Since you have to adopt some framework's system and have no flexibility to choose other things.
i.e. coupling
haha yea
php is the key to everything why use all the modern and flashy frameworks
when you have something thats been reliable for decades
what do you mean you dont like the syntax? its beautiful
Actually have scheduled therapy? Must be nice having someone to talk to
yeah but that doesn’t help for everything
what more do you need
A response
Aye and still shockingly fast
And with v8 pretty much state of the art
body pillow:
warm cuddles 
beautiful 
available 24/7 
cost: one time investment
can sleep on 
shoulder to cry on 
therapist:
warm cuddles
depends
beautiful
depends
available 24/7 
cost: hefty recurring fee
can sleep on 
shoulder to cry on
tears do not get absorbed by skin
and yes i did just spend 3 minutes writing that
lmao
All my efforts to get you into PHP…
I think we need a group exorcism in this channel
As we now know a therapy doesn’t help, too - thx for that cry 
@marble juniper i think remix suffers from the same issue as nextjs unless im doing something wrong
data does not persist between sessions
or at least not reliably
localhost in containers refers to the container itself, not the host
if you want to run multiple containers like that in the future the correct way to do that is by connecting the containers with a docker network and referring to the other containers on the network by their name instead of localhost
if you host a lot of infrastructure stuff you might wanna look into something like saltstack or ansible btw
so your deploys are reproducible and run with a single command
anyone know if its possible
to
make a batch-like javascript app
like
with pop ups saying for example choose 1 or 2 to go to (whatever) or (whatever)
Like a normal bare-basics "first touch" command-line projects?
Or was it just me who always started with libraryless CLIs when starting a lang?
In university we made so many "press X to do Y"-kind projects
yeah basically just for example:
[1] Go to X
[2] Go to Y
Type your answer:
Just do it normally, using stdin and stdout
How u access those on js is a different story
yeah i can get the input my thing is how should i handle what gets displayed
should i just do a check for the input
if input === 1 do whatever
else if input === 2 do whatever
i see
Except they are interacted with on a third-party site
You'd do exactly the same but interacting on ur pc
I made it so that my bot sends a message when it joins a new server, but realized it won't send the message if the channel perms disable it from sending messages.
I thought "SEND MESSAGES" permission would override it
What permission apart from ADMIN would fix this?
Just get the first channel that you can talk, not just the first channel in the guild
What a bad practice to send a message in a random channel
I would respond with some instructions when somebody run a command the first time or if someone mentioned the bot the first time
Of course in the channel it happened
it's saying client.on is not a function
name: 'interactionCreate',
async execute(client) {
client.on('interactionCreate', async interaction =>{
if(!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
if(!command) return;
try{
await command.execute(interaction);
}catch(err){
if(err) console.error(err);
await interaction.reply({
content: 'an err',
ephemeral: true
})
}
})
}
}```
and it is in event handler
Show how import that module
Oh no that gets complicated on mobile
first parameter isn't client
it's ...args
so inside that export what ur getting isn't a client but an arbitrary amount of args
Not only that
He’s already creating the event listener and tries to create another one inside its execute method
so do i flip ...args with client
client.on(event.name, (...args) => event.execute(...args, client, Discord));
That already creates the event listener
You execute method includes another creation of the same event
It includes another client.on("event"…)
ye you're supposed to respect the full signature
that's one of the 412749 reasons I find js weird
it doesn't enforce declared signatures
do i remove client.on and keep client.once
No
client.once is for events that are only fired once per time you run the program
putted this in my interactionCreate and it's not console logging
module.exports = {
name: "interactionCreate",
async execute(client) {
client.on("ready", async () => {
console.log(`${client.user.tag} is Online`);
// await mongoes.connect(config.MONGO_URL ,{
// keepAlive: true
// })
});
},
};
Oh dear god
Please never, ever, ever, ever, EVER create an event listener inside another event listener like this
aight
you want a stackoverflow? because that's how you get a stackoverflow
Remove the event listener from your event file
That’s just memory leak city
i did
As I explained above
The file (code) you shared in pastebin above
Errr sourcebin I mean
That’s your event file
That’s your event handler
Remove the event listener from your event file
aight
What you’re doing when calling your execute method is:
client.on("interactionCreate", (args) => { client.on("same event", (args) => …
If that’s done you need to get your arguments in the right order
Ok great my screen is dying
Great… back to a different phone as my screen died
can you do this in nextjs this concise @woeful pike

remixjs is my new favourite
its awesome
make the error get angrier for each successive retry
thats either server side error generation or a state hook where you keep track of the amount of errors
anyways its 3am goodbye
by
Not sure whats happening to my screen but it doesnt look about right
you mean that weird gradient on the top?
Lemme try to
that looks like a broken crystal
note how the top right is excessively bright
ye, broken crystal probably
(and display)
That was yesterday
Didn’t really think about it
Thought it would be a software issue
if it makes you feel better my lcd pixels on my phone are starting to burn in
Turns out it isn’t 
if you stay on something bright for like a minute or so it becomes visible after you get out of it for like 2-3 minutes
I prefer amoled displays
the true black is so mesmerising
that's just an amoled issue
amoled, cathode rays and idkled are prone to burn-ins
Anyways seems like I should backup and transfer my data soon
just change ur display
Before it goes black forever
Not really hard to change an iPhone display but impossible to save my data when it goes black in cases unexpected things happen 
Fuck this, gonna buy a Nokia 3310 again
lol there must be more wrong with the phone
my screens lcd 💀
that's a virus in ur screen
has it gone black yet
I think this thing may have a short
ffs
best is to shutdown ur phone and take it to technical assitance
r/FirstWorldIssues
Well let’s hope it lasts for a few more hours until I’m done sleeping
Aye
See ya
my gosh English is also broken
That’s no valid way how to include a css file
Remove the style tags
The link tag has to be a children of the head not of a style element
Also I’m not sure if that will work anyway
Guess you will have to find out after fixing your html syntax
ohk.. so ig the file will contain the style tags?
like this?
iirc you can use @bleak crane in topgg soo.. ig this shld work
The CSS file never contains the style elements
You told your html site already the included file is some CSS
you gotta use style tags only if you wanna write some css code directly into your html code without importing a style sheet file
does discord js, or discord api in general, have or recommend some way of generating a snowflake like id for things?
oh hey dang thats awesome, ty ❤️
yea im reading up on it now ❤️
so this function: {member}.disablecommunicationUntil()
src: https://discord.js.org/#/docs/discord.js/stable/class/GuildMember?scrollTo=disableCommunicationUntil
that 'times out' the member...
is that like, muting them for x duration?
It disables any possible action the member can have in the guild
Writing, joining channels, reacts etc
so like a more powerful mute 😄
you think it should replace a mute command entirely, or work alongside it to act as a more powerful mute?
yea ill just implement both. upto the user if they want to setup a mute like role etc
The member can literally do nothing like if he got kicked
lol, savage
yes
rip mute command 😂
Hmm not all discord features are terrible
I'm so confused as to how the {limit:10} option actually works for fetching channel messages when it isnt used?
or wait... its passing the {limit:10} as the message object?
ahhhh ok ok i see now. im dumb. leave me alone its 7am and i havent slept 😂
You’re basically passing objects as arguments anywhere in v13
Makes way more sense imo
why findOneAndDelete is not working?
I mean the past was a desaster, you could pass a string here, an array there, sometimes both etc.
Not really intuitive
Why is it raining?
How about some context, code and errors if you ask a question?
Why Fake exists?
To give you the possibility to ask this question
And to save the world
And to keep up the local economy
And so on
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.
The guildID and LogID should be deleted after executing the command
Okay i found the real error so yea
I'll try to fix this to myself
XD
DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `useFindAndModify````
deprecated
yep that's why its not working, i fixed it thanks
