#development
1 messages ยท Page 1042 of 1
great timing tool
almost instantly what
list(map(str, range(10000))) doesn't take a second to evaluate
alright what the living hell
I don't really notice the difference in performance between the both but Jesus Christ
how's timeit at fault here then lol

Does it start a subprocess or what
Time to use time.time then again
hallow
okay now lemme ask normally
for channel in message.guild.channels:
a = await channel.create_webhook(name = "why am i sending messages in all channels")
await a.send("why am i doing this")
im trying to make the bot send that message in every channel in the server
but when i tested it, it only worked on one channel
how do i tell it to send it to all the channels in the guild.channels list?
I assume no
Why do you want to send a message in every channel
question still applies
oh
why do you even create a webhook in each channel
help please
watch your indentation
@misty sigil guild#me is your bot as a guild member
@misty sigil guild#me is your bot as a guild member
@pale vessel thats what i wanted
for perm checking
i fixed the indetation
does some thing indented or not
not matter how i indent it bot is an error @sudden geyser
ah can you upload your file to a site like hastebin
need help with .updateOne()
Hello guys, I'm getting ECONNRESET and ETIMEDOUT errors sometimes. When I get this errors, my bot is being offline. How can I fix? :)
I'm using Discord.js v 11.6.4
const Discord = require('discord.js-light')
const mongoose = require('mongoose')
const { Guild } = require('../models/index')
const config = require('../config.json')
const guild = require('../models/guild')
module.exports = {
name: 'prefix',
async execute(client, msg, args) {
const data = await Guild.findOne({ guildID:msg.guild.id });
let Prefix = args[1]
if (!Prefix) {
let prefixEmbed = new Discord.MessageEmbed()
.setTitle('Prefix help')
.setDescription(`The guild prefix is \`${data.prefix}\``)
msg.channel.send(prefixEmbed)
} else if (Prefix.length > 10) {
return msg.channel.send('The prefix must be less than 10 characters (for now)')
} else {
Guild.updateOne({guildID:msg.guild.id}, {prefix:`${Prefix}`})
return msg.channel.send(`The prefix was set to ${Prefix}`)
}
}
}
@heavy pollen put your bot back online x)
@heavy pollen put your bot back online x)
@pure lion ...
11 is being discontinued
@opal plank i know i will but there isnt solve for v11 for now?
If I have my pc, I will update.....
so can anyone help me with mongoose
<= doesnt use mongo
<= is crying rn
https://discordjs.guide/additional-info/changes-in-v12.html
@opal plank I fully read this site already, I start to updating to v12 but my pc goneee when update is not finished
I just need help for this 2 error
Not for updating to v13
V12*
you have to
without more info i cant say
why not now?
istg if v13 changes the syntax again im going to scrEam
mobile coding, as shit as it is, is a thing
where is your bot deployed?
How to stop memory leak that makes the memory collector stop the appllication over time ๐ฆ
you check where the mem leakis coming from and fix it
you gotta debug it and see where the leak is coming from, first
It says it has too many instances. I think it makes an event listener every time a message is sent.
x)
It says it has too many instances. I think it makes an event listener every time a message is sent.
you what-
No just eventEmitters that listen for messages in servers.
how many do you have...?
where is your bot deployed?
@opal plank to my vps
Never payed much attention to it since the bot works fine without fixing it
ooooooooohhhhhhhhhhhboyyyyyyyyyy
@heavy pollen you need to ssh or access where the vps files are and then update it from there
just like you would on your pc
I got the warning that I need to increase the event limit, guess I could try that.
@heavy pollen you need to ssh or access where the vps files are and then update it from there
@opal plank I can access to vps
In phone
there is no reason to increase the limit
@heavy pollen then there we go, just edit the files from there
you prob wont have a linter or a proper way to visualize syntax errors or debug, but it will work
I don't know how to fix the leak then ๐ฆ
i wonder if there are decent apps for coding in mobile
Coding and mobile in one sentence
i wonder if there are decent apps for coding in mobile
@opal plank Mobile coding is trash
Just try for 1 times
im aware
You will see
trust me, i know
but since you dont have other options, either that or leave the bot crashing
@pure lion im totally not late at all, what do u need with mongoose?
could go to a LanHouse or something similar if they still exists
yeah, definetly update your code to v12
wdym client debug?
wut
Debug event
you are changing code, why you debugging?
Before updating*
i mean, yeah, you wanna test and see if there are errors n such
check the guide and update all the old stuff, then debug to make sure everything is in place
u can just do
Weird I don't get the warning anymore but I did not change anything
thats called me eating you memory
im addicted to postgres and i need treatment
Hey! I need some help using an api
But I want to eat my tasty memory ๐ฆ
what even is the problem
const people = // people model
const person = await people.findOne({ name: 'bob' });
person.updateOne({ name: 'dave' });
```
was dat
?
nvm I had to go over the limit of 10 messages
oh
thats gonna make bobs name be dave
(node:644606) MaxListenersExceededWarning: Possible EventEmitter memory leak detected.
idk im just used to that
oh
Is it normal to use multiple event emitters?
It seems to make one for every message sent ๐ฆ
VERY NO
@pure lion what is the problem?
if its the same, no, otherwise yes
not sure, brb
Not sure how I code it so it uses just uses one eventEmitter though
you dont need a handler
50 pieces of gold
PS F:\Users\Edwin\Desktop\Banana> npm install --save brawlhalla-api
npm WARN banana@1.0.0 No repository field.
+ brawlhalla-api@4.0.8
added 5 packages from 50 contributors and audited 133 packages in 7.064s
2 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details``` is it bad to get errors/warns while installing an api?
just js event.on('listener', (params) => { if (something) { do something } if (something) { do something } });
i feel sorry for u that ur not using strooplejs
D:
my library :^)
@digital ibex didnt work :^)
no like what is the problem
But I already have client.on('message', msg => { }
@hushed jungle need a total of o n e
i only made it the other day so its still in development lol, dont use it
how're u doing it?
the problem is that when i run the command jackshit happens and its not logging lolololol
Total of one?
const Discord = require('discord.js-light')
const mongoose = require('mongoose')
const { Guild } = require('../models/index')
const config = require('../config.json')
const guild = require('../models/guild')
module.exports = {
name: 'prefix',
async execute(client, msg, args) {
const data = await Guild.findOne({ guildID:msg.guild.id });
let Prefix = args[1]
if (!Prefix) {
let prefixEmbed = new Discord.MessageEmbed()
.setTitle('Prefix help')
.setDescription(`The guild prefix is \`${data.prefix}\``)
msg.channel.send(prefixEmbed)
} else if (Prefix.length > 10) {
return msg.channel.send('The prefix must be less than 10 characters (for now)')
} else {
data.updateOne({prefix:`${Prefix}`})
return msg.channel.send(`The prefix was set to ${Prefix}`)
}
}
}
porbo
thats how i got my index js to 50 lines
But how do I make sure it only makes one of these message listeners?
console.log(Guild)
remove the listener but only keep one
{
_id: 5f0753f2705fdb5058508587,
guildID: '710964023117479966',
prefix: 'aa!',
w_gChannel: null,
info: true,
ping: true,
poll: true,
uptime: true,
__v: 0
}
I tried to remove listener after using it but it would still show this particular error.
is that lower case guild or upper case guild ?
up
Should I use client.once instead of client.on?
oh yeah, mb. you have to await it
{ n: 1, nModified: 1, ok: 1 }
logged
what are popular games that yall would like to see for an discord bot rank command?
yeah, it worked
aaaaaaaaaaaa
wait ill log it
yep it worked
epicccccccccccccccccccccccccccccccccccccccccccccc
d.js: would user join or user ban fire first
How would I make a login system that uses html, nodejs, and mongodb?
@compact echo look into express, express-session and bcrypt packages, would be your easiest route
Still have the eventEmitter leak ๐ฆ
I tried removing it but then I can only send 1 message and it will stop working
learn nodejs 
I try ๐ฆ
Any book or guide you could recommend?
for node, i dont know any. just search on youtube: nodejs tutorials
thats how i learnt it
any ideas why this doesnt work? ๐ ```js
Client.on('message', message => {
const slot = require('./slots.json');
if (message.content === (`${prefix3}slots`)) {
message.channel.send(`${slot[Math.floor(Math.random() * slot.length)]}`);
}
})
what doesnt work
it outputs undefined
Are you sure slot is an array
Are you sure
slotis an array
@sudden geysercss { "slots" : [ "๐๐๐", "๐๐๐", "๐๐๐" ] }there is more but this is it
2 big to send ๐
watch the S
?
const { slots } =
actually nvm I'm dumb. You need to access the index, which is slot.slots
u have an s
look at the const
do const { slot: slots } = require('./slots.json')
ok
That won't work, it'll be an object of { slots: [...] }, so really accessing slot.slots[Math.floor(...)] should ideally work.
ok... ty
both would work
ok
ty!
error!
:D
const slot = require('./slots.json').slot.slots;
^
TypeError: Cannot read property 'slots' of undefined
at Client.<anonymous> (C:\Users\kianc\Desktop\Kian2.5\bot.js:2211:42)
at Client.emit (events.js:327:22)
at MessageCreateAction.handle (C:\Users\kianc\Desktop\Kian2.5\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\kianc\Desktop\Kian2.5\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\kianc\Desktop\Kian2.5\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (C:\Users\kianc\Desktop\Kian2.5\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
at WebSocketShard.onMessage (C:\Users\kianc\Desktop\Kian2.5\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (C:\Users\kianc\Desktop\Kian2.5\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\kianc\Desktop\Kian2.5\node_modules\ws\lib\websocket.js:797:20)
Does anybody knwo why when I type "hit" it doesn't work?
https://hastebin.com/miwolodoma.js
bj command?
yes
no idea sorry, but good luck

Does anybody knwo why when I type "hit" it doesn't work?
https://hastebin.com/miwolodoma.js
I've logged some stuff and from what I've seen it doesn't go into the awaitMessages().then it does however goe into the filter
https://discordapp.com/channels/264445053596991498/272764566411149314/730899921674436689
someone wanna answer me
Do you mean user leave?
huh?
I just discovered the most annoying thing
I spend 2 hours making a command... didnt work guess what
I need an api key
fk
#development message
Anyone wanna answer me?
a friend " me ๐ Can someone explain this to me?helped"
its for setTimeout
I can take a bigger ss
...
is that the elijah
tag?
elijah is a common name ๐ค
yeah ๐
#0001
nope
:3
#8888
trying to make a cooldown system?
yes
you dont need setTimeout for cooldowns
yes, but he said I need If you mean cooldowns like ?daily you have to use database
database...
if you dont mind them resetting on reboot(really not a hugeee deal) you dont need one
?
I fixed mine the issue was that message was being passed to the function and message is the msg object wich was sent by the bot
yay!
if you dont mind them resetting on reboot(really not a hugeee deal) you dont need one
@solemn latch what di u mean?
*do
for example.
if daily is only intended to run once a day. and you dont have a db, and your bot restarts itll forget they ran it
oh, yeah...
but since bots dont need to be rebooted too often, you can skip that
and I do that alot ๐
idk how to get around it...
I need to update my code?
lol
client.delete then client.login?
it deletes it....
If you have one
๐คฃ im clueless
no
๐คจ
i dont use djs but i dont remember a delete function but apparently its a thing ok
only we are clueless
๐
client.delete sounds fun xD
lol
!eval client.delete
i cant find anything in the docs about client.delete, can you send me a link to it
just do !eval client = undefined;
that'll likely fuck everything up

lol
see, I am clueless
delete function for what?
delete is a thing in native js
for whatever reason you guys are trying this
delete client || bot should work
@sick cloud I tried to test it with two separate methods (first, sending a message | second, logging it with a variable) and both got banned first, then left after.
so theoretically i can set a var in the ban event so it won't fire the leave event if they were banned right
You could, yes. However, I'm not 100 and 10% sure the ban event will be the first one fired as it's async.
only real way though, eh
yeah, what I'd do is just set a condition/variable and if it's been set to the appropriate value (meaning the event was already fired), ignore it.
client.delete? wtf are you trying to do?
honestly
not sure what happened
talking about reloading commands, and client.delete came out of nowhere
lol yeah me and my cluelessness ๐
I'm pretty sure client.delete isn't a thing lol
๐
@gray zealot have you used discord.js or Javascript in general before?
Anyone know a good wrapper for the djs docs?
wrapper?
@gray zealot have you used discord.js or Javascript in general before?
@earnest phoenix yes ๐
discord.js-docs?
It sux
and I still need help ๐ > https://discordapp.com/channels/264445053596991498/272764566411149314/730905542285066351
Ok lol was curious
๐
maybe you don't know how to use it properly
๐
Probably not
Emoji spam do be epic tho
@pale vessel also the docs are shit
yes!
Theyre outdated
oh, outdated != shit
if you want to kill your client there is client.destroy()
but that wont help with reloading commands
yes that ^^^^
Lol
@hushed jungle how many times do we have to say this
@pure lion, The amount parameter isn`t a number!
@vivid cedar, The amount parameter isn`t a number!
@vivid cedar, The amount parameter isn`t a number!
@vivid cedar, The amount parameter isn`t a number!
You only ne-
Smh
I don't really remember what you said tbh
I know but not how to code it ๐ฆ

imagine self botting
@vivid cedar e
How do I do code block?
It's not really we you are the only one responding to me lol
i looks like he immediately killed it
because it started responding to itself
lmao
responding to itself ontop of that
Lololol
300iq
client.on('message', msg => {
if (command)
});
lol
Is this not good?
@vivid cedar retar
test
@hushed jungle how many times do we have to say this
hmmm
just tried the same message that seemed to trigger it
the self bot
lmao
WTG
yes, wtf indeed
No im not
No I mean the package "discord.js-docs" has bad docs
are you sure?
@vivid cedar then what is this?
Yeap
@green kestrel most likely selfbot
I swear
sure
Im not selfbot
The fuck
its a badly coded self bot
it was under a second
Oh hey another mod hiiiii
those messages
then explain what happened
badly is an understatement

Lol you're gonna get beaned
bgon bot
if you're gonna selfbot atleast do it well
Lol you're gonna get beaned
b e a n e d
Breaking tos in a developer server 
100% not selfbot Boss

i swear
Definitely not
Wait
Nope, can't have been
let the guy explain
the fact that he wasnt here either when he got pinged shows he wasnt even on this channel before https://ptb.discordapp.com/channels/264445053596991498/272764566411149314/730914252424216657
sends 4 identical messages in less than 1 second
not selfbotverified
Explain how he's going to get his acc unbanned?
I do for avatars
yikes
yikes
lol
did he just-
still against tos
Well
yikes
well im sorry to say but thats not allowed
bye
Bean bean bean bean bean bean bean
I will see you later
o/

In court!
-b @vivid cedar admitted to self botting

Banned emirhๅญn#6932 (@vivid cedar)
bye
gg ez
Ee no re
ok guys, but no need to witch hunt and start trolling lol, let the guy explain first (also to bait confession)
rip to my boy
We'll never forget
cya boss
๐
Can someone help me with discord.js-docs package :<
go to work boss
he was just trying to add some more functionality to his discord account
Cya boss
what discord.js-docs package?
i mean you right, though i feel like there was enough proof there to make an argument
he was just trying to add some more functionality to his discord account
@topaz fjord
am i wrong
wait
why does selfbotting exist but not botselfing

it doesn't seem like something that you should be banned for unless it's used a bad purpose
technically logging as a bot is allowed as far as im concerned
you may use a bot as a client, not a client as a bot
ยฏ_(ใ)_/ยฏ
I believe that's not allowed either, not sure
why do you want to use discord.js-docs? you want to send information from the docs to discord?
No
we had a talk in DAPI, no one was able to point out a rule that said otherwise
looks nice
Also cooool time to download livebot ๐
lmao
Best docs
using a npm module for discord.js docs
Yes
the definition of stupid
so basically you want to make a command that shows the docs
Yes
thats actually not an easy task
cheerio + axios
since the docs are quite extensive
and you can get similar functionality without a shitty lib
d.js already has their own bot that does exactly that
oo
try asking them if its open source
you can go to the djs server and use their bot in the bots channel lul
^ second that
of course i dont mean for you to copy it, but will give you a template to work with
ima ctually impressed the bot has a proper name and its not 'D.JS Bot'
Should I give up on my event Emitter leak problem since I can't find a solution on Google/Stackoverflow.
its a shitty name tho
I could use client.setMaxListeners(0); but that just ignores the warning.
is this not good [@pure lion]
are you using that multiple times for different comands?
dont make a message listener for ever command
show code
sure
Otherwise I just reference that
does that warning show up right after starting it up or only after some time?
After sending 11 messages.
You're not getting any other errors? and it isnt crashing?
No, the only crash happened today when the console printed "Killed", implying it killed itself because it was using too much resources.
Which may be related to this memory issue.
Thus why I try to fix it.
Everything else runs like a charm otherwise.
I knew of this warning before but ignored it since I thought it would not be a problem but I never had the bot running for a long time and I guess on the long run it runs out of resources because of this.
Does it happen on any 11 messages?
@pale vessel a
how to check if you can dm this user or not?
I can test that
Jsjsjsjsjsjsjs
Attempt to dm them
if you cant, then you cant.
no other way that I know of myself
well.. how can i return it if i can't?
@hushed jungle you have a circular dependency
ok ty
Try {
//Dm
} CatCh {
//Peepeepoopoo
}
Normal messages seem to be fine.
thx
What is a circular dependency โ
when you require something that's required in a parent module
@hushed jungle main requires quiz which requires main which requires quiz which requires main which requires quiz...
Ah, I see.
you have that on reddit.js and uesp.js as well
the main file should never be required anywhere
requiring the main file prevents the main file from loading completely because it keeps waiting for the never-ending require cycle to finish
I had a function in main which I wanted to use in the other files so I just did this to get access to that.
You can pass the function as a parameter (lol) or define it in a separate module
Yeah I will have to look into that.
But the memory problem is not related to the eventEmitter then?
everything is related to the circular dependency
Alright, thanks for finding that out for me I would have never seen.
since its an infinite loop, the memory rises infinitely, and since the main file is required multiple times, it can cause multiple concurrent clients to be started, or other weird things
I did that accidentally in the TermTalk lib and was so confused as to why it wasn't working :P
i did that in a lib i was writing too
Is there a way to send a local image file inside an embed using Discord.Net?
possible yes
how idk, check the discord.net docs
there should be a method to attach files
There is attach files, except Im not sending as attachment, I am sending within the embed
the attachment is a requirement
I think only url is accepted, not path
once attached, you can set it as an image in the embed, using the following url: attachment://filename.extension
So send attachment, retrieve attachment, put image into embed, delete attachment?
the attachment should be sent together
in the same message
for example, something along the lines of ```js
.send({
embed: {
image:{
url:"attachment://myfile.jpg"
}
},
files: [{
attachment:file data,
name:"myfile.jpg"
}]
})
discord.net should have convenience methods that build it for you
Ok thank you
Represents a generic channel that can send and receive messages.
Represents a builder class for creating a Rich Embed.
How do I add fields with a forEach loop
embed.addField()
Okay
In using switch cases, is it possible to make it do something if the string is for example args[0] and in the case to be userinfo and also ui... Is it possible
i suggest using a command handler
@flat goblet
You can stack cases
advanced command features are best done in a command handler
case "someString" || "ThisString": is this kind of thing Possible?
oh i didnt see flazepe already linked those lmao
@pure lion i didn't mean that
you can stack them horizontally as well
For example as an aliases...
//Do something
break;
case "main string" || "aliases":
//Do the same thing that the main string does when aliases is done
break;
case "somestring": case "anotherstring": { do something }
lmao sorry
Nah not you don't worry lol
what db should I use for leveling
any db lol
@spare mirage not quick.db 
@hushed jungle did you update the code on github?
Not yet I wanted to make sure it worked first but I can push now
quick.db is good if you're a beginner to sql or dbs
but it only uses one column
for everything
and makes a new row every single time
@quartz kindle Push is done ๐
like once every 5 seconds or something stupid low.
Might be considered API abuse
at those rates
smh
5/20s iirc
Ty shiv
Discord has a very loose interpretation of API abuse; as quoted by them:
American Jake01/21/2018
@Danny automating the API in that way /is/ abuse. Automatically doing "X" every N is generally not a good idea. Where X could be posting a message, changing someone's nickname, renaming a role, changing a channel topic, etc...
Generally bots should only react to user actions...
Although, for very large N we generally don't care. But for small N, we do care. Think rainbow bots, etc....
"N" is not really defined, as rate limits are not a good thing to try to get very close to. You're going to have to mostly use common sense here, compare how close you are the rate limit, how often you do this, etc. @pure lion
@hushed jungle i cant see anything wrong, does it still happen after 11 messages? any message at all? even messages without commands?
Thanks for getting back to me. I think only after executing a command. Normal commands don't see to have an effect.
sure
yea why
its a general convention to define private methods, since js doesnt have a built in way to define them
people like to use it for private things
Define private methods?
Soon tho js will have private methods and variables
idk when node will support them though
yeah ive seen classes use that sort of stuff but never learned it myself
11 or something
did you update it on your github?
ah
I'm just gonna run this locally and see if i can find it
so you ran it 11 times
seems like the problem is not in discord.js
its a drain event in TLSSocket
not a message event
the only thing in your code that uses tls sockets is node-fetch
whats your node.js version?
12.9.0
https://oliy.is-just-a.dev/vhvwuj_4996.png I didnt get it
I can't manually change it they have made a selection of versions I can choose from
No local you don't get this message
I noticed that too during testing
where is your bot hosted?
It's gotta be a problem with your host
Well I could try to find different hosting then since now it crashes in the long run
But I used this since I already had access to it so it's the cheapest option for me
Well, if you dont get it locally, but you do get it on the host and nothing changed, that's all I can think of
what do they even charge?
Uhm I pay yearly for three a max of three websites.
And a couple of other stuff like databases, etc.
I am looking through my mail for the price
@hushed jungle a quick google search indicates this is a bug with node.js v12.9.0 and it was fixed in v12.9.1+
I didnt even know namecheap offered stuff like this, I'd assume it'd be for webserver hosting
F
I found that one too but was not sure if it applied to this situation
you'll have to contact namecheap and ask them to update node
12.9 is a very weird version to be on
considering the LTS is 12.13-12.18
LTS?
long term support
^
node 14 should become LTS soon
Their VPS is 125 lol
per year?
I doubt namecheap will update the nodejs version since it is using an applet for it
30 dollar per year yes
And 125 per year
And that's with a one year discount
what other node versions do they offer?
125 per year is very expensive
but 30 per year is ok, depending on the resources you get
It's specs have to be decent if that's the discounted price right?
im paying 33 per year for 1gb ram
weird versions
Yeah idk
For some reason the most recent version is in the third place
Makes sense
it's like someone started top to bottom, lost their placement, and went back to the top
but discord.js requires 12+
so basically you're out of luck
i self host
20gb storage
unless namecheap upgrades their node
yes ๐ฆ
I can run it now but eventually it will crash again
Because memory ๐ฆ

you'd think a thing for webservers would have node versions good for webservers
Guess I need to host somewhere else lol
and not ones that create memoryleaks
its worth opening a ticket in namecheap
I guess it's limited since this is more of a feature people with a VPS would use
this has to be taken care of
I can always try their support has always been kind to me even with the most stupid questions
marketing tactic 
yes
show them your errors, link them the github issue, explain that its a bug with node 12.9.0 and that node recommends upgrading asap
Yeah the github link should prove useful
Any hosting suggestions if this doesn't work out?
Or should I just upgrade to a full fledged VPS
contabo is cheap
I can't recommend contabo any less after it was learned they used ssd swap as ram
lmao
wat
That was about my reaction too
ovh time 
Hai
Hi again! ๐ Is the a way I can make it so if the command is something like !messages it will say how many times you have used one of the bots commands?
Hi alexis ๐
I think you'd need a db
yup
starting with a certain prefix
you need a database or some sort of storage to keep the number saved and updated
You would have to check every message that was sent using an event and see if it includes your prefix and if it does make a vestibule and add one to it every time a message that contains that prefix is sent and save that on a database or something
You could save it in memory and do something like You have used <number> commands since the last restart
Variable*
hmm
But a database would be better to count the total number
how would I do that... ๐
Depends what type of database you want
...
I mean this would be a good way to learn some SQL basics
Yeah
what do you plan on using ?
@misty sigil im not sure bc Idk what ones there are ๐
do some research
You'd have to learn how to setup the database and some simple queries
ok
You could use phpmyadmin and run it locally without having to buy anything online
But I donโt recommend doing that if you donโt want to run your computer 24/7
It really depends what type of database they want
I'd go with SQL
why, Mongo is quite good
๐
I use PostgreSQL but setup is not super beginner friendly
ok...
Either one is fine though. Look into SQL and NoSQL databases
ok
sql injection has entered the chat
lmao jk jk

PostgreSQL + Sequelize is a good combo
That's what I've been using
Updating is as easy as
await message.guild.update({ prefix: '' });
god damnit
@misty sigil what one?
i have client.db.collections("prefixes").findOne("g_id":message.guild.id)
@gray zealot any
Snake case cursed
Fetching guild prefixes is just
const { prefix } = await message.guild.fetchData(['prefix']);
Me? No, I'm just showing how I have my database setup
\๐ ok
I like noodles
ok
is there some way to do this
in web js
<anonymous> file:///C:/Users/ThatTonybo/Desktop/ssr-login/assets/js/app.js:7
i get this error rn
is there any alternative
the index.html requires the app file and i want it to require the router file
some how
from googling around people are saying to include your script in your html DOM
but they're executed in parallel
honestly if you want that kind of a structure
look into SPA or other js frameworks e.g. angular or react
custom or unicode
unicode
i'm working on making an alternative to a framework, making my own
I use PostgreSQL but setup is not super beginner friendly
@strange trout i agree
but postgre is so good
it can readso many lines so fast

I wish pgAdmin 4 wasn't buggy af
Now that's an undefined moment
is that for like a bot ping
Yes
you probably have your math mixed up
I just changed hosting
So I wanted to test
And it worked fine with the previous one
what i did for my bot to prevent it from looking stupid is check the number for positive or negative, if its negative just say it errored
else you have your math mixed up
What's the host? Nasa? Wtf @hushed jungle
{
let ping = Date.now() - msg.createdTimestamp;
msg.channel.send(`My ping is ${ping}ms and the API latency is ${client.ws.ping}ms.`);
}```
Just some random hosting website I found which seemed legit
Code is fine right?
whats the website
dont answer that actually
it doesnt matter what the website is, having negative ping means the bot is processing your response beofre you even sent it
Huh
basically if the ping is negative
it means the bot processed your command before you even sent it
approx. 48 seconds if my ms to seconds big brain is correct
How is that even possible lol
ping
I think the solution for this is to send a message like pinging then edit it by dividing the created timestamp of the pinging created message and the timestamp of your message
oh wait
yeah
do what voltrex said
my bot sends "Pinging...", edits it, then returns the time it took to do that
Yeah I should try that
let omsg = await message.channel.send("Ping...")
let latency = Date.now() - message.createdTimestamp
let check = Math.sign(latency)
if(check === -1){
latency = "Error"
}
This clearly doesn't work
Hold up
people arent like "omg wth bro"
Wtf is that
wtf is what
The thing you showed
I have not seen a single ping command have that... Were you working on your ping command for days my dude
that's all extremely basic js lmao
a ping command is really easy...
.,.

most ping commands are straight-forward
i like to be extra with my commands so i add more checks just in-case it wants to return a wonky number
"Me Wondering that even Math.sign function existed"
oh it checks if a number is positive or negative
so if a number is positive it returns 1
if its negative it returns -1
useful for uhh
i forget what i was using it for initially but
tbf that's not even exact ping, but close enough
Defensive over a command that everyone does a little wrong 
idrc about my ping command, i just did it to do it
Should I substract the Discord API latency when showing the bot's ping or include it?


Anyone know a script that sends a custom message (set by me ) when a user joins?
sure, thats easy
Yes, javascript
progress

I mean I guess it's not negative
167ms
So I have that going for me
its better than negative

verified