#development
1 messages · Page 1871 of 1
If you want clean code don’t use the MessageEmbed builder
im listening 🙂
{
description: "text",
fields:
[
{ name: "title", value: "line" }
]
}
The internals of Discord.js v12 are not type safe and are very jank to work with. Since they're moving to typescript, it's required to make the lib type safe
v13 is a step up, but still leaves a bit to be desired
Why this no work:```
this.on('guildMemberUpdate', function (guild, oldMember, newMember) {
const wc = new Discord.WebhookClient("885310964348624896', 'GjpnkjDLKGYPQofPN-cHG7xO-Sm1DrDullvlnZ_v4jyhQZTflsOmONvd0dohtHJ_3SUu");
if (oldMember.roles.cache.size !== newMember.roles.cache.size) {
if (!oldMember.roles.cache.has("851156630748921927") && newMember.roles.cache.has("851156630748921927")) {
wc.send(`yo !`);
}
}
})
I get the error
TypeError: Cannot read property 'roles' of undefined```
Im tryna check if a user gets a specific role
btw is mongoose "shared" trustable?
It's similar to supporting the (key: K, value: V) => V | null; overload for Collection.find
yeeees xd
`string line 1
string line 2`
Or
"String line 1\n" +
"String line 2\n"
…
Yeah got that but I can’t code atm as I mentioned 
Tim actually does anything for money tho
Even selling his socks
He’s a real capitalist
LogsChannel: {
type: String,
isEnabled: { type: Boolean, default: true }
}
why when i try to set isEnabled to true it's not working ?

mongoose
Using macOS? Try running this cool command:say -v Ralph Hi
he is saying cannot send empty message
ôh wait i see theres a new "send" system
approved as working 👍
.
data.SuggestionChannel.isEnabled = false
I mean true or false
and it's not add it in bath
Yeah you have to pass it as option to the method
{ embeds: [embed] }
do I change something in index to make it global or what
08.09 20:34:04 [Bot] Startup { body: commands },
08.09 20:34:04 [Bot] Startup ^
08.09 20:34:04 [Bot] Startup ReferenceError: commands is not defined
08.09 20:34:04 [Bot] Startup at Client.<anonymous> (/index.js:45:10)
08.09 20:34:04 [Bot] Startup at Client.emit (node:events:394:28)
08.09 20:34:04 [Bot] Startup at MessageCreateAction.handle (/node_modules/discord.js/src/client/actions/MessageCreate.js:23:14)
08.09 20:34:04 [Bot] Startup at Object.module.exports [as MESSAGE_CREATE] (/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
08.09 20:34:04 [Bot] Startup at WebSocketManager.handlePacket (/node_modules/discord.js/src/client/websocket/WebSocketManager.js:345:31)
08.09 20:34:04 [Bot] Startup at WebSocketShard.onPacket (/node_modules/discord.js/src/client/websocket/WebSocketShard.js:443:22)
08.09 20:34:04 [Bot] Startup at WebSocketShard.onMessage (/node_modules/discord.js/src/client/websocket/WebSocketShard.js:300:10)
08.09 20:34:04 [Bot] Startup at WebSocket.onMessage (/node_modules/ws/lib/event-target.js:132:16)
08.09 20:34:04 [Bot] Startup at WebSocket.emit (node:events:394:28)
08.09 20:34:04 [Bot] Startup at Receiver.receiverOnMessage (/node_modules/ws/lib/websocket.js:978:20)```
help
Bad mobile connection over here 
now got this 08.09 20:37:57 [Bot] Startup Started refreshing application (/) commands. 08.09 20:37:57 [Bot] Startup /node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:198 08.09 20:37:57 [Bot] Startup throw new DiscordAPIError_1.DiscordAPIError(data, data.code, res.status, method, url); 08.09 20:37:57 [Bot] Startup ^ 08.09 20:37:57 [Bot] Startup DiscordAPIError[10002]: Unknown Application 08.09 20:37:57 [Bot] Startup at SequentialHandler.runRequest (/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:198:23) 08.09 20:37:57 [Bot] Startup at processTicksAndRejections (node:internal/process/task_queues:96:5) 08.09 20:37:57 [Bot] Startup at async SequentialHandler.queueRequest (/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:99:20) 08.09 20:37:57 [Bot] Startup at async Client.<anonymous> (/index.js:43:5) { 08.09 20:37:57 [Bot] Startup rawError: { message: 'Unknown Application', code: 10002 }, 08.09 20:37:57 [Bot] Startup code: 10002, 08.09 20:37:57 [Bot] Startup status: 404, 08.09 20:37:57 [Bot] Startup method: 'put', 08.09 20:37:57 [Bot] Startup url: 'https://discord.com/api/v9/applications/875607866340438000/commands' 08.09 20:37:57 [Bot] Startup }
Load the commands you got from your files into a map
Loop though the map, then register them
client.application.commands.create()
Only once not on every startup
* Load all the available commands
*/
for (let dir of readdirSync("./commands/")) {
let commands = readdirSync(`./commands/${dir}/`).filter(file => file.endsWith(".js"));
for (let file of commands) {
const command = require(`./commands/${dir}/${file}`)
command.category = dir
if (!command.data) continue;
client.commands.set(file.replace(".js", ""), command)
}
}```
my find command portion
how do i get the guild member from a pinged target (interaction)
is that right?
Should be interaction.member
Yes your map is client.commands
thats the ppl who send it i want th ppl that got pinged
so replace with create?
Oh you mean the command option?
this mentioned user (as guildmember
No loading the files is a separate part.
The next part is to loop through the map and register each element
for(const [name, command] of client.commands) …
do I have to do that for every command?
whats command for loop?
You need to actually get the command options data, then work with it, in this case "target" as that’s your ID
oh ig interaction.option.getmember("target");
What I wrote above, the loop of client.commands, the map of your loaded commands
so the directory?
Err probably, I’m usually not working with the methods but it sounds correct
}``` this part needs to be changed right?
No
so I add right after that?
As I said the commands being loaded is correct
oh, thought said needed to be
The commands are saved in a map, client.commands
The commands are saved in a map, client.commands
The commands are saved in a map, client.commands
so what do I need to add/change then
so what do I need to add/change then
client.commands?
client.commands?
but which one
dont bully
dont bully
You need to loop through clirnt.commands
self bot?
@earnest phoenix
why can i only send 1 time the command and then the bot "ghost crash" the command dont work again @boreal iron
Im failing to comprehend how to do that
?
Look above 
@limber micaare you actually here, or did you self bot?
how do I loop, add to each command file?
Trolling or not, just annoying if I’m trying to explain something
Friend sent me a program.
what? xddd uninstall this shti
what program
lol
Im failing to comprehend that sorry, can you explain it for a dummy
If it's about the person sending the same message twice that's a discord bug, not a selfbot
Wut
that was infinity the second time
no he was repeating the previous person's message instantly
Anyone here coding by python
Yeah I just ran the program
Doesn’t seem like it’s eras day
Im talking to him now
can you explain it for a dummy how to do that pls
{ MessageEmbed } = require("discord.js"),
{ SlashCommandBuilder } = require('@discordjs/builders')
module.exports = {
data: new SlashCommandBuilder()
.setName("bite")
.setDescription("Bite them for being a baka!")
.addUserOption((option) => option.setName('member').setDescription('The person who you want to bite').setRequired(true)),
run: async (client, interaction) => {
const user = interaction.options.getUser('member')
const image = await axios("https://api.waifu.pics/sfw/bite").then(res => res.data ?.url || null).catch(err => { console.log(err) })
if (!image) return interaction.followUp("⚠ | There was some issue in getting image.")
const embed = new MessageEmbed()
.setDescription(`**${user.username}**, You got bitten from **${interaction.member.displayName}**`)
.setImage(image)
.setColor(client.color.positive)
return interaction.followUp({ embeds: [embed] })
}
}``` my base command for each command nearly except like 3
what file do I need to change I dont understand 
"prefix": "/",
"token": "removed token",
"color": {
"positive": "GREEN",
"neutral": "BLUE",
"negative": "RED"
}
}``` is in next file
I removed the token for privacy thingy
thats settings.json
@boreal iron
Changing password time
@earnest phoenix how to add loop?
@limber mica Maybe be more careful with the programs you run, self botting is against ToS and a bannable offense here.
trying to go global rn

with slash
so not just my server
you do JS? @earnest phoenix
No
Stop pinging me regarding Development support
can you get someone to explain it in dummy language

Dude don’t forget I’m driving meanwhile
oh, still?
I thought you got home my b
texting and driving
so my question?
-
Load your commands before logging the client
-
register the slash commands in your ready event
for(const [name, command] of client.commands)
{
// register each command here
}
Registration example:
https://discord.js.org/#/docs/main/stable/class/ApplicationCommandManager?scrollTo=create
In your case:
client.application.commands.create({
name: name,
description: command.description
})
(assuming your commands have a description property)
God that took forever to write
So
export class A {
// Main Class
}
export class B extends class A {
}
export class C {
constructor(otherclass: A | typeof A) { }
}
How would I check with typings that the passed class object is extended off of another
in typescript?
put in index or where 
It will end up be there, yes but I can’t write the full code on mobile and wouldn’t do so anyways
home.html
<!DOCUMENT html>
<html>
<head>
<title>GuildStats</title>
<link rel="stylesheet" href="style.css">
</head>
<h1>GuildStats</h1>
</html>
style.css
h1 {
text-align: center;
color: red;
}

didn't use the right path for css file iirc
actually wait that's the right way to link a css file
you're sure it's named style.css?
Did you change the css code first loading the website?
If so always clear the cache on a reload as most CSS properties are cached by your browser
(If you change anything)
And don’t forget to put your elements in the <body>
Your html code is missing that completely
See above
oh right
lmao
nope doesnt change it
You did all steps?
[Symbol(code)]: 'CLIENT_MISSING_INTENTS'
How do I solve this
yep
Code?
home.html
<!DOCUMENT html>
<html>
<head>
<title>GuildStats</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>GuildStats</h1>
</body>
</html>
and i know i cleared the website cache bc i got logged out of my website
Just CTRL + F5
lemme clear it again
Or SHIFT + F5
Oh that’s an issue
wdym
Clearing the cache doesn’t work if the app is still running in the background
At least for me tho
so u mean i need to restart my web browser?
Watching changes for CSS on mobile is a mess without being able to easily clear the cache for each change like in a browser
so how do i clear my cache

Phone settings on iOS -> Safari -> Advanced -> website data
Search your website and remove its data, there’s no separate cache to clear
If you got an Android phone, take it, go outsite, search a deep hole, throw it in, fill the hole with concrete, drill a hole into, put TNT into the hole, blast it
To make sure

I recommend using a real browser on your PC to develop frontend, not your mobile
A real browser isn’t called Chrome btw
If you got that thing installed, same steps as mentioned above just for the whole PC
so ill prob test there
Hmm that’s not so easy then
wym
Try to visit your website using private browser mode only
sure
Are you using a framework to serve static files?
Welp seems so
Make sure you got the path right and that your framework actually serves it instead of dropping the request
im using express
You should probably follow the guide to get started.
https://discordjs.guide/creating-your-bot/#resulting-code
(assuming u’re using djs)
Hi, how can I get a list of the users who reacted to a message with a specific reaction?
It should get displayed like this:
<@user.id> <@user.id> <@user.id>
//The more users who reacted, the more users' IDs that will be displayed when consulting said data```
discord.js btw
has anyone used aws lambda to host slash commands?
i was going to use firebase, but it's super slow
Anyone knows a good ocr library for nodejs?
because tesseract.js is not great... (#memes-and-media message)
@proven lantern how the heck do you use firebase for hosting dynamic apps
you need google cloud run for that
slash commands
don't you need the gateway for those
try google lens
for a second i thought you were going to scam someone
nah... got it
node-tesseract-ocr best
although I have to separately install binaries
node-tesseract-ocr is fast + accurate
yeah but google > amazon 
that is true
my command takes like 30 seconds to run on firebase
<1 second when i run it from my computer
u can make http server too
@drowsy crag
you'll still need to do the ocr yourself
is it possible to make a Promise with an async executor function? new Promise(async()=>{})
resolve(await new Promise((resolve, reject)=> {
setTimeout(() => {resolve("hi")}, 1000)
}))
}).then(console.log)```
this seems to work
!help
no
yes but its useless in most cases
and eslint will scream at you
Resolving a promise with another promise?
inception wants to know your location
using it in a lambda so i can return a response without using return
damn destructuring and renaming inside of destructuring
how to make bot discort?
learn a programming language first
Oh okay. Do you know how to install windows?. I installed Windows yesterday, I don't know how. but don't know how to install it
what is the requirement for those two promises to be awaited?
doesnt look like you depend on them to resolve your return value, so you might as well use them without awaiting?
If you want to learn how to code a really good discord bot learn python first. Java script is garbage because it has a small library and very bad api
Python has a bigger library and better api
Better performance
lmao
ah yes, an abandoned library is bigger and has better api and better performance
I shut it down in the past because of college
Python is not abandoned
discord.py is
You must be brain dead
some of my actions use the same names i store so i want to make sure they are there first
Im a 10 year experiance developer with associates degree in developing. I also work for a cyber security company
I know exactly what i am talking about
ah, well its an ok usage for it, if you really dont want to use promise.then(resolve)
and that is relevant how? discord.py is abandoned, the owner quit
well good for you
I dont use other random developers shit
Nice
I use lavaplayer for better quality for music 😂
lavaplayer is not even python
then why are you going around starting language wars in the name of python lmao
If you use python, do you have to use a vpn?
I wasnt starting language wars
I was telling the guy to learn python
Dont assume shit buddy
Learn to have common sense, morals and values for everyone
I can clearly see you are uneducated and very rude, toxic and disrespectful
Enjoy block
you tried to convince a guy to learn a language by stating incorrect information as a reason lmao
Ive been coding for many years. I have associates degree in developing. i also work for a cyber security company
oh im disrespectful? lol ok

Way advanced then you
Tim at this point
if you have those creds then yikes
Because that is a woefully uninformed opinion
The "Js has small ecosystem" argument is just bs, maybe not as big as python's but big non the less
And this is coming from a Python developer
I do personally recommend reading books about certain lanagues, taking online cources and watching youtube to learn yourself or going to college if you really want a degree in developing after studying all languages
This dude gotta be a troll lmao

and then throwing around his supposed status and credentials as proof that he is right, and im the rude one
he straight up copied groovy and stated it as a rewrite soo
Honestly i dont think he has those creds tbh
I copied the name
Code if fully custom
so much for morals and values :^)
The name does not have a copyright licence
And used their icon 
You must be brain dead
what about profile picture
The day i see a experienced developer having this as their banner
Is the day i buy google
Groovy's avatar is still their intellectual property even if the bot is offline.
No
I am still in school. let me quickly understand maybe someone can teach me
I could teach you but its going to take time to learn
You willing to take 2 to 3 hours a day learning?
Honestly pick a language and start googling flr tutorials etc... It doesnt matter if its Python or Js or some other popular language
whitespace
Think of some basic projects you want to do
And just start trying to code them from there
You learn by doing rather than watching
you can actually make functional recipes with it
So start with basic pronects and just work up
You can always do small basic projects for practice the gradually work on bigger projects, then sometimes huge projects with multiple developers
i'm from asia, sometimes need vpn
but what time?
What time is it for you?
Its 3am for me rn
I will start you off with learning PHP as your first language
You can do anything with PHP
What the fuck
Write a performant OS in PHP
fandi might get sick if you teach em php
man says js is shit to learn for beginners but then goes aha yes php
in Indonesia now at 15.50
Them calling Python the best would be the tip of the cake
Js has a bigger ecosystem than php 
hes literally a minecraft streamer lmao
PHP is the abandoned kid
prove it
I made over 4k to 5k in revenue
:^)
I used to work for a team called TuranicTeam
but why php
Better for pocket edition
Thats a fork
better question: why the h in php
Nah shit
Of a existing server
Its a fork with better implements
Its forked written by other developers "MODIFIED" by my team
Still written by us
No you modified part of it
Altay has implemented more then pocketmine
Gosh sometimes I hate being a mod 🤐 
You must be uneducated
So many things I'd like to say rn
Joined GitHub in March 2021
another thing "modified"?
Secondly i dont see your github in any of those comits
there is a reason why binance is overloaded with altcoins
people fork bitcoin and say OMG I MADE A CRYPTO HAHAHA
i'd never use your advice thank you
all his social media was joined this year, all has less than 20 followers
Which part of the original work did your team modify?
except twitch where he streams minecraft
I work private off my desktop. I pay premium to keep my shit private buddy
But honestly it sums up this dude in a nutshell lmao
Your commits are public on a public repo.
You cannot hide those
Says the one who is uneducated
lmaoooo
🤣
what a troll lmao
Dude just shut the fuck up and stop embarrassing yourself
I told you multiple times i work on a team platform page
*clusterfuck
I keep my shit private on my desktop buddy
Though you did that for long enough to make a good first impression
That means you didn't modify any public projects?
In other words, you don't have evidence of your contributions to public projects.
(:
yes i am confused 😦
Unless you're dktapps you did not write this
I took screenshots of the best parts and now I have free reddit karma
stonks
Anyways, ignore these uneducated kids who have no degree in developing. There rude, toxic and disrespectful including have no common sense, morals or values for anyone or anything except themselfs @jaunty ore
lmao
I will be willing to teach you
rude and toxic okay buddy, to speak in your slang
These types of people are those who only listen to their own opinions and never anyone else
There stubborn developers
Guys he's right, what did amazon ever see in my skills 
Mac lol why is he still here
monke creates
mentionable destroys
monke > mentionable
You ain't exactly open-minded either
Hypocrisy shows
😛
i need to pack my suitcase lmao
I'm literally in class laughing at this shitshow
im travelling in a few hours
lmfao
Same
he is still here to entertain us
Ah yeah right
We have a worl festival going on over the weekend
cool
I nearly forgot to do my covid tests 
-mute @stuck star Trolling, being highly judgemental, looking down on people, calling everyone "uneducated kids with no degree", toxic and disrespectful. | 3d
🤐 Muted 𝙷𝚝𝚝𝚙𝚜𝚓𝚘𝚑𝚗𝚊𝚝𝚑𝚊𝚗#6801 (@stuck star)
🤐 Muted 𝙷𝚝𝚝𝚙𝚜𝚓𝚘𝚑𝚗𝚊𝚝𝚑𝚊𝚗#6801 (@stuck star)
ive never been to a festival 
we might just get muted for off topic
I vote 1 week!
just three days
welp, time to go, see ya
bye
he gets one week and each contribution he made lowers it by one day.. wait 
not to worry, but i passed captcha bot with google lens
cya tim 
yes i want to learn but in terms of coding is windows 7 strong?
It might have some issues with compiling stuff
But for the most part you should be good I believe, depending on what programming language you choose
You can't run nodejs 14+
Python also dropped windows 7 support for newer versions
imagine using windows 7
ohh later, when i have upgraded my pc 😦
try using an online coding platform for now
I want you to guess which website I'm gonna say
Windows 7 sometimes has problems with the network
are you using wifi instead of connecting your router with a cable
because Wi-Fi sucks as heck on windows 7 ethernet rules
*windows 7 sucks
it is outdated
I have here a next file:
module.exports.run = async (inter, con, client) => {
const connection = getVoiceConnection(inter.guild.id);
const player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause,
},
});
connection.subscribe(player)
player.stop();
}
And I think actually the player should go into idle state in this file:
let channel = inter.member.voice.channel
if (!channel) {
return inter.reply({ embeds: [embedManager.warnEmbed(`${language(inter.guild, 'MUST_CONNECTED')}`)] })
} else {
await joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});
inter.reply({ embeds: [embedManager.successEmbed(`${language(inter.guild, 'CONNECTED')}`)] })
}
let connection = getVoiceConnection(channel.guild.id);
const player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause,
},
});
connection.on('disconnect', () => {
console.log("disconnected")
})
connection.on('error', () => {
connection.destroy()
client.queue.set(inter.guild.id, undefined);
})
let pathM = path.resolve('./music'), currentMusic = 0;
const playlist = fs.readdirSync(pathM).filter(file => file.endsWith('.mp3'));
connection.subscribe(player)
let currentMusicName = playlist[currentMusic]
client.queue.set(inter.guild.id, currentMusicName)
let resource = createAudioResource(path.resolve(`./music/${playlist[currentMusic]}`));
player.play(resource);
player.on(AudioPlayerStatus.Idle, () => {
console.log("idle")
currentMusic++
if (playlist.length === currentMusic) currentMusic = 0;
console.log("Music ended, playing:" + playlist[currentMusic])
currentMusicName = playlist[currentMusic]
client.queue.set(inter.guild.id, currentMusicName)
let resource = createAudioResource(path.resolve(`./music/${playlist[currentMusic]}`));
player.play(resource);
})
Why?
that command handler is a pretty smart idea tbh
not my hotspot from headphones
headphones?
Yes, my house has no wifi
hi guys so recently i updated most of my projects to use the go 1.17 sdk but the issue is that when running go mod tidy literally everything in go.mod gets filled with indirect require lines
did i do summin wrong or is that just a funny bug
Yes, I want to update windows, they say I have to change the motherboard and processor, because my processor is very old
is that right that the developer of discord js wanna delete the "messagecreate" event?
is it true that Discord want to Remove MessageCreate Event?
@terse flume that's wrong
discord is removing message content and you need permission from discord to get it
there are no plans to completely remove message create
how u mean permissions? intent?
so if i read it right. unverified bots can use message.content
Yea
But verified bots need permission from discord
how do i get informations about an emoji? \:emoji: doesnt work for me
(like this ':GUILD_OWNER:' for send emojis in bot)
discord
Does anyone know or can give insight about any of the following hosts?
GoDaddy, HostGator, Ultahost, Hostinger
like this. how i get these info easy
unless @lament rock sticks with Contabo being a better option than these 😅
i simp for cherryservers
try that
is your main language german?
no
oh these are german hosters?
13$ a month for the hourly plan
But the price decreases per month if you buy a longer plan
can send a recommend server hoster in the channel?
send it
if only someone asks for it you can send them in dm
Unless it's a well known trusted site
godaddy = apple of hosting, super expensive for no reason
hostgator = owned by EIG = stay away
i only heard horrible things of godaddy
I really want a decent host under 10€/mo

Contabo?
are there any redis alternatives?
that's only 2 cents below 10 
like for caching?
there's memcached
yeah
keyv is also a redis fork
here's a full list lol https://en.wikipedia.org/wiki/List_of_in-memory_databases
This article is a list of in-memory database system software.
I would like to have a dezentral cache, where all Documents will be cached and kept up to date with a change stream.
Bot --------
|
Cache Server
|
Apis ---------
when did you apply?
🆗
@quartz kindle ppl have been reccomending Contabo. do you know any competitor?
contabo is a full vps, like ovh, digital ocean, vultr, galaxygate, google compute engine, amazon ecw, etc...
they offer the best stats for the price of any other competitor
but their hardware might be older and/or slower
they offer the best stats for the price of any other competitor
even on user support?
if it's good/fast xD
well they have the best stats for the price
like 4 cores and 8gb ram for the same price others give you 1 core 2gb ram
I guess I have no other doubt ¯_(ツ)_/¯
Contabo gonna be my next investment
now with the OS... 
why is user.presence.clientStatus dont working? (tried Guildmember aswell)
missing intent?
that's not enough
you have to define the intents on the index
what do i need to define?
example:
const client = new Discord.Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
(i miss v12)
choose us region, there hardware is newer there.
All in all it works, didn't faced a downtime since 20days
can u send me the intent for it?
Intents.FLAGS.GUILD_PRESENCES
because you're not handling the Interaction correctly I think
Yes very much so, for us they typically respond within an hour or less
const {
REST
} = require('@discordjs/rest');
const {
Routes
} = require('discord-api-types/v9');
const { token } = require('../../../config.json')
const fs = require('fs');
const guildId = "818660032739672074";
const clientId = "745982051685105674";
module.exports = (client) => {
client.CommandHandle = async (commandFolders, path) => {
client.commandArray = [];
for (folder of commandFolders) {
const commandFiles = fs.readdirSync(`${path}/${folder}`).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`../../commands/${folder}/${file}`);
client.commands.set(command.data.name, command);
client.commandArray.push(command.data.toJSON());
}
}
const rest = new REST({
version: '9'
}).setToken(token);
(async () => {
try {
console.log('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationGuildCommands(clientId, guildId), {
body: client.commandArray
},
);
console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();
}
}
hmm, I actually haven't tried slash commands myself
I only have been using buttons and select boxes
I'm still thinking if I really need to fully change to slash cmds, or keep both ways of using the bot
i wanna keep both but first im trying to do all with slash commands cuz there many dumb ppl who didnt understand how commands with args working and in / commands they see it
which OS have you chosen?
I'm not acquainted with enough Linux OS
I only know that Ubuntu 18.04 has the most support, and that Arch Linux is a bragging thing
😂
Go with ubuntu
just like that? xD
so, 20.04 vs 18.04. which one?
I'm looking at this table here:
https://computingforgeeks.com/ubuntu-20-04-vs-ubuntu-18-04-comparison-table/
and even though 20.04 has better features/improvements, I know the community on 18.04 is bigger iirc
I don't think that's a big deal in this case - go with the newest
aight ¯_(ツ)_/¯
What exactly are you planning on hosting? a discord bot?
yeah xD
but I am thinking I could use it for other things later
so I want to make sure it's a good pick
yeah go with ubuntu, generally the OS of the VPS isn't that big of a deal, unless your app is OS-dependent, or needs some software that is OS-dependent
what if I want to make a Minecraft server later? 
I use Ubuntu 20
there most likely won't be a problem, I've never dabbled in that area, but isn't a minecraft server essentially a TCP server
I did 14 questions on my own bro
This is the last one of my file
still
^
they were different and easier
I dont know how to do menu driven programs
update: I made it o!
it says a menu driven program
python
I think he didn't get how simple it is
😮
lmao I was told that I could get any help here but you people cross questioning me :c
but we won't write the full code just for you
Are you in high-school or college
because that's 
high school
The question is very weirdly worded
"Write a menu driven program to do the following option on binary file "Student" "
tf?
the binary file should already exist from previous exercises
there are also some grammar errors I think xD
it doesn't make much sense, if someone gave this to me as an assignment I wouldn't know what to do either
Student: "010001011101010"
Hi! I have this error :
/moontest/commands/General/npm.js:6
const fetch = require("node-fetch")
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /moontest/node_modules/node-fetch/src/index.js from /moontest/commands/General/npm.js not supported.
Instead change the require of index.js in /moontest/commands/General/npm.js to a dynamic import() which is available in all CommonJS modules.```
How can i do bc yesterday i didn't get this error ...
i tried to recreate it and it threw the same error
try import() instead
isn't import() async?
I use like import fetch from 'node-fetch'
that's not allowed in commonjs
sad
I use TS
wait, I use CommonJS
look at my tsconfig
{
"compilerOptions": {
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "Node",
"outDir": "out",
"sourceMap": true,
"esModuleInterop": true,
"importHelpers": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"lib": ["ESNext"],
"declaration": true,
"watch": true,
"baseUrl": "."
},
"exclude": ["node_modules", ".vscode", ".env", ".eslintrc.json"]
}
but I have the imports previously done
before entering any scope
@modest maple how are you accessing the VPS? PuTTy?
What does the Windows command prompt or the Unix shell miss Putty can do for you better?
I just use ssh for setting up a new server, from there i just use docker and portainer for everything else after
idk, just asked XD
I'm using Git Bash for the first login
Putty doesn’t do anything better.
Telnet, SSH, cURL, nFTP etc. are natively supported by Windows and Unix these days.
(nFTP may needs Windows Pro, not sure)
yeah I found a tutorial on that, that's why I asked xD
only thing I've done was sudo apt install nodejs 
idk what to do after 
git installed
now it's the first time setting up an SSH key ever 😮
sudo apt install nodejs gave me outdated node version 8
wot
Did you update the package lib before?
same but it gave me v10
guess Ubuntu never updates
use nvm instead
nvm install v16.8.0
my nodejs is 10.19.0
Oh didn't saw that
I updated last week and then 16.8 was the final one
16.9 says in the nodejs page
nvm is what though?
The latest according to Ubuntu 20
yes
what the fu
so how do I update it?
nvm is not found
Install nvm
then
nvm install v16.9.0
yeah dumb me
sudo apt install nvm?
whats sudo?
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
client url
postman but for cli
Command Line Interface
new to Linux? @errant flax
I'm veteran on Linux
you forgot to add not to brag
I use Windows for gaming tho
and that's not something you should be ashamed of
It's not bragging
It's a story of pain
my blood, sweat and tears
xD
oh wait
node is different from nodejs
what have I installed?
root@*********:~# node --version
v16.9.0
root@*********:~# nodejs --version
v10.19.0
sus
well I just removed nodejs
node is from nvm and nodejs is from package I guess
hmm
I can't add a ssh I just created
wtf, it doesn't find the file
😦
woohoo
this is funnier when it works
and their
hahaha
imagine


you tried import('node-fetch')?
my bot start but i have this message
(node:24250) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use node --trace-warnings ... to show where the warning was created)
@waxen bough
i don't think this is related to import() problem
He say me fetch isn't defined, how can i do for fetch so ?
^
it throws error when using require
it shouldn't
says it's unsupported
how 
ye
Where did it say it
/moontest/commands/General/npm.js:6
const fetch = require("node-fetch")
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /moontest/node_modules/node-fetch/src/index.js from /moontest/commands/General/npm.js not supported.
Instead change the require of index.js in /moontest/commands/General/npm.js to a dynamic import() which is available in all CommonJS modules.```
here
here
but yesterday it's worked but not today
ok
up to date, audited 295 packages in 2s
44 packages are looking for funding
run npm fund for details
k it's alright
yes
what version of node is that
do node --version
v16.9.0
aight
same version where i tested
and u got this error ?
yes
mmh
hey so im making a website where the visitors ip address is shown but instead it shows invalid ip instead, i assume its the repl ip addrss not mine
think they may be proxied
i am thinking of putting the const fetch = (await import('node-fetch')).default statement inside the async function but that would import the module every time it's called
But how?? Should i switch to other programming sites??
can't really think of other solution
@everyone
k
nice try
@waxen bough , @outer perch and @pale vessel I succeeded: I installed an older version which is 2.6.1 (the last one is 3.0.0) and it works perfectly
for node-fetch problem
@waxen bough @earnest phoenix
This module was converted to be a ESM only package in version 3.0.0-beta.10. node-fetch is an ESM-only module - you are not able to import it with require. We recommend you stay on v2 which is built with CommonJS unless you use ESM yourself. We will continue to publish critical bug fixes for it.
Alternatively, you can use the async import() function from CommonJS to load node-fetch asynchronously
nevermind install 16
why won't can't nodejs allow cjs and esm mixing
english only
it does, but with certain conditions
man how do I wish discord allowed more than 5 buttons per row
I'll have to do that too, but it's mildly inconvenient
so, what does docker do?
it docks


discord.js is hurting my brain
const hash = this.hashes.get(${request.method}:${routeID.bucketRoute}) ?? Global(${request.method}:${routeID.bucketRoute});
^
SyntaxError: Unexpected token '?'
I don't understand
I am connected through ssh
tried to start an instance of the bot's dev version
it ain't starting
define "not starting"
but the bot isn't running
tsnode is just a shortcut for compiling and running typescript
try compiling it yourself and running it normally
but you use typescript right?
yea
the nornal way to use typescript is to run tsc file.ts
that should create js files
it never did with ts-node
and use node on the generated js files
but why doesn't ts-node work?
tsnode is just a shortcut that does it for you
what's the difference between my machine and the vps??
so one of the steps to figuring out whyvit doesnt work is to get rid of shortcuts to see if it still doesnt work
also tsc will create js files, which you can open and check if ts compiled it wrong
idk what the difference is, you have to figure that out yourself
check if dependencies are properly installed
but how would it compile wrong from just changing the place where it's done 😂
I ran npm i
check if they are the same versions, etc
How to put playing invite cater bot in our status like MAC's status
well try the tsc method
😔
ok
oh wait
does npm i install dev dependencies??
omg, I guess ts-node needs to be installed globally instead of locally
nah, not working still
lol
gonna transfer the file again through scp
hahaha no
scp means secure copy
scp-477384 a computer file that is unexplainably always empty, no matter how many times you save it and overwrite it
now it's something
and now its showing queued
usually its bytes
B so
otherwise that yould be 6mb
yeah
mB is Bits
in decimal
and Mb is Bytes
and mib is mebibytes
install it with apt
apt install fontconfig
One message removed from a suspended account.
yes! dev version is now completely running on the VPS!
now, is it possible to close ssh while running the process?
or make a startup process every time the server goes up?
so it transforms it into a system process and I can log off after and keeping it running?
not a system process but yes, a managed process
😮
const token = this.client.token ?? this.client.accessToken;
^
SyntaxError: Unexpected token '?'
but the code doesn't even exist in my main file
One message removed from a suspended account.
so i'm running with discord.js newest version. i'm not sure what it wants from me if it
it's giving me that code even though i don't have it in the file
You need to update nodejs
What is the newest version?
Older node versions don't know the null coalescing operator
16.6+
The djs update notes from v12 to v13 should mention this
Just copy the error and paste it in here
Literally all it says
Updating djs to v13 will require a lot of changes in your code anyway
You might wanna read the update notes
Sigh
Hey so its midnigth where i live my brain kinds stopped workiingk
Why does it says data is undefined??
While bro its right above that
how can I ensure that pm2 is running my bot on startup?
I started the process and then used startup and save
fuck, no
pm2 startup should send a command for you to use, iirc
pretty sure it asks for root privilege
didn't
only said this
[PM2] Init System found: systemd
Platform systemd
Template
[Unit]
Description=PM2 process manager
Documentation=https://pm2.keymetrics.io/
After=network.target
[Service]
Type=forking
User=root
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Environment=PATH=/root/.nvm/versions/node/v16.9.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PM2_HOME=/root/.pm2
PIDFile=/root/.pm2/pm2.pid
Restart=on-failure
ExecStart=/root/.nvm/versions/node/v16.9.0/lib/node_modules/pm2/bin/pm2 resurrect
ExecReload=/root/.nvm/versions/node/v16.9.0/lib/node_modules/pm2/bin/pm2 reload all
ExecStop=/root/.nvm/versions/node/v16.9.0/lib/node_modules/pm2/bin/pm2 kill
[Install]
WantedBy=multi-user.target
Target path
/etc/systemd/system/pm2-root.service
Command list
[ 'systemctl enable pm2-root' ]
[PM2] Writing init configuration in /etc/systemd/system/pm2-root.service
[PM2] Making script booting at startup...
[PM2] [-] Executing: systemctl enable pm2-root...
[PM2] [v] Command successfully executed.
+---------------------------------------+
[PM2] Freeze a process list on reboot via:
$ pm2 save
[PM2] Remove init script via:
$ pm2 unstartup systemd
what is interaction.defer() interaction.deferupdate()
What is defer?
Defer your reply if you're going to respond later than 3 seconds or if you want to add attachments to your original response
It'll say X is thinking... while you defer
Looks good
why does my client says defer is not a function?
hello. im getting a "no module named requests" error even though I have it installed. any ideas on how to fix?
i somehow got my bot to work
even though it is running on really old code
anyone here used aws lambda to host slash commands?
hello. im getting a "no module named requests" error even though I have it installed. any ideas on how to fix?
try reinstalling requests







