#development
1 messages · Page 1818 of 1
another to never ever try is rm rf --no-preserve-root /
Ugh. Pls no!!1
Although doing those two at least once is good for first timers
Lol, ye xd
Since you can face despair at least once
ik, lol
And know how to deal with it let it happen again
xd, ye
navigating around terminals is really easy once you get the hang of it. all you need is this:
ls -> show contents of current folder
cd folder -> enter a folder
cd ../ -> back to previous folder
cat file -> show file contents
easiest method...
cd ./././././././././././ to escape ur folder tree
Lol, yeah, xd
It's a MUST to install "screen"
It'll be your major tool for keeping the bot alive
just use services
Well, yeah
are there any *free hosts anyone can recommend?
Yet easier method - installing tuxcommander or smth
I like screen because they allow easy access to different envs
sry for ping
amazon web services offer a 1gb 1vcpu server free for a year
what kind of hosting? website?
yes
heliohost
ok thanks
bro... github or replit
and programs?
free, easy and stable
i like github because of GitHub Actions
ok
no heliohost is websites only
and very limited
repl.it can run other programs
ohk
=p compare to replit. I run a bot there and some pages at once
and where helio-something?
Ik just for some laugh
Had to be Tim recommending something named helio
wut
😄
Sun, helio, Tim, stars
and moon where?
lmao
some steroids
ye
And comets
ooh, i forgot - also black hole !!! (how could i forgot bout to big thing?)
So... My html knowledge is absolute garbage, and I'm trying to throw together a page that has a background of a gradient. However, whenever I try to apply a gradient to the body in css, this is what happens.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css?family=Quicksand:300,500" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div class="waffle-header">
<title>Waffle</title>
<h1>Welcome</h1>
</div>
</body>
</html>
body {
background-image: linear-gradient(#614385, #516395);
}
.waffle-header {
text-align: center;
font-family: 'Quicksand', serif;
}
Its correct. It repeats gradient correctly
The intended effect is to have a gradient that covers the whole page. How would I go about that?
Got it, nevermind
I don't see you defining the coordinatesany where the there
Yeah, just realized
did this instead ```css
body {
background: linear-gradient(to left top, #614385,#516395) fixed;
}
Yeah
I should really learn web development...
Just play with inspect element
Devtools has auto-complete for css stuff
And you can see the result in real time
People are lazy enough nowadays to use templates and remove the copyright 
I kinda wish vscode had a designer type thing like Visual Studio has with XAML, just so that I could see what I’m updating when I type things for HTML.
No idea, only selected lib dev have the access for now
no what interaction is it
context menus
Right click menu basically
yeah typescript doesn't like dynamic loading of files
Tsnode exdee if you're lazy to use tsc
Just know like 2 days ago can do jscofing.json to typecheck .js and immediately almost all my files go red swiggly
import('file').then(data=>{
//code
}).catch(err=>{
console.log(err);
})
your linter should get mad at you for doing that tho
cuz the import isnt at the top with the rest
Does anyone know a bot that could track my bot's uptime % and tag me when it goes offline?
You'd best make your own or look into other solutions like notifications via other mediums when your application is down similar to uptime robot
see, if you use that code inside a cmd is wrong, because clickMenu is an event, u must use clickMenu like the other events, ex message ready guildMemberAdd
if you want to use the event inside the cmd use collector
Libraries which facilitate connections to the gateway should be coded in such a way that they either reconnect or resume when applicable and only be offline whenever manually calling a graceful disconnect. If your bot is offline otherwise, then you have bigger problems and you should be fixing your logic
interactions expire after 15min
That'a dynamic import
generally you should use it over require
How do I get a div to align all the way to the left? For example, I'm making a side menu with buttons, and I want the button borders to reach the edge. However, this is the result I get from trying to do so:
I see
thanks
Ah okay! thanks
Both elements are divs, which means their display is set to block, which means they aren't going to be on the same row, (unless you're using a flexbox)
I suggest using flexbox when making websites
Flexbox makes life so much easier when adapting for phones
update your nodejs version
im guessing ur using replit because of that terminal
Yes
I cant upragade it
I tried to install node 16x with console
But still using 12.x
have you tried googling how?
im browsing thru the forums right now and it seems replit only supports node 12.x
@earnest phoenix
Lemme try and thanks for help
Ah yes, i forgot about that
how do you get new fishing rod?
I bought from store
how is this dev related?
uuhh
im using it for my bot, so i guess
My pc cant find a file
😐
So the file is here:
files > commands > other > jsontest.js
my json file to write json data in:
files > jsons > users > database.json
I put:
../../jsons/users/database.json
JSON database
but the path seems fine at first glance
@worthy ivy @earnest phoenix you can use node v14 if you choose the language as bash or deno when creating the repl
try downloading your code, deleting the repl then creating a new one
i dont use repl, i use heroku, i was trying to help the guy out

anyways, send help how tf do you use mongodb
If i use bash will bot work?
do i use the mongodb driver itself? (https://www.npmjs.com/package/mongodb) or use mongoose? (https://www.npmjs.com/package/mongoose)
maybe
i once ran node -v in a deno repl and it said v14
not sure about bash
I downloaded node 16.5 with console
im going to like do a custom prefix system/modlog system thing
if i were you, use node 14.x

lts moment
The shell does not have system access so it cant download the correct node version
anyways 
i swear DID YOU JUST DO npm i node
man i love being ignored
I did npm i node@16.5
im going to
@earnest phoenix ok i ll do it as you want
nvm is better
...
hes trying to say you cant update node urself on repl
javascript how do i hide a property from class when I do console.log?

the node command looks for nodejs in the SYSTEM ACCESS ONLY folder where replit installed node
installing with npm downloads it to node_modules which does nothing
and if you use the global flag it will throw an access error
i see
it's a long string and it clogs the terminal
so how do you update node version then
? so I have to rename jsons to JSON?
you either use a deno/bash repl to get node v14 or keep a replit engineer hostage until they agree to update node
the path seems fine to me 
no this was more a comment that you should not use .json files as a DB, so it just says that it cant find this file?
yes please dont use json databases unless its really a small project
try running console.log(__dirname)
same ngl but gives this error:
23.07 04:27:17 [Bot] Error writing file: Error: ENOENT: no such file or directory, open '../../jsons/users/database.json'
Ya ik i shouldnt this is just for a smal project
oh right
I forgot to tell
I renamed the file.
anyone know why my chakra-ui is not rendering?
https://weathernow.gq
..
but I canged it
wow 
maybe you forgot to send/write your code?
wdym?
I also renamed it at the place where its trying to locate it too
saved the codefile too?
it was a sarcastic way of saying that you havent sent your code for us to see
ya
lmao
oh my god thats so sketchy
const fs = require('fs')
module.exports = {
name: "json-test",
aliases: ["js"],
category: "other",
description: "store data!",
usage: "json-test",
execute: async (client, message, args, emoji) => {
let user = {
name: message.author,
id: message.author.id,
guild: message.guild.name,
guildID: message.guild.id
};
// convert JSON object to a string
const data = JSON.stringify(user);
// write file to disk
fs.writeFile('../../jsons/users/database.json', data, 'utf8', (err) => {
if (err) {
console.log(`Error writing file: ${err}`);
} else {
console.log(`File is written successfully!`);
}
});
}
}```
there
it is weather app tho .-.
it needs to know ur location
but Iam making a location form searcher
most services just use the recipients ip address then geolocate like that
I followed this guide:
https://attacomsian.com/blog/nodejs-read-write-json-files
dab dab
ya via IP is good too, but I need a vps for that
????
that must be 408 
anyways, can you tell us what was the problem with your ui
wh- its an error 500
before it was just a white screen
now it render
Internal server error
When i chose bash
next time use a screenshot tool like lightshot

or heck JUST USE THE BUILT IN SCREENSHOT TOOL
or simple WINDOWS + SHIFT + S
@earnest phoenix make a .replit file and put run="node yourbotfile.js"
Idont like to use discord pc
electron moment
Phone is best
windows + shift + s
lmao
fun for the whole family
You dont code using phone though 🤔
seems fine, doublecheck your paths again
No using pc for coding
or just explicitly use C:/[path]
if that even works
@quaint wasp try running console.log(__dirname) and see what it says
absolute paths are possible yes
yall never beat me tho
CPU: 0.0%
AHHAHA
ah fuck
the last one
0.7
alright
path.join(__dirname, "../", "../", "databases", "database.json"); mouthful to read but easier to debug
anyways
whats the best permission for setting a custom prefix for a server?
MANAGE_GUILD ?
It worked thanks
WHY DID YOU PING ME AGAIN
/poll”Wtf” a
beacuse
/leaveserver
Can i ask you last question
Can i change bash to node js when i type language node js it didnt work
nvm fixed it
how do you make it so that the bot can accept 2 prefixes?
using like one from a config.json, and the other for a custom prefix at a mongodb database
get the data from mongodb then check if the data exist if not just use the default prefix aka from the config.json
right now i just have args as
const args = message.content.slice(fetchprefix.prefix.length).trim().split(' ');
no like BOTH
i meant if there is a custom prefix applied to the guild, i want it to use the default global prefix aswell
so like 2 prefixes at once i meant
sorry for the misunderstanding

this is how i do it
const ms = require("ms")
module.exports = {
type: "msg",
run:async(client,msg,cache)=>{
if (!msg.guild || msg.author.bot) return
const cd = cache.schema.get("cd.js")
let prefix = await cache.prefix.fetch(msg.guild.id)
prefix = prefix.prefix
const commands = cache.classes.get("cmds.js")
if (msg.content.startsWith(`<@${client.user.id}> `) || msg.content.startsWith(`<@!${client.user.id} `)) {
if (msg.content.startsWith(`<@${client.user.id}> `)) {
const str = msg.content.slice(`<@${client.user.id}> `.length)
prefix=`<@${client.user.id}> `
if (!str.includes(`<@${client.user.id}`)||!str.includes(`<@!${client.user.id}>`)) {
msg.mentions.users.delete(client.user.id)
msg.mentions.members.delete(client.user.id)
}
} else if (msg.content.startsWith(`<@!${client.user.id}> `)) {
const str = msg.content.slice(`<@!${client.user.id}> `.length)
prefix=`<@!${client.user.id}> `
if (!str.includes(`<@${client.user.id}`)||!str.includes(`<@!${client.user.id}>`)) {
msg.mentions.users.delete(client.user.id)
msg.mentions.members.delete(client.user.id)
}
}
}
if (!msg.content.startsWith(prefix)) return
const args = msg.content.slice(prefix.length).trim().split(/ +/)
const cmd = args.shift().toLowerCase()
const command = commands.get(cmd) || commands.find(a=>a.alias&&a.alias.includes(cmd))
if (!command) return
if (command.cd) {
const cdData = await cd.findOne({
userId:msg.author.id,
cmdName: command.name
})
if (cdData) {
if (cdData.howLong>=Date.now()) return msg.channel.send(`Please wait ${ms(Math.abs(cdData.howLong-Date.now()),{long:true})} to run this command again!`)
cd.findByIdAndDelete(cdData._id).then(()=>{
command.run(msg,args,client,cache)
})
} else {
const newData = await cd.create({
userId: msg.author.id,
cmdName: command.name,
howLong: Date.now()+command.cd
})
newData.save()
command.run(msg,args,client,cache)
}
} else {
command.run(msg,args,client,cache)
}
}
}
what u mean by 2 prefix at once?
2 prefixes at once
like say, my global prefix is t!
and my server prefix is ;
i'd like them to be both usable
wondering is, how
const args = message.content.slice(fetchprefix.prefix.length).trim().split(' ');
like const args = message.content.slice(fetchprefix.prefix.length || prefix.length).trim().split(' '); ??

prefix is my global pref, and fetchprefix.prefix is my server only pref
if you dont get it sorry, my english is really bad jfc
if (content.startsWith("t!")){
prefix="t!"
}
its easy as pie 
u can do that with ur server prefix as well with else if
ill try my best 
you can do it with regex too
how?
you could do it like this
const prefixRegex = new RegExp(
`^(${firstPrefix}|${secondPrefix})\\s*`
);
if (prefixRegex.test(message.content)) {
///.......
}
hm
then you can do
const [, matchedPrefix] = message.content.match(prefixRegex);
const args = message.content.slice(matchedPrefix.length).trim().split(/ +/);
to get the args
what would i add in js if (prefixRegex.test(message.content)) { ///....... } then?
do whatever you do with the message
like this for example
then run your command or something
what?
this thing test if the message is started with the prefix
so like if IT has the prefix?
yes
oh ok sorry im really dumb rn
@sacred aurora it dosnt work

oh wait no
WAIT
IM STILL DUMB WAIT
twas dumb and forgot to include this

oof
oops sorry
1,521,157th
Is this Python?
I wish I knew it all
Now I know some
const Discord = require ('discord.js')
const client = new Discord.Client();
clinet.on("message", message => {
if(message.content == "Hi")
message.channel.send("Hi")
}
This is what I know
you have a lot to learn
which language do you know
Arabic
p
english, polish, snake’ish and some parts of german
Are you using multiple message listeners?
How are you not getting a “cannot read property channel of undefined”
cauze that person has not used that command yet
No it’s not in the message event scope
That one is working
Also lol I haven’t got a channel name that
So the command won’t work
Yeah, why is it working
Huh
Nvm
Nope it put it infront and it had a error with catch now
Define axios
I change it for the last time
And I made her type
But she isn’t taking
She’s just typing
What is ‘chatBot’
To send a message do message.channel.send(“message”);
They're inside the scope of another message listener, so it's creating a message listener every time a message gets received, I wouldn't be surprised
I thought for a second a random developer in topgg developed a bot with a consciousness
LOL I didn’t even notice that
I would explain what's wrong to them but my internet keeps going on and off
same since yesterday its so annoying
I put let in front of it and it says unexpected token
The let keyword is to define a variable
What is var
Pretty much the same
Var also defines a variable
It’s better to use let over var from what i know
Yeah
If u cant use var dont u use const
Const makes it uneditable(?)
Oh
And if
Idk what any of them I just caught own to looking at a lot of codes and learn to code a little from there
https://www.w3schools.com/js/js_intro.asp
https://www.codecademy.com/learn/introduction-to-javascript
Learn the language before you try using it, it’ll save you a lot of headaches
I forget everything from codecademy
I'd watch some very long js tutorial
at least you'll have tons of code as context
Lmao
I use to think coding was for Geniuses
🧍🏽♀️intill I started doing it it’s like learning to define words all over again
A lot of the time coding is getting angry at your program for doing what you told it to do, not what you wanted it to do
It’s like teaching you computer how to talk
Or be human
Not really
be human i hope that never happens
AI is teaching your computer to be human
maybe it deserves to be destroyed
Atp Everyone will start to think the earth is raned by computers and not god
But the good thing is there computers soo 👀 someone could hack into them and destroy them
the closest thing we have is gpt3 lol
who says god is not a computer?
but since its closed source I wonder if it'll go far
👀 yeah who says it
If he is then maybe we are
Idk if that ever happens I’ll cry
Non stop
maybe we are multiple layers deep in virtual reality
Lmao my imagination is running wild with this 😂 atp this would be a good movie
It’s called the matrix
we can already create computers inside computers inside computers, so its not that far fetched
is there an api for reddit?
Yup
can u show me the docs for it
Don’t feel like googling eh
Reddit gives you the best of the internet in one place. Get a constantly updating feed of breaking news, fun stories, pics, memes, and videos just for you. Passionate about something niche? Reddit has thousands of vibrant communities with people that share your interests. Alternatively, find out what’s trending across all of Reddit on r/popular....
Here ya go
thx
Internet is the world now soo I- mean it could be true we are robots behind the scenes👀
@earnest phoenix have you seen the matrix
Nope
You’ll enjoy it
Imma go look it up real quick
It’s about escaping the illusion and going behind the scenes of reality
dafuq, people who have not seen it exist?
It’s free for me
Lol I have prime
what timeline is this
Age of digitalization
age of unculturism
Idk if y’all like kids movie but it’s a kids movie kinda like the matrix
What
what
The matrix is the best anime
Holup
ruining good stuff lmao
I destroyed by discord bot a week ago it had 50 commands lmao it was on accident I accidentally copy and paste random things on it and could not fix it so I just saved all the codes
Imagine
That's why you don't copy paste without understanding code
Imagine copy pasting for your discord bot
I wasn’t copying and pasting a code
I was copy and pasting a poem
To my friend on discord and accidentally pasted it in 1k codes
Ctrl a
Anyways lmao it’s fine now
Ctrl + z
File > edit > undo
Photoshop moments
Ctrl + shift + z for photoshop isn’t it
Shift + ctrl + z lets you undo multiple times
Oh thanks
Alt + ctrl + z lets you re-do what you undid
photoshop's undo redo keys are stupid
and they changed them from one version to another
I swapped to affinity designer
which is even more stupid
Much better
anything adobe is stupid
as is office 365
like, why the hell would you change ALL shortcuts
I was too used to Adobe Fireworks, but as it ended support for it after CS6 I had to go elsewhere, only Affinity Designer has come close
https://sourceb.in/Z22WHf3jml why does it not work? playtop command
I will now use my telepathic powers to figure out what's wrong with the command since you haven't given me any details
command itself describes it
playtop meaning when you queue something it should go first in the queue
how does it not work? What happens?
We can't find the problem without knowing what happens when you run it
Hey imm
I have a quick question
Is it good to store image urls in local storage for faster loads?
With a ttl ofc
i love web development 🙃
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 0
[WS => Manager] Spawning shards: 0
[WS => Manager] Exceeded identify threshold. Will attempt a connection in 63587058ms
I get this is on my console log
anyone can explain me
please
well, you're royally fckd
you could try reconnecting and see if that's a lib-defined time or a retry-after time
if it's a retry-after time...well...I hope you can deal with impatient users
for reference, that's around 1059 minutes
or 17 hours
does Sharding work like nodejs threading but in more efficien way?
root 982695 7.1 0.7 748372 59968 ? Ssl 18:29 0:01 node /root/tune/index.js
root 982706 52.7 3.2 1113040 263640 ? Rl 18:29 0:10 node /root/tune/index.js
root 982724 0.0 0.0 8900 668 pts/0 S+ 18:30 0:00 grep --color=auto -i tune
``` hey anyone knows how I can kill these 3 process whenever I use kill -9 <pid> it pops up with new pid
wat
you probably have something autorestarting it, like pm2, nodemon, forever, screen,tmux,etc
Yeah I fixed it, just removed pm2 completely then killed the process one by one with top command
👀 does JS have an out parameter for functions?
Started playing with C# and just learned about out.
seems like a good time saving measure.
I dont think its quite that.
private void GetXY(Vector3 worldPosition, out int x, out int y)
{
x = Mathf.FloorToInt((worldPosition - originPosition).x / cellSize);
y = Mathf.FloorToInt((worldPosition - originPosition).y / cellSize);
}
when i use it
GetXY(worldPosition, x, y);
//I can use x and y here
Debug.Log(x);
ah, that
that's odd
but in javascript you could just pass the class reference and assign like <class>.variable = value
then you can retrieve the variable the same way
Your bot can't see the message you're trying to reference. It's either deleted or the bot doesn't have perms to see it.
Oh ohk
If you don't want your page filled with random crap, you're very much smart enough and creative to create your own minimalistic design.
Inspect Element can help you if you are on PC
Use markdown, honestly WAY easier than CSS/HTML
but not customizable
blogs would be horrible with people posting f̸̆̈́a̷͑̄ń̷̐c̴͒̄y̴̐́ stuff
but bot pages are not blogs
me
*customizable stuff in general
you know
I wonder
can we submit massive forms
to top.gg
write the entire blog in the prefix section
why not 
Does anyone know how to make a discord bot have an ‘about me’ page on its profile?
Edit the application's description in the developer portal
that's the bots' about me
Oh, thanks!
module.exports = {
name: "leave",
aliases: [],
description: "loops throught current song",
async run(bot, message) {
const voiceChannel = message.guild.voice.channel.leave();
message.react('✅')
message.channel.send('**Successfully Left the VC**');
if (!channel) return message.channel.send("fehfeuhfuhashf");
}
}```
what
when I only type $leave
what's the problems
it says channel is not defined
I mean its working fine
message.member.voice
but when the bot is not in the channel then I type $leave it causes error
saying channel is undefined
message.guild.voice?.channel.leave();
I try
yeah
the voice is null ot undef
not mine
damn it
yeah it has error
you can use (message.guild.voice || {}).channel
oh yeah object destruct
const { channel } = (message.guild.voice || {})
if (channel) // do sth
nah
not mem efficient
if statements are superior here
my solution looks cleaner
i break
here
yes
is that wrong
that
mmmm not really. It overcomplicates stuff and you're still using an if statement regardless
cause its not working 
module.exports = {
name: "leave",
aliases: [],
description: "loops throught current song",
async run(bot, message) {
const voiceChannel = message.guild.voice.channel.leave();
message.react('✅')
message.channel.send('**Successfully Left the VC**');
if (!channel) return message.channel.send("Bot is not in a VC");
}
}```
I replace it in the bottom
why not just if(message.guild.voice) { message.guild.voice.channel.leave() }
aight
don't need curly brackets
module.exports = {
name: "leave",
aliases: [],
description: "loops throught current song",
async run(bot, message) {
const voiceChannel = message.guild.voice.channel.leave();
message.react('✅')
message.channel.send('**Successfully Left the VC**');
if(message.guild.voice) message.guild.voice.channel.leave();}
}```
if it's a single-line statement
like this?
you dont, but its good practice to use them
you must check before the ezecution part
what
you leave the vc before checking
what a gamer
module.exports = {
name: "leave",
aliases: [],
description: "loops throught current song",
async run(bot, message) {
if(message.guild.voice) return message.guild.voice.channel.leave();
message.react('✅')
message.channel.send('**Successfully Left the VC**');
}
}```
but then the bot won't react or send a message
so like that?
not really, no
oh
@knotty talon lemme

if (!message.guild.voice) return;
message.guild.voice.channel.leave();
message.react('✅')
message.channel.send('**Successfully Left the VC**');
also another problem
No I mean its leaving the VC when it is connected to a VC
unescessary import "Discord"
but when I type $leave it causing error
please, read the code
again
and rerun it
aight aight
the point is, you are not understanding execution order and its data
please at least consult the docs
sorry can someone join my replt im just so bad
so sorry
module.exports = {
name: "leave",
aliases: [],
description: "loops throught current song",
async run(bot, message) {
const voiceChannel = message.guild.voice.channel.leave();
message.react('✅')
message.channel.send('**Successfully Left the VC**');
if(!message.guild.voice) return message.channel.send("I am not in a voice channel");
}
}```
like that?
r/facepalm
🤦♂️
He basically wrote the code for you up here ^^^
@knotty talon okay so the execution order is as follows:
check for channel:
if no channel: return
else attempt to leave
send mesaage
return
^
I think you're too quick to act. Stop what you're doing and go through a few javascript articles explaining the basics
Take things slowly, step by step
since when no connection voice is either null or undef
and neither of these has channel property so when you try to call it, that caused an error
also read the error stack
As the old quote says, slow is smooth and smooth is fast
I mean its leaving tho
it's your best friend when anything but async error
read
leaving is not the point, but also for you future commands
note stuffs downs first before writing code
If you're new, it can be helpful to create a logical step-by-step plan for what you want your code to do
module.exports = {
name: "leave",
aliases: [],
description: "loops throught current song",
async run(bot, message) {
if (!message.guild.voice) return;
message.guild.voice.channel.leave();
message.react('✅')
message.channel.send('**Successfully Left the VC**');
}
}```
last one
FINALLY
There you go
yeah IK
but when I type $leave when the bot is not in the channel it cause error
mind using await
I did that before
you should learn the language first
then the library
and soon you understand what you just asked is silly
Which you would be familiar with if you took your time to learn the basics
you just messed up from code execution order part
error handling is for intermidiates
after all, how can you handle errors if you don't know how to read them?
module.exports = {
name: "leave",
aliases: [],
description: "loops throught current song",
async run(bot, message) {
if (!message.guild.voice) return;
message.guild.voice.channel.leave();
message.react('✅')
message.channel.send('**Successfully Left the VC**');
if (!leave) return message.channel.send("Bot is not in a VC")
}
}```
this should work
What error are you getting
also use ``` next time
leave isn't defined
alrd solved "Can't read channel of null`
that
yeah
SEE
if (!message.guild.voice || !message.guild.voice.channel) return;
fun fact, this is a very simple error
@cinder patio no
don't
just channel part
voice can't be null
so it's okay
it can
for you
but you just said it can't
const Discord = require('discord.js');
module.exports = {
name: "leave",
aliases: [],
description: "loops throught current song",
async run(bot, message) {
if(!message.guild.voice) return;
const leave = await message.guild.voice.channel.leave()
if(!leave) {
return message.channel.send("Bot is not in a VC")
}
else {
await message.react('✅')
await message.channel.send('**Successfully Left the VC**');
}
}
}
for you too, if you spend 10 minutes reading
try this
that won't catch the error
error thrown : channel is null
smh bad advice from every angle
also Discord is unused
Yeah i don't if(!leave) {
I'm tryna fix his code
your code won't catch the error in his console
If there won't be any error
I know the basics
not this tho 
cap 
???
Cap
aight
lemme write the code and get this done with
ty
if you want 👀
@near stratus promises are too advanced for him imo
^~^
P.S. error handling is basics too
lemme get his org code
Tho it says promise that book covers a lot. It actually helped me switch from Py
I don't hate you, but you're wrong
Yea Rocket science is easier than learning how to poop
I feel like javascript is objectively easier to learn due it's relaxed nature, it's just that a lot of people can't be bothered to understand the basics and that's why there are so many incompetent "devs"
module.exports = {
name: "leave",
// attr whatever here
run: async (bot, message) => {
const { channel } = message.guild.voice || {};
if (!channel) return message.channel.send("not in vc");
return channel.leave()
.then(() => message.channel.send("left successfully"))
.catch(console.error);
},
};
@knotty talon
ty
exactly and they choose javascript cause it's the easiest, and it would be easy for them too if they bothered to learn
or maybe programming is not for everyone
i used object destructuring, optional assignment and promise-based methods @knotty talon
look those terms up if you don't get it
remove the async btw
ahh aight ty
I learned js from making discord bots. I always thought it was some weird shit
that has no "await"
what error
module.exports = {
name: "leave",
// attr whatever here
run: (bot, message) => {
const { channel } = message.guild.voice || {};
if (!channel) return message.channel.send("not in vc");
return channel.leave()
.then(() => message.channel.send("left successfully")
.catch(console.error);
}
};
you bothered to learn 😎
it says I need a bracket
you're missing a ) at the end of .then(() => message.channel.send("left successfully")
Yea i was a 13 y/o happy kid with python. then this js shit came to my life
sorry
I'm yet staying away from js...
@knotty talon copy paste this again
Yea kinda since now I know web dev which I used to hate
OwO
why are you talking in 3rd person
It was ! for me ||MEE6||
no
No
yes
i was talking about string literals
its the ${}
oh
cool, but do you know ```js
process
it also have some other stuffs too
process.kill(667, 'SIGINT')
process.env.token
do you know with process you can print this to your console live and have it updated everytime in 60fps
anyway bye gonna sleep
sweetdreams
ahh
gn ty for the articles again
can you?
not console log tho
and i didn't use any packages for coloring and styling either
stop comparing brain sizes
no i'm just saying what he could do
it's very powerful, if you know how to use it
just... learn properly
and only learn what you need
good luck with your bot @knotty talon
cored output to console... yeah sounds very powerful
aight ty that thing is not mine

i use stdout instead of console
so i have more control
just that i have to convert everything to string
before i pass
doesn't it automatically call toString() on everything that it can?
no
when typescript
When python?
console.log will auto call toString
3yrs ago
but not process.stdout
Ugh
ok
Just let it fail in production
well, you could make a native module to call printf under the hood
fucking hell
Stean...
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
one message isnt a raid
Aanyways. Mod issue
please dont ping all mods for any mod issue
@brave garnet dont star any unfunny content ty
It was funny. Don't ping mod for mod issue... Normally pato...
Bro...
I pinged one...
then what was that mod ping
And then you pinged the whole mod role
basically:
ping one mod -> someone being naughty, scam, spam, nsfw, etc etc
ping all mods -> top.gg is literally on fire, mass attack, veld goes haywire, etc
Yeah because wasn't deleted
dont ping the entire role
My braincells.
Dude.. I legit don't want to ask anymore.. let me just get my braincells back.
is it possible to change the business there in the way? because it is together with the bottom then it gets weird
Translate please
~ and if you want you can ask in pt in general
I believe it is the translation
Thank
client.on('message', message => {
message.channel.send(message.content)
message.delete()
}
```It works well but, the only problem is that it will delete and repeat the bot message too :/ so it end up being a spammer repeater
check if author is bot
message.author.bot
Silly me , thanks 😊
what the heck is this..
23.07 18:48:32 [Bot] /node_modules/discord.js/src/rest/RESTManager.js:32
23.07 18:48:32 [Bot] const token = this.client.token ?? this.client.accessToken;
23.07 18:48:32 [Bot] ^
23.07 18:48:32 [Bot] SyntaxError: Unexpected token '?'
23.07 18:48:32 [Bot] at wrapSafe (internal/modules/cjs/loader.js:1047:16)
it litilery doesnt let me start the bot
outdated node version
The nullish coalescing operator (??) is only available in Node.js v14 and higher
I now got version 15.6.0 or smth like that, but now it tells me this:
23.07 19:02:10 [Bot] throw new TypeError('CLIENT_MISSING_INTENTS');
23.07 19:02:10 [Bot] ^
23.07 19:02:10 [Bot] TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
what does that mean
Gateway intents
@solemn latch
That’s one of the better ones I’ve seen so far!
More believable than the usual steam scam
lol
Show your code
Wherever the error comes from/wherever you instantiate your client
I dont think I do at all
All I did was added a preinstail called "Multiple bots at ones" on pebblehost
and now I moved all my files to folder called "Bot1"
and am now re-adding all my dependencies because they were cleared for no reason.
not sure how to help then ¯_(ツ)_/¯
this is the full erorr:
23.07 19:02:10 [Bot] /node_modules/discord.js/src/client/Client.js:513
23.07 19:02:10 [Bot] throw new TypeError('CLIENT_MISSING_INTENTS');
23.07 19:02:10 [Bot] ^
23.07 19:02:10 [Bot] TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
23.07 19:02:10 [Bot] at Client._validateOptions (/node_modules/discord.js/src/client/Client.js:513:13)
23.07 19:02:10 [Bot] at new Client (/node_modules/discord.js/src/client/Client.js:73:10)
23.07 19:02:10 [Bot] at Object.<anonymous> (/Bot1/index.js:3:16)
23.07 19:02:10 [Bot] at Module._compile (node:internal/modules/cjs/loader:1108:14)
23.07 19:02:10 [Bot] at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
23.07 19:02:10 [Bot] at Module.load (node:internal/modules/cjs/loader:973:32)
23.07 19:02:10 [Bot] at Function.Module._load (node:internal/modules/cjs/loader:813:14)
23.07 19:02:10 [Bot] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
23.07 19:02:10 [Bot] at node:internal/main/run_main_module:17:47 {
23.07 19:02:10 [Bot] [Symbol(code)]: 'CLIENT_MISSING_INTENTS'
23.07 19:02:10 [Bot] }```
You need to provide intents in your client options
full?
new <discord.js>.Client({
intents: <intents>
});
o...
so there will have to be the word new before it, right?
(Just so I could use the ctrl + s to search the word)
yes, <discord.js>.Client() is a constructor
Imagine not importing client directly
what a noob

The error is thrown at line 3 of your index.js file
I prefer instantiating a client manually imo
o
What do you mean manually
thats definition of client
Its not going to do it for you
const client = new Discord.Client();
@quaint wasp Just show your code
yea, you're supposed to pass intents
With the new d.js update you have to pass in intents
it no longer does it for you
As voltrex stated several times
what kind of intents
Lord o mercy
like.. litilery just intents: <intents> ?
You never heard of gateway intents?
Then why is it requiring intents
Iirc only v13 requires you to pass in intents
Since it uses the new discord api
new <discord.js>.Client({
intents: Object.keys(<discord.js>.Intents)
});
This should allow your bot to use all the intents, if you don't want all intents; you should check out the links sent in this channel
Why are you doing that
You could just use the ALL Flag if you want all the intents
no
What do you mean no
That property was removed in v13
They aren't using v13 they said
So it is still valid
You legit just said-
They're using v13, they meant they never used v13 before
Oh okay
Well then
That will still cause issues
Since it uses all intents even the priv ones
ya...
So unless they have the priv intents enabled on their bot page
It won't as long as their bot is not verified and they have them enabled in the developer application
They need to be specific
But I got a question.. are there lots of changes? Like will I have to re-write like more than half of the code?
Probably not
There's a few breaking changes
Yea
There it is
I was looking for that
ahaha
Such as interacting with voice is now its own module
You need the discordjs/voice package
https://deploy-preview-680--discordjs-guide.netlify.app/additional-info/changes-in-v13.html#customizable-manager-caches well this is new
Kinda cool
https://discordjs.guide/popular-topics/intents.html#problems-in-version-12 seems confusing af ngl
What is confusing about it
Maybe I could help
But it shouldn't matter
you are using v13 now
Does client.on("event name", function () { //code }) still work?
Uh yes
why wouldn't it
Also
To manage dms you need the CHANNEL partial enabled
So you can receive messages from a dm
My bad
not guild
I meant DM
alright..
yes, but event names have changed
Event names have changed?
Since when?
For example the message event has been renamed to messageCreate
Really?
yea
wow..
Seems pointless
I get why they did it
But seems a bit pointless
They're trying to keep consistency with the official event names provided by Discord's gateway
why?
Yea
oh.
Even <TextChannel>.send() was entirely modified
they are redesigning a large portion of the library, god knows why
Just because of people messing up a lot of shit because of 2 parameters






