#development
1 messages ยท Page 1048 of 1
also =
Yeah
should be == or ===
It's == or ===
im never going to get used to SQL operators
@hazy sparrow facts
coudn't understnd tim should also be a string
i need a cheat sheet for it
I have never heard about SLQ operators
<> who the f decided this is NOT EQUAL
<@
I use a cheatsheet aswell
<#
bruh stop teasing me lmfao
there are way too many operators for SQL
though to be fair i used to the same about regex, now its somewhat decent
I mean < & > are pretty easy smaller then and greater then but then you put them both together <> NOT EQUAL TO
Like wtf?
Isn't there like WHERE NOT or something
@slender thistle im pretty sure js already does the walrus thing without it
I swear I remember something like that
Oh, how come? @quartz kindle
Whats a walrus operator?
is abuse api???
the f?
if (x := 2) == 2:
y = x ** 2```
Oh
is already doable in js: if(name = entry.get("name")) { console.log() }
Since when do they use () in if statements in python?
I thought it was like if 5 > 1:
oh wait
I'm stupid
PEP says to use (w := x) when used in conditions iirc
if i remember correctly
"if I recall/remember correctly"
Oh
why does that picture makes "without walrus operator" longer when its the same length
the problem is, you cannot declare a local variable on it, so it defaults to global
i think
let me test
how to stop setInterval() command?
not sure if a while can do it
while would be better rather than set interval
cuz you can break it
so you'd need to declare the variable beforehand, even if empty (typo in console.log, but works the same)
Any tips for how I should push my test version to my VPS when it's done? Now I just delete the commands file from my VPS and upload the one on my PC but the problem is that I sometimes do "hotfixes" directly in the VPS and it's not changed on my PC so I basically reupload the bug
I don't use git lmao
start using it instead
pc > vsc > commit > reload vps bot > updated
Wait so I can change my startup command from my VPS to pull the code from git?
Right?
Is there any significant performance/RAM usage in using global variables compared to local?
yeah you can script a git clone
Is there a way to make private githubs?
chickendev, yes
no, the problem is that globals pollute the namespace and may cause hard to track bugs due to being unknowingly overwritten elsewhere
So to what should I change my startup command to automatically pull from the github?
But, I mean, if you keep close track of your variables that are not used in the rest of the code... 
then yeah, there is no performance difference
at least there shouldnt be
but like, they wont get deallocated probably
unless you explicitly set them to null or undefined
Not working :/
Do I just do
git pull something IDK
@tulip ledge its a bit more complicated than it seems btw, cuz you need multiple steps
Just so u know
lmao np
Anyone!??
You have to install git
is it like a vsc extension?
Bot command => run external js
process kill PID bot
start rewrite.
clear folder
start git clone
finish git clone
process start index.js
process.exit(external script)
you'd need an external script to run the git, the clean and the bot restart
I'm confused
But
I have some connections in the index file that aren't in my files
first, i needs to initiate an external js, since your bot will go down and it wont be able to function
So I would have to change it every time?
wdym connections ?
Database
what about it?
It's not in my files if u get what I mean
im unsure if git already does a replace if exists type of deal
Oh
well yeah, you'd run it in the vps
How do I install git?
on vps? beats me
google is your friend
The problem is I don't have full control over my VPS tho
hence why i dont use one
This seems sketchy ngl
i need some assistance retrieving a password
try restarting your computer chicken
@dense prism
why did u lose your password?
Can anyone help me?
with?
..
I need to give my full name and email and stuff but does it get saved on this PC? As this PC has to return to school in september
@opal plank haha long story short i am stumbling through all this. been trying to take as many notes as i can but just this....... yeah
Question
I want the code where if someone used my a!help command, it would store the user's data to the specific JSON file filled with his ID only.
I tried fs.mkdir function but its created without (commands/util) how can i set this?
@feral aspen dont
@feral aspen dont
@opal plank Why
no json in database, for your own sanity
ive been using jsonb for quite a few days now, its a pain
Anyone!?
@earnest phoenix https://gist.github.com/Anish-Shobith/f818c6ef4e0bfa32c6527b219558e78a#file-commandhandler-js-L25 this should give you an idea of how to run it
highly recommend not copying
take it as example
how to show collection name and content?
name => content
@feral aspen save it on an array if you're only doing IDs, its better, keep it string based in an array
i tried foreach but it only respond with content
@opal plank @feral aspen that i can relate to. it will be simpler
@night bridge forEach bad, should prob use better loops
loop collections?
collection is map
thats when its created
okay i just remember ๐
@opal plank no
you need to upload it
thanks for info
how?
how do I upload it?
now commit
me using git desktop 
theres an easier way
are you committing on the right branch/repo?
I don't know what that is
that link that you sent before, are your files being sent there?
I don't know
pretty sure you need a workspace set as target dir before you commit
press ctrl+, on vsc
It zooms in
i edited
What now
Anyone!?
actually
take a look at this guide
it'll explain better than i will
my brain still coming back from yesterdays drinking
@earnest phoenix i sent you a link
with example in it
error```events.js:292
throw er; // Unhandled 'error' event
^
TypeError: Class constructor Channel cannot be invoked without 'new'```
code:
if(args[0] === "remove") {
LeaveChannel.findOneAndDelete(Guild, Channel)
return message.channel.send("Canalul a fost exlus din baza de date!")
}```
I got a bot that can give the number of servers the bot's in, how do i get the number of users that are in those servers. Im on discord.py
I just realized
I can't change the startup parameter of my VPS
@earnest phoenix You are trying to create a class but you need to use new as a keyword to create a class
wdym ?
๐
am dieing again
to my question above i see 2 options. Delete everything and start fresh. <<<(preferred) or is there any way to retrieve the password that i had set in the DB on first startup? i have been looking for ways to do both but coming up short on both accounts
I cannot log into my production bot anymore. However, when i exchange the botId and auth token to some other testbot, it works. Any one has some explanation for this?
did you run it on your pc or a server?
both
usually i get this bcs my internet is to slow to send all files by time
not that
i tried to make poll but the bot not waiting me to type and just skipping the await Messages function.
do i make wrong code?
So i want to read my bots messages using history. And delete the messages
However i want only some type of content to be deleted
And that content is embed
So how do i wrote it?
i think message objects have the property embed
get the array and filter embeds
forEach loop?
on the filtered array
Hello i how to delete in cookies?
for superagent and md5 npm module```javascript
const req = await superagent.post("https://www.cleverbot.com/webservicemin?uc=UseOfficialCleverbotAPI")
.set("Cookie", cookies)
.type("text/plain")
.send(payload);
return decodeURIComponent(req.header["cboutput"]);
return unset($_COOKIE[cookies]); // < not deleted... :c ``` here is my code
THANKS FOR HELPING.
@earnest phoenix There's no such thing as guild.member, there's guild.members, a collection of all guild members
k
Well, there is a guild.member function, it's not a property
Do you get an error? Is it failing in your try block? Did you make sure to check if the member is actually kickable?
what is the format to get someone's profile pic
Depends on the library
like url
So I have this date and I have a timestamp how do I find the difference between them?
subtraction
You can convert the date into a timestamp
How?
learn your language
you don't specific what language
A date and a timestamp are the same in all languages friend
^
Alright ty
@earnest phoenix v12?
Any idea why I'm getting a negative value?
message.channel.send(toTimestamp("07/11/2020 18:00:00") - message.createdTimestamp)
function toTimestamp(strDate){
let date = Date.parse(strDate);
return date/1000;
}
You're trying to divide a date object by 1000?
!avatar @indigo flax
Ah, well it's negative because Date.parse returns the time since 1970 in milliseconds.
You're then dividing that by 1000 and trying to minus it by createdTimestamp, which is kind of 1000 times bigger.
Is the member cached?
KICK not working
@sudden geyser I tried what u told but now the date is kind of really small
And is that member cached?
@solemn latch IDK
You need to be sure before kicking.
If its not, you need to fetch them
Discord timestamps are a specific timezone right?
Or well seconds since 1970 in a specific timezone
You'll want to do that in the same standard
timestamps are made to prevent the issue with timezones
I believe Discord uses UTC
Oh okay, so your date your putting in is in utc aswell?
I don't know
Yes
function toTimestamp(strDate){
let date = new Date(Date.UTC('2020','07','11','18','30','0'));
return date.getTime()/1000;
}
All of a sudden I'm getting this now:
-26,548,114 minutes 16 seconds
My head hurts
how are you parsing it?
function toTimestamp(){
let date = new Date(Date.UTC('2020','07','11','18','30','0'));
return date.getTime()/1000;
}
Is that the difference between
#development message
like how did you get -26,548,114 minutes 16 seconds
Code:
console.log(toTimestamp())
console.log(message.createdTimestamp())
console.log(client.moment.duration(toTimestamp() - message.createdTimestamp)
message.channel.send(client.moment.duration(toTimestamp() - message.createdTimestamp, 'milliseconds').format("m [minutes] s [seconds]"))
function toTimestamp(){
let date = new Date(Date.UTC('2020','07','11','18','30','0'));
return date.getTime()/1000;
}
Logs:
1597170600
1594484027014
-1592886856414
you're supposed to multiply it by 1000 to retrieve it in milliseconds
/ 1000 makes it return in seconds
either that or just client.moment.duration(toTimestamp() - message.createdTimestamp / 1000, 'seconds')
26,592,935,263 minutes 21 seconds
function toTimestamp(){
let date = new Date(Date.UTC('2020','07','11','18','30','0'));
return date.getTime()*1000;
}
why * 1000?
Multiply it by 1000 make it be milliseconds
That means its already in seconds?
44,772 minutes 40 seconds
getTime() is in milliseconds
Is without the /1000 and *1000
function toTimestamp(){
let date = new Date(Date.UTC('2020','07','11','18','30','0'));
return date.getTime();
}
I'm confused
Wait a sec
Don't
Date months start witth 0?
yeah
I mean
It got close
131 minutes 53 seconds
But not right
It's still 12 minutes
It is 131 minutes is it not?
And here it sais 131 minutes
Oh wait yeah timezones
I have to remove 2 hours
Ok it's working now
I dont remember what your doing.
But embeds can take timestamps and will do all the timezone stuff in the footer.
what are you trying to do?
I'm trying to make a lottery command and want to display when the next draw will be wich is every saturday at 2pm CEST. I'm gonna try to use node-schedule to schedule it aswell
Now I just need to implement it so it ups the day with 7 every time
Oh fuck
Months
add 7 days as timestamp
and then convert it to date
Bigbrain
I don't need to convert the date into a timestamp then
If I just save the timestamp in a database
Date.now() + (86400000 * 7)
Tim also had a point, that you can hardcode it into the program and just add the do the math at start up each time
Well the Date.now will be different
if its been 5 weeks since your hard-coded date.
Add 5 weeks to that date, then do the difference
Ok I've been trying for ages on discord.py and don't know how to get the despawn function working so that if [another spawn spawns]
[cancel other spawn]
the only way to work with timezones in the Date object is during initialiation, when you create a date
for example new Date("2020-07-13T14:00:00.000+02:00");
No matter what I do it just won't work
No I think I have an idea on how to do it
that date will give you the correct UTC timestamp for the input time in that timezone
The only thing I don't quite understand is Cron-style Scheduling
Well the thing is that it's just every so often and I can just save the timestamp from the last draw and add 7 days to it
yes you can
so just check what timestamp it is the the next date you want, and save that timestamp
and you're done
Alright
Do you know how I can make it so every 7 days at x hours it does a thing using the Cron-style Scheduling?
Cuz like 0 17 ? * 0,4-6 this is apparently every 5 minutes and I don't understand anything of it
Never mind they support objects
pogey
var j = schedule.scheduleJob({hour: 18, minute: 00, dayOfWeek: 6}, function(){
console.log('Time for tea!');
});
Saturday at 6 PM
I just need to find out what timestamp this is
i mean zone
It doesn't say on the docs
_date: Moment<2020-07-11T18:50:00+02:00> this is what it logs
Any idea what timezone this is?
+2 hours
I assume thats +2 from UTC?
i think so
Schedular is working too :>
I don't know lol
I always assumed they were the same
SELECT * FROM users WHERE tickets <> 0 should give me every user who does not have 0 tickets am I right?
SELECT * FROM users WHERE NOT tickets = 0 this then?
!= is so much better
CEST is summer time
should work
Hello
hi
I have a big problem with nodeJS
or check where the tickes are lower than 1
then say the problem
If I want to install discord.js then the error โrollbackFailedOptional: verb npm-sessionโ is coming
On my PC at home itโs working
But on my laptop says: no
does the laptop runs the same node version? maybe there is a difference in the supported version for the node installation
could you make a screenshot of the entire error stack?
Its only that, what I said
does it return control to the console? or it stays like that until you press ctrl+c?
but if you dont type ctrl+c is says that forever?
There is something with โDo you want to close the Batch (J/N)?
but if you dont type ctrl+c is says that forever?
@quartz kindle yes
sounds just like your laptop being slow
Yes
how long have you waited?
can you do node -v and npm -v?
Okay
i guess it can take a pretty long time easy a hour if its a potato
And now? @quartz kindle
what does it say?
i guess it can take a pretty long time easy a hour if its a potato
@lusty quest its slower as a potato
i know someone who still uses a Laptop with a Core Duo it cant be worse
what does it say?
@quartz kindle node -v = v12.18.2 npm -v = 6.14.5
i know someone who still uses a Laptop with a Core Duo it cant be worse
@lusty quest I have a PC but im in holidays... on my PC all is working
try npm install discord.js --verbose
Okay
and if it is the case its maybe better to buy a Raspberry Pi this thing probably got more power
try
npm install discord.js --verbose
@quartz kindle there is coming a text and at the end the same error
Algum Portuguรชs?
what is the text
I send a screen
@tulip ledge you have Math.random(()*something)
() * something
@fringe axle wait some minutes and see if anything changes
keep waiting
that is a long ass user name lmao
until it finishes
Okay
keep watching for more changes
there's a progress bar
that username looks like a broken windows user profile lmao
t h e n wait for it to finish thanks
@quartz kindle he did something
gimme 5000
I mean if u want sure ๐คทโโ๏ธ you'd have to join the server tho lmao
jesus christ 240 seconds to download abort-controller
sounds like your computer's internet is fucked up
But what does --verbose do?
jesus christ 240 seconds to download abort-controller
@quartz kindle its a laptop and its 6 years old I think
verbose = show all logging
Im coding on my PC all is working and super fast..
You need to join servers before you can do this command, please do +find and join some servers from that list then come back. To do this command.
how should i do?
what bot is that?
oh I see
Member +
idk that bot
Yeah join the discords
try asking in their support server
And then you can use the command
Still the same message
keep waiting
But its writing the same message over and over again... ;-;
doesnt matter
Okay
the logs are coming, its working
Im waiting
the files are being downloaded one by one
@tulip ledge you tell me join the discords you can send me by pv?
Nice
https://top.gg/bot/631117170306449428 this?
@nimble summit is it this bot?
It do something
if so, go to their support server: https://discord.gg/membersplus
people are desperate lol
200+ Boosts too
Yeh now imma use that to launch my bot
Lmao
They prob give the coins thing when u boost

Fancy ๐
lol
I'm so happy with how my bot is coming together this feeling is why I code ๐
Sure
I'm so happy with how my bot is coming together this feeling is why I code ๐
@tulip ledge I have a bot that is on 93 Servers. Im very proud about it too
I hit 38 for a bit
lol
I still have to rewrite the one in 139 guilds as it's still V11 and I coded it when I was a braindead stick
@quartz kindle ITS DONE!!
:P
Bru
Now โSorry, name can only contain URL-friendly characters.โ is coming
;-;
what is #bids ??
const { Client, Collection } = require("discord.js");
const bot = new Client();
require('dotenv').config();
["aliases", "commands"].forEach(x => bot[x] = new Collection());
["snipes"].forEach(x => bot[x] = new Map());
["command", "event", "server", "users"].forEach(x => require(`./handlers/${x}`)(bot));
bot.login(process.env.TOKEN);
does my index look good ?
:))
why using dot env
because you can use process.env everywhere
like easier
you can also use a json file anywhere if you just require it
yeah
env is just easier imo
yes lmao
MY POINT STILL STANDS
bruh
let json = require("config.json")
json . . ..
huh
require("dotenv").config
process.env.. . . .
what is drffrent
SyntaxError: Unexpected token F in JSON at position 4
@quartz kindle thank you soo much for all! Finally all is working like I want it
i get the syntax error on line 500
Ok this is weird:
let lotteryin = client.moment.duration(nextlottery - message.createdTimestamp, 'milliseconds').format("d [d] h [h] m [minutes]")
let nextlottery = lastlottery + (86400000 * 7)
//lastlottery is a timestamp from today at 2pm
when it tries to get a video it shows that error
rip. i just reache 110 guilds and its possible that i will shutdown the bot in the future bcs the Game i made the bot for is probably fucked.
Define fucked
the Company get probably Buyed by Tencient
Warframe
@errant perch that error happens if body is not valid json
Tim your big brain can probably find out why right? ๐
@tulip ledge what exactly defines last lottery?
also is last lottery defined in MS or Formated?
thanks
bcs this looks like its formated
let lastlottery = rows[0].lottery;
hmm
Ok I fixed it
lottery is a varchar
And not an integer
So I'm basically creating a huge string
Instead of doing an integer - integer
I just had to parseInt it
ohh this is the most annoying one
why are you using nextlottery before defining it?
How does this look
Well
@quartz kindle I just put it in the wrong way in the codeblock
lul
What?
anyone wanna commit multiple accounts of arson?
Its hard to tell because we can't see all the code
just copy paste it to hastebin
N OMEGALUL
We cant help if we dont know the problem
sendEmbed()? where did you get that function?
Why are you making a new client at the top of your file?
there's so many weird things happening in there
Yeah like how it's based on Discord.js v11
also
It's a ready cmd
ready event has message? thonk
No, i mean he didn't code it
Guys I need a name for the first boss of my bot? Any ideas?
Well
Woo
Tim
Yes
Tim Big Brain will also be one
Tim the Unbeatable
The Chicken
That'll be the final boss
Lmao
Karen, the MANAGER
I need any ideas , too :(
Any special abilities for Woo and Tim Big Brain?
Tim has a healthpool equal to the amount of messages he has sent in this chat
make my attacks be random programming questions
indeed
Lmao
Tim used if else statement
tim exported class
tim defined Attack!
I need help
Tim needs time to recharge (to google)
lmao

The bosses work like
1st uysers attacks
2nd user attacks
3rd user attacks
4th user attacks
Boss does main attack or ability
imagine being so nice as to let the users attack first
I need help please
do users have stats like intelligence?
dont ask to ask, just ask the question Zipo
@nimble summit for what?
Tim 1 hit ko anyone with intelligence lower than 120IQ
bro can you send me those emojis lol
I got them from sky.lea.moe (you need permission tho)
You need to ask the devleoper
blatantly stealing copyrighted material 
And she will send u the emojis if she finds ur project interesting
who is she?
when i + buy 10 its me this message but i have already joined enough server
this is not the members+ server
Wrong server
go ask there
lmao
So no specials abilities for Tim and Woo?
I mean I could try to implement intelligence
But it would just be more work and stuff
Yes
hmmm
You join others people join yours
Woo has more points in dates objects than anyone else.
just make me shoot lasers from my eyes and shit on noobs
so what should i do
How would I make it so if another character spawns it will replace the value using messagewait. (I created a variable character id where the latest spawn character is added)
Woo The Date Clown lmao
ooof
@nimble summit #development message
might aswell pick some random people from here and turn them into bosses

I want 15 total bosses
thats quite a score
ngl it did go thru my head couple weeks ago to try an rpg, but scripting dialogue is soooooooooooooooooo boring
Lmao
lol
All attacks miss
I am so confused by the conversation rn
Imagine adding fake stars
Oh
i feel like sending this cuz the context
Oh no
LMAO
the amount of snippets i've seen the past hour or so is insane
Now i gotta implement the bank
Wish me luck
Oh btw
If I make 1000 different MySQL queries at the same time what would happen?
Just asking for my friend ๐
What is the best way to get a users ID with his username + discriminator? (discord.js) Comparing all userdata to the wanted one would be a bit unefficient :/
message.author.tag?
what if its not the author :)
<User>.tag
message.member.user.tag
just use author.tag then
yeah
Image i have the username + descriminator as a string. The suggested things wont work then i guess
wdym?
Oh
Basically i want to search for a users id in the guild by their username
U wanna find the user object depending on the tag?
@tulip ledge nothing, mysql will process all queries as fast as it can
excatly
let found;
let userArray = Array.from(client.users.cache.values())
for(let i = 0; i < userArray.length; i++) {
if(userArray[i].tag === <your thing here>) found = userArray[i]
}
Not 100% sure about the Array.from
Good idea
Well first of all thanks for that snippet
but yk
if the userArray includes more that 1k values it wouldnt be a great way to handle it
Maybe now you understand the problem
Well looping over an array with 1k values only takes about .2 seconds
I don't see a different way tho
Maybe Tim knows cuz of his brain size but yeah
(node:6260) UnhandledPromiseRejectionWarning: TypeError: bot.guilds.keyArray is not a function
Help ?
await bot.guilds.keyArray().forEach(id => {
config.findOne({
GuildID: id
}, (err, guild) => {
if(err) console.log(err)
if(!guild) {
const newConfig = new config ({
GuildID: id,
prefix: dprefix
});
return newConfig.save();
}
})
})
cache
if you're on v12
bot.guilds.cache.keyArray ?
Hm yeah i mean its not much of a problem. Ill just loop if there is no other way
Thanks for helping out :)
Should I implement interest on coins that are stored in the bank?
I think this is off topic
ok so i have to rewrite this, can someone help me make my bot to join a specific voice channel by id/name?
i'm using this but it doesn't work
and neither crash
Did you edited it!?
yes i use my id
Your id or the vc id?
but i want to set a default channel for him to join, in case the message owner is not in a vc
it'll only change if the user joins a vc
oh
done
and wait for it to get approved
but my bot is offline
I think the wait time is like 2-3 weeks
you need a pc to keep it open 24/7
i use heroku for free host
you get 550 hours for free monthly
get 2 accounts and shift them every 1st and 15th of the month
free for life
i am use a ping dom
does anyone know about Discord.js
my bot is broken and wont get online
i need it online for Luca to approve it
can you show the error from console?
paste it in a hastebin
hastebin > pastebin
not like its open source
ok then
If i use $lc remove the bot is not removing any data from mongoDB
i got no errors
Why the hell are you making a doc for leaving a vc?
xD
Looks like it should work, is args[0] the second argument of a command?
Ok
I structure my code a bit differently, using await instead of callbacks, but it still looks like it should work
@crimson vapor (sorry ping) Can you tell me how findOneAndUpdate works ?
i am getting this error when i am trying to call a method/function (which is outside cog class) inside cog class in python
<function toop at 0x03F91DF0>
when i print it^
are you calling it
yes
show code
You should read mongoosjs docs but it is โfindOneAndUpdate(findObj, UpdateObj, callback)โ I think
guild = message.guild
if guild:
target_path_1 = os.path.dirname(os.path.abspath(__file__))
with open(f'{target_path_1}/test.json') as fis:
test = json.load(fis)
return(test)
else:
return('oof')```
and how are you calling it
I don't understand from docs, i don't know what findObj and UpdateObj mean ๐
Show how you are calling it
on the dbl api, how do I check if a user has voted in the last x time, or their total votes
You are not actually calling the function with parentheses
and since it's an async function, await it
So i made a function to detect if an string has a custom emoji and if there's... Show how many... Is this good enough?
function hasCustomEmoji(string){
if(!string){
throw new EvalError("Provide an string");
}
return string.toString().match(/\<?(a:|:)\w*\:(\d{17}|\d{18})\>/) ? string.toString().match(/\<?(a:|:)\w*\:(\d{17}|\d{18})\>/gi).length : "No custom emoji detected";
}```
@earnest phoenix itโs not called findObj, I just tried to simplify cuz docs confusing tbh
ah lemme try
An example would be { guildID: message.guild.id }
I don't know which part from my code should be findObj / UpdateObj, i tried with ```js
let channel = message.mentions.channels.first() || message.guild.channels.cache.get(args[0]);
LeaveChannel.findOneAndUpdate(Channel, channel);
but this don't work
Yea it wonโt
You can look at examples at the docs
It will help
Lemme see if I can get screenshot of how I use
<Model>.findOneAndDelete({find query})```
Thatโs what I assumed it was
As long as it is in the same object I assume so
Do i do it in the same {} or comma?
both
@crimson vapor sorry again for ping.
if(args[0] === "remove") {
LeaveChannel.findOneAndDelete({
Guild: message.guild.id,
Channel
}, (err, res) => {
if(err) console.log(err)
console.log("Worked");
})
return message.channel.send("Canalul a fost exlus din baza de date!")
}
if(!channel) return message.channel.send("Trebuie sa specifici un canal ! (ID sau Mention)")
message.channel.send(`Canalul a fost setat la ${channel}`);
LeaveChannel.findOneAndUpdate(Channel, channel);
}
According to docs this should work, if i execute the command i got "worked" in console but the data is not deleted, any idea why ?
what is Channel?
i got channel from here
in leavechannel command
const { Guild, Channel } = require("../../models/LeaveChannel);```
In LeaveChannel.js
```js
const mongoose = require("mongoose");
const Schema = new mongoose.Schema({
Guild: String,
Channel: String
})
module.exports = mongoose.model("LeaveChannel", Schema);
Why? What is wrong ?
I want to do a leavechannel(for leave message) command and if i use $leavechannel remove the data will be removed from db
Do you understand ?
@quartz kindle why is there no shard property for guild objects
Anyone knows why this function gives NaNM? When I log coins (I'm doing readables(coins) btw) it gives a valid number
And when using this SAME function on coins wich is the SAME value in a different file it returns 990M like it's supposed to be?
function readables(number, decPlaces) {
decPlaces = Math.pow(10,decPlaces);
var readables = ["M", "B", "T", "Qd", "Qn", "Sx"]
for (var i=readables.length-1; i>=0; i--) {
var size = Math.pow(10,(i+1)*3);
if(size <= number) {
number = Math.round(number*decPlaces/size)/decPlaces;
if((number == 1000000) && (i < readables.length - 1)) {
number = 1;
i++;
}
number += readables[i-1];
break;
} else if (number <= 999999) {
number = number.toLocaleString('en')
}
}
return number;
}
Nvm fixed
I wasn't giving a decPlaces
How come that always after I ask for help I get the answer
ยฏ\_(ใ)_/ยฏ
ye
Is it dynamic?
What does your commandfile look like
aSktOaSk
i need a new help command 
guildID: {type: String, unique: true, index: true},
userID: String,
im not sure if i should do the same as guildID to userID (more context, i will be searching using guildID and userID as the query if that is even possible)
const data = await GuildMember.findOne({guildID:msg.guild.id, userID:msg.author.id})
wait nvm its fine because the user ID will appear multiple times (hopefully
)
I have this error sometimes saying embed fields may not be empty and it's annoying cuz I know what command it is but the issue is that I have 8 different embeds in there
log the fields
tehfuk
client.login(process.env.TOKEN);
how is it possible that it says invalid token token is not invalid
i don't know you tell me
debug your code
i don't have magic powers to do it for you
Do you have dotenv?
Heyo Python developers
i am
Does anybody know if it's possible to open a discord.py bot in another thread
im forcing you to debug it yourself because you're prefectly capable of doing so
perfectly
debugging gives no errors at all but bot doesn't start it just shows me the list of commands
you do not know how to debug
inspect your variables
that is the first thing you do when you complain something is not what it is supposed to be
tldr
log your token
at Client.login (C:\Users\User\Desktop\Remixor\node_modules\discord.js\src\client\Client.js:204:52)
at Object.<anonymous> (C:\Users\User\Desktop\Remixor\remixor.js:146:8)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
(node:28632) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, orc function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unha flag `--unhandled-rejections=strictndled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) handled will terminate the Node.js
(node:28632) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
yes....and?
wym by log your token
tf who said to give me their token
im telling them to log their token in order to see if it exists in the first place
ooooh
Well you mistyped your token
@crimson jetty nope i didn't i could put the token in there without the process.env and it works but when i try to process the env file it doesn't work
if it does then you know the file is being read properly and you can progress onto comparing the token to the actual token on the developers page
not yet
Well that's why it isn't working
do not use heroku nor glitch
if it does then you know the file is being read properly and you can progress onto comparing the token to the actual token on the developers page
@earnest phoenix the token is just fine

