#development
1 messages · Page 809 of 1
I need to call super to call the base command constructor
and inherit base command functions or methods
or properties
everything on it
is inherited
yea
I see
basically
extending a class
basically is like your class is that class but you can add some other shit
or override the base class functions
so its kind of like a database where you define fields then fill them with ones specific to each command
in a way, kind of
there is also cases like this
discord.js client has login() method
but my WumpusClient has login() method as well
so it overrides the original login() method
but notice the super.login()
so you call it in yours?
yess basically, I extended the original login() method to do my thing first before calling the original login()
this is so smart
so classes allow for configuring of other classes, which is good for bot specific data
if I am correct
then, classes are also good for using getters and setters
notice the get keywords
a getter is like a property that can do stuff before it returns a value
I never liked getters and setters personally
Because if you have a get x then you cant have a this.x
Gotta call it something else
that getter is accessed via this.getterName
although you cant this.getterName = owo
cause getters are read only
Yeah thats what I don't like
because its behaving like a property but it executes the function before returning a value
Like if I have a
this.y = t
}
get x(){
return this.y
}```
has to be like this iirc
but I wont use getters
for example ```js
a = {
date: Date.now()
}
b = {
get date() {
return Date.now()
}
}```
a.date will always return the same date, because the date is resolved when the code runs the first time
b.date will always return the current date, because the date will resolve whenever the code is called
I dont work with functions all the time
alright classes and constructions and super, am I missing anything?
if I want something like that
just use this.prop = value
I just use getters on something that changes
like
totalPlayers and queue size is not always the same value, but I also dont want to make 2 properties just for them
so instead I can use getters
it always depends on your use case
if you want a property in class that is constant and never changes, as well hidden, then use Object.defineProperty()
I would like to attempt to learn about classes by testing them, anything else I should know?
should be fine now
all you need to do is to get used to it
and memorize the basics of it
do you have any suggestions for parts of the basics I should learn first?
ok
also this: create two classes, and add them to each other
?
so class creates objects?
i tryed to fix my mute command and it says „member is not defined“
and i cant fix it

show code
gimme sec
im sorry for being rude
module.exports = {
run(client, message, args) {
if(!message.member.hasPermission("KICK_MEMBERS")) return message.reply("du hast keine Berechtigung!")
let member = message.mentions.members.first()
if (!member) return message.reply("bitte gebe einen Benutzer an!")
let reason = args.slice(1).join(" ")
if (!reason) reason = "Keine Begründung angegeben."
let muterole = message.guild.roles.find(m => m.name === "muted")
member.roles.add(muterole)
.then(() => {
message.reply(`der Nutzer <@${user.id}> wurde gemuted` + (args.slice(1).length ? ` wegen: ${args.slice(1).join(' ')}` : "!"));
member.send("Du wurdest gemuted" + (args.slice(1).length ? ` wegen: ${args.slice(1).join(' ')}` : "!"));
})
.catch(console.error);
}}```
its german im sorry for you guys

can you copy and paste the error?
what line is the error
Wtf
I have successfully created a and extended a as b
@regal saddle what is your version of d.js??
time to add more to it
the error is "member is not defined" or "cant read property of undefined"?
show the full error
TypeError: Cannot read property member of undefined
if you want the full error i could dm you
If you want
that means message is undefined
message?
yes
is it possible you only passed message through the function
wait i need to start my pc real quick 

@regal saddle show your command handler
the only way message can be undefined is by not passing it when calling the function
ill dm you then just gimme some time rn
bruh
I assume tim and Saya are gone now?
if not, how do you push an object such as client through all of the classes?
thank you kind sir
what language is this
what is the file type?
.lua
I think it is CSS?
Can you run Lua on virtual studio code
Yes
vIrTuAl
you can run any language on your computer, you just need their compiler or their interpreter
you should try to learn to code
and stop ignoring us
Hi
message.channel.guild.members.filter((u) => u.status === 'online').size
``` any ideas why that returns undefined? (eris)
im dumb, fixed^
I think message.guild is it worked.
idk eris.
Discord.js
Okay, I have been trying to set a role's position for a long time not. I have it based off of another guild's role position. I don't see the problem, I get no error, and I can get the role position of both roles. The problem is just that it doesn't actually set the position.
await message.guild.roles.forEach(async function (r) {
let otherRole = client.guilds.get(guild.id).roles.find(role => role.name === r.name).position;
await r.setPosition(otherRole);
});
@earnest phoenix Did you make sure that it's actually message and not msg or something similar? Also, what are you trying to do with message.guild?
message.channel.guild.members.filter((u) => u.status === 'online').size
any ideas why that returns undefined? (eris)
@floral bloom
wtf
Lol
@floral bloom otherRole = r
Why?
I am don't understand how to get used ram bro can you say
dude
don't send your question in like 3 channels
Bro I need help
HIS
Bro
process.memoryUsage()
lmao
@zenith orchid I can't find with ID as the IDs are different. I am trying to set one role the same position as the role from another server.
Basically I'm duplicating the server's roles.
I was able to programmatically create the roles and set permissions, but I need to set the role position to be the same from the other server.
All roles?
Correct.
Wait
So 2 roles don't equals this position . It is impossible.
My idea but i'm trying.
Aaa
I understand.
You trying somerole in a guild, somerole in b guild and names equals.
This correct? @floral bloom
So you tried set position.
Guild A has a role named Moderator. I duplicated the roles so now guild B has the same role, Moderator, just out of order. I want to order them the same, but I am having trouble setting the role position to match so that the Moderator role are both the same position on both guilds. I am searching by the name, checking the position, and trying to set the new position the same.
await message.guild.roles.forEach(async function (r) {
let otherRole = client.guilds.get(guild.id).roles.find(role => role.name === r.name).position;
await r.setPosition(otherRole);
});
@zenith orchid Pinging in case you didn't see this or have the server muted. If this disturbs you, I apologize. Also, neat profile picture (off topic but whatever).
@zenith orchid Not that I know of, no. And that's what's weird.
Hm, using the eval command I get this error:
- Cannot read property 'position' of null
Djs version? @floral bloom
11.5.1 I didn't know there was an update available. I'll update it and see if it works.
wait... 12.0.1 is stable?
uh yes
yes
does anyone know how to get the presence of a user
(eris)
I'm on this page: https://abal.moe/Eris/docs/Member still a little confused
Member#game maybe?
so when you do console.log(<Member>.game) you just get [object Object]?
try console.log
ok
eval can be a mess
eris is so weird sometimes
im really bad with objects and methods and stuff but, would it be something like <member>.game ? <member>.state : <member>.name or something
true/false ? (if true) do something : (if false) do something
member.game ? state and name combined : "not playing"
(statement) ? true : false
oh
so if member plays the game then in the middle disolays, else in the right side.
yh im confused
its basically a shortened verison of if() {} else {};
oh
heres an example
var x = (statement, like member.game) ? (if statement is true, this will be the variable value) : (else, this will be variable value)
const age;
var x = (age > 18) ? "wow you're old" : "wow you're young"
// if age is bigger than 18 x returns "wow you're old" but if it isn't bigger than 18, it will return "wow you're young"
oh
Hm, is there a reason that it says my token is invalid, even though I changed it?
Yes, I did.
Retry
Nope. It's an issue with v12.0.1.
its not
I went back to v11.5.1 and it works just fine.
because you tried again...
^
Nope, works for everyone
I updated the token, changed it in the code, and restarted the program many times.
u were 1 too short then
@tight plinth I am sure. I never changed anything when changing the version number.
the things are bit different on v12 so you might need to change some codes before geetting ur bot on.
is it possible to have a link to dm for your bot?
wdym
my bot can be used in DM and not just in a guild so i want to provide a link so that a user click and it will add the bot as a DM
so you mean mass-dm bot? (thats illegal btw)
he means bot commands in dm's
^
there is no work around, if you find one it's a bug
ah i see
and abusing that bug is against t&s.
ok thanks! anyone can just dm the bot like they dm a normal user i guess and all bot commands will be available?
yes
if they are sharing a server with the bot
as long as it has no errors in dm's as the same as guild channels then yes.
for example, if you have a guild property in a command make sure it can't be used in dm's
Why would I be able to scroll around on my HTML page 🤔
huh?
thank you!
hey saya, you clicked on the wrong channel dw 😄
oops ty
is it possible to redirect a unknown command to a default command? im using python and i currently only am able to do something like this: ```py
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, CommandNotFound):
await ctx.send('Invalid command. For a list of valid commands, type ' + bot.command_prefix + 'help.')
else:
raise error
You don't want an unknown command since it'll be declined instantly and people don't really want it for something which would be like:
!ping -> bot1: 10ms -> bot2: Unknown command.
And people get annoyed at the bot.
It won't be declined for having unknown command errors, only muted.
You can, but I don't suggest it cuz it's hella annoying lol
(and obviously we will mute your bot)
oh my bad, sorry ^-^
im kinda looking to default an unknown command to an existing command which does do something as in all likelihood that is what the user meant
how do u even send a image file without the download file option
best practice is for unknown commands to simply be ignored
either use the image url, or download it into memory instead of into a file
how about
channel.send(`Welcome to the server, ${member}!`, attachment);
});
I tried to send to as a individual file instead of an attachment
Erm
1
Is you copy paste canvas example code from djs guide it should work
Why are you using that asset link?
that's how to save images on glitch
lmao
apprantely
I made a directory for it
assets
But...
Im just confused because you have 2 images there
The canvas image and the image in assets
Also, you can rename images you download
They dont need ?v=4884839595
it sends the canvas image as a file
Or whatever
https://discordapp.com/channels/264445053596991498/265156286406983680/685055434859610132 I guess that's now how to use it... I forget how to use setTimeout with in js. How to actually use it?
Its a name you give to the file before sending to discord
Not the file name on your bot
Change it to something normal
ie "image.jpg"
The preview is broken probably because of the long and weird filename
il, I just can't use it without crashing my bot
Is there any reason why you would need to?
my mute command for v12 js is still broke 😦
require('child_process').exec("node bot.js", function() {
bot.destroy();
process.exit(1);
});
const embed2 = new Discord.RichEmbed()
.setTitle('Done!')
.setDescription(`I'm back!`)
.setColor(0x00ff00)
m.edit(embed2)
})
}``` with this after i run the command the bot starts a new instance for example ping command it runs it twice help i beg
__**require('child_process').exec("node bot.js", function() { bot.destroy(); process.exit(1); });**__ const embed2 = new Discord.RichEmbed() .setTitle('Done!') .setDescription(`I'm back!`) .setColor(0x00ff00) m.edit(embed2) }) }``` with this after i run the command the bot starts a new instance for example ping command it runs it twice help i beg
@earnest phoenix
Well....
If you destroy client...
yah with and without it the same problem
well, wait more
lol its right there in the picture
please be patient us humans take time to verify bots
xd
yh so wait lol there is alot of bots they have to deal with
Waiting for 2 weeks
@cold lion you added your bot 2 DAYS AGO
lmfao complaints 2 days in
i haven't switched for that one reason
i cant be assed going through all command files and adding cache
@mossy vine i'll need to upgrade it soon anyway
why
@cold lion 👀
i cant be assed going through all command files and adding cache
if you used a proper IDE or even a text editor you could write regex to do it for you lol
eHeHeHE
2?
because old things will not work over time
unless i'm wrong then i might consider downgrading
does anyone host their bot on glitch using python?
trying to figure out how to keep it running - it keeps timing out after some time
i think glitch only does js
how do you keep it running?
With the package.json
pm2 or uptime robot
This work
Oof pm2 isn't for py
And yeah you can use uptimer bot if you use express for a response :/
is it necessary to run a flask?
no if you have vps.
Guys can someone give me a Giveaway Cmd?
I have Visual Studio Code, Node.js , Discord.js
commands are not given, they are coded
wise words from the one and only tim
commands are not given, they are bought
Guys can someone give me a Giveaway Cmd?
@solemn quartz code it
imagine specifying ur editor while asking for a code
hey he at least specified that he's using djs
@finite bough at least he didn't say notepad
Are you saying notepad is bad???
There might be better solutions
pssh
But I'm no JS developer, so I won't be surprised if notepad is the best for JS 😛
tbf you can code in notepad it's just not advised 
.-.
I know, when we learned Java during my study we had to use notepad during the first lessons
No build in error checking means you need to pay a lot more attention to your code
notepad is a good introduction to prove that code can be coded anywhere
My first ever program i wrote in fucking batch was coded on notepad
same
I still use notepad for small batch files
same
notepad++ that is
i use notepad++ for html files lol
or for stuff i just want to take a quick look at
same, if I want to check one file without starting the entire IDE then notepad++ is a lot quicker
As we dont have vs code or anything at our schools i'm forced to use notepad++ for school projects
I hate it.
I absolutely hate it.
npp isn't the worst
It is pretty bad tho
its better than notepad
Well yes
at least npp has colored text, basic notepad would be worse
npp is pretty damn good tho, its fast af, supports a shit ton of plugins and is themeable
wait it supports plugins
Bruh
wait it supports plugins
@earnest phoenix yes
lmO
im not saying they use it for normal programming, but they have it installed and might use it sometimes
vsc has a more programming friendly environment
I use it only when i dont have anything else so
I don't have it installed nor do I use it anymore 
ye
vsc is a truck, while npp is a bike
npp is a turtle and vsc is a plane
visual studio is an orbital space laser in that case
you don't want to start a full IDE like vsc when you quickly want to check a single file
code editors/ide wars?
they both have their own use cases
const client = new Discord.Client();
client.on("ready", () => {
client.guilds.forEach(g => {
g.leave();
console.log("left "+g.name);
})
})``` why this doesnt work? it says client.guilds.forEach isnt function
First off why tf do you want to leave each guild on startup and 2. i dont see a problem here
- cause its on 3 guilds and i am not there and i dont want to anyone test my test bot 2. ok, me neither.
I heard with djs 12 you need to add .cache everywhere?
you can try a for loop
its not odd, it makes a lot of sense
Not wise words from tim this time
not my fault if you cant understand them :^)

Tim out here speaking the language of the gods
Anyways ima make a discord wrapper bc im bored
tbf it's kind of fun
But the websocket connection is a pain
i've used master mostly but now switched to stable cause 12 is now stable
so you basically didnt change a thing
i used to eat strawberries with 40 seeds but now i only eat them with 39 because its more stable
so
vsc is a truck
npp is a bike
and tim is the guy who goes to the hospital after getting ran over by both of them
:^)
What
How much should I charge to host a bot for someone?
@hollow saddle depends
How much does it cost you to run :P
nah
A cheap vps is like $3
what does he or she wants in the bot
If it's just a private bot it won't require any real reasources
Music, moderation, custom features
around 13$ a month sounds fair
Are you making it or has it already been built
Das is le question
I pay 10 euro a month for proton vpn plus
I’ve already made it, it’s my code but he wants his own process and asked me to host it
@summer sedge ain't that an answer in #memes-and-media
Galaxy gate iirc do a VPS at $3 / month
... I am a little bit lost, my apologies
Depending on how effecient you've made your bot
It’s relatively efficient
I moreso want to change him for using my code
Because yeah hosting would be pretty cheap
Charge like $20 for a one off or somthing
'java' is not recognized as an internal or external command,
operable program or batch file.
I downloaded Java SE 13.0.2
and added the bin to path
what else do I need to do??
nvm
I got it to work
lmao
restart cmd
Can I have some help with setting up my SQL on discordjs
I recommend this tutorial https://www.youtube.com/watch?v=E5TVwyiCuYA
#roadtodiscordpartner
This episode has probably been one of the most long requested ones to date. We'll be making an XP system in MySQL. Hopefully you will be able to adapt this to everything else you'll need, such as warnings/etc.
Shameless self plug, follow me on twitch: h...
What if I just wanna use it for server settings?
The principles are all the same
I used that tutorial but I have nothing to do with XP
Also, w3schools is a useful source for MySQL-specific terms
I wanna use mysql
then the vid
Well, with my hosting I have a free MySQL account
And it won't allow me to connect to it
The video walks you through the entire setup
I've had no issues using MySQL so far
personal preference
@true ravine I get this error
Db failed to connect Ouput:connect ETIMEDOUT
/rbd/pnpm-volume/0f5820b6-fa0f-4e8f-ba68-8ab021a8e3bf/node_modules/.registry.npmjs.org/mysql/2.18.1/node_modules/mysql/lib/Connection.js:74
this._socket = (this.config.socketPath)
^
TypeError: Cannot read property 'socketPath' of undefined
at Timeout.connect [as _onTimeout] (/rbd/pnpm-volume/0f5820b6-fa0f-4e8f-ba68-8ab021a8e3bf/node_modules/.registry.npmjs.org/mysql/2.18.1/node_modules/mysql/lib/Connection.js:74:33)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)```
What code have you got so far?
const mysql = require('mysql');
const con = mysql.createConnection({
host: 'my host',
port: '',
database: 'the name',
user: 'user name',
password: 'the pasword'
});
con.connect(function (err) {
if (err) {
console.log(`Db failed to connect Ouput:${err.message}`);
setTimeout(con.connect, 2000);
}
});
con.on('error', (err) => {
if (err.code === 'PROTOCOL_CONNECTION_LOST') {
console.log('DB disconnected attempting reconnection')
con.connect((err) => {
if (err) throw err;
console.log('DB reconnected!')
});
} else {
throw err;
}
})
con.on('connect', () => {
console.log(`Connected!`)
})
module.exports = {
dbConnect: () => {
return con
}
}```
I assume you have the connection correctly filled in on your real code
Yes
Cool
Idk why I get errors
Could you show what you entered for the connection apart from the password
ok
I'm up to 73 files in my source folder interestingly
That's alot more than I expected
Oof screenshotted badly
73 files though
5.7 Megabytes between all of those files
so where u need help at?
I hope those 5.7MB is not just code
imports too
Also includes the folder size
and any quirks about how the fs manages the disk
I'm only up to 2.6mb rip
I know filesystems have some quircks though
like they have blocks
The size of a file is often larger than the size of it's contents
Yeah that's true
How would I go about sending data to a website to act as a monitoring/stats site?
I'm using glitch to test my idea (ik glitch is trash, just don't want to invest anything yet) so the data I want to send isn't stored in the same place as the website
Why not do the opposite and just pull from the storage at the website
If that makes any sense
I’m not good at explaining
If that's a cooler way of doing it then that works too
How would I go about that? (just vaguely)
I’m not sure tbh
What if you just maintain a constant WebSocket connection?
And send events that way
Or you could make a request to your website
Like POST /newdata.html
I'm new to this kinda stuff so I'll research websockets and see how far I get
Thanks for the suggestion
how do I use hyperlink markdown in embeds?
anyone knows how?
ah, nvm, just found out how
do webhooks work with http:// links
because it's not working for me rn
bot.channels.get("685189040470753301").send("Webhook activated.")
});
dbl.webhook.on('vote', vote => {
bot.channels.get("685189040470753301").send(`User with ID ${vote.user} just voted!`)
});```
how quickly can a bot edit a message for it to not abuse discord api
Api abuse and rate limiting arent the same thing. Any small interval for edits may be considered api abuse even if it doesnt rate limit you. But api abuse isn't a set-in-stone definition either so it's hard to tell https://cdn.discordapp.com/attachments/272764566411149314/604449094680707072/unknown.png
@earnest phoenix what is the actual link
https://12.34.56.78........:5000/
const dbl = new dbl1('my token was here', { webhookPort: 5000, webhookAuth: 'my auth was also here' });
shouldnt it be https://12.34.56.78........:5000/dblwebhook
is the url http or https
http
then dont have the s at the https
new dbl1( is that supposed to be dbl1
yeah
it works because my bot's game status includes how many votes it has
and it's uploading the servercount just fien
posting servercount and runing the webhook server are very diffrent things
whats ur current code
Discordjs version? (v11 I think)
uhh I dont know where I doing wrong help me (its dont save modlog chanels)
-_-
Can someone help me ???
ftr, if you copy and paste your code in code blocks its a lot easier to read
hmm I cant bc my idiot phone cant copy at all (note 2
)
can someone help me make a user resolver (eris)
@sweet spade do u have a file inside another file?
yea
i figured out what was going on
apparently on dbl you have to save the details before the test button works
;/
lmao

does anyone here use eris lol?
https://discordapp.com/channels/264445053596991498/272764566411149314/685213003561304064 its not work @earnest phoenix
??
oh i wasn't talking about your issue
learn to debug your code
i was talking about mine
go through the code one step at a time and see where it breaks
.-. ok
@earnest phoenix is a hidden mastermind coder giving actual good advices 
i dont know what you're being weirded out about because debugging is a normal part of developing which so many people here avoid for no apparent reason
honestly yes tuty
xD
we aren't here to find the issue among hundreds of lines of code for you
we're here to help you with the issue

i mean when all someone does it plop it in glitch and codes on mobile can they even debug?
if you take a few hits of cocaine maybe
cry, is glitch thing okay to use? i mean better than heroku?
neither is okay
in terms of small apps
both are equally meh
they simply aren't meant for bot hosting and instead are meant to be used for websites
pretty sure the specs u get are nearly identical
cry, i said small apps, who hosts bots on heroku 
quite a few people host on heroku
e.g a small webserver will run fine
i mean can you have private projects in glitch? all i see is people posting their dbl tokens public lel
For bots a free hosting service like AWS or google cloud platform will serve you much better than glitch
and make a mod to run code on it
True
gcp has a freee teir, genius
*free tier
so does aws
and gcp's free tier is pretty damn good
I mean you don't have to pay after 12 months if you don't want to
technically they are free if you exploit the fact that neither of those two check for duplicate credit cards
Use google cloud free trial

not helping
and cry, ye
and gcp's free tier is pretty damn good
but i mean thats a lotta work
dansgame
it is
i ran a bedrock mc server on it when my credits expired. not super great, but not terrrible
i won't even talk about how many times i exploited gcp's 12 month trial
xD
see. i use those credits in 6 months
same
4-6 months then switch to another account
xD
and besides, you can always upgrade aws and gcp, pretty easily
no moving from heroku to a paid host]
i am not encouraging this behaviour by any means since it's probably illegal but whatever floats your boat
having to transfer everything
and xD
i mean i host a simple api on heroku, works fine 
simple
i said simple apps, above.
true
but again, theres no reason to not use gcp or aws and upgrade later
yeah like i said small webservers run fine
mister dan, for changing the api to host it on gcp, is it actually 24/7 on or do i have to ping the damn thing like heroku to wake it up

Any real webserver is 24/7
i did say it was better

i feel like this is worthy nothing; whichever service claims that their products are free - you become the product
^ true that
i mean
tho
cough google
gcloud is just putting that out for free cuz they make enough money from paid
i mean a lot of apps use them; discord, snap
google is really interested in your data
mmmm
eh, doubt they can/would get at shit on a vps.
does eris have a discord
cuz you've asked that multiple times, and no one has been able to help or has responded and you might have better luck finding someone in the libs discord if it exists @digital ibex
Okay
Oof
what
huh
can you not randomly ping
@earnest phoenix
i cant help if 1) idk what you're wanting
2) idk what you're wanting
o..k?
you're here now?
copy you id
o
you must get you correct id
ye
but @earnest phoenix what exactly is going on?
cuz you're here now
so you should be able to submirt
try from pc or rdp
ahh
also laptop?
I have a question. In css, is it possible to create some kind of tail? For example: A object slides along a track. I want annother object to follow that object just with a little bit of delay. Is this possible in css and if yes, how?
only because idk how to explain it myself
what would be the best way to check if a given string is/seems like a valid discord id?
like lets say a user can input a string of random numbers, how do i differentiate that from an actual discord id?
pls no bulli
i think https://github.com/passthewessel/snowflakey supports it but idk
but just because its valid doesnt mean its an id that exists
ok i think ill be able to get enough info from just reading that
yea idm if its not real
just has to be within the given parameters
and with discord max id length of 19, with min 14, thats enoguh
i couldnt find info on min/max anywhere 😄
that seems to actually lookup if its valid though
which is a little more than i need 🙂
but ty for link, was helpful 🙂
/^[0-9]{14,19}$/ ez
I get this error whenever dbl api starts running:
(node:3870) UnhandledPromiseRejectionWarning: Error: 400 Bad Request
at IncomingMessage.<anonymous> (/rbd/pnpm-volume/6323fd81-f605-40d1-9545-4304110da25b/node_modules/.registry.npmjs.org/dblapi.js/2.3.1/node_modules/dblapi.js/src/index.js:118:25)
same line some dude had an issue with the other day: 118
sec
probly cant connect with the given credentials
sooo... wrong token?
dont think so, sure dudes in here been using v12
i'd maybe reset your token, and make sure its correct in the botzz code
Okkay
if that failz ~ 🤷♂️
same error
It's a different error if the token is bad
It's related to the dbl module not djs
Literally my dbljs code:
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBLAPI, client);
Also, if token is wrong, I would get a 401
dblapi.js is not compatible with v12 yet
you can workaround the issue by removing client from the arguments
and using .postStats() instead
oh ok, ill just fix dbljs code
the problem only affects dblapi.js' auto posting feature, everything else is fine
Wtf, everything is fixed, but 3 ppl need to approve
its already been approved by a bunch of people lol
has it
@gritty dagger pls approve
can someone link the pr
3 ppl with write access need to approve not just anyone
the problem is not approval
only tonkku has write access
he just needs to merge and release
isnt it untested
imagine making an issue instead of commenting on the pr
🙂
why not just clone tonkku's clone?
An official module for interacting with the top.gg API - DiscordBotList/dblapi.js
wait
wrong link

Wait
it's the same repo
different branch
lol
quick
someome make a fork and fix it
then you can share the repo
I'd do it, but I'm not home
there is already a fix
or you could clone the repo and switch the working branch then require it
anyway
approve bot will take 2 week ?
wait nononono
new bot ?
wot
how would i read this in message.guild.members
Collection [Map] {
'282961872758505473' => GuildMember {
at least until the update is released
if i want to check the member specific..
what do you want to read?
in the end i wish to check which voice channel he is in
do you have the user's id?
ahm
its either via 2 ways xD
So.. i'm working on a webpage here where the user logs in and yes, then i have a user id
message.guild.members.get(id)
or if you're using v12: message.guild.members.cache.get(id)
but i want to check which voice channel he is in
get the member, then check his voice channel
and on discord; i want to check his id based on the message he sent
?
would that make sence?
if he sent the message, you can use message.member
would that just be message.member?
to get the member of the one who sent the message, yes
message.member is the same as message.author, but gives you a member instead of a user
then you can use member.voiceChannel in v11
👏 learn 👏 fucking 👏 oop 👏
Temp fix for discord.js 12 dblapi.js
Also client.dbl is just new DBL(yourTokenHere)
client.dbl.postStats(client.guilds.cache.size)
setInterval(() => {
client.dbl.postStats(client.guilds.cache.size)
}, 1000000);
Put this in your onReady event
^
when you snychronously read files
sounds like he wants to sneak on his files
I have learned a bit about classes and stuffs today
but I am struggling to make a command handler
how would one go about that?
depends how you want to structure it
do you want to make all your commands into classes?
well, you could create a class
and then a command loader that loads your command files, and uses the class on them
like
seeing he's asking how to make one, id let him start with a simple collection array or object
all good
lol i was thinking of someone else
oh lol
oh
class Command {
constructor(name,file) {
this.name = name;
this.file = file;
this.function = require(this.file);
}
run(args) {
return this.function(args);
}
}
client.commands = new Map();
fs.readdirSync("./commands").forEach(file => {
let name = file.split(".")[0];
let command = new Command(name,"./commands/"+file);
client.commands.set(name,command);
})```
yeah
I will come back when I figure this out and configure it to my liking
thanks for helping me understand Tim
it is appreciated
👍
so, am I correct saying that all I would need to do would be search the commands for a command with a specific name then run the function of the command?
yes
I use a Map for commands, which allows me to do .get(command name)
and each command here has its own execute function that can be called if the invocation message is one that should call that command
hmm smart
I use a collection on my main bot, then I find a command with the name and run the function
but I want this to be a bit more modular
it also makes it easy to check if a message contains a valid command: ```js
let command = message.content.split(" ")[0].slice(prefix.length);
if(client.commands.has(command)) {
client.commands.get(command).run()
}
I have quite a lot
who can use it, whether it can be disabled, the cooldown on it, etc etc
my client uses class inheritance for each individual command, but yours doesn’t have to
each command can just be instance of a Command class
which is exported and loaded in your client
can you guys please tell me what is this xd
TypeError: Cannot convert "null" to int
well
it's about opusscript
you have a value null and you’re trying to convert it to an integer
which can’t happen
trying to do math with null
if you
say if you installed djs, then you went into the source code and edited it, will it at some point reset back to normal?
having never worked with shards before, these are probably super dumb questions... are the shards numbered? or do they have some kind of unique id each? or both? can i name them? do they already have a name somehow?
no
I mean
unless you updated it then maybe
but I would not recommend doing his whatsoever
@neat ingot each shard is numbered starting from 0
how else would a push request be made though? @white anvil 😛
ahh ok
regular numbers
I’m assuming that they mean that you clone it and use it, and then edit the source in node modules
instead of forking it
which is what you should do
shards have IDs
which are like array indexes
if you request 2 shards, you will get shard 0 and shard 1
so editing source code isnt a good idea?
mmk, ty 🙂
you can edit it if you fork it on git
i mean
is it possible to name them? or define which guilds go to which shards?
no
does this error mean that I didnt define something correctly? TypeError: Class extends value undefined is not a constructor or null
fork it, edit it and then clone your fork
guilds are sorted into shards automatically by their guild ids
discord uses a specific formula for it
ahh ok
@crimson vapor what’s throwing this
which you can use to know which shard a guild id goes to
extending a class
ive seen a bot that had premium servers limited to 100 guilds per shard
which intreagued me
can you paste the code
https://nmw03.is-inside.me/lXcVwOOI.png
is facebook api response ping 124K or am I seeing wrong
my initial guess is that it’s extending a class that doesn’t exist
could be a custom instance of their bnot with unique bot id tho
124.385
there is a major network outage going on atm
sure, should I paste the base and the extension?
its affecting a big part of the east coast
const { Command } = require(`../Base/Command`);
class test extends Command {```
lemme check the require
yeah Command will be undefined
how are you exporting the class?
module.exports
module.exports what
the require is pointing to a file that exists
module.exports = Command?
yes
gotcha
make it equal to your command class name
because doing { Command } = require() implies that you're doing module.exports = { Command }
oh
you don’t need to do it that way
then you can name it anything you want when you require it
yea isnt that whats going on?
module.exports = classname;```
thanks for helping
@grizzled raven if you can, extend it or overwrite a part of it. otherwise, if you must absolutely modify the source, you'd better create your own fork
oh btw, this is my normal command handler, my friend wrote it
function loadCommand(client, directory, module) {
fs.readdir(`${directory}/${module}`, (error, files) => {
// Written by 酒。#0001
if (error) return console.log(`Load Commands: ${error}`);
let jsFile = files.filter(f => f.endsWith('.js'));
let jsonFile = files.filter(f => f.endsWith('.json'));
if (jsFile.length <= 0) return console.log(`Load Commands: Couldn't find any commands in the module: ${module}`.red);
console.log(colors.blue(`Load Commands: `) + colors.yellow(`loaded ${directory}/${module}!`));
jsFile.forEach((f, i) => {
let fileCommand = require(`${directory}/${module}/${f}`);
client.commands.set(fileCommand.name, fileCommand);
});
});
}```
he is more of a give code than teach person
this code is useless unless you can understand it
and that console colour dependency is bugging me
well, if he wants fancy visuals...
no, I do understand it
it’s so unnecessary lol
no, I have edited it
that’s good



