#development
1 messages ยท Page 1834 of 1
i dont like babel anymore
nvm its the other way around actually
let a = null;
a ??= 7; // 7
a ??= 9; // 7
it only assigns if the var is null/undefined
hot
that be useful i use if (!var) several times in my proj
ye
details.studios.edges[0]?.node.name ?? 'NA' Like this wont work the the operator though
No idea
night
a
No!
My pm2 is struggling to start my bot for some reason
Actually seems like it's my VPS struggling
cpu 102%
Yeah it's odd
Hangs on this
Like 75% of the time
Also hangs on an online status for a solid 2 minutes or so
(After I stop the process)
Finally it loaded
Is this normal usage for the stats provided? ```
Loaded with:
commands: 17
cached users: 34
total users: 1534
cached channels: 143
cached members: 41
cached guilds: 17
memory usage: {"rss":132317184,"heapTotal":68399104,"heapUsed":60919304,"external":23782217,"arrayBuffers":21612946}
Damn, Tim went offline
alone
IT WORKED
nice
transpiled new node to node 10
@waxen bough @quartz kindle possible
left is babel right is original transpiled to node 12
think thats all the config you need (havent tried compiling djs yet)
can i target node v0 lmao
it worked (anticlimactic since syntax isnt too different)
idk man
the line 207 is client.commands.get('help').execute(embed, args); its the execution of the help command that is stored in another file.
https://haste.ntmnathan.com/uwuyesewoq.js Hey this is my queue class and I have a method name cleanup, what I want to do is when it's called with param memberID it will filter the results and replace the items of array with the array returned after filtering
let's see if this will run fine haha. transpiled djs codde
hot
I need help please!! I am looking for support with the Vote Tracker bot. I did the vt!setup, vt! is my prefix, and then did the info. in DM's, but once I entered authorization and webhook URL, I clicked save, but nothing happened.
pls
idk what I am doing
Wdym?
I went to the Vote Tracker server and they said to come here
Because when I click save, it does nothing
So they said it must be something to do with Top.gg
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Discord" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says Support Server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(
There
I ALR DID ๐ญ
Well...
So what exactly is your issue?
Save button where
I entered the URL, auth pass and clicked save
But the save button does nothing
Neither does the test
its because of site issues
yeah most likely
How do I fix this?
I'm legit crying this is so hard /hj
Not here
Just wait for the site to be fixed
How do-
People are voting and not getting the perms for the role ๐ญ
Idk why they told you to come here
And yelling at me

just give them the stuff manually till shit works
This is just difficult and no one seems to know how tohelp
Oki
Its mainly cuz of site issues again
We cant really help you in this case
yes
Oki, I'll try again in a bit, maybe on Monday
till then just give the stuff manually
Hopefully the site will be fixed
so i forgot i added a function that tells whenever somebody joins a server firebot is in, and This popped up when i looked at the console
@near stratus
Wdym?

Too blurry?
Yeah he was being sarcastic lol
its updated here
when i try to view
tada... empty
tried to clear cache and cookies
still same
tried other browsers and yup still same
top.gg website is updating or not? its more like when refreshin to other pages it has 3 side version
oldest, current and beta
there's also things l;ike buttons that is missing like API token
heres a sample:
watch the things i am clicking carefully
uBlock is disabled in top.gg to support the dev since im listing bot and server for free
you can also see it at the gif
other extentions is volume booster, metamask and ronin for my cryptos
topgg bags any profit they get from ads, the devs get nothing lol
ok so im in a class and i called a function
NameError: name 'log' is not defined```
python
and defined it
but it doesnt seem to be defined??
@drifting wedge show your full code
its fine i figured it out
Alright
i removed it from the class
what do you mean salary of devs isnt good?
you haven't put a style tag
you're ?
where? lmao this isnt my website
<style>
code
</style>
- sounds like a you problem
a 14 year old teaching me.
@sly sierra next time make sure that you know what you are referring to..
before telling this to someone
and learn to use you're
Same, but i know how to use it
@vagrant panther You shouldn't push your token to a public github repo
there's a reason it auto resets
i need help regarding vc roles bot
Where do you host your bot?
Store your token in an enviroment variable and update the code to read the token from there
replit has config for enviroment variables iirc
@vagrant panther
<@&695153281105920070>
-wrongserver
@eager egret
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Discord" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says Support Server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(
Does someone know how to delete a msg with id
Like let x = message.guild.messages.cache.get("msgID")
x.delete()
Let me guess you donโt have access to the message obj?
If not you need to get the guild from the cache of your client
client.guilds.cache.get(msgid)
And after that simply fetch the message by its id
You need the channelid for a message to delete it
hello how setup aws server in pm2 dashboard
I have a const abc = "something" in index.js
How do I import it in command file?
Does const { abc } = require('./index.js') works?
module.abc = "something"
In index?
sure
is the command file imported by index.js though?
If it is then that's a circular dependency
Yes
how can setup accorate stats command
can any one tell a npm package
which show accorate
@sterile thicket you have the mutate module.exports not module
module.exports.abc = "something"?
yes
And in the command file, const { abc } = require('./index.js')?
yes
Ok thanks that worked....
But
I also need to use the abc in the index file as well
Should I create another const abc = 'something' for that?
as long as you still have that in your index that's fine
I mean don't add anything it'll work
It didn't... It says undefined
yes
do I do const module.exports?
then you can either reference it with module.exports.abc or you need to keep your const and below that add module.exports.abc = abc
alrighty, thank you very much
hey, i have a weird question, i think? Is it possible for a bot to not be able to get the guild id of a server?
my bot is in several servers but there is only ONE server where the bot keeps breaking cos it can't seem to get their guild id, and i'm not sure why D:
Maybe it's an unavailable guild?
what does unavailable guild mean? o:
A guild that's offline, crashed or rate-limited. What lib are you using?
@devout vapor try running console.log(guild.available) on it
discord js docs encourage you to check if the server is available before processing anything on it
discord.js
Read the docs above
OOO: okay, i will! thank you to both of you!
I need help with discord.py slash commands
you have 20mb in array buffers (binary data / audio) and 70mb in heap (cache / js code), you are using lots of memory for something. are you running a music bot? large json files?
My bot is not replying to my commands anymore, i have the code all correct and the code is running but its not responding to me, know why?
my music bot stayed at that RAM 
how are you measuring that ram?
Heapused
thats why
Process.memoryusage.heapuse
heap is only js code and caches
turn of the caching
no buffers or binary data, and doesnt count node.js itself
if you want an accurate memory usage of the whole process, use .rss
process.memoryUsage().heapUsed / 1024 / 1024;
``` or u can do something like this to measure how much memory the nodejs process is using
That ia what i used
where can i get my topgg token?
your bot's edit page
i think
that doesnt include the node.js process
hmmmm
.rss
.rss?
yes
tq
process.memoryUsage().rss/ 1024 / 1024;
oh ok
since node 15.6 you can also use process.memoryUsage.rss()
which is a faster version of process.memoryUsage().rss
since it calculates rss directly, instead of calculating all memories then getting only the rss
${(process.memoryUsage.rss() / 1024 / 1024).toFixed(2)} MB Let see what I got then
Same result just fixed on 2 decimals
๐
Wont matter on the first few minutes, few hours is what really matter to measuring RAM usage
But based on my heapUsed I dont think it will rise that much
kinda offtopic, do u use heroku to host ur bot
No.
ok
Hmm.. look like nothing much going up/down. playing 48min song (Muse whole album)
this is only posting from a single shard, why? I tested the code and reduce did manage to get the total servercount
but when I post with dblapi.js right now, for some reason it's just only taking the shard's server count
and I posted it here instead of in #topgg-api since I am using the old dblapi.js by tonkku and not the new module
dblapi.js is deprecated. I'd suggest moving to the new autoposter
It isn't. The server posting takes 2 minutes to switch.
There are examples of code in the docs. Just copy and paste and change the details
dblapi.js has a built in webhook for votes, I couldn't even find anything regarding voting webhook on the new documentation
Check the pins in #topgg-api
you still gotta do the express stuff yourself, which you don't have to in dblapi.js
The packages in pins will be updated for the upcoming v1 of the API.
also about this, reading about it, it says it's running broadcast eval, does it even support the new way of doing broadcast eval in djs v13?
since v13 changed the way you do broadcast eval
v13 hasn't been released yet so it might not.
exactly, so I can't use it then
since I updated to v13
and that package was last updated 2 months ago
Well the problem is you're not using an official package ๐คทโโ๏ธ so it might not work with the API as you'd expect. You could try posting your stats directly to the API without a package to do it for you.
the problem I had, I found out that the process to fetch the client values and then add them together was being too slow, so awaiting the reduce before posting the stats should work, seen as it did work earlier
don't u have something like guild config?
if so, just grab the row count
it'll be the same as the total guild count, unless you don't remove dead entries
adding the await did fix it
I'm trying to log the server votes but it ain't registering, any help please?
Here's the code :
const keepAlive = require('./server');
const Discord = require('discord.js');
const client = new Discord.Client();
keepAlive();
client.login(process.env['BOTTOKEN']);
client.on('ready', () =>{
console.log("Bot is ready !!");
client.user.setActivity('Tracking Votes', { type: "LISTENING" }).catch(console.error)
})
//Webhook
const express = require('express');
const Topgg = require('@top-gg/sdk');
const app = express()
const webhook = new Topgg.Webhook("tokenauth123")
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(80)```
> And in dashboard :
> **Webhook URL :** `https://test-bot.solace.repl.co:80/dblwebhook` (changed username for privacy)
> **Webhook Authentication:** `tokenauth123`
Repl doesn't work with port 80 iirc.
I think its in an env variable(PORT) or 3000 if not.
Also you shouldn't need to add the port to the url, they handle that for you
Ohh, ok it was written in docs ๐
It's needed in some cases, not in others.
So I need to just create a new env key with value 3000 and it will work, right?
You should be checking if they provide it for you in an env variable.
If they do not just use 3000.
Or check the replit docs
Thanks a lot, I will try both
const Canvas = require('canvas');
const Discord = require('discord.js');
const { join } = require('path');
const { wrapText } = require('../../function');
module.exports = {
name: 'gandhi',
category: 'Images2',
async execute(client, message, args) {
const { registerFont } = require('canvas');
const m = await message.channel.send('Loading.......');
const canvas = Canvas.createCanvas(1700, 1400);
const ctx = canvas.getContext('2d');
const background = await Canvas.loadImage(
join(__dirname, '../../Gandhi.png')
);
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
const a = args.join(' ');
if (!a) return message.channel.send('please specify your message ');
ctx.font = '200px type'; // Defining Size, Font
ctx.fillStyle = '#ff0000';
ctx.fillText(a, 1000, 600, 600, 1500);
ctx.textAlign = 'center';
const attachment = new Discord.MessageAttachment(canvas.toBuffer());
message.channel.send(attachment).then(() => {
m.delete();
});
}
};
I want to do like if text was long then it will automatically send it in next line
how can i make my bot send a message to a channel in my server when someone upvotes on top.gg?
use @top.gg/sdk
How do we do this red text?
check pin of #topgg-api , is what everyone here would say๐
use backticks - `like this`
Its description?
hm
<p style="color:red;">red</p>
<p style="color:blue;"> blue</p>
Umm, it looks like replit is using 3000 port for something else and many people can't use it on replit, can't I have it with port 80?
Thanks
repl it only allows the use of one port per program afaik.
are you hosting a website/dashboard/another webhook already with your bot?
Not quite
Each repl is just containerised on a constantly alternating node system
The ports aren't virtualized/don't have separate IP's
You can have more than 1 port, you just have to try and find an open one
I've always done a small loop within 3000-4000 to find one, usually something random and uncommon works just fine ๐ค
๐ why doesnt repl have env variables for ports like glitch and heroku.
much easier for everyone
But can you show me a example text with that?
I have asked a similar question
message.guild.roles.cache.map((x, i) => `${i + 1}| ${x.name} (${x.id})`
The above is not returning in the correct order, how can I fix that?
What order is it meant to be returning in?
The top role is supposed to be on the top of the list.
I don't believe the api returns it like that, you have to sort through it manually
What can I do to return it like that, though?
.. by reduce??
I don't use any discord libraries, but I am 99% sure it returns the bitwise indicator for role height
Been a bit since I've used the role system, so it may have changed
collections are ordered by insertion
so roles.cache is ordered by which role was cached first, when roles were downloaded
it has no relationship to role order or position
Nope,
at Server.setupListenHandle [as _listen2] (net.js:1316:16)
at listenInCluster (net.js:1364:12)
at Server.listen (net.js:1450:7)
at Function.listen (/home/runner/AS-bot/node_modules/express/lib/application.js:618:24)
at /home/runner/AS-bot/index.js:29:5
at Script.runInContext (vm.js:130:18)
at Object.<anonymous> (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1343:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 'EADDRINUSE',
errno: 'EADDRINUSE',
syscall: 'listen',
address: '::',
port: 3000
}
repl process died unexpectedly: exit status 1```
This is the error I'm getting
You can use this.
const roles = message.guild.roles.cache.sort((a, b) => b.position - a.position).map(role => role.toString());
you're trying to use the same port multiple times
.sort is really confusing, I barely understand it, but works. (so as .reduce())
yeah read the conversation above.
#development message
how do i embed a url?
like
opengraph tags
Ah
opengraph tags (you must have control of the website in question)
a what?
actually speaking of opengraph tags, I'm having issues getting long(50mb+) videos to embed properly, what can i do about it?
Ohh I read that, I will try using 3500 , will i need to enter port no in website url too on dashboard then , since it's uncommon port or it will handle itself ?
how do i use opengraph tags?
do you own the website?
yes
the above url is covers the opengraph protocol(OGP)
Well the program is running without errors now but still it ain't registering votes 
what is a sub command group?
Here's the code :
const keepAlive = require('./server');
const Discord = require('discord.js');
const client = new Discord.Client();
keepAlive();
client.login(process.env['BOTTOKEN']);
client.on('ready', () =>{
console.log("Bot is ready !!");
client.user.setActivity('Tracking Votes', { type: "LISTENING" }).catch(console.error)
})
//Webhook
const express = require('express');
const Topgg = require('@top-gg/sdk');
const app = express()
const webhook = new Topgg.Webhook("tokenauth123")
app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))
app.listen(3500)```
> And in dashboard :
> **Webhook URL :** `https://test-bot.lace.repl.co:80/dblwebhook` *(changed username for privacy)*
> **Webhook Authentication:** `tokenauth123`
remove the port from the url
Ohh done that already in dashborad, srry , forgot to remove from here
instead of trying to run multiple servers on multiple ports, which is not officially supported, why not just run one server for everything?
One message removed from a suspended account.
wdym? ๐
repl.it is supposed to give you only 1 port per instance, 1 port per app
because that 1 port is bound to the url they give you
you cannot have the same url for multiple ports
so your repl.co url is automatically linked to the first port you listen to in your code
and i guess that port is in your keepalive file
so instead of trying to create a separate server for the webhook
simply add the webhook to the existing keepalive server
so you can receive requests over the same port, using the same base url
the way repl.it is intended to work
oh so i was right ๐
Ohh well it's on port 3000 and with keeping this as port value I get this error
at Server.setupListenHandle [as _listen2] (net.js:1316:16)
at listenInCluster (net.js:1364:12)
at Server.listen (net.js:1450:7)
at Function.listen (/home/runner/AS-bot/node_modules/express/lib/application.js:618:24)
at /home/runner/AS-bot/index.js:29:5
at Script.runInContext (vm.js:130:18)
at Object.<anonymous> (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1343:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 'EADDRINUSE',
errno: 'EADDRINUSE',
syscall: 'listen',
address: '::',
port: 3000
}
repl process died unexpectedly: exit status 1```
Also this is the code for my server.js
const server = express();
server.all('/', (req, res)=>{
res.send('Your bot is alive!')
})
function keepAlive(){
server.listen(3000, ()=>{console.log("Server is Ready!")});
}
module.exports = keepAlive;```
Sorry for being dumb, but can you help me ?

why is this still sending me the error message when using !test spotify?
if(args != 'netflix' || args != 'spotify'){
return message.channel.send("**Please input a valid parameter: spotify or netflix!**")
}```
how do i get an option from a sub command group in djs v13
console log args
args is probably an array but log args
So did this
const server = express();
server.all('/', (req, res)=>{
res.send('Your bot is alive!')
}).post("/dblwebhook", listenerHere);
function keepAlive(){
server.listen(3000, ()=>{console.log("Server is Ready!")});
}
module.exports = keepAlive;```
> and got this error
```ReferenceError: listenerHere is not defined
at Object.<anonymous> (/home/runner/AS-bot/server.js:6:24)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at /home/runner/AS-bot/index.js:3:19
at Script.runInContext (vm.js:130:18)
at Object.<anonymous> (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)```
Umm, what to do now ?
dude...
not literally
your damn dbl listener
the listener you use in your dbl code
Well I'm sorry, lemme try again, I'm beginner at node so I'm making dumb mistakes, thanks for being being patient with me and I'm sorry once again
anyone that knows the answer?
this part
you simply put it on your existing server
just cut paste there ?
server.post("/dblwebhook", webhook.listener(vote => { etc }))
instead of putting it in a new express server, in a new app
you put it on the server you already have
ohh now I'm getting a hang of it
you can get rid of the second express altogether
just use one express for both things
if(args !== 'netflix' || args !== 'spotify'){
return message.channel.send("**Please input a valid parameter: spotify or netflix!**")
}```why does this fucking logcial or operator not work?
it sends me the return message constantly
if its not netflix or its not spotify will always give true
because if its netflix, its still not spotify = true;
how do i export a class in js?
use:
class test{
static cache = new Map();
}
module.exports = test
V13 is released. ๐
did they release the update guide?
I dont really use DJS anymore, but still would like to see the changes
Has anyone here worked with google's oauth2 system for google calendar
yeah
BREAKING CHANGES GUIDE: https://discordjs.guide/additional-info/changes-in-v13.html
The full changelog is available on GitHub: https://github.com/discordjs/discord.js/releases/tag/13.0.0
Changelog: https://github.com/discordjs/discord.js/blob/master/CHANGELOG.md#1300-2021-08-06
For breaking changes please reference: https://discordjs.guide/additional-info/changes-in-v13.html
ill take a look then, thanks
Did release it official now?
Or do you have to still install from dev branch?
yeah official
Ohh didn't expect to see you here 
no need for dev branch.
โhttps://i.woo.pics/30160b049f.webp
just tried
I am everywhere lol
So what is the point of Discord.js (practically)
I just took a look, last time I used it really was v8
Now it seems to have a lot of overhead
OOF.
Currently I just make my own requests and such without a library
if you don't like overhead use detritus
djs is out? dayum
I'll check it out, thanks
I was looking at Eris but it's dead now so /shrug
The API is just changing so much that I'm doubling my work updating everything
they want to use node 16 on v13 soon
gonna release djsl v4 then
Discord.js light?
still maintaining djsl?
and i already wondered if I shouldโve had installed latest node version on my vps lol
What will v14 have lol
ah neato
pain
Im procrastinating to make this. kekw
v13 out and now I don't wanna update my bots. ๐
Is it necessary to update them ?
I sense that someone is going to wonder how to get node v16.6 for d.js considering the default ppa still uses 14.x so I'll post it here for those searching (since I just did it to test it out)
curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh - This will fetch a script to add the ppa to your system (assuming a debian based os)
Always always always inspect the contents too, or if you feel ballsy trust the https
nano nodesource_setup.sh (or use vim if you are evil)
sudo apt update - update package list
sudo apt install nodejs - should install latest node version, 16.6.1
If you use node version manager (nvm):
nvm install node - installs the latest version if not already installed
nvm use 16.6.1 - starts using 16.6.1 (or for the future, just use nvm use node for the latest version installed)
No, but it'd be good to.
just use nvm 4head
I hate nvm so much so I never recommend it
It's caused me many issues that I don't even wanna get into
He's crazy
Just right time refactor all my stuff and left making 1 more feature, lol
why is everyone rushing with the updates
I'm waiting until discord finishes everything in their todo list and then wait for the lib to release those changes
because updeeeeeeeets
DJs v13 is here
I've been awhile making my bots around 1 month plus when it still in dev, happen to 99% finished my bot and v13 released
So you don't have much to change
https://github.com/Ayeven/hanyuu nothing more to change
already push my refactors commit
even though majority are against it and the fact it will break a lot of libraries, bots and features they still did it pensive
haha. defer() become deferReply() on last hour
at this rate I'm just gonna fork the library and maintain my own copy of it lmao
and from 14.6 become 16.6
there are ways to get around it but pfsh
this is the most I've hated djs in a while lmao
I don't think djs devs understand the concept of backwards compatibility
it's a major version upgrade lol, they're not supposed to be backwards compatible between major versions
laughs in Microsoft
it's just so irritating to see them break so many features all the time
structures was a shitty idea imo
and you can't stay on a specific djs version forever because a gateway update or something else will eventually render it useless
they're just pulling a python3
I do agree but it seems wrong just removing it when so many bots and libs rely on it
and removes some of the flexibility of the lib for the better or worse
yeah you can use define property or something similar but man
Mark it as deprecated or something
Umm, sorry for disturbing you again

I changed server.js to
const server = express();
server.all('/', (req, res)=>{
res.send('Your bot is alive!')
}).post("/dblwebhook", listenerHere);
function keepAlive(){
server.listen(3000, ()=>{console.log("Server is Ready!")});
}
//for top.gg
const Topgg = require('@top-gg/sdk');
const webhook = new Topgg.Webhook("4N8eXCvZHjpfwt");
server.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}));
server.listen(3000);
module.exports = keepAlive;```
And index.js to
```console.log('Beep beep! ๐');
const keepAlive = require('./server');
const Discord = require('discord.js');
const client = new Discord.Client();
keepAlive();
client.login(process.env['BOTTOKEN']);
client.on('ready', () =>{
console.log("Bot is ready !!");
client.user.setActivity('Tracking Votes', { type: "LISTENING" }).catch(console.error)
})```
> I think I'm missing a function there in index.js to call or is it alright ?
you have sinned by disturbing tim
did you try using it?
and you know can't you test it yourself
don't worry there isn't a quota on how many times you can run code
unless there's something I don't know about
So maybe someone that have no clue on this Structure fiasco, I see alot doesnt like it, but it said to bring something will break? Since I'm a classic js user, not really sure what is wrong with it, can enlighten me?
at Object.<anonymous> (/home/runner/AS-bot/server.js:6:24)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at /home/runner/AS-bot/index.js:3:19
at Script.runInContext (vm.js:130:18)
at Object.<anonymous> (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)```
I got this error ๐
i told you that part was wrong lol
you were not supposed to add that literally
also remove the second server.listen
you can only have one
Removed
I'm now more confused
, sorry for taking so much of your time
index.js
const keepAlive = require('./server');
const Discord = require('discord.js');
const client = new Discord.Client();
keepAlive();
client.login(process.env['BOTTOKEN']);
client.on('ready', () =>{
console.log("Bot is ready !!");
client.user.setActivity('Tracking Votes', { type: "LISTENING" }).catch(console.error)
})```
> server.js
```const express = require('express');
const server = express();
server.all('/', (req, res)=>{
res.send('Your bot is alive!')
}).post("/dblwebhook", listenerHere);
function keepAlive(){
server.listen(3000, ()=>{console.log("Server is Ready!")});
}
//for top.gg
const Topgg = require('@top-gg/sdk');
const webhook = new Topgg.Webhook("4N8eXCvZHjpfwt");
server.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
console.log(vote.user) // 395526710101278721 < user who voted\
// You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}));
module.exports = keepAlive;```
> error
```ReferenceError: listenerHere is not defined
at Object.<anonymous> (/home/runner/AS-bot/server.js:6:24)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at /home/runner/AS-bot/index.js:3:19
at Script.runInContext (vm.js:130:18)
at Object.<anonymous> (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)```
did you save?
looks like its still erroring from when you added "listenerhere"
yeah i did
Well i shall logout then login again and then try once
Still the same error 
do you have the old code still?
This was original
I need to copy from here
did you still not remove that?
you have to remove what you added when you didnt understand what i said
this
.post("/dblwebhook", listenerHere);
hey guys, i am deleting the sent message
exports.run = async (client, message, args, channel1) => {
if(args != 'netflix' && args != 'spotify'){
message.delete()
return message.channel.send("**Please input a valid parameter: spotify or netflix!**")
}```
and now the return message is increasing with the amount of times that i used the command lol?
wut?
i am deleting the message of the users
i first use !test and it returns the error message once.
then i use it again and it sends 2 messages at the same time
and it just increases and increases
or am i just doing something wrong lol
const server = express();
//for top.gg
const Topgg = require('@top-gg/sdk');
const webhook = new Topgg.Webhook("4N8eXCvZHjpfwt");
server.all('/', (req, res)=>{
res.send('Your bot is alive!')
}).post("/dblwebhook", listenerHere);
function keepAlive(){
server.listen(3000, ()=>{console.log("Server is Ready!"), console.log(vote.user)});
}
module.exports = keepAlive;```
like this ?
no
you were not supposed to add that
remove that
listenerHere makes no sense
when i said "listenerHere" it means "put your listener here"
this is your listener
Hello. I have a question for someone who is a bot developer. I own a really unique and we have reached the maximum amount of channels in it. We need a vc for every language in the server, but not every vc is used at once. (Like 4-5 are used at once out of the 45 we have).
Someone suggested having a bot that creates a vc like when someone requested it so as to keep the channel count down. Is this possible, and does it seem like a good idea? Also, how could the bot be created so that it is easy for new to discord people to use? (We get a lot of people who are brand new to Discord that join)
but you already put it in another way and its fine like that, so remove that green box
So my current code is fine after removing 'istenerHere?
Tim, help me!!!!11!1!!11!
yes, remove the entire green box
and it should be fine
message.delete()
const linkcodes = fs.readFileSync('./links.txt', 'utf8');
const links = linkcodes.split('\n');
const link = links[Math.floor(Math.random() * links.length)];
message.channel.send(link)
i want to remove the pre-sent link variable from the txt file
how can i achieve that
damn are you guys still busy with that issue
show full code, including message event
It's possible, but depends on your experience with Discord bots. If you have no experience, you'll have to seek out a bot that already has this functionality (which I don't know of) or ask someone to create one for you. If you have experience developing bots, it could be as simple as:
- User types
/vc <lang> - Bot creates voice channel with the language name for a temporary amount of time.
- When the channel becomes inactive or room is needed for another voice channel, delete it.
The concept is very similar to threads.
no that was a dumb issue that i fixed
i am just stuck with this now
Well now vote object is undefined ๐
const server = express();
//for top.gg
const Topgg = require('@top-gg/sdk');
const webhook = new Topgg.Webhook("4N8eXCvZHjpfwt");
server.all('/', (req, res)=>{
res.send('Your bot is alive!')
})
function keepAlive(){
server.listen(3000, ()=>{console.log("Server is Ready!"), console.log(vote.user)});
}
module.exports = keepAlive;```
> error
```ReferenceError: vote is not defined
at Server.<anonymous> (/home/runner/AS-bot/server.js:12:75)```
should I include vote in server.all ?
why did you remove the entire listener?

i didnt tell you to remove this
update to node 16.6 at least
At the same time, it may not be the wisest decision to be creating and deleting voice channels. You can reuse channels and modify them instead. For example, in the Python Discord server, they have 10-20 channels for getting help with Python problems. Instead of creating a new channel, users can pick from inactive channels and make them active for their question. When they're done, it'll go back to being inactive.
Hmm, interesting. Thanks for the thorough response! So in the python server, does it just change the name of the channels when they become active? I don't have any experience making bots, so I will have to look for someone to do this stuff. ๐
I am going to try
Iโm using ytdl-core and turning that into an array buffer, but that command was not used once during my RAM usage testing
Not exactly. There are categories for available, occupied, and dormant channels.
- Available can be used to "create" a new question (like
/vc <lang>). - It'll get moved to occupied (like joining a voice channel).
- When the question is marked as resolved or doesn't have activity in a certain amount of time, it'll get moved to dormant (like deleting the channel). After some more time, it'll get moved back to available.
So, channels are not created and deleted. Rather, they're just moved around. Of course, you don't have to use this system, but I personally think it's a good system for capping and allocating channels. The process can be invisible to users (so the channels always exist but users only see the in use channels).
I can't thank you enough @quartz kindle , it started working finally !!
Thanks a lot !!

I used devtools to take heap snapshots
First and second pic are after about an hour of running
3rd is about 1.5 hours of running
(No commands sent)
Thanks so much for the helpful advice. I really appreciate it.
could be a memory leak
you went from 67k to 93k arrays, 34k to 59k maps, 290k to 457k strings
either something is being cached, or something is leaking memory
Well, the map is full of message objects from what I can see
I donโt really know what the strings even store
yes, from 45k to 81k messages
do you have the message cache enabled?
Yes
do you need it?
try disabling it
Iโll try that
Iโll get onto my pc rq to try to fix this
Now that I think about it... whatโs the point of even caching messages?
Anyone know anything about cf argo tunnels? I've tried a few different things but nothing works. It works on every other domain apart from www.domain.icu, my config is ```yml
tunnel: id
credentials-file: /root/.cloudflared/id.json
ingress:
- hostname: ws.domain.icu
service: ws://localhost:8080 - service: http://localhost:80
Umm, since I can perform limited no of votes each day (1 in 12hrs), is there a way i can simulate the voting for testing the bot? I'm creating a vote tracker for my server
@lunar cove there is a test button on the webhook page
ur italian dont lie
the only reason would be to monitor message edits and deletes for moderation
and shit like snipe commands
severus snaper
click the test button
in your bot's vote settings
snaiper
don't send normal messages
Results after disabling it. I no longer have that huge map. However this is right after starting up the bot, so hopefully it doesn't grow
Well it opens up a pop up to type the test case, how do I simulate voting with that ? ๐คง ๐คง
dafuq is that from?
looks more reasonable
So, if I implement a cache what would be the best way to keep it small? Like put a timeout for 5 seconds to delete the entry?
An error has occurred while processing your request```
> I'm getting this as reply when pressing test and no log on console which I get when someone votes
from replit
Depends on how long you need the data for
what are the requirements ?
then why are you adding a vote webhook?
to track server votes for my server
oh thats a server webhook?
yeah i did that
and this came
idk then, ask in support or something
ok thanks a lot
Do I need to have messages cached to be able to access payload.message.author.id?
I'd assume not, right?
I currently have this to grab a User/member object (doesn't matter which): ts const user = payload.message.mentions.first() || await payload.rest.fetchUser(args[0]) || payload.message.author; which all works except for the payload.message.author line. Do I need to have the GUILD_MEMBERS intent and/or the GUILD_PRESENCES intent enabled to access payload.message.author?
But adding a timeout would be an ok solution?
Should be
So setting a timeout would not be taking more memory then the cache itself?
I use a system for ratelimits on interactions similar to this:
const RatelimitCache: Map<string, Timers.Timeout> = new Map();
const timer = new Timers.Timeout();
RatelimitCache.set(interaction.userId, timer);
timer.start(RATELIMIT_COOLDOWN, () => {
RatelimitCache.delete(interaction.userId);
});
no
if you are receiving the message via a messageCreate event, it should always contain an author field, except if its a system message
Hmmmm... I get an error saying HTTP Exception 404 Not Found whenever I try to access a user's avatar from author
And it used to work
Also another weird error when trying to use one of my owner only commands (list all guilds) in DMs. Says that it cannot read id of undefined when I have clearly passed a message into the function (it's attempting to use message.id)
export function addReactionCollector(
client: CommandClient,
message: Message,
author: string,
data: RequestTypes.EditMessage[],
onReact: (payload: GatewayClientEvents.InteractionCreate) => any,
onUnreact?: (payload: any) => any,
onEnd?: (payload: Message) => any,
timer?: number,
) {
client.reactionCollectors.set(message.id, {
// More code down here not relevant to the error
}
Also how would u implement owner only commands with slashcommands
It errors on the message.id line, when I pass in _m as the Message parameter into the function, defined as this: ```ts
let _m = (await payload.message.channel?.createMessage(embeds[0])) as Message;
Hi! I'm a bot developer and I'm looking to verify my bot, im under 18, but im above 13. I have a School ID with me, what information do I need to provide in order for it to be accepted?
U need to give up ur ID
I was 13 or 14 when they introduced the system and I got accepted
That info should be on your ID
U need to provide front and back of your ID
o
At least thatโs how it was when I did it
It's issue with site , they confirmed
๐
I have this cog (https://mystb.in/AlthoughTransparencyAffordable.python) and its getting loaded and everything but the top.gg thing somehow doesnt work:
I filled out the webhook tab in my bot settings and tested it, but somehow i wasnt getting a test vote.
Hmmmm, for some reason payload.message.channel comes out to null when used in DMs... Has discord changed something I don't know about?
when I push package.json and package-lock.json to install a new npm package to my bot, I have to do npm i to install the new packages on the server, but sometimes that creates a different package-lock.json even though every package is updated in the push, is there a way I can avoid the change of the package-lock.json file in those scenarios?
it's not a big issue, it's just a question so that I won't have to stash before pulling after installing a new package
package.json can override package-lock.json whenever a newer version is found for a dependency in package.json
npm ci will install from package-lock.json only
Complete confusion is going on in my brain rn
ah I see, thank you Tim
The dapi server told me that you only get a channel id for DMs
But that can't be true otherwise my command would've never worked in DMs before
you only get channel id in dms
then its up to the library to chose what to do with it
How on earth was this working yesterday then- ```ts
let _m = (await payload.message.channel?.createMessage(embeds[0])) as Message;
the library will likely create a partial DMChannel object
Maybe detritus broke something then? I didn't update the package or anything
no idea, never actually used detritus
btw what happened to erwin
havent seen him in a long time
He doesn't type here anymore
He types in the detritus discord
He explained why in there but I don't think I'm supposed to send that here
he "types" :^)
lol
This is confusing
I'm thinking that changing my intents must've broken something
For some reason
Didn't change anything for the command itself between then and that point in time
lol
"dependencies": {
"axios": "^0.21.1",
"bufferutil": "^4.0.3",
"discord.js": "^13.0.0",
"enmap": "^5.8.5",
"fast-glob": "^3.2.7",
"html-entities": "^2.3.2",
"moment": "^2.29.1",
"moment-duration-format": "^2.3.2",
"utf-8-validate": "^5.0.5",
"zlib-sync": "^0.1.7"
}``` my dep shrink after I remove the music command. Muahaha
still too many :^)
I can remove bufferutil, utf..., zlib, that is optional
you can keep those
"dependencies": {
"@types/node": "^15.6.2",
"@types/node-fetch": "^2.5.10",
"detritus-client": "^0.15.0",
"dotenv": "^10.0.0",
"moment": "^2.29.1",
"moment-duration-format": "^2.3.2",
"mongodb": "^4.0.1",
"node-fetch": "^2.6.1",
"prettier": "^2.3.2",
"ts-node": "^10.0.0",
"tslib": "^2.2.0",
"typescript": "^4.3.2",
"ytdl-core": "^4.9.1"
},

granted half of those dependencies are for ts
I only need jsconfig.json
types can also go into dev deps
Ah
Won't bother with changing that for a while
I've already broken enough shit haha
I used axios for most of my https requesting api(s). Lolzer
It error handling quite easy for me
i'm surprised evie still maintains enmap
There is josh too, but I installed enmap first
Heap snapshots are staying at 60-70mb after disabling message caching, thanks @quartz kindle!
๐
you also have to remember the gc doesnt kick in until memory is low
btw what happened to evie?
lmaoooo
havent seen her in a long time too
How tf was it working
lel
for reasons i understand now lol
are those reasons shareable or private?
she made a post about it in her server ages ago
i think i left it
if i were to guess, probably something about the djs community?
lmao
i'll try find it
i lowered the memory from 1gb to like 500mb
nice
though doesnt matter since after a couple hours it goes back to gb figures since theres probably a memory leak
lul
says everything lol@quartz kindle
good code but no patreon donations for you
lmao
i dont think the donations even go to some of the most active contributors
yeah it all goes to one guy as far as i can see lmao
the "owner" of djs you could say
Do I have to wait 1 hour so I can use slash commands?
yes but if you make slash commands specific to a server the updates are instant
๐
you should assign slash commands to a specific server when testing and when you're releasing to everyone you make it public
im gonna make an eval slash command
One message removed from a suspended account.
kadybat wont be happy
I Just don't Know how to add the status
and wait how are you gonna do that if you cant add multiple lines
How do i Code the bots status in?
one liners 
that sucks
You read the docs
V13
who cares, i guarantee you im not gonna be the only one
Answer old questions ๐
Uh Im Using Python and Doesn't the Status code use C++
what
One message removed from a suspended account.
So Idk How to add it
hugs
Their documentation is better than any other libraries, that for sure. for JS/TS that is
const banned = await message.guild.fetchBans();โ
Why this code give me error in discord.js v13
fetchBans doesnt exist in v13
Dear lord why is everything breaking
you should read the breaking changes
its guild.bans.fetch
theres new ones all the time
Ow thank you
makes me wanna either maintain my own discord.js version on github or use another library
lel
i always end up forking libraries i use and adjust them internally to my liking lol
Tim djs-light v13 wen?
but im too lazy to create my own library
AH DAMIT I don't have a Developer Application License
i'll probably do that and adjust some of the code to go back to how it was before
might even bring back structures
which one are you talking about ?
I wasn't talking to you
if I have an array of unknown length between 1 to 20, what is better to use? for of or for(let i;...) javascript
my cat is jumping over my keyboard again lmfao
what they all say
for i has better performance than for of
doesn't for of just transpile down to a normal for loop
for of is just syntax sugar
uh i think i crashed my bot
depending on array size
size of 20 max, dont think it that large size
let messages = await message.channel.messages.fetch({limit:100});
messages = messages.array();
Why this is error in discord.js v13
Ok my bot was just Being slow
yeah anything below a certain amount shouldnt matter anyways
https://discordjs.guide/additional-info/changes-in-v13.html try look here first
Thank you
I'm not sure and for certain can't remember all the changes
who does
actually
it still returns a collection
according to the docs
@winged juniper try instead of .array do .values
Collection .array() method got removed
values returns an iterator, so you still have to consume it
at this rate i'll have to rewrite my whole bot to work with v13
messages = [...messages.values()]
Hey Guys i need some help
i'll dont think i'll even use v13
im gonna go from v12 to raw
just need to finish my raw lib
I can't get My RP code working
i can hear erwin screaming detritus
detritus dont seem too bad
it looks really good
but is it going to be another library thats going to be abandoned in a year or so
or with api updates released at a very slow rate
api updates are released very fast
doubt it'll get abandoned
^
I'm just asking out of curiosity, I'm a beginner so trying to learn, more the resources much better learning 
what kind of caching tactics if any do they use
or is it just a self managed library
djsl v4 is out
I'm getting an HTTP 403 Missing Access exception with a 50001 code when I try to reload my commands in a guild. No idea why this is happening.
Whenever I use the command in DMs, I get no errors
I HATE CODE ERRORS
Missing Access It mean the guild you in doesn't give the permission to the bot to execute
But that doesn't make sense.
It's an internal command
let err = false;
try {
// Clear all of the commands
message.client.commandClient!.clear();
// Read all of the commands
await message.client.commandClient!.addMultipleIn('commands', { subdirectories: true }).catch((...e) => {
e.forEach(console.error);
err = true;
});
if (!err) console.log('Reloaded Commands');
} catch (e) {
err = true;
console.error(e);
}
// React to the message
if (!err) return message.react('โ
');
else return message.react('โ');
Missing Permission mean not proper intents from the bot
@sinful belfry
I understand, but I don't understand why it's happening all of a sudden. I have used this command in the past with no problems whatsoever.
i have encountered the hacking situation 2 days back
yeah
gullible kiddy + young + parent no give card = scammed
rip
the error says everything you need to do
go to https://discord.com/developers/applications choose your application, go to bot and enable the intents you use
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
but i dont search it
ok thx
in py, errors are read from bottom up
so your actual error is this
ok thx
djsl v4 = djs v13 or are there subtle differences? I'm rewriting my bot for v13 and slash commands and I've been wanting to switch to djsl for a while now. This re-write is basically a good opportunity for me to do all the optimisations I want to do.
all the major differences are documented in the readme
otherwise it should be the same
it confuses me every time when i get a python error
although there is still a lot of untested things, so if anything comes up let me know
afaik there was no testing done whatsoever with djs voice for example
discord js voice light
Ok. I'm counting on it being in a testing environment until September at least anyway before pushing to production.
the packets are compression strong
๐
I don't use voice anyway
lmao
Umm, can I get some good guide for discord.js other than official documentation ?
My Bot does not like me

but jokes apart, there're barely anything better than the official docs when learning how to use stuff
Yeah but if you don't know how to code those guides have examples
Ok thanks
Well I know in C++ but not in JS
Tbh asking for alternatives to docs is better than just copying a tutorial off YouTube to clone a git repo ๐คทโโ๏ธ

Well I wanna learn so I can customize 
Watch guides it will take your maximum 2 weeks
Yeah I'm learning and have created very basic versions
link pls
I found out how to add about me to my Bot (I blurred The Link to stop self promo)
Congrats
congrats
now add custom status and activity
idk How to
My Code keeps Breaking when i try to
console.log("Bot is ready !!");
client.user.setActivity('Tracking Votes', { type: "LISTENING" }).catch(console.error)
})```
It's mine change it to your needs
Where do i put it in my code?
just below client.login
oh wait thats not in my code
lol, then it must be bot.login ig
Im using Replit
Well I'm too
Look at your lib's docs
I get this when i run the code
client.on('ready', () =>{
console.log("Bot is ready !!");
client.user.setActivity('Tracking Votes', { type: "LISTENING" }).catch(console.error)
})
i meant this
File "main.py", line 15
client.on('ready', () =>{
^
SyntaxError: invalid syntax
๎บง
KeyboardInterrupt
๎บง
KeyboardInterrupt
That's JS
IM new ok
your fundamentals are wrong
Watch some guide on youtube to build a basic bot first
Replit is lil bit of confusing
No How to I run the File That Is the Status File Into the main code without putting the JS code in the Python code
Well that too but it's better to do in c++ than js imo
Mind my Grammar
JS code won't work in python
No I made a Second File In my Code for the JS
I agree, I hate that it doesn't have .env and have to use thier secret something
see
You have to set your bot's status using py
They have
Nah I meant for general programming
I'm running into an issue with discord embeds, in which I get a 401 for them, but everything else is fine - messing with discord.js for the first time

why are you mixing languages
If I send it manually, it works fine
idk
then stop
How do i make the status code in py?
what status code?
you have no idea what you are doing
You read the docs
please stop messing with the api
this
client.on('ready', () =>{
console.log("Bot is ready !!");
client.user.setActivity('Tracking Votes', { type: "LISTENING" }).catch(console.error)
})
Is js
How do i make that into Py
read the py docs
where
omg
atleast change a bit 
yeah ik this, but env feels better to me
you are using discord.py right? is there any other py lib?
yes im using py



