#development
1 messages ยท Page 1119 of 1
Its spoon feeding and against server rules
if it's five lines of code, then how about YOU do it
bot.on("message", (mEsSaGe) => process.exit(1));
then don't code
$5 per line. And I enjoy whitespace
then pay someone to make the bot for you or learn the basics first
I was going to get into this community but I don't want to learn anymore you guys are mean ):
Make a simple project first
bye!
kbye
๐ข
this community isnt even the worst ive seen tbh
No one was mean, you just asked us to do stuff that's against server rules
There are plenty of guides at your disposal, all you have to do is look for them, no one here will spoonfeed and write you code, you have to learn yourself
^
definitely not the worst but not very nice to newcomers even if they haven't had time to adjust to the rules. I accidentally broke one rule and I'm sorry but there's no need to constantly discourage me from trying to do this
This isn't a teaching room
Discuss bot dev, not learn JS
"if you have questions ask the questions and wait for someone who can naswer to help you. do not ask to ask."
it isn't being mean, it's expected of you to already have intermediate knowledge and a sense of what you're doing, which you do not. we're not here to teach you the basics, we're here to assist you with your logic - we can explain it to you but we cannot understand it for you
^
^^
lol
about what?
mdn, w3
w3
aight I'm sory. I clearly don't fit in here and you guys don't want me here. I'll stop bothering you and leave. why do i always fuck everything up god fucking damn it. ok bye |;
feelsbadman
whatisitwithpeoplenotreadingtheruleswhentheyenteraserverlmao
that isnt #development
aight I'm sory. I clearly don't fit in here and you guys don't want me here. I'll stop bothering you and leave. why do i always fuck everything up god fucking damn it. ok bye |;
@earnest phoenix
this is a im14andthisisdeep moment when they snap "don't hmu ๐ฉ "
e
no
link me to something
lol
How can i get Message Embed Object out from JSON?
https://lmgtfy.com/?q=how+to+do+cool+css+background @delicate shore
;-;
Use that
from the webserver
can't fool me
from their own website
i know
the gif exists on their server
you can put an external URL
you didn't
i did ;-;
worked for me
what did you try
@hybrid roost you can pass the object to the MessageEmbed constructor
<html>
<head>
<style>
body {
background-image: https://cdn.glitch.com/d627e943-fbaa-4cab-abab-a4178d6f915d%2Fmaxresdefault.jpg?v=1596645157400("paper.gif");
background-color: #bbbbbb;
}
</style>
</head>
<body>
<h1>The background-image Property</h1>
<p>Hello World!</p>
</body>
</html>
i am not good at html
whywhywhy
stop
idk what im doing
coding
ok
@hybrid roost you can pass the object to the MessageEmbed constructor
@sonic lodge so,new discord.MessageEmbed(JsonString)?
ok sorry
if you took an extra second to look up how to reference strings in css instead of copy pasting shiny colored code blocks you would already know what to do
parse it first
it's just as simple as background-image: url(); what in the world did you do
yeh
or inline it into the body tag if that's easier (although bad practice)
I can't
because you downloaded a jpg from google
get a higher quality image
And make it a web friendly/optimized image format please
so use a png or lossless image format
I cant type today aparently
how do bots change their own name colour when they join a server? see: probot
wallup*
If the bot has permission to, it can edit its own role
I invited my bot with admin permissions, but it still says Forbidden
and cry
hi!
and one more
Them maybe it can't? Does probot make another role it gives itself?
auger
everyone but the guild owner cannot modify their highest role
Oo
So if i go ouyt of the server my bot will disapear from the server list?
bots like those create a new one in a position under their own and make it colored
Intresting
thanks
because it's too small
By default it doesn't stretch images
oh
it repeats by default
;-;;;;;;;;;;;;;-----;;;;;;
monitors have different sizes
5k monitors are somewhat common
look into the background-size css property
Macs bleh
and background-repeat
ok
you could just make something that's tileable
i've used heropatterns a bunch
That logo looks more like d p than h p
upside-down p
I kinda like it
i think i can find a project where i nicely integrated it in
how to solve this
ugh
people have told you how to solve it multiple times
oh
or do what every website is doing and use wAVes https://getwaves.io/
also imagine not using adblock
the default is repeating @delicate shore
adnauseam is a cool adblocker if you guys are into privacy
also for the love of god don't use that background
i use ublock origin
- 2 anti adblock killer scripts
adnauseam is built on ublock but clicks tracking ads so that they get fake data that isn't useful at all
Pihole and ublock
i use ublock origin
@earnest phoenix link
- 2 anti adblock killer scripts
@earnest phoenix how
two words; google it
bro google it wym "link" and "how"
yeah same. Well my server is my pi
Also. @earnest phoenix Just make a VM, and point your DNS at it for your PC
i'd want to make it network wide though
A Rasp Pi Zero can easily host it $10
family members constantly use services like youtube on tv on which you can't install adblock
I dont have mine network wide since other people are on my network who might not want an adblocker
Having an adblock for the phone is awesome ngl
I do have it on all my devices tho
tfw gf doesnt want adblock so she can earn points by watching ads in a game ๐
lmfao
@faint prism so I did it so far, now I just gotta figure out why my mysql is not working. Well it just adds more entries of the same name + different date even tho I tell it to update ๐ค
sql = con.query(` INSERT INTO birthday (bdUser, bdDate) VALUES (?, ?) + 'ON DUPLICATE KEY UPDATE bdDate = VALUES(bdDate) + 1' `, [message.author.username, editedmessage]);
any idea?
Hey there is a diff in quality of av of my bot and dyno why so ?
of what
size parameter
Profile picture
Dyno probably gets a larger size
Do i concatinate ?size=something ?
What approximately ? ๐ค
iirc
Ohk
With css yeah
you can modify anything on the website
find the according class and overwrite it
well not anything
but short des are markdowns allowed
Can you make it redirect to your website?
Use css
Can you make it redirect to your website?
@faint prism cert devs can
nice
Cascading style sheet is the answer to all ๐
i would imagine there's probably an exploit that allows you to do so since DBL's frontend and backend is a dumpster fire
No
ok
You can style it from the long description though
Css
Get the class of the short description
find the short description element
i am sorry
And do .classname
Inspect Element
but didn't worked
Npm I quick.db
Gave me tons of errors
Inspect Element
@slender thistle ;-;
Quick db has some requirements, which is linked to on the npm page
let me try
what errors
to learn
Css has a ton of resources online
<style> tag for that selector
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:307:47)
gyp ERR! stack at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:225:16)
gyp ERR! stack at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:271:16)
gyp ERR! stack at exithandler (child_process.js:315:5)
gyp ERR! stack at ChildProcess.errorhandler (child_process.js:327:5)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
and much more it says
I use side dev panel so I can resize the screen easily and see how stuff changes
wym by tag of selector
Look at the quickdb troubleshooting page @earnest phoenix
Could not find any Python installation to use
global variable for python missing?
Where can I find that?
Yeah maybe you need python installed
installed aswell
It has requirements depending on the platform iirc
Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if the py launcher can be used to find Python 2
gyp ERR! find Python - "py.exe
anyone know how i can make a channel locking command?
Probably a good idea
add Python to PATH when installing
Where is your python install?
When you installed python you didn't add it to path
It means you can do python thing in cmd
an environment variable
In inpect element?
Hello I want to host my glitch bot free 24/7
Glitch costs money now to br 24/7
dont use glitch
large">This paragraph refers to two classes.</p>
buy a vps
Why?
Your making a new paragraph with a class
Pay $3/mo for a vps or self-host for free
tl; dr
glitch is overpriced rubbish
Glitch charges $10 a month for something that should cost less than $3 a month
something that should cost $1/month
It really is just a useless platform for bots
Anyone wanna give me money for no work?
^ yes
oh hell yeah
But I cant
Pogg, thanks,,, oh
It really is just a useless platform for bots
this ^
Hi guys, I have just started out bot developement can you guys give me a free vps please
ok details are rote@3 and the pasword is dsufhdsuighsduighasufh
Sure but it's got 0.0003GHz clock speed and 1kb of ram
Has anyone made a bot on one of those Google micro servers yet?
Never even heard of them
Sure but it's got 0.0003GHz clock speed and 1kb of ram
@placid iron wew
What their free cloud service?
I think it could be a great platform for small bots
those what has like 10mb to 250mb ram?
It was 200mb iirc
Hmm, I could host my ping bot there then
azure has 12mo free
ez
I would get the free Google cloud service but I can't because no credit card
I host on my raspberry pi

I dont think you need a credit card for the micro stuff
Same
you do
fs.writeFileSync('./GuildConfigs/guilds/' + guild.id + ".json", JSON.stringify(newGC), (err)=>{console.log(err)});
There are no error. That's just not working.. /Why my code not working without some logs and errors../
They go up to 8gb of ram so honestly not too bad
I host on my raspberry pi
:cry:
@placid iron But do you have a UPS for router, modem, and PI server?
huh im making a command handler and i want to make it on ceparated folders and not in a folder with all the commands(all)
Universal power supply, in-case of a blackout
You'd have to change the way you get commandFiles
I would buy a VPS than get a ups
like const command = require(./commands/${categories});
Ups not worth it for a pi
@dire obsidian you can use fs.readdirSync and assign it to a var and then use a for loop
confused.cry
You can use a battery pack to power a pi in a blackout and hotspot with your phone or smth idk
Well, I recommend UPS's for home networks anyway.
I have 2 in my house rn, planning on a third soon
Most isp's provide internet when the power goes out
<user>.send
@earnest phoenix you can use the cache to get their ID
Tbh tho our power has gone out 2 times in the 10 years I've lived here
messageAuthor
@earnest phoenix cache the ID
Depending on how your dming.
If its just the message author.
Message.author
If its a mentioned user message.mentions.user
client.user.cache.find('id').send('message')
If its just from an id, what if6 is talking about
MySQL Question:
I want to update bdDate if bdUser already exists
What am I doing wrong?
var sql = con.query(` INSERT INTO birthday (bdUser, bdDate) VALUES (?, ?) ON DUPLICATE KEY UPDATE birthday SET bdDate = ` + editedmessage , [message.author.username, editedmessage]);
- not the greatest at mysql -
Is bdUser the primary key?
On conflict I belive
INSERT OR REPLACE
@earnest phoenix if youโre trying to send message to a user thats not the message author
with same user somehow
You don't want to replace
you have to cache using .get
Because that resets other columns
.get? what
If its a mentioned user you don't need to use the cache
Would this be useful? 
.get(it)?
client.users.cache.get(user id here)
so const user = client.users.cache.get(user id);
user.send('Message')
@worldly nebula look nice bro, just can you add templates and that can be nice
๐ค now I'm hella confused
If I'd actually do that I'd use Embed messages tho @dire obsidian
They'd look cool
That was just a test if I can even do that
without discord api being stop abusing me
I'm still not sure why we are assuming he should get the user from cache.
The vast majority of the time you already have the user somewhere.
@worldly nebula as long as its following rate limits its cool ig
I think it is
Then I'd just add some cool Embed messages
and templates like @dire obsidian said
.-. yes
;-;
lol
Why this filename cursive..? This curios..
Changed over to embeds, and it's lookin sharp
There are a ton of samples I'm sure
what language?
js
im trying of make in separated folders, not files
i find this:
const Discord = require("discord.js");
const Enmap = require("enmap");
const fs = require("fs");
const client = new Discord.Client();
const config = require("./config.json");
// We also need to make sure we're attaching the config to the CLIENT so it's accessible everywhere!
client.config = config;
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});
client.commands = new Enmap();
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let commandName = file.split(".")[0];
console.log(`Attempting to load command ${commandName}`);
client.commands.set(commandName, props);
});
});
may work?
that seems to be getting files all in one folder
this question is more fs related than discordjs related
yes, actually i find this on a random github repo
@placid iron I tried it with ON DUPLICATE KEY UPDATE but it creates a duplicate entry
That User's name lol
instead of actually updating*
INSERT OR REPLACE shouldn't create duplicates, but creates if the key doesn't exist
not sure if replace is a safe way to do it
Hm
I feel like it could delete other columns
https://i.imgur.com/dFW9cRD.png kinda like that, just with different users
first of all, your primary key should probably be the user id not username
people can share usernames on discord
oh shit you're right totally forgot that
and if i change my username, your db wont know who i am
I was planning on using the discord user ID as the primary key. It's a shame it's a ulong
How To count total number of server on my Discord server by python
like total guilds
nvm I'm dumb
xD
py
python works a bit differently guys
yeh
@cerulean venture let me get my sql real quick
len()
discord.py probably mentions it in their docs regarding their object for the Bot
right?
okay thanks
i have the same thing
I swear
stop treating python like js
that is correct
HA
Gottem
lmao
It's weird ik
client.guilds isnt a list is it?
c.execute("""INSERT INTO guilds (`id`, `bot channels`) VALUES (?, ?)
ON CONFLICT(`id`) DO UPDATE SET `bot channels` = ?""",
(guild_id, channels_ids, channels_ids))```
this is what i did @cerulean venture
Hm
its a list in discord.py
well I have no idea
thaaaaanks
len([g for g in client.guilds]) i thought
nope
or something like that?
if it was a generator you would have to do that
ooo
woo*
That's the same with me and JS
they are pretty similar for the most part tbh
LMAO
I got heated
that is definately not true
is guild.members a list aswell?
yes
idk why i asked that, i have docs open
https://stackoverflow.com/a/62116724
suggests using
len([m for m in ctx.guild.members if not m.bot]) to remove bots from the member count.
guess it depends
I gotta remember that if I ever count the users
yeah
i have a feeling
[m for m in ctx.guild.members if not m.bot]
is pretty much a .map in js
but it is faster
we have .map or something similar in python but list comprehension is way better iirc
python is pretty much always slower if i remember right
in fact it depends https://stackoverflow.com/questions/1247486/list-comprehension-vs-map
@solemn latch i wasnt talking about inter-language speed but intra-language speed
exports.run = (client, message, args) => {
message.channel.send("poeweng!").catch(console.error);
}
``` i find a new command handler, but how i add the info of the bot like: name: '', description: '',?
What
well the command handler is this: #development message
module.exports.help?
hmmm like add that in the start of the file like:
module.exports = {
name: 'ping',
description: '',
exports.run = (client, message, args) => {
message.channel.send("poeweng!").catch(console.error);
};
}
?
Can you use hyperlinks in embed descriptions?
yeah
yes
Thanks
@dire obsidian Try it and see
no spoonfeeding #rules-and-info
imagine not reading rules
right?
only weirdos read the rules when they join servers
@misty sigil lmao you paid for boost
which is why i read them first
yes i did
I can't pay my patreon payout isn't in :(
:c
F
Hi how do I delete all the reactions in a message I mentioned?
Library: discord.js version: v11 or v12
<message>.reactions.removeAll()
no, it didn't work @solemn latch
It'd probably be deleteAll() on v11 because it's a collection then
v11 is deprecated btw
when will we get v13?
at the next major update
when will we get v13?
When the Devs learn how to use the enigma to encode the syntax
in v12 we got cache, in v13 the cache will have its own cache, or what?
oof
github better release histories when
Can we send a custom message to all the server where our bots is at one time
hello
that would probably be api abuse @surreal notch
๐คทโโ๏ธ
@midnight blaze looks like v11 was released in 2016.
probably awhile till v13
https://github.com/discordjs/discord.js/releases/tag/11.0.0
@surreal notch You can and it's ok only if you set a timeout each time it sends the messages
iirc, its api abuse if no users in the server requested it.
Ok
its usually the other way around
^
if you do it that way, its fine
isnt announcement channels now free?
i believe so, yes
don't you need a communtiy server
any servers that want it can follow it
That gave me an idea actually
the reqs for a community server are pretty much stuff bot support servers should probably have anyway
if you want to send announcements, imo thats the proper way
๐ฎ i didn't know it was that easy
What's wrong here, please help?
async def before():
now = datetime.datetime.now()
period = now.time()
new_period=period.replace(hour=11, minute=20, second=00)
while True:
if now.time().strftime('%X') < new_period.strftime('%X'):
date = now.date()
else:
date = now.date() + timedelta(days=1)
then = datetime.datetime.combine(date, new_period)
await discord.utils.sleep_until(then)```
life
what error, what unexpected behavior, anything useful
Alright so I want to make sure I'm going about implementing this the right way.
I have an issue where I have a command +list
The issue is that the returned string exceeds the 2k character limit.
I was playing around with the idea of +list 1, +list 2, +list 3 and so on and dividing up the original string into a string array[returnedString.Count / 2000] for example
The alternative is to figure out the addon for reaction paging @earnest phoenix linked earlier. Which is honestly, probably the way to go
@sonic lodge nothing just it;s not working
i put that code out and tried to print 'then', but it's not printing anything untill i put it in the loop
then it will print the infinite loop of that timestamp
^
if i break, and it will execute the command, then when the task.lopp is called, after that will it run again itself??
Consider setting an escape condition instead of True or include a break
cause its a before_loop
when will we get v13?
@midnight blaze on discord api v8
does anyone here know of an api that can identify images of self harm with some level of accuraccy?
free is definitely a plus
ive found one called sightengine, that can identify porn, nudity, weapons, drugs, alcohol and offensive symbols such as swastikas and isis flags... which is good, but it has some holes.
im using it to censor user added images to my bot's db
sightengine is good
yeah, it is
im quite impressed
but i gave it a picture of someone hanging themselves and it just allowed it because no guns, drugs or alcohol were used ๐
im wondering if i need a secondary api to detect that kind of stuff like google image recognition
you know, even just discussing the ability to block this stuff makes me kind of uncomfortable.
its a touchy subject
agreed, but sometimes things need to be discussed
i used it 1 time
ah ok ๐
im currently on the free trial, but if my bot grows im going to have to either change api's or invest in the paid plan, if i get enough subs to cover it
free tier's ratelimit is 2000/month (500/day)
yeah and each image check takes 3 calls
thats why I dont use that
BUT, not every bot user creates a team, and only a tiny subset of people that create a team will customise the team hub page and upload an image on it
right now there are 2874 players, 127 teams, and only 3 have images on them - one of them is mine ๐
Best automatic image moderation API. PicPurify is designed to automatically detect and filter specific contents in a picture, with an unprecedented accuracy.
so long as the percentage of people actually using team hubs stays the same... those quotas are manageable
you are probably looking for this
aw come on you couldn't at least remove the image
man is snacking (lmfao im so fucking sorry)
is it possible for my discord.py bot to dm me when the bot has restarted?
hmmm
I am trying to wrok out
gore/violence filter wont detect the kind of pics im trying to filter
i tried their online demo with various stock photos
๐ค no idea
@green kestrel I am actually trying myself to impliment a filter for nsfw pictures for my bot. I just found this https://github.com/infinitered/nsfwjs, but I am not sure if this is good enough. Do you know other packages?
hmm, i wouldnt use a package
its something best done by deep learning
which is best outsourced not processed by you, theres a massive amount of training the dataset needs doing to make these things accurate
sightengine and that picpurify work well for a lot of nsfw pictures
i think im just going to have to rely on a report button for anything that slips by, for now
Oh god, Unicode increases the character count more than string.Length detects ๐ฆ
What are some ways I can reduce the size of a node.js docker image
my express app's image is like 164 MB
reduce the amount of dependencies you have
I really need to implement that embed reaction page soon..
what is that though
That More users available is kinda a substring truncation of the actual output
It keeps the average niceness of users based on ML predictions of their messages
i just have 4 @earnest phoenix
ah
then you could use reaction pages
what about showing the percentage // how "nice" they are
eris, express, body-parser, and common-tags
hastebin // paste.mod.gg (hastebin) fork
@earnest phoenix it's common guild scope specific for requesting user
IO is slow
i feel like pagination for something as big as that is unintuitive
you don't have to use IO
you can do it all in memory
reaction pages imo are easier to work with rather than sending a large file
reaction pages imo are easier to work with rather than sending a large file
@sudden geyser large
It's gonna just get bigger
a few kb lol
If the server has 1k people that avail users count is going to be about 600 of them
well maybe not in size lol
but what I more mean is an embed reaction with a few reactions to browser back/forward seems easier for a user rather than giving them a file to download and look at
that's what I'm thinking about implementing
yeah i get it but to me that's unintuitive and it doesn't scale well
I have a list of available users. It'll be greater than 2k more likely than not on busy servers.
Reaction Pages are clean, but have additional CPU overhead.
Offloading to another service that provides a download link feels unintuitive, and there are privacy concerns with that
Torn tbh
i'd just send a .txt file
feed a string into a memory stream, rewind it to pos 0 and send it with SendFileAsync
you can make it fancy by referencing it in an embed i think
give me a minute
Context.Channel.SendFileAsync() oh sick it does have a stream param
ok this may sound stupid, but how do I connect mongodb to a vps. I've been trying to connect mongodb compass to a vps for like an hour, and I just keep getting errors like
Error creating SSH Tunnel: (SSH) Channel open failure: Connection refused
Error creating SSH Tunnel: connect ECONNREFUSED <ssh ip>:27017 - Local (0.0.0.0:29250)
Error creating SSH Tunnel: connect EADDRINUSE <ssh ip>:22 - Local (0.0.0.0:29250)
yeah nevermind i thought you could reference the attachment url in an embed the same way you can in embed images and thumbnails but you can't
you can probably do something like sending the message, then editing it to include the attachment url but that won't hide the attachment card that appears above the message
you can also do something like sending the list in your super secret guild
getting the attachment url from that
and then sending a message in the context's channel with the url
Like the support guild ๐
make sure to put the filename and file type so that way people knows what it is
Just a button saying DOWNLOAD tells the user nothing. It might be a virus for all they know.
You're fast af Cry. Have i told you that
๐
@summer acorn they can choose whether they want to download it or not and the extension would appear in the url
if you're a paranoid about a text file, well... that's a you problem
some people wont take the chance unless they know exactly which file it is
and they don't know it's a .txt file before they click on it
for all they know, it could be an infected website
ayy
Hi, how I see in how much servers is my bot?!?
?
jokes aside, you need to state the library you're using otherwise nobody can help you
read my message
Ok thanks
you could also just check the invite link if you want an easy thing without code
you could also just check the invite link if you want an easy thing without code
@thick gull how?
Click your bots invite link and select a server then it says how many servers itโs in
Ok
ok this may sound stupid, but how do I connect mongodb to a vps. I've been trying to connect mongodb compass to a vps for like 2 hours, and I just keep getting errors like
Error creating SSH Tunnel: (SSH) Channel open failure: Connection refused
Error creating SSH Tunnel: connect ECONNREFUSED <ssh ip>:27017 - Local (0.0.0.0:29250)
Error creating SSH Tunnel: connect EADDRINUSE <ssh ip>:22 - Local (0.0.0.0:29250)
https://cdn.discordapp.com/attachments/734520305145479198/740669693941252237/unknown.png
https://cdn.discordapp.com/attachments/734520305145479198/740669701020975144/unknown.png
whitelist the vps' ip address
using ssh?
yes,
I am connected with bitvise, yes
i have a connection via my ip address already set up with a connection string, so then what i do is i get the vps connection's ip address and whitelist it on atlas
I am not using atlas
oh then idk how to explain it
hmm (i just tried to eval msg.member === null, my code is open source if needed)
how can i use a variable to refrence something from a rowdatapacket
like if the name of the variable is balance and there is a var i have called currency, how can i do balance.currency (where currency is whatever value i have it set)
How can I make it so users have to wait 5 seconds before a command can be used again? I tried doing some research on Google and I'm getting no help at all. For instance, I want it set so if somene runs the command, no one in the server can run it for 5 seconds.
@tight plinth What version of node do you use?
Use node v12 or higher
Node.js v14 for optional chaining 
When you're stuck with v12 node 
@spiral veldt Just set a cooldown using a database or a Set()?
?
Okay so something like this? https://discordjs.guide/command-handling/adding-features.html#cooldowns Will this affect all users in a guild?
@open flicker wanna show your schema for mongo
?
Are you passing it with that object when you create the document?
or do you want it to be added even if it doesnt exist?
I do not quite understand
@spiral veldt Using a Set is better for this though
let cooldown = new Set();
<Command start>
//Check if the cooldown is set
if (cooldown.has(
<message>.guild.id)) {
//Do something if cooldown exists
} else {
//Do the command
<Command goes here>
//After it we set the cooldown
cooldown.add(<message>.guild.id);
setTimeout(() => {
cooldown.delete(<message>.guild.id);
}, 5000); //5 seconds in milliseconds is 5000
<Command end>```
Ah great. I'm trying to make it so users don't spam the command I have set in place
Tfw you use a Raspberry Pi to host and you accidentially forgot the Job ID for the bot
if someone is bored and wanna help me with some json random thing ... please pm me ๐ฆ my mind is really going mad
just ask your question here
@dusky lagoon from what im seeing you aren't removing it anywhere
< message > Please don't tell me I have to put the message printed in those. It's an insanely long message.
then remove it from the single user lol
what do you mean??
@spiral veldt No
you can remove reactions from individuals
you don't have to clear them
Okay good.
or are you thinking a line in code
already fixed it
{
"imgMemes": {
"aggressive": "https://media3.giphy.com/media/3o7WTOv81ONBE7413O/giphy.gif",
"banana": "https://thumbs.gfycat.com/ImpressiveSomeFieldmouse-size_restricted.gif",
"bear": "https://media1.giphy.com/media/PaiePPzQ8AtCU/giphy.gif",
"best": "https://i0.wp.com/media2.giphy.com/media/9Xh1CGm4Hzo4g/giphy.gif",
"bird": "https://64.media.tumblr.com/064bea4abbfb10531ef60c5226c4c6e3/tumblr_inline_pat02nBUoV1vu12yv_500.gif",
"birthday": "https://media1.tenor.com/images/bac81fca76a33e709530cafa60a6a75b/tenor.gif?itemid=5476259",
"bite": "https://media1.tenor.com/images/c91f7e6ca3f5c157c5e6f6e4ea2e364c/tenor.gif?itemid=7748718",
"blush": "https://thumbs.gfycat.com/PossibleNextGoshawk-size_restricted.gif",
"boom": "https://media2.giphy.com/media/laUY2MuoktHPy/200.gif"
}
}
So... this is a part of my memes.json that sends a gif image for every keyword. Is there any chance that i may transform to select random from multiple images for same keyword ?
make imgMemes an array of objects instead of an object
although that should be hardcoded anyways
i dont get the point of using json for that
using require caches the file so there's no point, and reading the file manually on every command is so unperformant it hurts my soul
Yea but json support arrays so you can put an array and put your links in there and get a random one instead of just one link as you put there
me 0 - 3 python ... that s why json
the entire bot is on discord.js, i started from a github base bot of discord.js
i said that s why i choosed json
what ?

ok this may sound stupid, but how do I connect mongodb to a vps. I've been trying to connect mongodb compass to a vps for like 3 hours, and I just keep getting errors like
Error creating SSH Tunnel: (SSH) Channel open failure: Connection refused
Error creating SSH Tunnel: connect ECONNREFUSED <ssh ip>:27017 - Local (0.0.0.0:29250)
Error creating SSH Tunnel: connect EADDRINUSE <ssh ip>:22 - Local (0.0.0.0:29250)
https://cdn.discordapp.com/attachments/734520305145479198/740669693941252237/unknown.png
https://cdn.discordapp.com/attachments/734520305145479198/740669701020975144/unknown.png
third time I ask. I've been having this issue for ages. I've tried when connected through SSH with bitvise, and when not. I just can't figure out why it is like this. The error I am mainly getting is EADDRINUSE

uh, I don't know how to do that
edit the config file
and check
its located at
/etc/mongo/ i cant remember the exact file name
hold on
ngl
@summer acorn /etc/mongod.conf is the file you wanna edit
alright, thank you ^^
only a few syntax errors
ok I didn't know what to use
ok there, now it was without errors
I'm clearly doing something wrong here
ok there, now it was without errors
@summer acorn listening on 0.0.0.0 right
<message> is not s thing
idk what the f that background , font, colors and opacity is
is this = or == or ===
but i hate it
funny thing, I actually thought of nano first
It's whatever Kali Linux comes with
i cant even read whats going on
and yes, 0.0.0.0
Is that all I need to do?
@spiral veldt would be nice if you posted an error or something rather then 'this nu work, pliz fix'
@summer acorn sudo service mongo restart
what are you expecting to occur? whats happening?
it might be all but let's go step by step
Okay no errors now. Let's hope this works
oh
replace systemctl with service
I didn't see
its cool
Okay so that didn't do a cooldown at all.
lmfao
fair
all I know is just how to start, stop, restart, upload, and code a bot
I don't know any terminal stuff
Does someone have an example of an event handler?
No problem
feel free to shoot me a dm if you need more help
i'll happily explain / show you how commands work
Sure will ^^
I will definitely need a lot of help in the future with using a VPS properly ^^
@quartz kindle So i want to do logs wth my disord.js-light v2 bot, and i have a problem with the messageDelete event: 95% of the properties of the message that the event returns is undefined (I can't get channel name, author is just an empty object and worst of all, the message content is undefined). Any idea of what i can do against it? the GUILD_MESSAGES intent is enabled
and ofc i cant fetch a deleted message
there is no way to get deleted messages if you dont cache them beforehand
if you want to make a logging bot, i suggest you use a database to store messages
Or simply make a discord channel to store the logs
you can do that, but rip your ram

So this might be a bit dumb, but I'm struggling to find the correct object that implements ISocketMessageChannel.
await context.Channel.SendFileAsync(stream, fileName, embed: embed);
This will send on the channel the command was recieved from, but I was to specify the channel. I see the GetChannel(ulong id), but it doesn't have the SendFile.. I might just be missing something obvious @earnest phoenix
cast
cast a spell
yup, that's correct
you can also cast to socket variants safely, cached channels are always going to be a Socket variant
It seems like it just specifies which interface you're targeting that was inherited
Sup
I've got this code to store my events, how do I make them run now?
// Events
const events = new Discord.Collection();
fs.readdir('./events/', (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if(file.endsWith('.js')){
const event = require(`./events/${file}`);
events.set(event.name, event);
}
});
});```
you dont need to store then, you need to bind them
oh
Woah that looks badly formatted
So I keep getting "SSL protocol error" on my peerjs app even though I'm passing in the cert and key
client.on(name, event.bind(null, client)); like that?
you can do that, but rip your ram
@quartz kindle i mean, there is no way to me to not use ram (and storing messages in a real db is a big nono)
something like that yes
client.on(event.name
@tight plinth this is what dbs are designed for
storing things that you dont need to access in real time
ofc not
and im too lazy to write a script to delete messages from the db if they are 30+ days old
but since you're not using them most of the time, you're just storing them for a specific rare occasion, a db is much better for it
ram usage by storing them into a temporary map or cpu usage by doing a lot of db calls, my choice is quick
well, considering my bot uses 1% cpu and 10% ram, not a hard choice for me either
1% cpu but it can still lag a lot for no reason
Should this work?
// Events
// Get all the events file
const events = requireAll({
dirname: './events',
filter: /^(?!-)(.+)\.js$/,
});
// Prevent duplicate listeners
client.removeAllListeners();
for (const name in events) {
const event = events[name];
client.on(name, event.bind(null, client));
}```
Alright. Now to find the link that the SendFileAsync() posts
also, there are several databases that are designed for that purpose, like time series dbs
fast and efficient permanent writing, and even automatic delete on expiration
const peer = new Peer({
port: 9000,
path: '/'
});
// client side
let key = fs.readFileSync('/etc/letsencrypt/live/ale-bot.xyz/privkey.pem')
let cert = fs.readFileSync('/etc/letsencrypt/live/ale-bot.xyz/cert.pem')
const peerServer = PeerServer({
port: 9000,
ssl: {
cert: String(cert),
key: String(key)
},
proxied: true
})
// server side
idk what im doing wrong here
the kind of databases actual logging systems use
i mean, i can do what i want soo
sure
just responding to your response to my suggestion :3
@pure lion ssl is terminated in nginx
you dont need ssl in node
why is d.js's collection clone a shallow copy 
I had so many issues with editing the clone and it editing the old one I was so confused
object cloning is a mess
tim, now getting timed out err
is the port correct? in nginx as well?
I just ended up making a new collection, looping over the old one and setting the collection stuff. I was working with permissions and I didnt want to make multiple api calls to update the permissions
is the port correct? in nginx as well?
its port 9000 at client and server (how do i enable through nginx uwu)
if all else fails, you can always JSON.parse(JSON.stringify()) :^)
I tried that
it gave me undefined => undefined
https://oliy.is-just-a.dev/ugrjy_5423.png this is what I ended up doing
Progress ๐
The link however isn't correct... I need add some logic for getting the link it just posted.
Any suggestions? If this command executes a lot, I don't want it to grab the wrong link. Maybe a Guild ID in the message in the hosting channel?
push the channel ID/a timestamp or something to a map and as the key and the value as the link, then get when needed?
@pure lion for example: ```js
location /peer {
proxy_pass http://localhost:9000
}
then you access https://ale-bot/peer
because is a dynamic URI element
which file is this again
your wbesite.conf file
yeah
does it accept a path prefix?
um
yep
nginx: [emerg] "proxy_pass" directive is duplicate in /etc/nginx/sites-enabled/ale-bot.xyz.conf:26
ran test
are you running other things on this node.js server?
nope
are you gonna run other things on your website?
not at the moment
