#development
1 messages · Page 79 of 1
you do you anyway, but you should really consider at least a couple courses
why can i not understand how to conver fucking jquery into javascript
$(function(){
$("#vidLinks a").click(function(){
$("#modal").fadeIn()
});
$("#modal span").click(function(){
$("#modal").fadeOut();
$("#mainVid").attr("src", "")
})
})
;play 10 mg
document.querySelector(function(){
document.querySelector("#vidLinks a").click(function(){
document.querySelector("#modal").fadeIn()
});
document.querySelector("#modal span").click(function(){
document.querySelector("#modal").fadeOut();
document.querySelector("#mainVid").attr("src", "")
})
})
that's what i did earlier but it keept throwing errors about the query selectors
Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document': 'function () {
I guess it's a bad converter
every converter does this
but .click function seems a bit sus
isn't it supposed an entire event on its own
The click() method doesn't even exist on the elements
wym
Unless it's an actual button*
Have you tried logging what the query selector returns when you pass in the actual selector string?
You can remove the outer one in this case, the $(function(){ ... }) because that's not needed
it returns the nodes
five of them since there are five divs connected to this
I'm talking about the querySelector() method, it only returns the first element that matches the query
can i use querySelectorAll()
Yeah
Since it returns a node list you can use the item() method and pass the index of the node you want
And then work with it
If I remove that part of the code, will it still work?
ap.on('posted', () => {
console.log('Status posted!')
})```
absolutely impossible to say without seeing...yk...the code
but for all effects, try it and see
const ap = AutoPoster(config.topgg, client)
ap.on('posted', () => {
console.log('Status posted!')
})```I want to leave the console clean, without logs
You don't need to log anything
And if that's all you use that event listener for, you can just remove it
Yeah (reply to a deleted message)
ok
that's a terrible thing to want
a clean console is a bad console
obviously a too messy console is equally bad
a clean console is bad, a messy console is badder
const string = '8795485488564835575723945398498489398434434';
const bigInt = BigInt(string);
console.log(bigInt)```why is this instead of actually returning me the value
giving me an object
Shouldn't await be used for functions?
because BigInt is an object, toString it to get its value
when a function returns a promise, yes
so more accurately, it is used on promises.
Ah
bad, badder... badass?
Something to do with your console itself, Node.js logs the actual value by default (I didn't use console.log() here because it makes no difference)
that may just be the case of the node repl
it's still giving me this
trying to save a bigint to a string using sqlite, but it still seems to round!!
this was something i bothered tim with yesterday but it doesn't go away
Nope
Some consoles might take the output value and turn it into something else for whatever reason
Saving it as a string and converting it back to a big int from a string should be lossless
You're doing it wrong
const foo = 500_000_000_000_000_000n;
await saveToDatabase(foo.toString());
// ---
const bar = BigInt(await getFromDatabase());
console.log(bar);
// 5000000000000000n
i am not
i am getting a user input from a message collector and then saving it to a string in my database
Show your code of saving and converting back to a big int
i am not converting anything to a bigint. Let me show my code
if(connected == 1){
unverified_role = m.content
connected++
let currentDate = new Date();
let cDay = currentDate.getDate();
let cMonth = currentDate.getMonth() + 1;
let cYear = currentDate.getFullYear();
// await db.query(sql`ALTER TABLE serverdatabase DROP CONSTRAINT id;`)
await db.query(sql`UPDATE serverdatabase
SET unverified = ${m.content}
WHERE id = ${interaction.guild.id};`)```This is part of a normal message collector
it saves the m.content as a string
as unverified in the table is a string type
only thing i am doing next is console.logging the unverified in my table and it returns me a rounded version of the original
might need to do m.content.toString()?
It's returning a number, not a string like it's supposed to from the database
Because it's a string type
I would say this is either the fault of your database or something you're doing which causes this
strange tbh
You don't seem to be saving it as a string though, you're just passing a number to the right-hand side of the assignment operator in that SQL query you've got
Because when you're substituting a string to another, the quotes are no longer there
no ${} already gets seen as a string
if i used '' it would say that i cannot use it as it's already parsed as a string by sqlitedb itself
Oh wait you're using tags (sql), I didn't notice that
yeah i am using @databases/sqlite
Then yeah, back to my previous statement
which one?
i will try to parse it with '' first as a last resort
it's not treated as a fucking string tho
wtf
I would say you're better off using better-sqlite3 or PostgreSQL
would i have to change a lot in the ways of amking a query?
Because a few thousand lines of code depend on this
😭
This might help
youre still using sqlite3?
better-sqlite3 has built in support for bigint
but like, why dont you just use strings
why go through the hassle of working with bigints
its not worth the storage efficiency, unless youre working on a large scale project
i am sing string
using*
i've changed it
but it still rounds like dafuq
did you set the table to use TEXT?
string
await db.query(sql`CREATE TABLE IF NOT EXISTS serverdatabase (
id INT,
status STRING,
admin INT,
date STRING,
level INT,
unverified STRING,
pending STRING,
verified STRING,
timezone STRING,
PRIMARY KEY(id)
);`)
unverified is the thing we need
you also need to add quotes to your queries
no it's not needed in this lib
try it
well ion know
because like, ```js
const a = "876273468";
const b = set something = ${a}; // "set something = 876273468" <- SQL interprets this as a number, not as a string
for some reason, this mother fucking library doesn't use STRING but TEXT as type???
wtf
normal sql does use string right?
not really, it mostly uses varchar or SMALLTEXT / MEDIUMTEXT / etc
Owh really?
I have my midterms coming up in a month
and they mainly use STRING as type
Together with INT and BIGINT
yeah ours looks a lot like postgres
mariadb and mysql are 99% the same thing
Yeah ik
Just wanted to point it out
I'm actually not sure about SET tho
Which lib are using btw?
Hmm ok
Sqlite literally boils down all datatypes to the most generic option available
Also I never saw a database that uses STRING as a type
await conn.execute(
"""
CREATE TABLE IF NOT EXISTS profile
(
id BIGSERIAL,
profile_id BIGINT NOT NULL UNIQUE,
balance BIGINT DEFAULT 1000,
class_id SMALLINT DEFAULT 1,
rank_id SMALLINT DEFAULT 0
);
CREATE TABLE IF NOT EXISTS item
(
id BIGSERIAL,
profile_id BIGINT NOT NULL,
item_id SMALLINT NOT NULL,
FOREIGN KEY (profile_id) REFERENCES profile(profile_id) ON DELETE CASCADE
);
"""
)
Is this how I make a One-To-Many relation between profile and inventory? From the docs on the internet this is correct but I just want to be sure.
Also if it is, how would I insert an inventory item so it belongs to the correct user?
Hey, I'm pretty sure I should know how to fix this but i dont, has stuff changed with the new version of discord.py? I stopped using discord.py when Rapptz said it was done and I have only recently discovered that theres been like 10 updates so im back at it again. Can someone explain to me why i have this error? i have never encountered "Name of a command" TypeError before
2: Extension 'cogs.config' raised an error: TypeError: Name of a command must be a string.
is your commands name a string
Make sure all the command names in your cogs are strings
they are:
@commands.command(name=["set_prefix", "set-prefix"], description="Set your servers' new prefix!!")
async def set_prefix(self, ctx, prefix):
await ctx.trigger_typing()
set_prefix(ctx, prefix)
await ctx.send(f"Prefix successfully set to `{prefix}`")
yea I don't think you can use lists anymore
I might be wrong but i remember something about that being removed
does the aliase function still work?
there is still a prop called aliases that returns a list of str that the cmd can be called by
how you set them idk
I don't really use message cmds anymore I use slash cmds
yeah... idk how to do slash commands. the discord.py lib was dropped at one point because of it lol
they back now tho, so im glad
you were right, i just changed it on one of my cogs
I just looked at the docs
discord.gg/dpy ask here if you wanna see if you can still do listed names
thank you
It never was a thing in the first place
It wasn't?
I swear I remember seeing it as well
const fs = require("fs");
const router = require("express").Router();
const MdW = require(process.cwd() + "/middlewares/middleware.js");
const mdw = new MdW();
class Router {
constructor(app){
this.app = app
//app.use("/", mdw.connect)
app.use("/", router)
// app.use("/", mdw.error)
}
load(name, fun) {
router.all(name, fun);
log.log(`Loaded route ==> ${name}`)
}
async loadAll() {
const dir = config.routerDir || "routes/route"
let route = process.cwd() + "/" + dir
const files = await fs.readdirSync(route)
for(const file of files) {
let fun = require(route + "/" + file)
let name = file.split(".")[0]
this.load(name, fun)
}
}
}
module.exports = Router
its saying "cannot get /main"
help
It could be that there is no route registered for the /main path, or there could be an issue with the route handler function that is being used to handle requests to that path.
Need more context btw
I am making a yt search command but the reply comes undefined.
Plz help!!
Code- ```js
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const search = require('yt-search');
module.exports = {
data: new SlashCommandBuilder()
.setName('yt')
.setDescription("Yt command")
.addStringOption((option) => option.setName("query").setDescription("the vid you wanna see").setRequired(true)),
async execute(interaction) {
await interaction.deferReply();
let q = interaction.options.getString('query');
const find = search(q);
if (find) {
const embed = new EmbedBuilder()
.setDescription(`${(await find).url}`);
return interaction.followUp({ embeds: [embed] });
} else {
return interaction.followUp({ content: "No results!" });
}
},
};```
thats not how js works
hi, why is this happening
function getData(url)
{
request(url, { json: true }, (err, reason, body) =>
{
console.log("This will display body: " + body)
return body;
});
}
const data = getData("epicurl");
console.log("This will display body as undefined" + data);
First console.log waits for data to be fetched and then displays it but body is returned immediately
Indentation 
@earnest phoenix
const find = await search(q);
if (find.videos.length > 0) {
const video = find.videos[0];
const embed = new EmbedBuilder()
.setDescription(video.url);
return interaction.followUp({ embeds: [embed] });
} else {
return interaction.followUp({ content: "No results!" });
}
Does ur body undefined?
nope
its very defined
i tried making it async but it should be async by default
Nah,
function getData(url, callback) {
request(url, { json: true }, (err, reason, body) => {
callback(body);
});
}
getData("epicurl", (data) => {
console.log("This will display body: " + data);
});
Try this
Or use promise
Lemme try
yeah promise worked
Poggo
Why interaction.followUp() instead of interaction.editReply() when you used interaction.deferReply()?
followUp and editReply both will work if the interaction is deferred
That's why I used followUp
So does ur problem solved? @earnest phoenix
Ah, okay. I've never used interaction.followUp()
Love you!
The problem is solved! 🙂

I can use documnet in node express server.
It says document is undefined. For eg I'm using : const wrapper = document.querySelector(".wrapper") what could alternative be?
How can I make a drop-down like interface on slash commands?
U mean select menu?
Maybe yes
In slash commands I mean...
Like, an argument but the values are given by the bot
and the user has to choose one
Aaaa
Choices
Also there exist autocomplete
I'm still having trouble. I'm using djs v14.7.1. I tried using .addChoices and .setChoices it gives me an error ValidationError: Expected the value to not be an array
Have you tried adding options separately with .addChoice()?
Don't pass an array
I mean choices
Yep, doesn't work
How can I separate the choices if not using an array?
Expected the value to not be an array
The error says it all
How it's supposed to be used, I don't know
Can you post what your command looks like?
Errors give you the information though
ValidationError: Expected the value to be an object, but received string instead
Ah yes, remove the important part of the error
Isn't it just
.addChoices({name: "blah", value: "blah"})
And you simply pass multiple of those objects
e.g
.addChoices(
{ name: "blah", value: "blah" },
{ name: "blah2", value: "blah2" },
)
The API expects an array of choices
Dunno how you have to pass them internally in djs
well this worked...
¯_(ツ)_/¯
The fact that you have to pass the structure the api expects as argument to the addChoices() method instead of creating the entire structure yourself is just weird
Idk why people use the builders

I don't know either 

ChatGPT and Github Copilot failed me ¯_(ツ)_/¯
Don't rely on AI
Don't blame them... they have to continuously develop new nitro and emoji shit
No time for consistency for the rest
I swear
Also chatgpt is bad with interactions
I'd be ready to be snowsgiving "gifts" are like last year
Emoji and sticker packs
It's pretty good and solves many cases including difficult ones, but they said that to put them in an array and pass them to addChoices
addChoices also confused me why they arent expecting an array
Nah, chatgpt mostly just uses freaking reactions lol
It's djs after all
public addChoices(...choices: APIApplicationCommandOptionChoice<T>[])
pheww... humans still have some chance

You don't know how many bots I've reviewed that use / as text prefix and not application commands and write on the bot's page
Prefix: / (Slash commands)
lol
Or people using #/@ as prefix, also legends
Also depr. Channel.send() method
Ye the exclusive prefixes like () or {}
Not sure about that one
Show how you asked smh
Partially correct
Yeah I asked it to use SlashCommandBuilder
What's this error trying to say, I didn't understand... https://cdn.hamoodihajjiri.com/tK9KtYbX7z ?
Host is unreachable
Oh, wat?
Exactly what fake typed
Do I just set another registry or something.

Which means network problem
You can search on Google for help around that
Searching with the error message will give you lots of results for help
Wait, wrong one.
Simply try to ping the host
That's what Google says, yes
ping registry.npmjs.org
And show me the results
Searched npm err! code ehostunreach on Google :)
Address unreachable?
Nope, just a Destination unreachable: Address unreachable.
Are you blocking outgoing connections on port 443?
I've done nothing on my VPS for the past 2 months.
Although, I am attempting to host an express application.
You have the VPS somewhere
These people can block specific things
You don't own the machine
I haven't done anything really but install nginx, create a configuration file, certbot, and that's it.
There could still be a firewall of your provider active
As said, it's not because you did nothing regarding firewalls that it can't be done by the provider that temporarily provides you with the VPS
Oh, it could be the configuration file.
Does apt update also return an error?
Nope, returns 29 packages.
Also, could me current configuration file for the application I want to host via NGINX be an issue: https://cdn.hamoodihajjiri.com/bUv83b6g0A .
Weird, honestly. I've only done the above, then the error occured.
@earnest phoenix does a TypeScript library require typings to be exported
Well yes, the typings are required for TypeScript to know the types
But there's no need to export typings if the types are declared in the actual files instead of a separate typings file (such as a d.ts) file
@earnest phoenix sobbing
should i remove support for linux arm x64 gnueabihf
i dont understand all of this

This error indicates that the executable/object file was built using one or more 32-bit libraries or shared objects but is being run in a 64-bit environment
then what should i do
i dont even understand what gnueabihf means
whats the difference
That's the ABI, not all machines use the same ABI, which define the system features, types, sizes, and many other stuff

for it to work the process.arch should've yielded arm, but it yielded x64 instead
Exactly, but that environment you're running it on is a 64-bit environment
then what should i doooooooooooo
i dont fucking get it
Compile to the proper target then
@earnest phoenix can u explain what these docker flags mean
Hey guys
first time using slash commands, I got a ping command working
but anytime I try to add another command it just overwrites the past one
so if I have 2 commands in the command folder only one works
Nvm, fixed it stupid error
Had the new collection in the loop by accident
Anyone know this error? discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: User.list_users() got an unexpected keyword argument 'search'
Need code
does anyone know a vscode plugin that makes this easier / one click?
turning
"hello im " + name + "! how are you"
into
´hello im ${name}! how are you´
It's already built-in, no need of an extension
Haven't seen that
Doubt there is an extension as well
Also haven't seen any extension about that when going through the marketplace
<Script
src="../scripts/modals.js"
is this how u load scripts on nextjs
using the next/script btw
i tried to log the error or onload
and it's logging nothing nothing
which is weird
How can i make Pocket code and Social Media below Anmelden and Team?
Wrap the whole thing in a div and then flex col, or use a single col grid
What du you mean with flex col?
is this djs?
yea, i see why I couldn't spot it
its in my dev mode debugger thing
Are you certain the error is coming from this particular part of the code?
That all looks correct to me
embed values are strings yes
I don't know where to ask this but is it possible to use top.gg api to make website have a statistics part to show how many guilds and total user amount the bot is in? How hard would it be to make? Yes I know the bot needs to be approved for api token stuff.
Also dont mind my silly forming of the question
Just preparing in advance, incase the bot gets approved
you dont need topgg for that
Really?
I'm a rookie on this kinda stuff so didn't know
topgg does not give you any statistics, in fact its the opposite
ah
you use the top.gg api to send your statistics to them
so they can display it on your bots page
anyone knows y im getting this?
` message: "Cannot read properties of undefined (reading 'add')",\n` +
" name: 'TypeError',\n" +
` stack: "TypeError: Cannot read properties of undefined (reading 'add')\\n" +\n` +
" ' at Shard.wsEvent (/home/container/node_modules/eris/lib/gateway/Shard.js:853:65)\\n' +\n" +
" ' at Shard.onPacket (/home/container/node_modules/eris/lib/gateway/Shard.js:402:26)\\n' +\n" +
" ' at Shard._onWSMessage (/home/container/node_modules/eris/lib/gateway/Shard.js:2444:29)\\n' +\n" +
" ' at WebSocket.emit (node:events:513:28)\\n' +\n" +
" ' at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:1178:20)\\n' +\n" +
" ' at Receiver.emit (node:events:513:28)\\n' +\n" +
" ' at Receiver.dataMessage (/home/container/node_modules/ws/lib/receiver.js:513:14)\\n' +\n" +
" ' at Receiver.getData (/home/container/node_modules/ws/lib/receiver.js:446:17)\\n' +\n" +
" ' at Receiver.startLoop (/home/container/node_modules/ws/lib/receiver.js:148:22)\\n' +\n" +
" ' at Receiver._write (/home/container/node_modules/ws/lib/receiver.js:83:10)\\n' +\n" +
" ' at writeOrBuffer (node:internal/streams/writable:392:12)\\n' +\n" +
" ' at _write (node:internal/streams/writable:333:10)\\n' +\n" +
" ' at Writable.write (node:internal/streams/writable:337:10)\\n' +\n" +
" ' at TLSSocket.socketOnData (/home/container/node_modules/ws/lib/websocket.js:1272:35)\\n' +\n" +
" ' at TLSSocket.emit (node:events:513:28)\\n' +\n" +
" ' at addChunk (node:internal/streams/readable:324:12)'\n" +
'}'```
why is that even formatted the way it is
an error with eris it seems
what do you think i should do?
I fear no man, but what the fuck is that log
lol now that error is gone
' <rejected> MongoError: E11000 duplicate key error collection: test.guilds index: _id_ dup key: { _id: "1024414204809183262" }\n' +
' at MongoError.create (/home/container/node_modules/mongodb/lib/core/error.js:59:12)\n' +
' at toError (/home/container/node_modules/mongodb/lib/utils.js:130:22)\n' +
' at /home/container/node_modules/mongodb/lib/operations/common_functions.js:258:39\n' +
' at handler (/home/container/node_modules/mongodb/lib/core/sdam/topology.js:961:24)\n' +
' at /home/container/node_modules/mongodb/lib/cmap/connection_pool.js:352:13\n' +
' at handleOperationResult (/home/container/node_modules/mongodb/lib/core/sdam/server.js:567:5)\n' +
' at MessageStream.messageHandler (/home/container/node_modules/mongodb/lib/cmap/connection.js:308:5)\n' +
' at MessageStream.emit (node:events:513:28)\n' +
' at processIncomingData (/home/container/node_modules/mongodb/lib/cmap/message_stream.js:144:12)\n' +
' at MessageStream._write (/home/container/node_modules/mongodb/lib/cmap/message_stream.js:42:5)\n' +
' at writeOrBuffer (node:internal/streams/writable:392:12)\n' +
' at _write (node:internal/streams/writable:333:10)\n' +
' at Writable.write (node:internal/streams/writable:337:10)\n' +
' at TLSSocket.ondata (node:internal/streams/readable:766:22)\n' +
' at TLSSocket.emit (node:events:513:28)\n' +
' at addChunk (node:internal/streams/readable:324:12) {\n' +
' driver: true,\n' +
' index: 0,\n' +
' code: 11000,\n' +
' keyPattern: { _id: 1 },\n' +
" keyValue: { _id: '1024414204809183262' }\n" +
' }\n' +
'} reason: MongoError: E11000 duplicate key error collection: test.guilds index: _id_ dup key: { _id: "1024414204809183262" }'```
Why is it formatted like a string?
How did u actually manage to even get it like that
now im getting this when the bot joins a server
Yeah you're trying to insert a key twice, it's written in the first 2 lines
any solution?
...like not inserting it twice?
I imagine that's happening because you're saving all the guilds to the database on startup
Show code ur inserting twice
But really, try to fix that log too
Its a code which I got from github
im just going to reinstall it and hope for the best
Pro tip: don’t copy paste code you don’t understand
ik
💀
Don't think we can help then
All in all, running random code from the internet is a serious security concern, and even if safe, it's generally impossible to maintain
And yes, I know you'll just roll your eyes and continue whatever you're trying to do, but at least give some thought to what I said
onRequest((req) => eval(req.body))!!!
What does this do I wonder
lmao
Well u gotta blame the pleb who's running node with root privileges
Who doesn't run node with root privs tf
@earnest phoenix gaming https://cdn.discordapp.com/attachments/914510802579521546/1055020139914993684/image.png

even though i know it'll fail
The average Linux pleb who has no clue what he does 
Well the opposite
Dude u trying to add document to MongoDB with _id that alr exists
_id is unique, so u can't
Oh, sry, it was answered alr

@earnest phoenix can you explain this in a simpler way on what each flag does so i can understand
the docs didn't help
or anyone who uses docker
Docs are self explaining but sure
-v set the volumes
Which means that you can 'mount' a volume, folder, from your computer into the docker container so that it can edit the files and they will be edited on both your computer and in the container.
It is used like computer_path:docker_path - so the computer_path is the path on the current computer for the volume you want to share and docker_path is where it will be 'mounted' in the docker container itself.
-w sets the working directory in the docker container, nothing more to explain to be fair.
If you don't know what a working directory is, you can search it up and get a result like
The current working directory is the directory in which the user is currently working in. Each time you interact with your command prompt, you are working within a directory.
By default, when you log into your Linux system, your current working directory is set to your home directory. To change the working directory use the cd command.
https://linuxize.com/post/current-working-directory/#:~:text=The current working directory is,directory use the cd command.
thanks!!!

i already know what a working directory is thanks
Awesome 
There are lots, just ask your question.
Note that Replit is not made for Discord bots at all and it is not recommended to do so.
I understand that, I'd just rather use it since it's hosted online. Would it be better if I used something like Visual Studio Code?
Visual studio code is a code editor and does not host anything
I see
Local files
it's more recommended to use a VPS to host discord bots
You need to take care to keep backups etc. using e.g. github
I can't find any tutorials on coding Discord bots online because they're all outdated and the scripts don't work. Where would you recommend I go to learn?
The documentation of the library you're using
You should not use Replit to host your bot
While this may seem like a nice and free service, it has a lot more negative sides than you might think, some are the following:
• The machines are super underpowered.
• This means your bot will lag a lot as it gets bigger.
• You need to run a webserver alongside your bot to prevent it from being shut off.
• This isn't a trivial task, though eats more of the machines power that is already very low.
• Replit uses an ephemeral file system.
• This means any file you saved via your bot will be overwritten when you next launch.
• They use a shared IP for everything running on the service.
• This one is important - if someone is running a user bot on their service and gets banned, everyone on that IP will be banned. Including you.
Please make yourself a favor and avoid using Replit to host your bot. It's not worth the trouble.
so, what program should I use?
You code your bot with a code editor or IDE.
You host your bot with a VPS.
What's a VPS?
Just google it
Did u resolve ur issue
what are the limitations for slash command names
no special characters (- is allowed), no capitalizations or spaces
I don't remember if numbers are included
gotcha
I think you can't use numbers tho
How can i use pterodactyl websocket for console in javascript
@carmine summit You can't use numbers as Misty said
But - and _ are allowed chars
Alright! Thanks!
Between 1-32 chars
https://images-ext-2.discordapp.net/external/UFNr5GxVsSCfKIr-eBpJivhlb3t_G5PocV7X-xt0j3k/https/user-images.githubusercontent.com/11778454/208881664-4d1a38fe-384f-49c5-a48f-c6778cca30a7.png
https://images-ext-1.discordapp.net/external/Uq3KLyCwZE4H57ZX5d_CO3p3R1eiFF7aEHxtSrDI3Sk/https/user-images.githubusercontent.com/11778454/208880731-3310633d-f806-4bea-bd5f-f061b86c4816.png
https://images-ext-1.discordapp.net/external/jpR10NzmSo4z42aFJ16TcVaTgzI634RjBRy1Js3g5sI/https/user-images.githubusercontent.com/11778454/208880618-db42dc3c-fb27-447e-8f5f-9804f5a4728c.png
YAASS Discord! Now give it to us as a slash command option
Oh nice
Finally
Guess we now need to wait another year or two until this is implemented in the application commands UI
And maybe another year for modals


Yeah it's so sad
Nice, I see that you're slowly getting the proper hang of GitHub Actions
#lifegoals
hi Mac Frost
now i feel like i'm maintaining LLVM 😎
Heh, we don't even use GitHub Actions at all for building LLVM, we use the Harbor Master through BuildKite via our Phabricator instance
fancy
anyway anybody know what docker run --rm --privileged multiarch/qemu-user-static:register --reset does?
The documentation explains what all the flags do, the one I linked before
just tell me what it does
the person who made the CI template put this as the first step in several jobs

- The
--rmflag is false by default so the file system of your container stays/persists even after the container exits, which can make debugging easier but if you only need short-term foreground processes and such then those file systems and their states can pile up and use a lot of storage, using the--rmflag tells Docker to automatically clean up the container and remove it's respective file system
Everything that is contained in the container's respective file system
- The
--privilegedoption gives the Docker container extended privileges, as by default all Docker containers are "unprivileged", which for example, they can't run a Docker daemon inside a Docker container
The option provides fine-grained permissions so you can be sure it runs with the exact permissions you need
- There's no flag called
--resetin Docker anywhere, unless that's for a different program
Aloha, I've been going through some GitHub Repositories, and from a repository I've found, I've noticed a file called .env.example. Anyways, within such so, I've noticed the following properties requiring data, what am I required to do if I'd want to host it locally?
# exposed to client
NEXT_PUBLIC_UMAMI_USERNAME=umami username login
NEXT_PUBLIC_UMAMI_PASSWORD=umami password login
NEXT_PUBLIC_UMAMI_URL=umami self-hosted url
NEXT_PUBLIC_TWITTER_USERNAME=@twitter username
NEXT_PUBLIC_SITE_NAME=site name
NEXT_PUBLIC_SITE_URL=site url including "https://"
NEXT_PUBLIC_SECRET=
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
Now, honestly. After I've tried to run said Next.JS application (a website), it asks me that the supabaseUrl is required. If the application is hosted locally, with what am I supposed to fill it with?
Exactly what the property names say, Supabase is a database so you would need your own instance of it and the URL pointing to it
Usually these projects have a documentation you can follow.
And here the variable names are self explanatory 
Unfortunately, the repository is empty. 😂
Ohh, I didn't notice supabase is a database.
👍 👍
@earnest phoenix i fucking hate FreeBSD
Lmao
how to get reactions on an old message? i'm trying to fetch the message and create a listener but its not working
client.on("messageReactionAdd", (reaction, user) => {
user.send("test")
});
Only works for new messages
It's like "rawMessageReactionsAdd" or something. However, this function does not provide any message. It just provides the message ID, guildID, channelID, etc...
How are you trying to fetch the message?
You can try this
const message = !reaction.message.author? await reaction.message.fetch(): reaction.message;
nvm i just used an outdated version
but i need a specific message
and user id
google isn't helping much
Then remove .cache before fetch
I mean, that was pretty obvious going by the first log in the workflow
still doesn't work
can't create reaction collector
😢
Then you need to check if this message exists, if the bot has access to it, and so on
As error itself says, "unknown message"
Can you post some more code because maybe the error lies in another part of it
var x = client.channels.cache.get("1052712693188010116").messages.fetch("1052713687670079499").then(m => m.createReactionCollector());
results in m.on is not a function
message is fetched tho, shows everything when logged
Assign m.createReactionCollector() to another value like
const collect = m.createReactionCollector()
and then
collect.on()
I'm glad it works
well turns out if you fetch it then on messageReactionAdd event will work lol
From what it seems to me, all message events work on messages that are in the bot's cache. If you fetch a message, the bot takes information straight from the discord api and puts this message in the cache
The cache resets every time you turn on the bot or you can set it manually to clean it from time to time
yeah its weird but very simple
it doesnt seem to explain that well in the docs
or im just blind lol
also, what would be c# {get; set;} js equivalent?
@earnest phoenix linux arm 
do u know why
look there's no need to write an essay
Basically getters and setters, an example:
class Foo {
// Private property called 'bar'.
#bar = 5;
// Getter to get the value of the private property 'bar', but only if it's divisible by 2.
get bar() {
return this.#bar % 2 === 0
? this.#bar
: null;
}
// Set the value of the private property 'bar', but only if it's a number.
set bar(value) {
if (typeof value === 'number' && !isNaN(value))
this.#bar = value;
}
}
const foo = new Foo();
// The default value of the private property 'bar' is 5 as we declared.
console.log(foo.bar); // null, because it's not divisible by 2 as we defined.
foo.bar = 4;
console.log(foo.bar); // 4
foo.bar = 'g'; // won't change as we're only setting the value if it's a number.
console.log(foo.bar); // 4
thanks
I'll try it
Exactly what it says, it requires GLIBC (GNU C Library) version 2.33 or higher, which is not on that environment you're running it on
What distribution is that ARM Linux environment anyway?
Debian? Arch?
no idea, it's on a GitHub Workflow
it's on a ubuntu-latest so guess
Hmm regardless, that .node add-on object file requires GLIBC 2.33 which is not present on that environment, something definitely needs to be updated there, or there's no GLIBC 2.33 for that target you've compiled against
fixed it with https://github.com/napi-rs/napi-rs/issues/1375 in this pull request https://github.com/napi-rs/napi-rs/pull/1384
Nice
@earnest phoenix is there any difference between aarch64 linux with aarch64 android?
like if an aarch64 linux binary works, is it a guarantee for the aarch64 android binary to work too?
They're both mostly the same, including their libraries, instruction sets, and other stuff but some some libraries can differ and cause the program to not be able to find what it's looking for
oh alright
should i add another tests job for android?
You don't necessarily need to, but if you want everything to work exactly the way it is, just in case some things don't match then go ahead
I might be dumb but I'm converting some v13 code to v14 and I'm unsure why this is flagging as false.
console.log(needsDJ)
console.log(!interaction.member.permissions.has("Administrator"))
console.log(!role)
console.log(!interaction.user.username === player[0].queued_by) //Should flag true because MiyukaTest !== Miyuka right?
console.log(interaction.user.username)
console.log(player[0].queued_by)
Output:
true
true
true
false // here
MiyukaTest //compairing
Miyuka // compairing
Ya I was about to do that tbh
but I assumed it was the same thing putting the ! at the beginning
Nope
that casts interaction.user.username to a boolean and then checks if that equals the other
Which will always be false because you're comparing two different types with the strict equality operator
Yeah
Noted for future code.
ty
https://scs.twilightgamez.net/97Ecb.png yerp that does it. I probably did that to a lot of code not realizing the difference. 
Welcome back to another episode of "Why you should use typescript!" 😉
You know.
I was kinda tempted too when I stumbled apon a regex test thing with typescript and seen how useful it was. But then JS has a similar this but with an extra line of code.
.test
Well, that's not the point of typescript
The ts compiler would've screamed at you for this line of code: !interaction.user.username === player[0].queued_by
oh really 
Oh I see.
Isn't it complied differently. Or can you still do the whole node index.js if you wanted too.
Well I guess TS probably doesn't use node right
Usually catches a lot of compile time bugs before you run it
TS uses node, it transpiles into javascript which is then run via node or some other js engine
oh okay.
I'll likely dabble with it knowing that.
I've heard only good things about TS > JS
It gives a lot more compile time safety
And unless you're Tim you probably won't be complaining about some of the limitations
Also something that is kinda lame and unrelated.
Why DJSv14 have to change permission checking from ALL CAPS to A cap.

they felt like it
might also be something with standards, but usually with enum flags it's up to preference
I suppose PascalCase looks nicer
<rejected> RangeError [BitFieldInvalid]: Invalid bitfield flag or number: ADMINISTRATOR.
just more of this while I clean up my stuff
lol
The main two are SCREAMING_SNAKE_CASE and PascalCase for enums, I don't usually see anything other than that used
inb4 camel case just to smite you
Nah not even Java goes to that circle of hell
java is great
you should try groovy then
😔 but that's the whole point of java
hi miyu

encapsulation and fun
hi ❤️
nah, kinda far from that
though I don't necessarily agree with the "everything must be in a class" doctrine
I wish I could write some static functions without needing class bodies
but maybe that's the rust side of me showing
how's him btw?
ah ic
https://scs.twilightgamez.net/g/iLt5A.gif learned alot branching off doing my own stuff. Like databases, more advanced JS stuf. I enjoy the solo experience
but really, give groovy a try someday, it's almost as if js and java crossed paths
noooooooooooooooooooooooooooooooooooooooooooooo but buttonnnnnnnnnnnnnnnnnnssssssssssssssssss
think of the wasted rest requests 😔
noted aswell
like, u get all the power of java with much less verbosity, if that's the part u dont like
it's to java what js is to ts basically
wish I could like it, but it feels too odd for me
If you have an already sorted array of integers, would insertion sort or selection sort take a longer time to terminate ?
both would be O(1) no?
or at least, O(n) since you'll need to read all entries to see if it's sorted
Sounds like an exam question to me
lol yeah I got my CS final results but I think I got it wrong
I’m pretty sure it’s selection I put insertion
Think about what both of the algorithms do
Selection sort swaps values until they’re in place
Insertion orders by selecting the highest/lowest value and putting it in place
ain't that bubble sort?
Selection’s best complexity is O(n^2)
They’re similar but not the same
Selection is slower than insertion on a sorted array
Because best case for selection is O(n^2) and insertion’s best case is O(n)
I wonder what I got wrong on my CS final
I got 94/95
Very curious
I got a 85/87
Nice
syntax :(
hey- does anyone know react?
man was using the 1TBS when that isnt the syntax
synth axe
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);```
Someone wrote this and I haven't talked to them in quite some time and now that I really need to use the file there's a problem, with the `<` / `>` symbols.
I am unsure on what he was attempting to do, but since I do not know React I thought one of you would know and maybe help me fix it.
ping in replies
Can you be more specific on what the problem actually is?
discord.py 🤢 🤮
Be nice please, if everyone used the same programming language we'd all be using 30 year old programming languages still
The < and > are unexpected tokens. But it seems like they are needed for this to work.
Unsure though since this is my first time using react
Sorry bro.
Im trying to put my text on the left side of the click icon but my text-align isnt working idk why
h1 {
color: white;
text-shadow: 1px 1px 2px black, 0 0 25px blue, 0 0 5px darkblue;
text-align: left;
}```
yes please
not js but c
Machine code ftw
Might need quotes
Try:
h1 {
color: white;
text-shadow: 1px 1px 2px black, 0 0 25px blue, 0 0 5px darkblue;
text-align: left !important;
}
or
h1 {
color: white;
text-shadow: 1px 1px 2px black, 0 0 25px blue, 0 0 5px darkblue;
text-align: left;
position: relative;
}
Does that fix it?
i am working on a project where for each card i should show a quick demo with a video
how could i get through this without making the entire laggy as hell
I'm trying to animate stuff in on scroll using react and I got this function:
useEffect(() => {
const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
console.log(1)
console.log(entry)
if (entry.isIntersecting) {
console.log(2)
entry.target.classList.add("show")
} else {
console.log(3)
entry.target.classList.remove("show")
}
});
});
const hiddenElements = document.querySelectorAll(".toanimate")
hiddenElements.forEach((element) => observer.observe(element));
return () => {
hiddenElements.forEach((element) => observer.unobserve(element));
}
}, []);
But this doesn't work and it probably is because the observer is being fired before my element actually exists. One way I can solve this is by using the useRef hook but then I'd have to make about 50 useRefs per page to animate everything, does anyone have a better solution?
this usually has to do with the width or the display type of the object try setting display block and width: 100%
fixed
using chatgpt
how to get my pc's port number for topgg webhooks 😂
You need to start a web server yourself and do port forwarding. Your computer has lots of ports
oh okay, I done it :D
omg, unbelievable! I'm not a developer unfortunately, teach me your ways master.

Well does someone know tho... I figured out how to use pug to load files with parmaeters recived from express app but the css doesn't load up. I will need lots of help in pug itself. If someone is free 
Anyone can claim that badge, unfortunately, even people who are not serious bot developers
I want a very secret badge too 
I hate those guys

🔥
thats the same reason y they removed the bot developer badge
people just started to make bots just to get the badge
Yes
Hey for app directory I emailed discord after fixing the issues they haven’t replied yet
We do not represent Discord, nor are we affiliated with them. We merely use their service.
If you have any questions and/or suggestions regarding Discord itself, or wish to report any violations to the Terms of Service, you can use any of these links:
How to leave feedback/suggestions to Discord
How to report bugs/issues to Discord
How to report a violation of the Terms of Service to Discord
How to contact Discord for general inquiries
theres a channel for help with that on
https://discord.gg/discord-developers
Also from what I heard most of the employees are in holidays now, so it will most likely take long to get a response, up to some weeks
I still haven't gotten any response after 3 months for a general question, that should tell you how good their support is..
lol
2 days ago i asked about issue with my servers custom invite and they fixed it the next day, and my bot got verified after applying only 3 hours before
discord support fast for me
how can i use frameborder="0"
for some reason it doesn't recognize frameborder
NextJs question
frameBorder
that did it
.modal_container {
background-color: rgba(0, 0, 0, 0.7);
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.modal_container.show_modal {
display: block;
}
also the script that i made adds the show_modal class name to the div but for some reason is not updating the display
class="Home_modal_container__CazAv show_modal"
here is the div's class after i click the show modal button
it adds the classname
but doesn't update the css
does anyone know why this in my nginx http block
error_page 404 /etc/nginx/pages/404.html;
isnt sending the custom 404 page?
how many choices can I put inside a slash command argument?
The Discord API documentation is most likely the best source
lmao the discord docs now have snowflakes raining down? since when hahah
I instantly disabled that horrible thing
hahahah
just tried autocomplete, pretty good ngl
tho I don't know why .respond() expects an array, but .addChoices() doesn't
TIM!
It's best to get used to it and not overthink it too much 
d.js consistency moment
@earnest phoenix wait do they actually parse these comments
oh
@earnest phoenix should i go dynamic or static lib

I'd go dynamic
how do you convert a Go string to a UTF-8 []byte without copying it
the answers i've found on the internet are using JSON https://stackoverflow.com/questions/41460750/how-to-convert-utf8-string-to-byte
without copying it
?
You mean without doing
x := "Hello world"
y := []byte(x)
?
yes
do Go strings use UTF-8?
then how do i convert Go strings to UTF-8 byte arrays without copying?
You don't?
Yeah that doesn't make too much sense from a garbage-collected language standpoint
oh
Yeah
gc langs will always be damned to copy operations
Rust isn't right?
Rust does not use a garbage collector, but rather achieves these properties through a sophisticated, but complex, type system.
Google says that and sometimes that it is garbage collected
write your own interpreter in c to allow for manual memory management
technically it isn't because the compiler automatically places in free statements
Rust is not garbage collected
okeh
My mind is garbage collected tho
But C is /s
I forgot what I ate yesterday
Yeah rust isn't because of ownership semantics
My mind is garbage
Time to collect
Yeah mine as well
I literally made an event dispatcher library for my project
I end up not using it 
the pause might be a while, but you'll be back to normal assuming no leak
hi Voltrex
ok so i have this Rust project that can compile into native DLLs
how would i make a Go library around it

can go even import native libs
Then just do that :)
i mean when making a C library you have to handle lots of OSes and Architectures
Unless what you're doing is generic enough
ok so how would i do this
do i store precompiled binaries?
or does go have a custom makefile system or smth so that it runs when you install it
?
error_page in the http block only works for absolute http urls
otherwise error_page's path is based on the root directive of the current server block
how can I do what I want to do in this case?
server {
location = /404.html {
root /var/www/default;
}
error_page 404 /404.html;
}
``` something like this
would that be global?
it will affect only the current server block
is there any way to make it global?
you can try making a redirect
http {
error_page 404 http://yourwebsite.com/error.html;
server {
location = /error.html {
root /path/to/file.html
}
}
}
but you still need to change the root on the main server block for that domain
you can also try defining a default root, not sure if it will work but try it
http {
root /path/to/nginx;
error_page 404 /error.html;
}
anyone know how to make this?
I'm pretty sure you need the command id
</command_name_here:command_id_here>
bot id?
command id
oh okay ty
oof, doesnt seem to work; do you know if caddy isnt so weird?
never used caddy
anyone got an idea why my index isn't incrementing?
const [index, setIndex] = useState(0);
useEffect(() => {
const introInterval = setInterval(() => {
setIndex(i => i + 1);
console.log(index)
}, 500);
setTimeout(() => {
setIntroFinished(true);
clearInterval(introInterval);
}, 4000);
}, []);
Figured it out, turns out React renders components twice when using strict mode thus the useEffect useEffect was being called twice and resulted in some weird behaviour
You can do the exact same thing with multiple directories dynamically(just by doing multiple loops)
Or if its just a couple you can do the same thing a few times.
eww multiple loops
i was thinking something like this
const command=require(`./slashCmds/*/${ file }`); // * is different command categories, not sure if thats valid in file paths
client.SlashCommands.set(command.data.name, command)```
What you're looking for is recursion
he typing a paragraph oh no
You can also use globs but if you can just use recursion
Function:
- Read from directory
- Loop over the entries of the directory
- Join the paths, previous path + the current entry
- If it's a directory, go to Function
- Otherwise load the command
- Join the paths, previous path + the current entry
And pass the commands directory to the function
Because that's a glob pattern
for (const cat of require(...)) {
for (const file of require(...)) {
// Pow.
}
}
use cat to draw path
@uneven tartan
import { readdirSync } from 'node:fs';
import { join } from 'node:path';
import { pathToFileURL } from 'node:url';
// Declare function for recursion.
async function loadCommands(dir) {
// Read entries from the given directory.
const entries = readdirSync(dir, { withFileTypes: true });
// Iterate over the directory entries.
for (const entry of entries) {
// Join paths.
const path = join(dir, entry.name);
// If the entry is a directory, recurse.
if (entry.isDirectory()) await loadCommands(path);
// Otherwise, if the entry is a regular JavaScript file, load it.
else if (
entry.isFile() && (entry.name.endsWith('.js') || entry.name.endsWith('.mjs'))
) {
// Import command.
const { default: command } = await import( // Convert the path to a file URL, this is needed on platforms like Windows where the hard drives have drive letters like 'C://', acting as file URLs.
pathToFileURL(path)
);
// Load command in whatever way you want.
}
}
}
You can of course also do this in CommonJS, just use the global require() function to import, and no need to convert the path to a file URL as it doesn't need to be a file URL with require()
The thing you should pass to that function is the path to the commands directory
Stupid question. I got this npm package I'm using in my .js files:
japiRest.discord
.getApplication("1018001748020961311")
.then((user) => console.log(user.data.bot.approximate_guild_count));
Is there any way to use it in a .ejs file?
so ./commands
everything is in a folder under that
so like
/commands/moderation
/commands/music
Yes, exactly
and the return from that function is passed to the collection
or should i just do that inside the function
sort of, what you want is to call that function first and then pass the result as a parameter to the ejs render function
not directly inside an ejs file
OHH
THAT CLEARS SO MUCH
THANK YOU
how do i store input image in mongo without creating file in my server?
Is that generated?
no its from a go example
idk if i should return pointers or values when returning structs
Pointers
But shouldn't write it like that
You can just
return &person{}
with the fields in it
why not return by value
You should work with pointers whenever you can
Also NewXXX should return a new pointer
oh alright
Especially for custom structures
have you ever worked with cgo before?
The good thing is that Go will auto dereference structures, so if you print the returned value you won't see the memory address. It will act just like a normal pointer, simply made better to prevent the hassle of having to use, for example, (*p).name to print the name, instead you can just use p.name which is much more convenient
Nope never
last time i used go was last year
Same here
Last time I used Go was yesterday evening 
why
sob
Whats the point of it
how do i integrate a Rust project into a Go library
you dont
Probably can't
oh alright then
At least never heard of it
you know what i'll just make a java wrapper instead, i'll do go later
Java 

i cant believe im installing java again
still 3b
cope
imagine not having a mascot
cope deez nuts into your mouth
cring
I'd uninstall any language without mascot
so true
https://github.com/microsoft/GODEL
noow how do i use this beast thatll help us in peevanced
shrug
That blue line color tells me it's TS
Yet another language without mascot
Cancelled
nah its Python
LMAO it really is Python
Cancelled
gonna need to ask that nerd who knows ai stuff in team
Yepa
There's also an amazing talk at a conference
wait

I would use Rust it it can work with Go projects 
but how do you make a Go wrapper of a C library
Without coding in Rust obviously
That idek, never used cgo
never made a go library before
But you're probably not the only one trying that
So Google may have an answer to it
Anyways heading out, arriving at uni
cya
how is interaction.deferReply() different from interaction.reply()?
deferReply shows a <botname> is thinking... message beforehand afaik
oh you can't put message inside deferReply
deferReply is basically telling discord you will do something at a later time keep the interaction going










