#development
1 messages · Page 1085 of 1
how else would i do it then?
you might want to add more break; for each switch case
i didn't knew
a
@pure lion i will see u in dms sooooon
@quartz kindle rate my stupidity
@delicate shore depending on your internet Speed / Speed of your machine it can take easy 30 minutes
@opal plank 37/10
you prob right about having to cast type
@delicate shore depending on your internet Speed / Speed of your machine it can take easy 30 minutes
@lusty quest oooooooooooooooooh no 😭
though im trying to figure out howhavent used typeof nor declarations for this
@solemn latch yes
basically yes, but it also has other features
the break fixed it, thanks @quasi hearth :)
Intresting
rip
newest features before they come to js too
JavaScript but strict.
im loving Es11
if you're used to languages like c++, typescript will make js much more similar to what you're used to
Js is like a pig, whatever you throw at its direction it'll eat it and yoink happily at you
lmao
Ts you gotta properly make sure everything is in place
Ah, so not for me.
Someone who throws stuff at a wall till it sticks
same
i write sometimes overcomplicated code
How do I fetch user (using arrow functions)
like stuff you can solve in 1-3 lines
its definetly fun to play with, specially cuz if gives you a good idea of statically types oobjects from other langs
fetching has nothing to do with arrow functions
it will tell you when its done
ok
you can fetch users with client.users.fetch()
i was kidding about the any type but im really tempted now
i have to sleep i will go and set my status to online and come back when
someone pings me
so you set your status to "online" when you go sleep?
ye
make sense
lol
When I'm asleep, that's my most online time.
ah yes, antipatterns
const Discord = require("discord.js");
.then((message: Discord.Message => ...
say i have a date object, how do i work out if that date is within the last 24 hours of the current date
js
Yeah, discord.js is a pain to use with typescript
@sick cloud compare it with the current time and if the difference is 24 hours do what you need to do.
i'm asking how though
also that doesn't make sense, i only want it to match if the date object (which say is created 17 hours ago) is within the last 24 hours of the current date as in now
ok
if it's less than Date.now() it's in that time
you could also compare dates
or greater than*
hi
i have an array of messages and basically only wanna filter them to ones that have been added in the last 24 h
can I ask something ?
each msg in the array has the date prop which is when its added so
it should be a flag
@amber fractal can you give me a rough idea on the logic i need for this, its 1 am so i get barely anything tbh
<Date in ms> + 86400000 > Date.now()
ok got it
@formal drift early supporter is a flag contained in UserFlags
You can check flags of a user by
<User>.flags.toArray()
huh
am i doing this wrong somewhere
there's def messages in the array
activity.messages.filter((x) => (new Date(x.date).getTime() + 86400000) < now);```
oh ok
ay worked
thanks
and the same logic would apply for say 7 days and 1 month right
yes
just +more time
isn't that just for cached messages
*cries in how the fuck do I webserver*
I use express for my ejs webserver
Port out of your vps?
can't get node gyp to rebuild properly https://hasteb.in/ifazewap.sql
If you dont know, your probably not containerized
Have you tried going to the page?
Ip:port
@sick cloud error MSB8036: The Windows SDK version 10.0.18362.0 was not found
and how do i fix that lol
try repairing your vs installation, or install/reinstall windows-build-tools
vs 2019 might not be supported yet
.
why it could not install lol
check the log files in that folder
there's no logs in that folder relating to build tools
Hey Tim, Can you suggest me a free chatbot api, that can respond to the user's messages?
Free? No
@sick cloud do you have any visual studio installed?
yes
@rocky hearth idk i never used any chat api
i dont
i uninstalled all these things earlier by accident because i ran out of hdd space
running in admin powershell right? any logs?
@quartz kindle
Hey it's been over 40 mins almost and it is still showing same thing saying successfully installed python 2.7
@quartz kindle no idea how to fix this anyways, is there something i can install
read the rules
we don't spoonfeed code
@solemn latch yeah, returned timeout
@solemn latch yeah, returned timeout
@pure lion
E
how much time
Does it takes
I am tired
Yeah
@pure lion did the guy who host you the Docker Container allocated the port? and added it to the firewall of the host Machine?
it can be stuck or it still works
@lusty quest I'll look i to that
its possible that your CPU is just super slow
;-;
or abort it and try again. it should recocnize python as installed
press the up arrow
just to make sure your prefix can't have capital letters, right?
rip
arrow key
the one where you run it first
did you closed it?
Yws
i dont say close it i said abort it.
What is abort ?
scroll up in the channel and see what Tim wrote
yes
bcs it compiles some stuff
it will not install python
well then it was just a bug
what language?
im not sure want to know what language before firing with Docs
assuming its d.js
can you put multiple prefixes in config.json?
{
"prefix": ""
}
np
at Object.readdirSync (fs.js:872:3)
at Object.<anonymous> (C:\Users\Harjap\Downloads\accurate-thin-mango-2020-07-25_134817 (extract.me)\app\index.js:67:4)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\Harjap\Downloads\accurate-thin-mango-2020-07-25_134817 (extract.me)\app\server.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:1133:30) {
errno: -4058,
syscall: 'scandir',
code: 'ENOENT',
path: './gifs/'
}
PS C:\Users\Harjap\Downloads\accurate-thin-mango-2020-07-25_134817 (extract.me)\app> ```
i don't even need the
gifs folder
then dont require it
@earnest phoenix https://discord.js.org/#/docs/main/stable/topics/voice
assuming its d.js
i think A I is useless for Discord Bot
lol you just dont think on a large enought scale
it is useless is some way but usefull in other
Dude it is so slow
ffmpeg
hi
music is a complex subject
I am not supposed to be here
@earnest phoenix it says in the guide
continue reading the link i sent you
all info is there
I need help
if(!coins[message.author.id].coins ){
return client.music.sendEmbed(message, "Test numéro 1.")
}
let pUser = message.guild.member(message.mentions.users) || message.guild.members.get(args[2])
let pCoins = coins[pUser.id].coins;
let sCoins = coins[message.author.id].coins;
if(sCoins < args[2]) return client.music.sendEmbed(message, "Erreur 1")
if(sCoins > args[2]) {
coins[message.author.id] = {
coins: sCoins - parseInt(args[2])
};
coins[pUser.id] = {
coins: pCoins + parseInt(args[2])
}
}
client.music.sendEmbed(message, `${message.author} a donné ${args[2]} a ${pUser}.`)
help with.....?
some context would be nice
[25/07/2020] [Error] TypeError: Cannot read property 'id' of undefined
WHICH id?
yes
does it say what line?
let pUser = message.guild.member(message.mentions.users) || message.guild.members.get(args[2]) i think you want here message.member
but you dont really need the member property user does the job too
and for mentions you probably want message.mentions.users.first()
Any tips for advertising our bot?
auctions ?
add it to Top.GG and apply for auctions -> they are not Free
but adding it alone give you some advertisement
Not paid
and get it approved

why have u got 2 message events 
thats not the issue, ur just gonna get a memory leak
but that code goes in the if statement
use if/else
what could go wrong if i attach all my 130 commands with an event each?
what could go wrong if i attach all my 130 commands with an event each?
@opal plank everything
naaah tis fonna be foone
or even switch/case if you're feeling efficient
yea
but that code goes in the if statement
@digital ibex
music is complex, youll have to do a lot yourself
music v. complex
Look at other bots also it's not really a "development" question ask in off-topic for ideas.
judging by the fact that you are using 2 message events you probably shouldn't be making a music bot
sad
why?
agree with jeremy
doesnt really change anything about how the bots gonna perform / functions
i mean, you can just use if/else / switch/case / command handler
apart from the memory leaks, @digital ibex
still doesn’t change anything tho
yes
still not gonna really change what the bot can do tho
lol
he doesnt seem to know js at all

hi
making a bot itself doesnt seem like a good idea in that case
prob w3school snippets first to at least get a hang of js
ye
Don't be like yandere dev - use switch case unless it's an openGL app that for some reason can't read keys dynamicly and it's retarded
i need help, dm?
No send here
i mean
This is literally the purpose of the channel
send here.
make a bot with no coding experience sure
I did that
same
making a bot with no coding experience and just being stubborn no
@earnest phoenix my iq haheyyy that was a joke
and a few websites
thats a bit hypocritical, jeremy 
altho it was mainly copypaste 
unity 🚮
unity got better recently but unreal engine still easily tops it
i don't know if you all saw the UE5 trailer
but holy shit that is powerful
in UE5 you'll be able to use movie grade assets with no performance cost
can you ask the question
that make me wanna start game dev
its hot af
can you ask the question instead of saying Can someone help me?
@digital ibex check my GitHub repo of my first game it's the ray caster thing and it's shit but it's my baby and I love it so much aaaaaaaaa
p.s. people in development channel != crystal ball woman 
whats ur github?
if (true)
println("hi")
... i have a brainfart rn, cant think of a way for having a number stored in a value accesable in mutiple files that can also be updated (updating the guild count without restarting)
use a databsae?
how is it 🤔
if you don't need it to be persistent
multiple files, as in exports?
was thinking on collections but for some reason i have a brainfart with how to allocate it
just pass the variable around through functions
oh
quick question if anyone knows, im getting this error: js FetchError: invalid json response body at <url here> reason: Unexpected end of JSON input
i've read: https://stackoverflow.com/questions/58374497/fetcherror-invalid-json-response-body but it just confused me. any ideas?
the code is just: ```js
body: { "content": "${content}", "username": "${webhook.name}", "avatar_url": "${avatarURL}" }
oh
^ Also, why not just create an object then use JSON.stringify instead of entering the raw JSON like that
how can i make it format the json response properly then?
because stringifying an object is slow
sure it would
any ideas?
Maybe you aren't getting JSON as a response
it returns an object
in order for discord.js-light to save ram, does cache in the .fetch methods have to be false
@digital ibex https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
i dont think object is a content type
officiallylost? more like officially lost all my respect
Lol its my code roast me or you cant biiiTch
returns a json
save more ram than cashing
doesnt djsL have ways to clear cache? thats the main benifit
i've already told u..
multiple people have
@earnest phoenix https://discord.js.org/#/docs/main/stable/topics/voice
coneaczon.pley(emm pee three file)
@celest schooner d.js-light also clears the cache from users /channels that where not used for 24 hours (not sure if you manually need to use the function for this)
got it
if you want to save more use jemalloc
oka
or make ur own :p
in the longrun it can cut down on ram usage
yeah, likly will increase steadily for the first 24 hours then level out
I need to swap to djs-l
yea this is for doing it manually
does it do it auto matically?
Woo do it you gotta
idk
automatically
@quartz kindle does discordjs light sweep cache automatically?
tim has a server
Omfg
oh
i can find the link if ya want
yes pls
🤔
does that work wth
lol
got me
cant pm ya, gotta open dms for a second @celest schooner
@celest schooner you need to manually sweep
oh
but its easy to make
make a timer that runs every like 24 hours and this calls the 2 sweep functions
How do I remove the Bot ghost thing
The what
ik
will also work but it has both the same effect. since it will anyways do it every 24 hours if not changed
'
How do I remove the Bot ghost thing
@stray wedge you code a real bot
well, if you only clear things that are 24 hours old, and only once every 24 hours.
things could live for 48 hours
theoretically
well, will
also im not sure what is more rescource heavy. a functions that does something every 24 hours called every hour or called once in 24 Hours
buy the premium version to remove the status
what about once every 24 hours clear
i have it running like this
since it doesnt make a difference bcs everything starts to get cached when the bot starts. i start the timer when the bot starts
right now, i have excess ram, so id go once every 24 hours, and have stricter caching cleanup if needed down the line
did you got this much stuff running that you need to cut down this much?
i runn currently ~95MB ram with about 180 Guilds
im running a bot 448 servers 100 ram not even
optmized
that doesnt include everything else tho\
like node
and stuff
the 95MB is just the node process
Poor Tim
I heavily optimized for cpu. some of my commands are some of the heaviest cpu using commands of any bot i know
calculating gogol?
yus
https://github.com/timotejroiko/discord.js-light#clientsweepusers
yeah so the correct way is to call it yourself
yep
is there a way to sweep guilds
I want to replace all /t in a string. So I tried <string>.replace(/[/t]/g, ' '), but that doesnt seem to work -- since it adds 2 spaces for some reason. Anyone knows why this happens?
roles are not that heavy too
users are the worse to cache,. no?
while you would have 400 guilds cached, you'd have over 300k usuers cached
@earnest phoenix your replace the /t with 2 spaces
where?
, ' ')
thats one space innit
i havent fucked with cache, but im politely assuming users would be the biggest chunk by far
Tims endgoal is to make it be able to be cacheless.
which i presume, in time more things will be sweepable
its already without caching exept Guilds (default)
working*
wait, tim made djs-light
yes
yeah
yus
o
lul
thats one space innit
@earnest phoenix
@quartz kindle big brain
ahh yes by bot just random Errors with the message: null. ive added to every catch function a way to determine where the error appears but i cant find this one
YAY I FINALLY GOT MY BOT TO MAKE EMBEDS
I just made one mistake
i just wrote one word wrong
@lusty quest looking into it, so far no idea
me neither
its also possible thats somewhere in my code
its nothing critical but a red message in the logs is a bad sign.
How can I use .map() on discordjs light .fetch() things
since .fetch returns an object
fetch returns a promise
oh
what do you want to map over?
i want to map all the guildmembers IDs
you'd need to fetch all members first
guild.members.fetch().then(members => members.map(...))
or
(await guild.members.fetch()).map(...)
got it
or use the fetchAllMembers client option
if you dont want to cache the members when fetching, you can do .fetch(false)
it tries cache first, then discord
got it
Hey guys
can someone send me a code of the following
I want it where that if someone doesnt have a specific role in a specific server, it will return
if it doesnt have the role id = roleid
can anyone send me the code for what I said, as I couldnt figure out how to do it.
discord.js
or lib
and then call it your function where you want to check the role
idk how, sorry.
thats why I needhelp
if someone doesnt have a specific role in a specific server, it will return
did you know the id of the role?
Yes
or the name?
some returns true/false of arrays.
or the array of someones roles.
if()
then just check make a if check for the guild and inside the check make a check for the command author if he got the role or not
then just check make a if check for the guild and inside the check make a check for the command author if he got the role or not
@lusty quest I said idk how the code is.
||
||
it’s ||
lol
can anyone tell me how?
how what
the code for it.
no.
if someone doesnt have a specific role in a specific server, it will return
na we don't spoonfeed unfortunately
did you even read the rules?
usersroles.some()
oh wait nvm
let the man enjoy his double d's
0.0
@client.command(pass_context=True, hidden=True)
async def setprefix(ctx, *, nprefix):
nprefix = nprefix.strip()
if nprefix != "":
try:
prefix = nprefix
await commands.Bot(command_prefix=prefix)
except:
await ctx.say("`Error: no prefix entered.`")
else:
await ctx.say("`Prefix has been changed to:` **{}**".format(prefix))
I get the error ERROR asyncio Unclosed client session
if(message.member.roles.cache.includes("roleid")){
//your code
}
}
``` @feral aspen something like this

I will try! 😛
not sure if it will work tho
oh god
but it gives you some pointers in how to do it
what else gives you pointers? the docs
read docs
v12?
🤔
but it gives you some pointers in how to do it
@lusty quest question
if(message.member.roles.cache.includes("roleid")){
//your code
}
}``` In the id = premium guild
what do I replace the premium guild with?
with this id = 'serverid?'
this is the spezific guildid you wanted
the docs explains how to use createchannel
Pointer explanation:
== Is for comparing everything
=== Is for comparing an string with an string or number with a number or object with an object``` @feral aspen
😐
you need atleast 2 = for comparing the guildid
1 = 1 // sets 1 to 1
1 == 1 // 1 equals 1
1 == '1'// number 1 is equal to string 1
1 === '1' // number 1 is NOT equal to string 1 (different types)
its says its not a function
roles.cache is a collection, not an string or array
So roles.cache.has("role id")
?
wiggly
oof

Bruh lemme get my telescope
😂
open link, chrome at 950% zoom
lool
imagine harcoding tokens
wanna see my token?
oh good, im not the worst one 
my token is config.token please don't steal it
my index is 29 lones bruh
Fixed
in a older version i had a reply to fuck you bot
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit
Please help
use one listener
you have 11 message listeners
no need for more than that
@earnest phoenix i am from turkey
why is it always 11?
@haughty igloo Glitch ?
are they copying from somewhere?
@lusty quest yes
Madara Uchiha looking ass
@earnest phoenix XD sure
@haughty igloo o bir hata değil
and you try to play music?
@earnest phoenix napmam gerek
Birşey yapmana gerek yok
@earnest phoenix wot, you're talking to a RegExp proficient, let's see it anyway
lol
ok
@haughty igloo did you try to play music?
@lusty quest it works, thanks
Bro bot offline
Not use bot all commands
https://ptb.discordapp.com/channels/264445053596991498/272764566411149314/736659575524163657
https://ptb.discordapp.com/channels/264445053596991498/272764566411149314/736371778368176131
https://ptb.discordapp.com/channels/264445053596991498/272764566411149314/735881306109378630
https://ptb.discordapp.com/channels/264445053596991498/272764566411149314/735482017923203153
https://ptb.discordapp.com/channels/264445053596991498/272764566411149314/733805167060713593
Where the fuck yall copying your shitty code from?
Not use bot all commands
agreed
Please hell
@haughty igloo your un out of Memory this is why you get the error
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit
@lusty quest dm pls
its always 11 listeners
i mean, clearly, still though where they taking this source from?
@haughty igloo that would always happens of your boy is running low on memory
Don't even bother trying to find out why
lmao fair enough
Some Turkish tutorial that's very popular
lool
@slender thistle wdym bro pls help
that would always happens of your boy is running low on memory
boy
@earnest phoenix
Lol
gib badg plx
Pls help
Start using if statements instead of multiple events in your code.
@haughty igloo your Glitch project runs out of memory, you need to shave down on it or get a proper VPS
you only need one
client.on('message')
@opal plank me?
yes
yes
bot.js?
yes
yes
@haughty igloo there's 2 reasons that would happen
2- Nested events```
1 min
gottem
how to make 10 message spam command
@earnest phoenix no
inc
no
i try
Api abuse 
spamming = api abuse = ban
but not online
Spam is against Discord ToS
Guys its says bot waiting in approval
i told u
he added another one
I made the bot using DBD
@haughty igloo Show your code
token incoming
client.on('message') @slender thistle
Bruh he went to add another listener
@earnest phoenix what
Guys its says bot waiting in approval
@earnest phoenix u wait lmao?
check #502193464054644737
i write but not online bot
im.... going watch a youtube vid
Pleasee help
@haughty igloo https://www.w3schools.com/js/
Be nice
read that
did we got someone here who could tell him in his native language what is wrong? i guess this here will not work
Be nice
wdym i am
@haughty igloo and you, calm down
token incoming
@opal plank
lol
you need to know js before attemping to get a bot done
stfu
at least a bit
Omg this channel's confusion is more worse than api abuse
@haughty igloo https://www.w3schools.com/js/
@opal plank wdym bro
Help
shivaco being rude
You need to know Javascript (Programming language) to make bot @haughty igloo
not nice
yeah, thats why i stopped talking, too many people needing help at once
@earnest phoenix help me. how to make 3msg reply command
@earnest phoenix no
that's api abuse
5 people have asked a question
@opal plank bro i know but i not look this code
at least take a look at this https://discordjs.guide/
@opal plank u help my bot?
@solemn latch usually they smell when someone needs help so they can jump with in the convo to maybe get some help too
bro 75+ servers

send one message, with all the content of the 3 messages @earnest phoenix
api abuse
but offline because have fix
use else if
Yes
wtf is even happening
what i do?
Hey, so I am discord.py. I want to make a command to get the server boost status of a server. How would I do this?
shivaco it's your time
Bro
@haughty igloo
// What your code is supposed to look like
client.on("message", function(message)
{
if message.content.startsWith("!command")
{
// do stuff when !command is ran
}
if message.content.startsWith("!second")
{
// do stuff when !second is ran
}
})
// WHAT YOUR CODE ACTUALLY LOOKS LIKE
client.on("message", function(message)
{
if message.content.startsWith("!command")
{
// do stuff when !command is ran
}
})
client.on("message", function(message)
{
if message.content.startsWith("!second")
{
// do stuff when !second is ran
}
})
}```
@slender thistle bot.js?
oh no
yes
where is it?
or index.js whatever it’s called
Can this chat calm down for a second
yessir
index.js?
@earnest phoenix stop
k I’m out, I’ll see yall later.
sorry
Python on top
@earnest phoenix do u need help or what
ahaha
Yes
if statement incorrect
ok
@earnest phoenix bro index.js?
Hey, so I am discord.py. I want to make a command to get the server boost status of a server. How would I do this?
@earnest phoenix
bro
Im working with java
x)
@earnest phoenix Asking too much from someone who doesn't use JS on a daily basis
@earnest phoenix read the docs
https://discordpy.readthedocs.io/en/latest/api.html?highlight=guild#discord.Guild.premium_subscription_count
Makes sense
@haughty igloo
// What your code is supposed to look like client.on("message", function(message) { if message.content.startsWith("!command") { // do stuff when !command is ran } if message.content.startsWith("!second") { // do stuff when !second is ran } }) // WHAT YOUR CODE ACTUALLY LOOKS LIKE client.on("message", function(message) { if message.content.startsWith("!command") { // do stuff when !command is ran } }) client.on("message", function(message) { if message.content.startsWith("!second") { // do stuff when !second is ran } }) }```
@slender thistle where is it i write code
If you are willing to contribute, feel free
You only put the top half
he speaks turkish
so he probs doesn't understand
ill explain
@haughty igloo You replace ALL your client.on("message") stuff into ONE event
im ded
You have more than one
@slender thistle event where is it?
@haughty igloo Sorun ney :d?
client.on("message") = "message" event
Turkish in #memes-and-media
Language wars are unproductive. All languages have their purposes and uses. You may have your personal preferences or opinions, but arguing accomplishes nothing. Civil conversations discussing languages without getting emotions involved is ok, just shitting on something is not. Those involved in language wars will be muted.
thank you shivaco
Hi we have #memes-and-media for jokes
😔
Well, God help my soul
my prayers and condolences to you shivaco
Hey I am new here
Gotta love how people decide whether you help in DMs for you
Hey there, need help? @young patrol
Kinda
It says that my bot needs approval and I have no clue what to do :/
e
anyone got any ideas how to fix this error? ```js
FetchError: invalid json response body at <url> reason: Unexpected end of JSON input
wait
It says that my bot needs approval and I have no clue what to do :/
@young patrol you need to wait
It says that my bot needs approval and I have no clue what to do :/
@young patrol wait
approval here or in discord?
are the 100 limit in place?
.-.
3 or more sounds more appropriate currently
in october
OfficiallyLost for experimenting, you could fetch it, convert it to raw text (.text()), and log it to see what you get.
october 7th
7th?
6.10.2020
oh same as d.js?
6th?
deprecation
i thought everything was updating 7th
And how do I get the not developer role? Just asking
6th is the last day you can use it
7th everything more than 100 needs to get approved to get more guilds
congrats
And how do I get the not developer role? Just asking
bot*
get bot approved
you need to add a bot and get it approved
my website now live update guilds users and channels
be careful with that
privacy concerns and whatnot
cant just let anyone see that in any guild
yeah you cannot post info about guilds/channels to people that arent in it
privacy breach
counting your guilds isnt a privacy breach
it's literally displayed when people add your bot
counting? no
he didnt say counting 🤔
displaying info about guild, ids, messages, members, updates, status, is
If it's in your privacy policy you can do it









3+