#development
1 messages · Page 1707 of 1
@blissful coral probably do a bit more than 1k tho
yeah
Unnecessary
too many objects
I am switching from djs sharding manager to kurasuta so was just curious
Maybe 1.5 or 2 if you feel like
Luckily all the functions are the exact same for 1 and I don't use that 1 
But like 2.5 is MAX
And 1k is MIN
well not really but like it's the normal params
So anything in between is good
I think if I get performance issues I will change it but I should be fine for now
Well yeah
Shutup million 
yea
Is SUPER OVERKILL
LMAO
like taking a plane to the supermarket
I have a guild per shard and 10 shards wdym
actually thats impossible to have 1 shard per guild
some guilds will be bound to be put on the same shard
it's possible but the chances of it actually happening logarithmically increase the more guilds you have
iirc you can't have that many shards
I mean how many shards would you need for it to be satisfied by the shard equation
too many
you'll have like an 8 minute startup
my body width doesnt cover the full screen when i see how it looks on mobile
margin: 0;
padding: 0;
width: 100vw;
height: 100vh;
i have this in my body
<guild>.leave()
dose the other maker of the bot need to be in here?
No
is that chrome mobile simulator?
anyway, show ur css
Hoi, what is the plugin thingy that can make profile cards, llike a ui for my discord bot in js, please take it easy as i have had around like an 8 month break of off coding
is it possible to get message content from message id xD
Not gonna DM you buddy but feel free to check out this guide: https://anidiots.guide/hosting/heroku
pretty sure yes
hmm ok
node-canvas is what you want, but you can use canvas-constructor to simplify things
ahh perfect. node-canvas. thats what i used to use
textchannel.messages.fetch(messageid) so you need both the message and channel ID.
As
thx

now to look at the docs of node-canvas
kinda strange how you need the channel ID to get a Message since no two resources can have the same id. Although, the route makes sense
It's because of the HTTP route which requires the message ID first, since it's a nested structure.
Yeah. Having everything like how it is makes sense, but all things considered, getting a resource by ID requiring two IDs just seems a bit strange
Also in terms of IDs you say no two resources can have the same ID... no, actually, not globally. I've seen message IDs being the same in two channels of the same guild.
No to same resources have the same ID.
https://extreme.is-a.computer/files/s33PsmpqSrpUtewH.png amazing reasoning
Heard that one before
The "it's been X months since I used Y language"
how do you export and import the class
ok show the ts code for exporting and importing
pain
Ah, yes, the ball
Anyone knows where is the error? Because i only see a lot of codes which i dont understand

Yeah
Won't even start my basecluster file its something happening the second I start my node process and the cluster attempts to connect a shard
a cluster of clusterfucked clusters of clusterfucks
yes.
Tim has a bedtime wut
One message removed from a suspended account.
For dropdown menus (not the input ones, like the user option ones or whatever) how can I get the menu under the button in all types of screen sizes etc?
ANyone say how to add embed to my bot
lang : python
yes
i have it setup
its just being buggy
when i try searching
it throws thsi
@odd stratus ?
Oh you're using a Python lavalink lib?
ye
Sorry I don't know Python. I use a JavaScript lavalink wrapper
hi
which is the best free and trusty VPS to host our discord.py bot on
"Best free and trusty VPS"
Those combined do not exist
I wouldn't call heroku a VPS but it's great if you don't need much memory
and it's free
yea true it's not really a vps
You get 512 mb for free which is pretty good, You can have at least 1k guilds if you handle memory right
Can anyone help me create an thread to run lavalink while my bot is hosted
- no local storage
HOW MUCH TIME IT WILL TAKE TO GET VERIFIED
Yep
Sure
Ok lemme show u
im not a python dev, so i cant help, sorry
use tab
f'string'
?
Yeah
I'll be out of here
@clear marlin format is also valid
I'm not a pythonier
@earnest phoenix
Didn't know lol
¯_(ツ)_/¯
What do u think?
Your code has too many issues, main one being that you are not familiar with indents
def get_role(client: Client,
guild_id: Union[str, int],
role_id: Union[str, int]) -> Optional[dict]:
return client.guilds.get(guild_id, {}).get("roles", {}).get(role_id)
cursed
would fetching webhooks in nearly 4000 servers at around the same time ratelimit my bot
Hey guys, I'm having an issue with setting the status on my bot. I feel dumb for this, but I'm getting an error in my terminal when I'm running "node .".
Here's the issue:
Am I blind?
bot is not defined
where did you define the discord client
or what did you define as
Can anyone help me create an thread to run lavalink while my bot is hosted
Here, can someone dm me.
@earnest phoenix would fetching webhooks in around 4000 servers at the same time ratelimit my bot
@earnest phoenix pls help me
about what=
This
idk
well, I kinda need to do it to make sure my bot is fixed
@earnest phoenix who can help me?
¯_(ツ)_/¯
add a 1-2 seconds delay between the requests
just to make sure you wont get Ratelimited
sure its quite slow and will take a hot minute to fetch all webhooks
but i guess its the safest way
add a delay after each time the loop ran once, it should help with ratelimits
but yea its slow
well, what is the ratelimit for get requests?
no SQLite/ quick.db/ jsondb + restarts every 24 hrs
@pale vessel I am sure you already know why I am asking this x)
Heroku has free PostgreSQL server
@lusty quest can you help me out pls
- no mongo support
- only db available are MySQL (verification) and Postgre
so I'll be using 2 different services
Yes
You can use mongodb cloud
it's free
Not Heroku alone
like atlas for db, Heroku for ram+ processor, Dropbox for storage, imgur for image hosting
When I can get 2yrs free vps with AWS
That's what you have to do if you don't want to spend a few bucks on a VPS
Also Heroku is hosted on AWS
ew AWS
^^^
still 2 different services
So the one service hosted on AWS actually has better performance than AWS ?
performance? there shouldn't be that much of a difference, but heruko is super easy to use and it can be easily integrated with github
Proof:
How is that relevant, Heruko is easier to use and just as powerful
Autodeploy?
That was the first thing they got
https://aws.amazon.com/blogs/devops/automatically-deploy-from-github-using-aws-codedeploy/
(This post has been updated on October 1, 2018 to reflect the deprecation of GitHub services. You can learn more about this deprecation here. We now recommend setting up automatic deployments from GitHub using AWS CodePipeline and AWS CodeDeploy.) AWS CodeDeploy is a service that makes it easy to deploy application updates to Amazon EC2 […]
Also with student you get better things to play with
Then roll with that, sure
I am
i make a large circle around Music bots, they are annoying to maintain.
So who can help me?
¯_(ツ)_/¯
How do i add imgur gifs on my discord embed?
I do .setImage('imgur.com/gallery/****') but it doesn't work
@last lava pls help me
lol, cant find someone to help, decides to ping random people
Lol
put the absolute link like https://i.imgur.com/QIvSH7V.jpg
This is the last thing I'm gonna post regarding this - Heruko's services are meant to be very easy to use
If you want to do everything yourself go with aws
How do i get to that link ?
You heard it everyone
Fuck VPS they're bad as shit
Switch to HEROKU
Nooo
We're talking about free tier here
right click on the image > open in new tab
Free tier only lasts a year iirc
I use CentroNodes its a free VPS and it xorks 24/7
Amazon ES2 is a free(2yrs) VPS
Thx
With student 2
Ah
Yea that's why I said
You heard it everyone
Fuck VPS they're bad as shit
Switch to HEROKU
if its free, it sucks. thats my opinion on free Hardware
oh my god can you stop being an ass
refer back to
#development message
so you're gonna continue being an ass, okay
Also one last thing about Heroku
- Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.
- Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.
- Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.
- Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)
- Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.
bruh
Heruko is a good starting point
obviously you are going to upgrade once your bot grows
and it's free forever for one project if you link a card
*if you cant afford a VPS or have no idea how linux works
But eh, if you have a card, it's probably better for aws/gcp free tier/trial
yes, but i havent meet anyone that started out having a credit card
True
they are usually 12-16 years old
wait a second
You can't use Heroku without a credit card anyway (It'll only be active 22 days a month)
they probably wont bcs its likely they are Boomers and say technology is bad and a free VPS is a waste of time
They can use Studen pack (GitHub Student)
If you have a card it goes on for a full month
back when i where in school i dont had any way to prove im in school to Github
It's harder to get the student pack when you're not from the USA
If you have a card you can get 4 gig ram for a year on Google cloud
1 gig on Azure
1gig 20 months on Vultr
Then How did I
lol all the teachers on my school where Boomers who had the knowledge about PCs like my Granddad
same. I tried multiple times, didn't get it
they just managed to fire up Youtube
Same here
IKR our principal can't even reboot the wifi
the joke where back then they where in theyre late 30s mid 40s
The whole school knows the password anyway
What does did you submit ?
does Github Student existed back in 2010?
well then it wont have changed anything
I don't know
I was only 5 y/o then
yea 2018 i where already out of school for 2 years
atleast ive managed to get some Free CAD software before getting out of my last school
i turn 25 in 11 weeks
Great only 10 years to go for me
Same
to be fair ive started with an Apprenticeship when i where 15
that lasted 3.5 years
so i could afford to rent hardware with 15
@oblique shuttle I'm not a js dev, so I can't tell you

i have this code and i wondered if you can wait to store a message in every variable before it continues because now it just goes strait to sending the variables as undefined ```js
const filter = (m) => m.author.id === message.author.id && !message.author.bot;
const collector = message.channel.createMessageCollector(filter, {
// time: 1000 * 1 // seconds
time: minute * 2 // minuts
// time: hour * 1 // hours
});
collector.once('collect', m => {
msg1 = m.content
});
collector.once('collect', m => {
msg2 = m.content
});
collector.once('collect', m => {
msg3 = m.content
});
collector.once('collect', m => {
msg4 = m.content
});
message.channel.send(msg1 + ' \n ' + msg2 + ' \n ' + msg3 + ' \n ' + msg4)```
await msg1 =...
await msg2 =... In all and async m => { to async it
I guess this will work
And its collector.on
m.first().content
ill try that
Also you should look into awaitMessages cause it does exactly what you want
const messages = await <TextChannel>.awaitMessages(filter, {...});
// messages is a Collection with all messages it collected
messages.array(); // Array with all messages
const allItems = fs
.readFileSync("./levels.txt", "utf8")
.split("\n")
.map((x) => x.split(/ +/));
let filtered = allItems.filter((x) => x[0]);
let final = filtered.map((x) => x[1]);
const labell0 = [final]
const french = Math.max(labell0)``` So final is returning an array like this: [25, 30, 98, 299];. Why is french returning as NaN?
max doesn't accept an array
Math.max(1, 2, 3, 4, 5)
Also labell0 is essentially [ [ ... ] ]
final is already an array, just spread it
const array1 = [1, 3, 2];
console.log(Math.max(...array1));
// expected output: 3```
from mozilla.dev
aha okay
i am changing it from await so i can collect in dms
You can use awaitMessages in DMs
how
const channel = await user.createDM();
channel.awaitMessages...
why do people still use json as "database"
also your json file is either corrupted or badly formated
what can i do to remove this error
just get an error saying user is not defined
You can't copy that code and expect it to work
Replace user with the actual user object you have
switch to a proper database or fix the error in the json (if its not corrupted)
how do i fix it
Can anyone help me?
Not unless you ask your question
@dusky sundial i asked mt question 3 times
Can anyone help me create an thread to run lavalink while my bot is hosted
@dusky sundial ^^
@last lava sir^^
if isinstance(error, commands.MissingPermissions):
await ctx.send(f'It seems you are missing permissions! in particular the {MissingPermissions} one' )
Currently making a quick error handler for a command, but em- how can i send back which specific permission they are missing??
i cant find the right function
you want to have a pretty output?
Fixed.
i want it say in embed** for example**
44 seconds
3 minutes
15 hours
1 day
i guess you could use MS to convert milliseconds into a pretty output
someone told me to use pretty ms package but i am working on save storage as much i can
i literally just explained
using Date with getDay, getMinute, etc will cause the same effect
use the % operator to remove them as you go instead of diving
what does git push --force do
this is why i suggested to convert milliseconds with MS to a pretty output, but idk how it will handle stuff larger than 1 day
iirc ignore conflicts
i guess if you add -H tag or was it -h
how can there be conflicts
im not merging two branches
im adding more commits to a branch
what if 2 people work on the same branch?
then you get conflicts
usually you should resolve them
imagine not using git kraken
but sometimes you need to force it
this just gives me a Cannot read property 'first' of undefined error. am i using it incorrect? ```js
const Discord = require('discord.js');
const minute = 1000 * 60
let response = [];
module.exports = {
name: 't',
description: 'test',
async execute(message, args) {
const filter = (m) => m.author.id === message.author.id && !message.author.bot;
const collector = message.channel.createMessageCollector(filter, {
time: 1000 * 10,
max: 4
});
collector.on('collect', m => {
response.push(m.collected.first())
response.push(m.collected.second())
response.push(m.collected.third())
response.push(m.collected.fourth())
});
collector.on('end', m => {
message.channel.send(response[0] + ' \n ' + response[1] + ' \n ' + response[2] + ' \n ' + response[3])
})
}
}```
- don't define the array outside of the command,
mis aMessage, just push the contentpush(m.content)- I don't think you know how collectors work. The
collectevent is emitted when the user sends ONE message, currently you will push the same message four times in the array - Like I previously said, use awaitMessages instead of a collector
If you still want to use collectors, completely get rid of the collect event and just use the end event - the first argument to the callback is all the collected messages
@rocky dagger imagine using an async execute function and avoiding await
as i said i am going to do all of this in dms
what a nice excuse
and i amloast dont know anything about await and collect
awaitMessages works in dms...
how about you learn
i am trying
one sentence to explain await: wait for smth to finish before executing the rest of the code
i still dont know how you do it tho
if you explain it as if i was a dumb ass i might understand
swoops in https://js.evie.dev/promises

Need help of my own real quick. ```
message.guild.channels.cache.get("260228691886473223").messages.cache
.filter(m => m.embeds[0].description.includes("2 days 10 hours ago"))
.first()
.embeds[0].description.match(/<@(\d+)>/g)
So this match() is returning `[ '<@831249237349630025>' ]` instead of `[ '<@831249237349630025>', '831249237349630025' ]`
and I'm not sure why. (\d+) is the capture group isn't it? I'm sure it's stupid, but I just woke up, hadn't had my coffee, and need to ban 98 spam accounts asap
i dont remember correctly but you need a flag for capture groups ig
wait no you dont
@umbral zealot try using matchAll if you're on node v14
and remove the g flag in the regex
Ah yeah I just took the lazy route and sliced 'em in a map() lol
and it was because of a zws in there I Couldn't see
Thanks for helping though!
zero width space 😛
zamazon elasic sreach is so gud
h
h
can bot post nitro emojis
without an embed ?
Yes, it can
Show your code
If it's too long to put here you can do a pastebin
Otherwise it's fine to paste it here
you can send the file
but do it in a code block
const embed = new MessageEmbed()
.setColor('RANDOM')
.setAuthor(message.guild, message.guild.iconURL( ))
.setTitle('Server Info', message.guild)
.setThumbnail(message.guild.iconURL())
.addField('Owner', message.guild.owner.user.tag)
.addField('Location', message.guild.region, true)
.addField('Member Count', message.guild.memberCount)
.addField('Emoji Count', message.guild.emojis.cache.size)
.addField('Roles Count', message.guild.roles.cache.size)
.addField(
`Text Channel :-`,`⌨${
message.guild.channels.cache.filter(channel => channel.type == 'text')
.size
}`
)
.addField(
`Voice Channel :-`, `🔉${
message.guild.channels.cache.filter(
channel => channel.type == 'voice'
).size
}`
)
.setFooter(message.author.username, user.displayAvatarURL())
.setTimestamp();
message.channel.send(embed);
}```
Ohk
Its not showing owner
And this is an error
Anyone help?
guild.owner is nullable
not guaranteed to exist
it only exists if the owner's GuildMember object is cached
so you need to fetch it
xD
@earnest phoenix do you have a development related question?
Ye
Yes
Then ask it
Ask your question
I can german xD
await guild.members.fetch(guild.ownerID)
You can use #general-int then
Whem i asks?
das kannal ist fur programming problem
has du ein problem?
Wie mach
Thnx for help sir
ok, and you need help?
Ye
help with what?
Long?
1-2 weeks or more
Few weeks
Ok
Can I get this in tag like ibrahimpakir3#9999
Yes?
Wanna use a Moderation Bot I made?
what do you mean?
@lavish bramble Wanna use my bot
@dusky hawk this channel isn't for plugging your bot
Owner username
aw man
@opal plank this

like guild.owner.user.tag?
Yup but its not fetched
it will be cached after you fetch it
how is that related to me?
Ok ill try
imagine not checking for promises

or conditional chaining
actually
conditional chaining is the same version as d.js right?
v14 i think?
ye
should be able to just slap a ? there
Mmm
Error
tag is not defined
why tho
i mean
show your code
Erwin with his brazil internet needs to check every request Tim
(await guild.members.fetch(guild.ownerID).catch(() => null))?.user.tag
this would be better no?
his internet is better than mine tho
shhh

sure
const user = message.author;
const Owner = await message.guild.members.fetch(message.guild.ownerID).user.tag;
const embed = new MessageEmbed()
.setColor('RANDOM')
.setAuthor(message.guild, message.guild.iconURL( ))
.setTitle('Server Info', message.guild)
.setThumbnail(message.guild.iconURL( { dynamic: true } ))
.addField("owner", Owner)
.addField('Location', message.guild.region, true)
but if that errors a bunch of other things will be erroring as well
because discord borked
is discord never borked tho?
notice how i included an extra pair of parenthesis
ye but if that errors you'll likely have bigger problems xd
@earnest phoenix
hello i made a bot. But I don't know how to command.
Do you have any knowledge in programming?
Which program?
I have codes
Do you understand them?
yes
So what is your issue?
I don't know where to code, I need a command program.
What language are you programming in?
tr
Turkish
Turkish is not a programming language
no stars for you
knew the turk answer was coming 
Turkish???
Kanka türk Müsün?
evt
aha valla
Please use #general-int for other languages than English
oke
So what language program is there?
I mean, there's a whole lot of them
but the most popular ones for bot development are Python and JavaScript
Python
What about it?
yes
Yes? Okay 
ok
ok i want
I do not know much English
I'd recommend you to learn some basic Python then
how so?
thank you
np
np what?
you said thank you, i said np(no problem)
what is np?

I do not know much English
ok
@earnest phoenix move to #general-int for other languages please
and must my bot be coded in a specific language ?
or any ?
any
As long as it works
kk
and follows the rules
rules ?
this is a revamped version of my previous tutorial.
index.js https://pastebin.com/ygFNspns
server.js https://pastebin.com/HCqB385g
is this good ?
It might work, but once again, it's not going to be good
the best free host you can get is google compute engine f1-micro, but you need to have a credit card to create an account
tnx bro ❤️
repl.it is probably the best option that is free and does not require anything
but its not 24/7 it goes offline if its not active after a while
Yup
did that kid really tell everyone to go to a different website other than the discord dev applications 
Beep!
it goes offline if repl or uptime do a fuckup, other than that, its online
you still need to setup an external service
?
repl.it goes offline for inactivity
but there are services like uptimerobot that can be used to keep it online by regularly sending it requests and not allowing it to go inactive
so yes there are tricks to make it stay online longer
paid plans never go offline
ok ty
Use heroku
use an actual vps
OVH:
Heroku paid plan better
But expensive af
Excuse me sir but my server appears to be on fire
cant compare with an actual vps lol
thats when you use an actual vps cause hacker plan cost more 
oh yes very worth much wow
yea I typed its 7 $ only
ok I heard there was a new way voor vote webhooks etc. (https://www.npmjs.com/package/@top-gg/sdk). Is it right that that package only replaces the webhook and the rest should go the old way (including the <dbl>.on(error event)?
Rewrite it all
😬
Lang: Python
Files
main.py
logo.png
Code py "small_image": "logo.png"
very professional
Is this the correct way to use img in python? Cuz the img isnt being displayed by the programm
wat
...
Can I get a database with infinite storage
no
I think theres no such thing as infinite storage
Nvm figured out the solution
@earnest phoenix what do you want to do? why did you get sublime text?
...
So what can I use for database with maximum storage
what did you tell them that made them tell you to use sublime text?
exactly
I dunno...
They kinda say
what can I use for my database
OH FU I FORGOT
is there anything you DO know? every time you come here with weird out-of-context questions and when we ask more information about what you actually want you just say you dont know lol
we cant help if you cant explain what exactly are you trying to do
No... its 7$ for hobby plan
Which is also of double price
But the git deploy is worth it perhaps
Can I still use this code with the "new" dbl api?
// changed line:
const dbl = new DBLAPI.Api(DBL.token);
dbl.on('error', (error) => {
consoleLog(error.stack);
});
dbl.webhook.on('ready', (hook) => {
consoleLog(`DBL webhook running at port ${hook.port}!`);
});```
no i dont think so
i get a TypeError: Cannot read property 'send' of undefined error when i do this and i have the correct id and name```js
const bountyChannel = client.channels.cache.find(channel => channel.name.toLowerCase() === 'bounty');
bountyChannel.send('hello');
or
const bountyChannel = client.channels.cache.get('channelID')
bountyChannel.send('hello');
nope
hm thanks. Do you know an alternative? Can't see it in the documentation
the channel you're trying to find was not found
but why? i have the correct id and name
where are you using that code?
Discord should fix its mobile copy text and also copy formatting such as ** **
oh wait I'm in the wrong channel for this
top.gg sdk does not use events
in a async execute(message, args) {
idk if thats what you mean
@quartz kindle so there's no way to know if your webhook is ready or if there's any error?
it's not in the docs
show your code
registerCommand(Command) {
if (typeof Command !== 'function') return;
let command = new Command(this._config, this.beta)``` this isnt registering commands all of a sudden
its all manual, there is nothing automatic
you post your server starts yourself in an interval, so to check for errors just catch the function
no I found another package for that
and webhooks are used in a webserver as a middleware so use your webserver's own events
ok but still no error event?
const Discord = require('discord.js');
const client = new Discord.Client();
module.exports = {
name: 't',
description: 'test',
async execute(message, args) {
const bountyChannel = client.channels.cache.find(channel => channel.name.toLowerCase() === 'bounty');
if(!bountyChannel) {
console.log('channel not found');
} else {
bountyChannel.send('hello');
}
}
}```
yes only a 'posted' event, but I only want to know when something's going wrong
but if that event doesn't exist, I think it's not relevant
you're using the wrong client
new Discord.Client(); creates a new discord client, completely empty and not logged in
Ohh
Object.keys(inventory.inventory).includes(itemToUse);
I have this object called inventory and I have a property called attitudecoin that is stored as a value to itemToUse.
How can I check if the value of attitudecoin is more than 1?
I love how it's highly available too 
Filter I guess
Why would I want to filter?
Filter by item name and check the array length
plot twist, its not
xD
honestly at that price the server better be inside a nuclear bunker
Does this work? inventory.inventory[itemToSell] >= 1
if the value is the item count, yes
the first inventory ignore that.
Second inventory is the object.
The bracket notation value is the item ID
or as known as the property
so we take that value and check if its greater than 1.
Correct what I did?
Well, yes.
👍
Thanks! :)
Is there no not greater than or equal to symbol?
whats the double = for ?
strict equality
same value and same type
is that like Type bounded or something ?
like 1 == "1" is true but 1 === "1" is false
for (const file of files) {
this.registerCommand(requireReload(file))
}``` is returning command first alias
so just const client = Discord.Client();?
then i get ReferenceError: client is not defined
you have to find how to get the client from other objects
oop
in the case of your code here, message.client is a thing
(node:2416) UnhandledPromiseRejectionWarning: C:\Users\Mohammad Hajjiri\Desktop\Attitude\src\commands\economy\inventory.js:80
if (key === 0) continue;
^^^^^^^^
SyntaxError: Illegal continue statement: no surrounding iteration statement
const mappedData = Object.keys(inventory.inventory)
.map((key) => {
if (key === 0) continue;
...
}).join("\n\n")
Did I do something wrong?
Bruhhhhh
Alright, thanks!
hi can someone pls help me setup fact of the day bot plss?
its teh fact of the day bot that i wanna setup in my server
Ah ok in this case this is the wrong server. You're on top.gg server not the Fact Of The Day support.
oh thx
Your client should store the session_id from the Ready, and the sequence number of the last event it received
can someone explain where i should get the sequence number from
OH
nvm
how can i have a difference presence for each shard of the bot?
yes
hi guys !
hey !
anyone know an npm package for music filters? ( 8D, bassboosted)
are you using lavalink?
noup
ffmpeg?
discord-core
discord-ytdl-core ah
yes ffmpeg too
yes
i want to add filters
xD
maybe premium command 🙂
use discord-player ezier
have u an example
no spoonfeed
yea sure
yes but how do i do that each shard has a different presence
Get the amount of all shards, loop through each one of em, set a status depending on the id or just randomly
js find of the day:
a = [""]; a.pop(); a.push("a");
is faster than:
a = []; a.push("a");
Sorry what
yes

30% faster
the reason is simple
[""] tells v8 to create an array of strings
[] tells v8 to create an array of unknown type
when you push a string, it has to convert the array type if its different than the value type
Can someone explain me the difference between client.on and client.once in Discord.JS, i never had to use .once and their difference is explained nowhere
Once executes the callback... once when the event occurs
no
.on() can run multiple times. .once() will run once and then self-destruct so it won't run again.
So if you were to do something like client.once("message", msg => console.log(msg)) it would get one message, then never react again.
I was trying to say the same thing, should've worded it better
yeah sorry I misread what you said, Google. somehow my brain saw "error" instead of "event" 
arggghhh so it wouldn't fix my problem, i have a problem with my event handler that copy data in bad place in my BDD, i thought .once would fix that but apparently not
yeah no definitely not a solution for that, unfortunately.
anyway thx for the explanation
const mappedData = Object.keys(inventory.inventory)
.filter(key => key !== 0)
.map((key) => {
const itemName = items.find((val) => val.id.toLowerCase() === key).name;
const itemID = items.find((val) => val.id.toLowerCase() === key).id;
const itemLogo = items.find((val) => val.id.toLowerCase() === key).logo;
return `${itemLogo} **${itemName}** ─ ${inventory.inventory[key]}\n**ID:** \`${itemID}\``;
})
.join("\n\n")
embed.addField("Owned Items", mappedData);
I applied the filter, but doesn't seem to work.
I was planning to add continue in map but doesn't work.
Is it advisable extend the Client class?
yes
As you see, there is a value of 0 but I don't want that so I am filtering but doesn't work.
just .filter(k => k)
because you compare it to a string in the map callback
so the numbers there, 0, 1, 2, that looks like it's inventory.inventory[key] which yould mean it's your other array that's returning that value
not the key
Try a loose compare
val.id.toLowerCase() === key if this is returning true then key is 100% a string
if your inventory is something like js { a: 1, b: 2, c:0 } then when you do Object.keys(inventory) you get ["a","b","c"]
aka, the KEYS of the object
of course you cant filter the value like that
the keys could be numbers
I mean, strings containing a number, object keys are always strings
That's why it doesn't work, he's strictly comparing if the key is 0
and it returns false cause key is a string
if the server goes out of ram, pm2 just stops the process?
It restarts it if that option is on (it is by default I think)
whats the option? the --no-autorestart keeps turning off my bot on the vps with no reason
It restarts the bot by default
not restart
--no-autorestart, like the name suggests, doesn't restart it
I messed up.
When the auto restart option is on?
keys were the properties and I had to deal with the values not the properties.
.filter((_, value) => value !== 0)
when is it good to use multiple event listeners
thats not how filter works
the second parameter is the index
use a map or djs collection instead of an object for your inventory
not the value of the item
that way it is wayyyy easier
it worked only because its the first value thats 0
When you want to structure your code, I guess. Let's say you have two different functions which do two different things but need to listen to the same event, you can put them in a single event listener, which will make the code messier, or you can just have two different event listeners for the same event
It used to return the 0 part.
if any other value is 0 it will not work
Someone here uses pm2?
you just said multiple message event listeners for multiple command functions are legal
Oh.
No, there are better approaches for commands... Treat the entire command handler as a single component which uses one event listener
What now. pain
Sorry for the ping, but what can I do now to filter?
you have keys, not values
so if you want to filter the keys
you have to do something with them
keys is the properties, but I want to fill the values
Use Object.entries instead
to get the values they are assigned to
omfg, I forgot what's called when you can align the text at different hanging points
for example
Or just inventory.inventory[key]
.filter(key => object[key] > 0)
I am trying to deal with the values of the keys
I am doing that.
Hm, let me try
bruh
can someone respond me? : (
Works. 🎉
i use pm2
one of my process suddenly shuts down every like 2 days and i dont know why
logs dont say anything
pm2 logs yourprocessname --lines=500
css property?
that's text-align
but I wanted the image that shows you those alignments at W3
nothing, just the bot logs
I can't find it xD
I have this but there isn't the image I saw somewhere around here
what are the last logs
also scroll up to the errors section and show the last logs from there
i think i know whats happening
PM2 | 2021-04-15T15:05:10: PM2 log: App [doom:0] exited with code [1] via signal [SIGINT]
PM2 | 2021-04-15T15:17:25: PM2 log: Process 0 in a stopped status, starting it
PM2 | 2021-04-15T15:17:25: PM2 log: App [doom:0] starting in -fork mode-
PM2 | 2021-04-15T15:17:25: PM2 log: App [doom:0] online
its a mongodb connection error
the vps keeps disconnecting mongodb
anything in the error logs tho?
did you scroll up to the errors section?
0|doom| ReferenceError: client is not defined
0|doom| at NativeConnection.<anonymous> (/root/doom/mongodb.js:24:61)
```is the lastest error from like a week ago
fuck google im moving to aws
lol
well he said thats from 1 week ago
(node:5100) UnhandledPromiseRejectionWarning: TypeError: Class constructor AddRole cannot be invoked without 'new' if i add new (node:5272) UnhandledPromiseRejectionWarning: TypeError: Command is not a constructor
read docs, you're trying to add a role the wrong way
no, im trying to run the command, it wont even register the command
/**
* Register commands to client
* @param {Command} Command command class to add to client
* no async/await for performance
*/
registerCommand(Command) {
let command = new Command(this._config, this.beta)```
show your Command file
'use strict'
const { Command, Color, MessageEmbed, FailureEmbed } = require('../../')
/**
* @class AddRole
* @extends Command
*/
class AddRole extends Command {
constructor(...args) {
super(...args);
this.name = 'Add Role'
this.aliases = ['addrole', 'createrole'],
this.group = 'Administrator',
this.description = 'Add a new role, with optional color and hoist.',
this.usage = 'addrole [hex color] [name] [hoist]';
this.example = 'addrole #748bd4 test true';
this.botPermissions = 'ADMINISTRATOR',
this.permissions = 'MANAGE_ROLES'
this.parameters = [{ type: 'color', required: false},
{ type: 'string', required: true, missingError: 'failures:commands.createRoleFailure'},
{ type: 'boolean', required: false }]
}
}
module.exports = AddRole;```
thats the command file?
or is Command internal?




