#development
1 messages ยท Page 1568 of 1
he thought he was supporting my bot
Why didn't anyone help me: <
by adding it to new servers
Well let him know he's not!
hmmm, if one of my shards crashes on like an undefined variable or whatever, it just autorestarts, it doesn't really feel right to keep the app running with an error in there ๐
if that's the case you can edit the file, save it and then restart that shard manually?
not sure who is misunderstanding ๐ the problem is, if the error gets to the real bot even through testing on dev version and a crash appears, it basically keeps running with that error still in code, not shutting down
tho undefined variable sounds like that would be global scale
if you have a real bot in prod any testing should be done on a clone
tho I don't understand "it basically keeps running with that error still in code, not shutting down"
you could detect when the error occurs and shut down the process (process.exit())
so does it stop working?
it seems to me like instead of shutting down, it just logs the error
nah, I just had a piece of commented code from past which was prepared for the future but unmodified for the principle, what I'm trying to get to know by that is how I should handle it
discordjs sharding manager makes it autorestart and keeps running it with that error, canceling all collectors in progress, if it would be a frequent error, I don't think restarting each 5 minutes would be good for users ๐
the testing is done on dev version, but what if the error gets in the prod version
which is what is supposed to happen to stop the bot from restarting 100 times
and you want it to not?
doesn't crash the whole app nor the specific shard
stop
I think I should not right? restarting the shard shuts all the active collectors for all users
you just said it reboots the shard
I'd rather deal with few hours blackout ig
now you say it doesn't crash nor reboot
you can catch all errors or unhanded rejections
If I send a message containing 'name', can the bot reply 'You name Seku' ???
if message.includes('name') message.channel.send('Your name is' + message.author.username)
yea you shouldn't restart the shard on every error
depends on what type of error
!bid
ohh thank very much
if its the ws dying, might want to restart
I guess I formatted that incorrectly, it throws the error and reboots the shard
I think I should rather crash the whole app when that occurs, right?
my sharding manager has CLI --unhandled-rejections=warn, but undefined variable isn't a rejection, right?
assuming you don't have a reconnection ws
there are 2 ways, you can catch in an area to prevent an error ex. try/catch blocks or .catch() on promises
you could also do process.on('unhandledException', console.error) and it would error but not crash
they may have unexpected side-effects though
so I could do like
process.on('unhandledException', process.exit())
to shut the whole app (all shards) when an error like that occurs?
as said, I don't wanna keep it running when an error other than rejection occurs
send a message to the master process, which then sends a message to all shards, and when a shard receives said message, process.exit() is called
that should only restart the one shard I think, im not familiar with djs sharding
yes only the shard in which the error occured
^ to close all shards
alright, I'll give it a try, thank you ๐
why is an empty array being logged?
let container = docker.getContainer(id);
container.exec({
AttachStdin: true,
AttachStdout: true,
AttachStderr: false,
Cmd: ["-it", "echo", command]
}).then(exec => {
exec.start( { hijack: true, stdin: true } );
});
I've been playing with dockerode, but I can't seem to find a way to execute a (Minecraft server) command using it.
Is there any way to send (Minecraft server) commands using dockerode?
command is "stop"
There's no errors, but it doesn't work.
I could start/stop/kill/view the console/list all servers with dockerode though.
the owner isn't granted to be in cache
fetch the owner using the owner id
my internet's taking a shit so i can't browse the docs
how do i do that
see fetching owner doesnt work half the time fir me
message.guild.owner returns undefined as well lol
how do i fetch someone with their id
you need to format it
Maybe you need intents? How big is your bot?
246+ servers, verified with the server member intent
await guild.members.fetch(guild.ownerID)
but without the server member intent (on my next bot being released) I can fetch guild owner np
can you give me the full code or documentation about this?
djs docs
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threade...
js docs
I left it formatted wrong on purpose

so you would have to understand what you were doing
yes
Ok so think of it like this in java
if (this happens) { this happens }
Read it as: If ( I do this) then this happened
reading the docs will give you more clarification
Its kinda like when doing math equations you need to put ( and ) at the start and end of the statement
say for like
I do recommend learning proper syntax and some basic coding before delving into making a discord bot though
Date.now() - 100, You would put it like (Date.now() - 100), same thing with if statements you have to put it in parentheses
Agreed
๐ this is not quite correct
the latter part is
but you don't need parenthesis in the former example
parentheses are recommended when doing the math
Because, Without the parentheses I get NaN alot
sure

for complicated operations
Well I wouldnโt call the message timestamp being subtracted from Date.now() complicated
exactly
ergo parenthesis are obsolete in that example
I need some opinions.
So currently, i'm in the process of coding another bot named GameCord.
It will include an economy... Since there's nothing huge to it, in my opinion, I believe that a local SQLite file will be fine for storing the data.
Since users will only earn cash when using commands and not chatting, I don't believe concurrency should be an issue.
I don't want to have to use MongoDB or any other database since it's not really worth the effort when all I store is wallet balance and bank balance.
Can I get some opinions on this?
Sounds good
So it should be fine?
Okay, thank you.
Especially for discord bots ^^
Big databases, SQL or nosql based, are generally way overkill for discord bots
It's realistic to store as little as possible too
Oh, well SQLite is super easy to implement, but tbh so is mongo, but mongo isn't really worth it
That's the only two db's I know how to use atm ๐
Should I also make regular backups of the SQLite file?
Where do you host?
im using sqlite as well
Yeah
Nah but it's not like the file will just disappear
i back it up daily
It's not a JSON database, it won't corrupt as often
and delete backups older than 5 days
Tbh, i'd rather back the SQLite file itself rather than everything
I auto backup 3 times a day because I bash 8)
sqlite has a built in backup function
Kinda redundant for nosql but who cares
once per day
Doesn't really matter
Do you manually do it or do you have a script?
i use the built in function, with extra code to delete past backups

lmao
The timgineer
lmao
sure
legend, thank you
which npm module are you using for sqlite?
sqlite3
use better-sqlite3
"it's just better"
^
Is it the same format or is it different?
idk, never used sqlite3
the api should be different because better-sqlite3 is synchronous
no callbacks
enmap keeps a copy of everything in memory
use josh then
evie.codes fan lol
why use a wrapper when you can get skillz
it saves time
get realโข๏ธ
innitโข๏ธ
sometimes you should be lazy
no u
sqlite is super easy to use tho
and use packages available
It really is lmao
just setup a simple CRUD operation and ur sorted
ran from expressjs
How many operations can sqlite handle at one given time, any idea?
queries*
So a bot which is in like 10,000 would be fine?
If it only gets the user from the database when they use a command
And not when a message is sent
Oh damn, that's smart
i have a db with about 27k rows
Whats your bot?
the file is about 15mb
bot's name is "Astrobot"
with lowercase b, there is another bot with the same name but uppercase B on top.gg
lol
yes
can anyone help
me wiht my bot
ew
what a nerd, copying bot names
me learning java currenly
hello
Learn JS, not Java ๐
no
java in 2021 is only useful for minecraft modding 
how about neither
tru dat
@earnest phoenix running a non-indexed LIKE %% query that matched 7k rows took 50-200ms
oh wow
running count(*) takes 0.3ms - 1ms
name: 'memberinfo',
description: "COMMANDS!",
execute(message, args, Discord) {
const usernamemention = messagearg.username;
const avatarmention = messagearg.avatarURL({ dynamic:true });
const idmention = messagearg.id;
const tagmention = messagearg.tag;
const lastmessagemention = messagearg.lastMessage;
const Statusmessagemention = messagearg.presence.status;
const messagearg = message.mentions.members.first();
if(messagearg){
const infoembed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle(`**${usernamemention}'s Information**`)
.setAuthor(`${usernamemention}`, `${avatarmention}`, `${avatarmention}`)
.setDescription(`Every Bit Of Detail About ${messagearg}!`)
.setThumbnail(`${avatarmention}`)
.addFields(
{name: '**Username:**', value: `**${usernamemention}**`, inline: true},
{name: '**User Tag:**', value: `**${tagmention}**`, inline: true},
{name: '**User Id:**', value: `**${idmention}**`, inline: true},
{name: '**Status:**', value: `**${Statusmessagemention}**`, inline: true},
{name: '**Last Message:**', value: `**${lastmessagemention}**`, inline: true},
)
.setImage(`.avatarmention}`)
.setTimestamp()
.setFooter('I Told You, Every Detail...', `${avatarmention}`);
message.channel.send(infoembed);
}
}
}```
Help
I Want The Bot To Take The First Person Mentioned After Command And Put It In The Embed
I got This Error Doe
Yeah
Im trying To Put The person There And The String To Get The personed mention's usename
if you did not understand what im pointing out
you're trying to use messagearg before you create it, when it still doesnt exist
the order of variables matters
yes
the only place where it doesnt matter is when creating functions using the function keyword
for everything else it matters
message.mentions.members.first() returns a member
members do not have .avatarURL()
only users have
oh
you can convert a member to a user using member.user
ok
Tim do you know some ts?
I am trying to export an enum or something similar as part of a class
soconst messagearg2 = message.mentions.user.first();
const avatarmention = messagearg2.avatarURL({ dynamic:true });
That Tim?
also possible yes
ex. Class.x would be the enum so I can do Class.x.TRUE and get 1
Ok
how should I do that @quartz kindle
ok
show cod
show call of duty
I don't exactly have any cod
No point really. There is a way, but the enum cannot be a const one
You should just put the enum in the same file the class is in and export it
I need to export it as part of the classs
something like this should work no? ```js
enum bla {
...
}
export class abc {
static x: bla
}
I could do js this.x = { "TRUE": true, "FALSE": false } in the constructor but then its not typed
I would prefer to keep everything part of the main class
I don't think I can do that Tim
lemme try
then.. you'd do this:
enum Smth {
A,
B,
C
}
class A {
x: typeof Smth
constructor() {
this.x = Smth;
}
}
ye but he wants it as a static prop
not on the instance
i think
you want to access MyClass.x? or a = new MyClass(); a.x?
new
Then
enum Smth {
A,
B,
C
}
class A {
static x = Smth;
}
its already an instance
ah then do google's first answer
I think yours actually will work GoogleFeud
both of mine will work cause I tested them
but I just find it super unnecessary
just export the enum and make it const
100% more efficient, slightly different code
is there anyone who knows the pass array argument to the broadCastEval in discord.js
// server.mutedRole = Mute Role ID
const muterole = message.guild.roles.cache.get(server.mutedRole);
if(mutee.roles.cache.has(muterole)) {
embedError.setDescription(`${mutee.user.username} is already muted!`);
return message.channel.send(embedError);
};
Not returning...
@quartz kindle solve this :)
probably p was undefined by the time you assigned it to e
wait that doesn't make sense either
no
oh shit
man, I wish this was possible
if i press up arrow, await p and const e = await p isnt present in history
whoa
unfortunately I didn't find a way to load a text from another site and apply styles to it
all I can do is iframe it
which looks shit
kekw
if it isnt present in history it means it rever returned, it awaiting forever
therefore the const e also never took place
life is a simulation
can you use await in the console?
it didn't seem to output errors but like
it doesn't halt the console
the console runs with top-level async enabled
something node has been promising to do for a while but never did lul
kek
den though there's deno
ah yes, deno
'node'.split('').sort().join('')
doesn't node 15 have top level async?
node 15 isn't stable yet anyways
latest stable version is 14.x.x
it's fairly stable
hmm
yes you can
ok
use the JDA library
are you also making a bto
no
it's an AI to conquer the world
humanity will cease to exist
also doesnt work in a file
ok
it does support html
html is supported
where you making the bot @quartz kindle
Not for servers 
oh
well
markdown is an easy to use alternative to html so you can't really use css in markdown
i hate typing on mobile
Fair enough; Markdown just doesn't seem to support what I'm trying to achieve. This is what it looks like:
The top image is a slideshow of various background images with the logo on top; there's buttons and whatnot for nav.
I don't think markdown supports this, but I could be super wrong.
there seems to be something i need to do in order for it to resolve
OH WAIT
there we go
im so pro
interesting
canvas dosent work with node v14?
it does
Error: The specified module could not be found.
\\?\C:\Users\J\Desktop\Commissions\valor\node_modules\canvas\build\Release\canvas.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\J\Desktop\Commissions\valor\node_modules\canvas\lib\bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\J\Desktop\Commissions\valor\node_modules\canvas\lib\canvas.js:9:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)```
did you recently change node version?
did you copy/paste the node_modules folder?
and you just run npm install canvas?
when you installed discord-canvas did it show any logs about canvas?
also why the fuck does discord-canvas require fortnite
nope i even tried npm i canvacord same thing
both of them use canvas
and canvas is a native module
requires compiling
run npm rebuild canvas
oh may of worked
I need help
como hago esto
const dato1 = args[1];
const dato2= args[2];
const datos1 = ["perro","gato"];
if (dato1 no existe o no es igual a datos1 )
si si
how I do this
const data1 = args [1];
const data2 = args [2];
const datas1 = ["dog", "cat"];
if (data1 does not exist or is not equal to datas1)
Now
I edit now
Reedit
Ah okay
Now
if(!data1 || data1 !== datas1)
Ok i test
Alright
Wait
?
you want to check if data1 exists and is perro or gato?
if(["perro","gato"].includes(data1.toLowerCase()))
I think he just wants to see if it is not equal to datas1
datas1 is an array
Ik
a string cannot be equal an array
True
Maybe he didn't word it very well
But we should make sure he clarifies before confusing him
const nick = args[0];
const edad = args[1];
const sexo = args[2];
const generos = ['masculino', 'femenino'];
if(!nick) {
message.channel.send("Uso de Registro : \n //reg nickname edad sexo")
} else if(!edad) {message.channel.send(" โ | Olvidaste poner tu edad \n Debes escribir: Nick Edad Sexo \n en orden")}
else if(!sexo || sexo !== generos) {message.channel.send(" โ | ese genero no existe \n Debes escribir: femenino o masculino ")}
else {
message.channel.send(**Nickname: **${nick} \n **Edad: **${edad} \n **Sexo: **${sexo})
Help me where are the error?
if im correct user dosent have a roles property?
const roles = ['Testing', 'Tester One']
if(user.roles.indexOf(roles)) return```
its not reaction.message.member tho?
not sure
Helpme
I use js
ik i was just saying something
Isn't it just REST though
// server.mutedRole = Mute Role ID
const muterole = message.guild.roles.cache.get(server.mutedRole);
if(mutee.roles.cache.has(muterole)) {
embedError.setDescription(`${mutee.user.username} is already muted!`);
return message.channel.send(embedError);
};
``` Anyone knows why it's not returning?
https://gyazo.com/663f2b2fbe1ef2e13456cdc4730b172a hi i have a problem, i cannot display the exact number of members on my bot (i am using lib discordjs v12)
are you retrieving from cache?
What do you mean?
if you are getting the count from the cache
Ah
But about my question, do you know anything about it?
?
sorry I didn't read what you were saying
yes
or iterating over each guild and storing the count in a variable?
oh, nvm, I thought it was hamood's question lul
no cache will ever have the total amount of users
Ah
How can I get the server count of my bot to show? client.guilds.cache.size returns "Cannot read property of โcacheโ of undefined"
so how do i get the exact total?
if you console.log inside that if-clause, does it write something?
I will write.
iterate over each guild retrieving the total count
When I log 'client' it does have a guilds property
python or js?
except that it is not the guild total but the user total
js
you're writing "a!help | X users"
Never used js, but I'm assuming just client.guilds.size doesn't work?
if you want guilds it's easier then
yep. neither of them work
yes i want the total members
not the total guild
iterate over the guilds, retrieving total member count
but when logging client it does look like it goes like this client => guilds => cache then I can use client.guilds.cache with a .size to get the amount
k
Unfortunately not.
It returns undefined but it still has the property
if you console.log "mutee.roles.cache" what does it output?
Instead the if statement or outside?
How is mutee defined?
let mutee = message.guild.member(message.mentions.members.first() || message.guild.members.cache.get(args[0]));
Sure.
Thats how I have defined it in the past and it worked np
nevermind, it didn't console log anything inside the if statement.
if(mutee.roles.cache.has(muterole)) { ... }
This doesn't work.
or just server.mutedRole
const muterole = message.guild.roles.cache.get(server.mutedRole);
/// server.mutedRole = The Muted Role ID
remove server.mutedrole
redefine muterole
as
message.guild.roles.cache.get("ROLE ID")
do you even need mutedrole
Yes.
for?
ig mutedRole is a saved config
Yes.
sorry muterole
MutedRole is the Muted role ID.
use it then
Yes
server.mutedRole is considered as an ID
I meant muterole
.has(server.mutedRole)
see instead of server.mutedrole I wouldve done let mutedRole; mutedRole = database fetching code
and then it can be changed at any time with a command
hmm
Uh
kudos to flaze
if(['Level One', 'Level Two'].some(role => member.roles.includes(role))) return```
what am i doing wrong?
hmm
I have several questions
reaction.message.member
Does Visual Studio Code randomly open sometimes for anyone?
then use array.some(name => member.roles.cache.find(role => role.name === name)) ig
ctrl + shift + esc -> statup
see if vscode is there
or check if you didn't link vscode to text files
I don't use Windows so I basically opened the equivalent. Visual Studio Code isn't running, but a process named "Code Helper (Renderer)" is ๐ค
Which has some open files/ports pointing to VSC
idk, never seem that
if(roles.some(name => member.roles.cache.find(role => role.name === name))) return user.send(user, noRole)``` keeps returning even if they have the role
how do i send videos in discord py
embed
you can't
you can only upload video files
๐ฆ
looks like proxy time
Looking for testers for my discord bot! They need to test my bot and give me feedback! Dm if interested!
Is it legal to post that here?
@lyric mountain
no
mods will tell u to check for fiverr or freelancer
find some friends to help u test
Cuz i might have missed some bugs
Wish i had some ๐ฅฒ
dot dot dot
I wonder if Tim is around ๐ค
Tim?
Yeah, he usually helps out in here. I just wanted to thank him for something ๐
Ok lol
@long marsh can you help me test my bot if it has any bugs
I already tested
Negative on that ๐ - I'm fixing my own bot's problems atm ๐
But i might have missed some bugs
What's your bot?
Its a multipurpose bot
I want to start with coding and figured I'd start with a discord bot. I did some research and found out about discord.py for Python, should I start with Python? Or other languages?
Sorry for disturbing the convo 
Start with any language you feel the most comfortable with. Python is easy to learn since it practically reads like english. Discord.js for JavaScript is also great for its extensive guide.
don't
No problem lmao
but bots just make it worse

I learn best from throwing myself in the deepend and climbing my way out, haha
My bot just hit 1.5k servers ๐
๐ ๐ ๐
WHAT
I started learning the basics of Python, I could share the video i learned from. I don't really know how to make use of it though 
1.5k
just note that python LOOKS easier, but it's a double-edge dagger
Agreed
Congrats! 
@earnest phoenix anyways can i ask you a favor?
Of course
python is a siren that charms you and take you to the bottom of the ocean
O.O
when you notice you're floating lifeless on a pile of code
It's really easy to lose yourself in Python code ... ie. spaghetti
But, I guess, that's really the same for any language.
Python just makes it easier ๐
the issue with python is that it's so abstracted that it charms new coders
there's a quote for that:
"easy, cheap, fast - choose 2"
python would be easy and cheap
I see
Python can be fast if optimized correctly. Most new learners wouldn't know that though.
the major bottleneck of python is that it's an interpreted lang
and doesn't have threads at all
python is good for small tasks
like automation, routine scripts, etc
It's 'fake' multithreading ๐
which is why it was made
For example, we use it at my day job for automating CI scripts and build plans ๐
yeah, CI scripts are really easy with python
I use python to retrieve sound name for my stream
Honestly, I've fallen in love with Javascript. I used to hate it. Once I switched from Python to it ... haven't really gone back.
since IO with it is dirty simple
I can't get used to JS, like, I use it for sites and whatever but I don't really like debugging it

idk, I'm just not made for interp langs
No problem
interpreted languages
langs that aren't compiled, just run directly
the runtime "interprets" what you're trying to do
like
let a = 30;
a = "aaa";
console.log(a);
will output aaa
meanwhile in compiled langs it'd output
Cannot convert type String to int
Oh
ts 
I think i get it
pros:
- less vars, less code
- easier (is it?)
cons:
- slower
- howthehelldoIdebugthis
Lol
Scale? 
yeah, code size
project size
actually, complexity size
o
Ohh
So basically
Interpreted languages for smaller projects
Non-interpreted languages (?) for bigger projects
Do bots contain much code or rather less as for the size?
depends
more code not necessarily means more complexity
some bots are really simple
while others have a whole cobweb regarding methods
the most barebones as possible bot would have about 15-20 lines
it depends on the project, you cant really use an interpreted language for an arduino device no matter how small the project, neither can you use a compiled language for a huge project if the project is a web app
i mean, technically you can, but you will end up complicating everything to accomplish it
java is like, 80% compiled and 20% interpreted right?
it compiles to bytecode, which is interpreted by the jvm
A question to the reload things, since the commands a saved in a map, theoretically I could overwrite them with same function, which I use to load commands, Is this possible? @Tim#2373
lua has luajit, python has pypy
pypy lul
pp for abbreviation 
idk how noone made yet a lib named papaya for python
hm yes
yes, you can do client.commands.set(name, newRequiredFile)
it will replace the existing
perfect Thx again 
p-py py
depends, what are your goals?
I recommend java, but really depends on your goals
I'm a bit biased towards java tho
That's a good question i should've thought about what i even want to achieve
js and python are probably easier for beginners and they have by far the biggest communities out there, which means lots of resources to learn from
c# is rapidly growing as one of the best balanced languages
use C
best for beginners ,jk , js is good, c++ or py
java has been around from decades and has multiple ways of using it
use binary like a real programmer
newbies don't need ptsd
im learning rust and it's been a blast so far
000101000100100101001001001001 here xD
lua is commonly used in videogame scripting
roblox 
^ and mouse scripting
How about a bot
ruby is also popular for server development, and afaik for rpgmaker
ain't rpgmaker java?
last time i used it, it had ruby scripts
Many languages i haven't heard of, I'll have to do some more research 
to build the actual content, not the engine logic
when you ask me , I would begin with javascript. Its easy and a powerful language
if it gives you an idea, 90% of bots out there are either js, java, python or c#
with js being like 80% of those
lmao
I see
rust 
ah, someone should use discord.js-light , 1 user + 
what if you filter-out turk/copypaste bots? 
im gonna try making a bot with rust later on
probably still the same
wonder how it will turn out 
js is currently the most popular language in the world afaik
wasn't it python or something
make sure to take anti-tetanus shot
I heard Python is also used in data-management or so? Please correct if it's not true 
objective task
Uhh programming is really complex
When you can not decide:
make a python to js parser 
not at all once you get the hang to it
nah, its easy
python used to be extremely popular for creating small scripts like reminders, automating excel files or download/upload/move files and folders, etc
but these days js can do the same with node
What'd be a good kind of project to get started? You know get the hang of it and so on. Or should i just study as a start?
js is also categorized as a scripting language
@earnest phoenix js has the advantage, you can run it on nearly any browser
java _script 
Node?
That's not why but okฤซ
node js is a libary lol
js has always been a scripting language, but before node it was confined to browsers
with node, now js can run everywhere
Help, Code -> https://pastebin.com/Nruxcynj
node.js is a javascript runtime*
Hmm
for example, before you could code a python file, similarly to how you would do a complext bat or shell file
and then just run python file.py
and it would work
back then no other language could do that
So
now you can do node file.js
calculator
DIscord bot 
actually, start with a "Hello World" project
like a simple sum calculator
don't
lol I started xD
discord bots are advanced projects, dont start with that
Node is kind of a tool to even be able to program certain things in javascript?
properly learn before doing something advanced
if you want to have sucess, start with a "Hello World"
all good devs start with it
node is a program that interprets and executes javascript code in real time
console.log("hello World")
I thought they do it on runtime
Welcome to the calculator!
Type a number:
6
Type another number:
12
Result: 18
lol wanted to tell
it's a must, else the programming gods will be angry
And without it javascript can't by itself?
and bugs will haunt your code
help please
thats a one second project, cmon
javascript needs an engine to run on, node is one engine, browsers contain another javascript engine as well
made one in c xD
there are many engines that run javascript, but the most popular one is called v8 which is used in node and in google chrome
calculator despite being simple help learning basics
and then you have monstrosities such as chromium built on top of v8
it's easy now, but I bet you couldn't do it that fast when you started
I did some "Hello World" and other things such as lists and uhh dunno how you call it but for example (Age: ___, you type it in and then the output is: "You are <input> years old") on Python
so if you already have some experience with python, you can stick with it
I see, thanks
this probably interests @earnest phoenix to 0% rather confusing them. GO on lets squeeze out everything you know 
unless you want to move into web development
web is javascript land
python has no business there
do some simple programs, there are a bunch that we do to practice when starting a new lang
And what do you mean by running in Chrome or any browser? 
that's backend
backend is part of web dev skid
making a snake game is also a good exercise
Google 
it's kinda simple but involve a lot of knowledge
people just wanna disagree with everyone 
press F12 in your browser, and go to the "console" tab
Sounds good, I think I'll start with Python or Javascript
the console is a real time javascript engine
you can literally type js code in there and it will work in real time
I can give 100% discord dm support when you use js lol
I pressed f12 and turned on airplane mode 
wtf
lol
then you are on the laptop probably
Can Someone Help me With This error
I am
if your laptop has FN keys on
Yup
then you need to press fn+f12
ctrl + shift + j or this
yup
And when i go to console i can type if i want
except if you have function keys reversed in byos
some laps have it on by default
for example, type ```js
for(let i = 0; i < 10; i++) {
console.log(i)
}
and you will see the code running
interesting 
I typer it in
just remember that F5 will clear ur runtime
I see numbers in a list and it says "undefined" at the bottom
yup, thats the result of the code
the code means "count up to 10, and each time you count, output the current number"
You basically said that i = 0 and to count from i to 10
yup
And that was js?
yup
although something basic like a for loop exists in almost all languages
One of the features on my bot is a counting channel. You can set the counting channel and then in that channel it will change the message you send into a webhook (Just the same message basically but has bot next to it) and if it isn't a number it will give a warning message and delete it etc. Would my bot get rate limited if say it was being used actively in 10 guilds and each one was counting 10-20 numbers a minute? It would then be deleting 100-200 messages a min and sending that many webhooks. Should I change it so instead all it does is delete the message if it is not a number? (This is still a test feature not public yet don't yeet my bot from top.gg pls ty)
Me?
yep
Mb
Python seemed a little easier, but there's not much of a difference probably
that one absolute wall-of-text
;-; Am I Invisible
I ned help
I keep getting this error
yes for some things python might be simpler, for others js may be simpler
your variable is undefined
But do you know if that could get it rate limited?
How do i defin it?
I would've shared what I have learned on Python yet but a few months ago i gave up and deleted it -_-
you will definitely get ratelimited
and webhooks are one-way only
there's really no way to make a realtime counting message
I see, so I just change it so it will only delete the message if it is not a number n ditch the webhooks then ig
the cool thing about programming is that 90% of programming concepts apply to multiple languages, so if you know how to do X in one language, doing the same in another language is usually very similar
because the concept is the same, just the syntax is different
Ohh
this is very prone to error
That's great
giving role to the top is working but this is not working I can't give role to bot
no, you need to check if a member was mentioned at all
for example this is js js mylist = [1,2,3,4,5] for(number of mylist) { console.log(number * 2) } and this is python ```py
mylist = [1,2,3,4,5]
for number in mylist
print(number * 2)
Thats Why There is a if statement
and this is java```java
List.of(1,2,3,4,5).stream().peek(System::println)
lul
xD
const Discord = require('discord.js');
const ayarlar = require("../ayarlar.json");
exports.run = function(client, message, args) {
if (!message.member.roles.has("806260410957299773")) return message.channel.send(`**:warning: ใป Bu komutu kullanmnฤฑz iรงin yetkiniz yetmiyor.**`);
let sahip = args[0]
let pawyon = args[1]
let prefix = args[2]
let sahip1 = message.guild.members.get(args[0]);
let sahip2 = message.guild.members.get(args[1]);
let kanal = "806247959083352145" // bot onaylama reddetme kanalฤฑ
let furkan = "806259279036153897" // bot durum log kanalฤฑ
let botsahipkanal = "806259279036153897" // bot sahiplerinin gรถsterileceฤi kanal
let developer1 = ayarlar.developer;
let botlist1 = ayarlar.botlistt;
if (message.channel.id !== kanal) return message.channel.send(`**โน ใป Baลvuruda bulunulmuล bir botu yalnฤฑzca <#${kanal}> kanalฤฑnda onaylayabilirsin.**`).then(msg => msg.delete(5000))
if (!pawyon) return message.channel.send(`**:exclamation: ใป Botun idsini yazmalฤฑsฤฑn.**`).then(msg => msg.delete(5000))
if (!sahip) return message.channel.send(`**:exclamation: ใป Botun sahibinin idsini yazmalฤฑsฤฑn.**.`).then(msg => msg.delete(5000))
if (!prefix) return message.channel.send(`**:exclamation: ใป Botun prefixini yazmalฤฑsฤฑn.**.`).then(msg => msg.delete(5000))
message.delete()
sahip1.addRole(developer1);
sahip2.addRole(botlist1);
let embedd = new Discord.RichEmbed().setDescription(`**:white_check_mark: ใป<@${pawyon}> Adlฤฑ Baลarฤฑyla botu onayladฤฑnฤฑz.**`);
sahip.send(embedd);
let embed2 = new Discord.RichEmbed()
.setColor("#5fbf00")
.setDescription(`<@${sahip}> **adlฤฑ geliลtiricinin; <@${pawyon}> adlฤฑ, __${pawyon}__ idli botu onaylandฤฑ.** \n \n __**Botu Onaylayan Yetkili :**__ ${message.author} - **${message.author.tag}**`);
client.channels.get(furkan).send(embed2);
};
```
and this is wall of text
pls help not work
an if statement AFTER getting the username is useless
So from what I've picked up Python and Javascript are great to start with, after i learned some basics i could make simple projects to learn the language even better. If i take js or python depends on what i want to achieve later 
not give a role a bot
you need to check if there's a mention before you start getting the attributes
mostly yes
Of So Add The const in the if statement?
no
Im confused
but dont fret too much about the choice because once you learn one, moving to another is not hard
Okay
the check must be between those two lines
Do i Put The if statement between that
@quartz kindle May I ask which langs you code in mostly?
dot dot dot
wat
ok
in between the two lines
yes
In terms of difficulty Python and js are the same hmm
I think I'll get started with js then
ah, one last tip I have
Never, ever think about pressing Ctrl + C and Ctrl + V
:O
idk, but people like to borrow code from the internet
Hello
which results in catastrophic codes
also, it's good to write code by hand instead of copying, even if it's your own
learn how to code with ctrl + space
its the most wonderful combination ever
copying my own code
What does it do?
some call it intellisense, some call it godhand
in vscode it shows auto completions
it's basically auto-completion
if using intellij, alt + enter is also your friend
yep
i use mostly js
and my mostly i mean almost exclusively lmao
hi
Alr, thanks
so yesterday i was making fun of python ternary operators
and today im learning rust
let thing = if condition { something } else { somethingElse };
python ternary operators are backwards to js right?
oof 
yea
thing = something if condition else somethingElse
https://pastebin.com/PMr1hLih I need help With The .lastMessage.id Part. I Keep Getting A Error
yeah, kinda weird. but its probably just because i learned js first
at least the rust one isn't inverted or anything
whats lastMessage a property of?
Wdym
const messagearg2 = message.mentions.users.first(); -> const lastmessagemention = messagearg2.lastMessage.id;
whats messagearg2 defined as ๐
ohoh
lastMessage can be null
i dont think users have lastmessage properties too
it only works if the user has sent a message since the bot turned on
So member?
Oh
Ok
If anyone has experience with MongoDB, how come when I update a document it updates the updatedAt as well as the createdAt
should the createdAt not remain the same or is there something I have to do
are you using updateOne or update?
findOneAndUpdate
this is a mongoose answer, but seems to be the same issue. https://github.com/Automattic/mongoose/issues/8954
It seems this is actually intended, if you want to have a createdAt(which actually maintains the original date) it seems the correct solution is to add your own rather than letting mongodb handle it.
That's pretty stupid that they auto update the created date but thanks
gotta love weird undocumented quirks

