#development
1 messages · Page 1059 of 1
how
@earnest phoenix use boolean
user.presence.clientStatus
okay so i wanted to make a 8ball command. this is the code i made
module.exports = {
name: '8ball',
description: "Ask the 8ball anything you want!",
execute(message){
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
const ball = Math.floor(Math.random() * (6- 1 + 1) + 1)
if (!args.length) {
return message.channel.send(`what are you asking the 8ball, ${message.author}?`);
}
if (args.length){
if(ball === 1) {
message.channel.send('yes, m8')
} if(ball === 2) {
message.channel.send("that's a big NO")
} if(ball === 3) {
message.channel.send("I don't think so.")
} if(ball === 4) {
message.channel.send("i don't what what to say about this")
} if(ball === 5) {
message.channel.send("YAAAAS!")
} if(ball === 6) {
message.channel.send("no.")
}
}
}
}
will it work?
try kek
ok
it worked lmao
i had one error which was "prefix was not defined" so i defined it and it worked
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 83. Please try re-compiling or re-installing
glitch moment
Whats this :/
try npm rebuild
node-gyp rebuild
-bash: /root/.nvm/versions/node/v12.18.1/bin/node-gyp: No such file or directory
should i just delerted the node_modules folder?
yes
npm WARN discord.js-commando@0.11.0-dev requires a peer of better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of sqlite@^3.0.0 but none is installed. You must install peer dependencies yourself.
audited 352 packages in 6.632s
21 packages are looking for funding
run `npm fund` for details
found 6 vulnerabilities (4 low, 1 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
root@client:~/public#
this might be cause?
@restive pebble
Same error
could u try copying the json.sqlite file
json.sqlite?
yes
Uh no
i dont use sqlite its just quick.db shit requirement
and quick.db requirement for shit commandop
yea
So will i still have a .sqlite file?
better sqlite 3 dosent support many node versions
i use 12
i use better-sqlite in my other bots but weird erro r just popped out when i installed the dbl lib
i know sqlite doesnt work with 12+
it does
yes i does
it works with 10 also
it does
14?
what error
i cant reproduce it right now since im getting https://discordapp.com/channels/264445053596991498/272764566411149314/732920848565927976 right nopw
if i wanna go back from to hygenx/ from hygenx/main/bot.js would I do ../?
or what?
that just means it was compiled for the wrong node version
../../
you need to rebuild it
rebuilding doesnt work :/
how are you rebuilding?
npm rebuild
use node-gyp kek
npm rebuild better-sqlite3
where u hosting bot
vultr vps
k
better sqlite is strange
show full log
@restive pebble btw on node-gyp https://legendary-king.is-inside.me/Q4syYHlF.png
Full log was in?
as*
install then
there is no actual build log?
@restive pebble [Error: ENOENT: no such file or directory, scandir '../../events/'] { errno: -2, code: 'ENOENT', syscall: 'scandir', path: '../../events/' [Error: ENOENT: no such file or directory, scandir '../../dbl/'] { errno: -2, code: 'ENOENT', syscall: 'scandir', path: '../../dbl/' (node:24) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined at /home/container/hygenx/main/bot.js:34:35 at FSReqCallback.oncomplete (fs.js:155:23) (node:24) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:24) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. Code:https://hastebin.com/jayebufode.js
paths: hygenx/commands/
hygenx/events/
hygenx/dbl/
https://legendary-king.is-inside.me/FF6595qg.png @restive pebble
https://legendary-king.is-inside.me/FF6595qg.png @restive pebble
@small prairienpm i graceful-fs
Any one can tell me how !! Is work ?
@quartz kindle https://hastebin.com/isinuqewer.sql
ok
Any one can tell me how
!!Is work ?
@robust moth wdym by !!
i want it to go to HygenX/commands
../../commands/dbl
nvm
im a idoit
!! is like
Im officially dead
reverse
@restive pebble check the log
try with ../
fs.readdir("../../events/", async (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));
});
await console.log(`All Events have Been Loaded and are waiting to me activated.`)
});```
ok
why are you awaiting the console.log?
cause i want it to console log when everything is done
whats ur issue, also?
...
awaiting it isn't gonna do anything
scroll up ^^^
no
@restive pebble Tried
same error
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '../dbl/'
[Error: ENOENT: no such file or directory, scandir '../events/'] {
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '../events/'
(node:24) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined
at /home/container/hygenx/main/bot.js:34:35
at FSReqCallback.oncomplete (fs.js:155:23)
(node:24) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:24) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
and yes
there are files named that
might be a problem with pulling
@small prairie whats that?
logs
Logs
wot
npm rebuild
you dont need to rebuild everything, you just need to rebuild better-sqlite3
@restive pebble So?
the command npm rebuild better-sqlite3 should produce build logs, if it doesnt, that means its trying to use prebuilt binaries
try npm install better-sqlite3 --build-from-source
wait
now thats producing logs
but it lags out at this should i just wait? https://legendary-king.is-inside.me/c6eNBZf0.png
np
the build process should take a moment or two
x
like 30sec-1min
ok
rip its not happening ;-;
should i close other processes and then rebuild?
what other process
how do i make that
which lib
d.js
setAuthor() has image option
like
setAuthor(AvatarURL())
no
(text, image url, url)
It's same as footer
oh got it
Cannot
@small prairie I signed up. and downloaded sharex how do i config it?
Docs
how did this bot do then
Hi chicken
you can use image url on author, image, thumbnail and footer
That author lul
^
Hi
Markdowns
kek
ok
so
.setAuthor("string", message.author.avatarURL())
yes
ah got it thanks
I acxtually wanna cry
Null moment
why @tulip ledge
Go to pins and read all rules
also I do when I see that spelling
The way I make weapons work is by saving stats to a user but the issue is that if an item is too OP and I wanna rebalance it the user keeps their stats D:
Kek
I would have to run multiple queries to check if the user has the item equipped etc and then remove the stats 😦
And I just realized it after writing around 10000 lines of code that depend on that system
another question, can i leave out a title in a field?
No
use zws
Use an invisible unicode character
Tell me some really awesome api
what kind of api
cat api ofc
Tim
Like spotify
Do you know a better way of making my item system work?
whats this then
I wrapped their api already
So that I can actually rebalance items
description
desc
I want to wrap more apis
description of?
.setDescription()
embed.description = string
Does anyone have a better way of doing stuff with my items then I'm doing right now?
markdown
Mardiwn
i know how to put the whole discription as a link
Html basics
)
ya
``
.setDescription('text[text](link)')
ty
do this allowed? (when someone send ads to server which is ad protected)
Wot
no its not
Does anyone know a better way of doing my items? As items have different stats like strength, agility etc. I currently save them in a JSON file to get the stats by just looking up the item the user has equipped in that JSON file but the issue is if that I need to rebalance an item the stats won't change and I'd have to run like 4-5 SQL queries to rebalance the item, if there's alot of users this could take really long
the whole thing became a string
Nice
what does the json look like?
@gleaming glen benim botum da reklam engelleme var eğer reklam filtresi açıksa reklamı siler ve sunucu sahibine atar
buna zin varmı
It won't work
but add the )
No space
and '
"item name": {
// Item stats like "strength": 10,
"rarity": "rare",
"obtained": "How it's obtained",
"type": "weapon"
},
Like that
but add the )
@digital ibex me?
.setDescription('hi[aye](https://google.com/%27) is sending "hi[aye](https://google.com/)"')
I don't see how that would help storing it in an array
Well not really
As items are stored by ID's
Meaning an id like this FHYE-IT73-OT90
I'd have to track down all the items by querying the items table
how r u making the queries?
Then getting the id's
And then looking up all the users who have that ID equipped
And remove the stats
I have yet to rebalance any items
I just noticed it
That that would be an issue for later
And then looking up all the users who have that ID equipped
how are you doing this?
just with an if statement?
how long does it usually take to get bot verified?
like 3 weeks
client.con.query(`SELECT * FROM items WHERE itemname = "tobalance"`, (err, rows) => {
if(err) throw err;
if(rows.length < 1) return "nothing to balance!";
rows.forEach(x => {
client.con.query(`SELECT * FROM inventory WHERE weapon = "${x.itemid}"`, (err, rows) => {
// Remove the stats
})
})
})
Probably something like that
And lets say (this is probably not gonna happen but it's in theory) you have 2000 users in total and about 200 people have that item equipped I'd have to do around 400 querries
im assuming you're storing users in your database?
if (member.items.some((e) => items.includes(e))```
then thats when the storing in arrays comes in 
That could work but then I'd have to do alot more stuff aswell
more stuff like?
Like more stuff in the database
When the user equips and unequips stuff
The thing is my items also have reforges and stuff
I would make it WAY more complicated
How long would it take on average to do around 400 queries
In theory
if its well maintained, i'd say it should be like 0.3 seconds
well i mena
0.3 seconds is a big issue, but if that screenshot is correct, you shouldn't worry nope
0.3 seconds to make them queries is adding 300ms onto your ping
lets say your ping is 150ms, it'll be like 450ms
Well I mean it's just right after I release an update that rebalances an item for example
I can just do that query once
Rebalance all items
And then I don't have to querry any more
what would the rebalancing do?
is that dev only?
Yes
Dev only
then ig you shouldn't have to worry
np 👍
I'll prob do like -balance <item> strength:5, agility:2 wich is how much it should be removed by
K
prefix.findOne({
Guild: message.guild.id,
}, (err, data) => {
if (err) console.log(err);
if (!data) {
const newPrefix = new prefix({
Prefix: args.join(' '),
Guild: message.guild.id,
});
newPrefix.save();
message.channel.send({
embed: {
color: colours.auxcrd,
description: 'Prefix has been set!',
},
});
}
else {
}
});``` hey i just started using mongodb but I want to update/edit the data if the guild has already set a custom prefix
Same lol
Euhm why does it say my query is wrong? ALTER TABLE users ADD key VARCHAR(10);
please do kek
Mysql btw
U using mongoose?
yep
SURRENDERS
i have my models already
i dunno if this matters but i use compass too
Ok so apparantly u can't name a column "key" in MySQL
please...
Make your own api x)
const Schema = mongoose.Schema({
Prefix: String,
Guild: String,
});```
:D
k
do not make collections for each thing, thing like prefix, logs whatever
Aa mongoose
i have an api but not sure if you'd be interested in that kid of stuff lol
Thank you lost
@earnest phoenix make one schema for the guild lmao
I like aviation and space stuffs
its for astronomy and astrology
Kerbal space programme?
ksp?
imma just play around with code, see if i get some progess
gives planetary and stellar positions at specific moments in time
Kspppppp
that one game that I fly a rocket in and manage to orbit it round the sun and kill all the crew?
COOl
K thx
i needed a help
I will see
@trail finch HTTPS://DONTASKTOASK.COM
if (err) throw err;
let file = files.filter(f => f.endsWith(".js"));
if (file.length <= 0)
return console.log("There is js files in the commands folder");
file.forEach(f => {
let props = require(`./commands/${f}`);
console.log(chalk.yellow(`Attempting to load ${f}`));
client.commands.set(props.help.name,props);
});
console.log(chalk.bold.bgGreen("Everything loaded properly."));
});
process.on("unhandledRejection", error => {
console.error("Unhandled promise rejection:", error);
});```
full code one
What's the matter?
=( sad from morning dont know why
its tellign error
client.commands.set(props.help.name,props);
await rows.forEach(x => {
if(x.area !== floor) return message.channel.send("One or more users are not on the same floor.")
if(x.dungeonkey === "false") return message.channel.send("All users must have a key or they cannot enter the dungeon.")
else {
let sql = `UPDATE users SET dungeonkey = "false" WHERE discordid = "${x.discordid}"`;
client.con.query(sql)
levelarray.push(x.level)
}
})
Any idea why it isn't returning even tho it's sending the message "All users must have a key or they cannot enter the dungeon."
telling error doesn’t help
give us the error
No error
not u
the error is
Jsjsjsjsj
client.commands.set(props.help.name,props); ```error: the name cant be find
read property*
/app/index.js:23
client.commands.set(props.help.name,props);
^
TypeError: Cannot read property 'name' of undefined
at file.forEach.f (/app/index.js:23:36)
at Array.forEach (<anonymous>)
at fs.readdir (/app/index.js:19:8)
at FSReqWrap.args [as oncomplete] (fs.js:140:20)```
the full error
you didn't set a name for each command
console.log(props.help)
most likely
um
?
Anyone knows mine?
whats ur issue?
await rows.forEach(x => {
if(x.area !== floor) return message.channel.send("One or more users are not on the same floor.")
if(x.dungeonkey === "false") return message.channel.send("All users must have a key or they cannot enter the dungeon.")
else {
let sql = `UPDATE users SET dungeonkey = "false" WHERE discordid = "${x.discordid}"`;
client.con.query(sql)
levelarray.push(x.level)
}
})
Any idea why it isn't returning even tho it's sending the message "All users must have a key or they cannot enter the dungeon."
The code after the forEach is being executed
Even tho it shouldn't
um
its sending that regardless?
is that a rpg game bot?
Why?
?
yes it's sending the message
But the code after the forEach gets executed
oh
you cannot return a foreach
its not "false" its false
tim help pls (ive read it)
hm
if you've read it, you know the problem lol
Lol
send the file tree
wheres it though
Wait so you can't return a forEach?
Would I do a for loop then?
Or what would I do
use map
forEach takes a function, so when you return inside a forEach, you are returning from that function, the parent code is unaffected
any other loop
i know the error is somewhere here
aight guys I just figured out how to update my mongodb prefix data
ty for the help tho
umm my problem....
welp
@hazy sparrow
xd
capital c?
yes
@trail finch one of your commands has no help property
Hello I need a help
What do you mean your issue
oo
Basically I'm making a raid bot
Didn't like 3 people already answer you?
guild.members.cache.forEach(mem=>{
mem.ban()
})
help property
So this will work?
hm i didnt got that
if he has perms
why would you want to do that
@hazy sparrow
@quartz kindle fixed it but still same error
Yes he has all
But I think raid bots are against ToS
lol
Then should you tell be asking us
Or any other thing
the forEach will be executed concurrently, which will flood the api, although discord.js will block it and queue it for you
so u dc bout banning ur acc?
in any case, it would be better to make it sequential
hm
I am just making a raid bot
Epic
umm i didnt understand the umm
I wanna test
No
I am just making a raid bot
@restive pebble lmaooo
Not that
*one of my command dosnt have help prop, so what should i do?
Idc about TOS
Cool
sorry i am a beginner so
Yes
Add the help property
Unless I'm not caught
Lets kick boieieieieieing
Idc
wheres tim
wait why would you say that
console.log(help.prop)
Walking on thin ice there buddy
Boeing are you good
this?
You realise Tim isn't the only person here
no
@hazy sparrow
Lol
In ur command files you need a module.exports.help = {//stuff}
Boeing are you good
@earnest phoenix why
Keep this channel on topic
owo ok
but hes the only person who i actually understand
O_O
Damn he your therapist?
@restive pebble you usually don't act like this but we'll move on
Hotel Shivaco
Kek
Okay I'm leaving this server that was so bad
?????
why?
Why do I get like 3 spotify adds wtf is this
lol
wdym?
I can't breathe rn 🎉
3 lmao
shoot
if anyone knows, does anyone know why im getting this? client_loop: send disconnect: Connection reset by peer
You're so gonna get banned
Stop discussing it
I'm using the guildCreate
boeing i want to donate to your raid bot to raid my server
uhm why
message.member.voice.channel
Returns undefined "voice"
Stop all this talk about raid bots now
Ah ok
Just go loop on the channels and see if the type is a text channel and if the bot has perms to type in it
And keep this channel on topic, last warning
Alright
Because member isnt in a voice channel @hoary lily
Ok
I'll again
Mongo?
me?
Yes
im just gonna post my problem and code here
nope
And error also pls
its for my website
@digital ibex Are u hosting it on your home pc?
im not
As it mgiht be that the connections/requests are too much for your router to handle
@tulip ledge channel.me.hasPermission('SPEAK')?
How do I check
I am making a moosic bot
lol
that endpoint hasn't been getting much traffic
if(channel.permissionsFor(guild.me).has("SEND_MESSAGES"))
over 12+ hours
is anyone gonna solve my problem or what
Hey guys! How can I delete a role that I have the ID from with discord.js?
hello
hi
Yeah role.delete()
errors?
bye
bye
bye
Whats the error?
If the role is higher then the bot's role he can't delete it
Thats why you might wanna add a .catch() to it
Cuz you know "Gotta catch 'em all"
Hi why does
message.member.voice.channel
Returns
TypeError: Cannot read property 'voice' of undefined
TypeError: Cannot read property 'delete' of undefined
it cant find the role
The user is not in a voice channel @hoary lily
I tried that already
Are you using v12?
@jagged sun it cant find the thing you're trying to delete
Ye
As you need to add a cache to it
Ooo
No I'm talking to @jagged sun
Maybe you need to add cache to it aswell @hoary lily not sure tho
msg.guild.roles.cache.get(<ID>).delete()
other way around
just do msg.guild.roles.cache.get(<ID>).delete()
oops
Like that
msg.guild.roles.cache
we posted the same lmao
can you guys tell which line is deh error
yes
msg.guild.roles.cache
@digital ibex TypeError: Cannot read property 'get' of undefined
It can't get when using cache
what the actual fuck
send the code ur using
me?
no
ok
I just evaled this: console.log(message.guild.roles.cache.get("725026789574836315")) and it works tho
Meaning the ID is probably wrong
It needs to be a string
Kek
but does that matter?
Hotel shivaco is the best thing anyone has ever said here I'm sorry it's uncontested
oh guys i figured out my problem
IDs need to be strings in js
Lmao
Hotel shivaco is the best thing anyone has ever said here I'm sorry it's uncontested
@pure lion true
Idk why I was like "shivaco" that sounds farmiliar and I was like a yeah "Hotel Trivago"
how can I make an int to string?
because all js numbers are 64 bit floats, and IDs are larger than what 64bit float supports
"${id}"
so rounding occurs, and all your IDs become invalid
Wait no
how can I make an int to string?
@jagged sun use "<id>" not <id>
"${id}"
@tulip ledge no
you need to store them as text in your database, and retrieve them as text
I use varchar
${} means template literal for those who don't know :D
To store them
"Hotel Shivaco" is my first time on the starboard in 2 years of being in this discord lmao
mine was last month
It's the best thing on the starboard
@jagged sun use "<id>" not <id>
@hazy sparrow I know, but I didn't have a var there
with what
Don't ask to ask
this is a https://dontasktoask.com/ moment
sorry
Lmao I am braindead aparantly
what api
You mean discord.py library?
can you ask this person to ask me what is my problem pls
Wait what
You mean discord.py library?
@tulip ledge Yes
I just lost more braincells then I have trying to read that @hazy sparrow
Is there a way to put an image in an embed if you don't have url?
lmao
Whats ur question?
me?
Thanks for help
np
There mgiht be a way tho
I tried discord.py once
And then went back to js
So I'm not that good 🤷♂️ I just looked at docs
images in embeds have to be linked via an attachment url
Currently the bot sends the image to a specific channel
Parameters
url (str) – The source URL for the thumbnail. Only HTTP(S) is supported.
Then it gets url of the attachment
msg.guild.roles.cashe.get(${rid}).delete() still can't read property get
Not cashe
Does my beta app affects my bot's processes?
Not cashe
The amount of times this happens here
lol bruh
I mean discord beta apk
still lmao
NOOO I was writing this really long mysql query in my cmd line and then I accidentally pressed arrow up 😦
😬
cache shows the same thing
@proud condor you define a file with discord.File(path,name) right?
Wdym don't use MySQL
I don't*
Oh ok
@proud condor you define a file with
discord.File(path,name)right?
@quartz kindle Yes
then in your embed, you need to define the image url as "attachment://filename.png" for example
Tim said MySQL should be fine so I'm sticking with MySQL
the file name must be the same as you defined in the name parameter of discord.File
using nosql x)<
then you send both the file and the embed in the same message
yes
you set the url as "attachment://name here"
using the name from discord.File
What can I do here, it says it can't read property get of undefined msg.guild.roles.cache.get(`${rid}`).delete()
@jagged sun is the role cached?
the file name needs to include the correct extension for it to show up correctly
.jpg or .png
or whatever discord supports
@jagged sun is the role cached?
@lusty quest no, it's just the ID
if its not cached you cant use the cache
the file name needs to include the correct extension for it to show up correctly
@quartz kindle Ye i know
cant i open 2 folders in VS code?
Toby are you on v11 or v12?
@quartz kindle v11
Anyone give me link of better antispam discord server
use .roles.get()
so what else can I use then?
remove the .cache part
remove the cache
Anyone give me link of better antispam discord server
yes but i cant give
@hazy sparrow give me in dm
Cannot read property 'delete' of undefined
@earnest phoenix read what i said
@hazy sparrow ok no problem
the role doesnt exist then
@jagged sun is the role id coming from your database?
@jagged sun you dont pass the id you pass a mention
the role doesnt exist then
@tulip ledge It does
@jagged sun is the role id coming from your database?
@quartz kindle Yess
@jagged sun you dont pass the id you pass a mention
@lusty quest It's the ID
is the id stored as text in the database?
No, but it is then used as a string
````${id}``` should return the object not the id
it doesnt matter
unless your database supports bigints, you cant store it as int
what database are you using?
${rid} I doestn't work like that?
remove the string parsing
remove the string parsing
@lusty quest It has to be a string then?
it wont work, the id is already invalid
Pls some1 give me link of better antispam discord server
remove ${}
and it didn't work with .delete, I had to use msg.guild.roles.delete(ID)
wait does that mean that js is braindead?
the moment javascript gets the value from the database as a number, the number loses precision, because it exceeds what 64 bit floats support
wait does that mean that js is braindead?
@tulip ledge think so...
whats this called
if you use Mysql you could store it as Bigint
if you use mongoose you cant use Bigint
wdym?
like
having to use n on every operation for big int is annoying af
is it a field
No
whatever you do with the number afterwards doesnt matter, the precision is already lost
Its .setDescription()
what would happen if timestamps exceed 64 bits?
the only way to reliably store large numbers in a database in js is if the database supports returning them as bigints, in a way that the value is never converted to a regular number
@quartz kindle It's not working
show code
It just sends the embed without the image
file = discord.File(theMinefield[user].draw_field(), filename="minefield.png")
embed = discord.Embed(title="Minefield successfuly created!", colour=discord.Colour(0x3153))
embed.set_author(name=user, icon_url=user.avatar_url)
embed.set_image(url="attachment://minefield.png")
await ctx.send(embed=embed)
Okayy
Oh it's working
I thought it will send the embed and the image separately
Thanks
are u making a minesweeper?
the attachment:// is what links them together
without it, they will show up separately
like interactive?
wdym?
yeh
I didn't know okay
i once made a minesweeper in the browser
How would minesweeper work in browser?
But I always wanted to make one in djs but idk It would be pretty hard as users can't rlly select what spots to chedck in discord
Yes using JS
is it a huge 2D array if buttons?
Kinda like this http://minesweeperonline.com/#
How it would work generally, I'd assume
Oh nice
You make a 2D array
And a Cell class or something
And store the cells in the array
Ye i have the same
And then check if the users clicks a certain pixel then calculate what x and y it si in the 2D array and reveal it
You also have some calculations to calculate the number, floodfill etc
Oh you meant like you can click the tiles?
Yes
No it's just using commands
Or you type like E5 or something
Using a command and row, column numbers
+yardım yetkili
@hazy sparrow Code?
wait
https://pastebin.com/S1QShwGr (token is wrong dont worry)
client.commands.get('foohelp').execute(message);
foohelp as no execute exports
And dont if else stack when using a command handler
Just do like if(client.commands.get(cmd)) client.commads.get(cmd).execute(message)
what??
Just do like if(client.commands.get(cmd)) client.commads.get(cmd).execute(message)
@tulip ledge what??
instead of doing
if(message.content.startsWith(`${prefix} help foo`))
Do what I said
it'll remove alot of lines
ah the classic "build a command handler and dont actually use the handling part"
instead of doing
if(message.content.startsWith(`${prefix} help foo`))Do what I said
@tulip ledge still did not understand
command handlers exist exactly so you dont need to if else every single command you have
instead of if else every single command, you just check if command exists
thats what a command handler is made for
instead of js if(a) {} else if(b) {} else if(c) {} else if(d) {} else if(e) {} you simply do ```js
if(commands.has()) {
commands.get.execute()
}
because your commands are already inside a list, that you made with readdir and commands.set
you dont need to check each one of them separately, you check if it exists in the list
so its
commands.get.execute('foo`)
}
We never solved your problem? @hazy sparrow
cannot read execute of undefined, in your case, it means that the command doesnt exist
and that problem will not happen if you use the commands.has method, because non-existent commands will not be executed
i added the file in a wrong folder
commands.get.execute('foo`)
}
like this tim @quartz kindle
oh fuck
you need to adjust it to fit your code
thats actually a good call, i just voided the errors instead of using has
i was doing get()
well you can do whichever
you can also do this ```js
cmd = commands.get()
if(cmd) { cmd.execute() }
try {
cmd.get(command).execute()}
catch {}```
oh lmao
i understand what you say but i dont understand the code
it just tries, if errors, void it
@hazy sparrow all your commands are stored in client.commands correct?
i dont see any client.helpcommands.set in your code
it has a helpping.js
where do you set it?
what?
i dont see any client.helpcommands.set
oh shi
that doesnt matter
after you make that map, you need to map key/values
ive done client.commands.set twice
yes, so your helpping command is also stored in client.commands
and honestly, keep it that way
okay
its better to keep all commands in the same storage
just remove the client.helpcommands line
ok
so now that all your commands are in client.commands
client.commads has .get() and .has() methods, so you can quickly get a command, or check if a command exists
now look at this part of your code
in this part you define a command variable, which represents the first word of the message, after the prefix. which means, this word is the name of the command
but the reason i wanted a seperate folder for help commands is because this
therefore, command is the name of the command
@hazy sparrow later down the lines, there a guides to show you use put the help on the module exports
so you can call it dynamically
so all you need to do is client.commands.get(command) to get a command, or client.commands.has(command) to check if the command exists
ahh ok
so you have two options
first check if the command exists, and then if it exists, get it and run it
or
get the command first, and if you got a valid command, run it
the first option would translate to ```js
if(....has(command)) {
....get(command).execute()
}
the second option would be ```js
let cmd = ....get(command)
if(cmd) {
cmd.execute()
}
both do the same thing, just in a different way and order
check if it has it, if it has it get it, execute it
or
get it, if it exists execute it
anyone making a coin system w/ mongodb because mines just not working
@earnest phoenix still need? I made one yesterday
