#development
1 messages Β· Page 1839 of 1
how's roles undefined https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=roles
so msg.member.presence?
yes
TypeError: Cannot read property 'status' of null
@near grotto from the official docs
guild.roles.create({
name: 'Super Cool Blue People',
color: 'BLUE',
reason: 'we needed a role for Super Cool People',
})
.then(console.log)
.catch(console.error);
I have a variable
var msg = "a b c d e f g h i j";
I also have an array
const arr = ['b', 'g']
I have another array
const arr2 = ['m', 'n']
I wanna replace arr with arr2 in msg so that the result be
a m c d e f n h i j
How?
The <GuildMember>.presence property is nullable if you either don't have the GUILD_PRESENCES intent or if the member is offline, try fetching the guild member by <GuildMember>.fetch() and see if you receive the presence data
for(let i = 0; i < arr.length; i++) {
msg = msg.replaceAll(arr[i], arr2[i])
}
Use a for loop and iterate through each replacement:
// Using your example.
// Define a message in a string.
let msg = 'a b c d e f g h i j';
// Define the replacers, but instead of 2 arrays containing the replacement information, we'll use objects instead.
const arr = [{
placeholder: 'b',
replacer: 'm'
}, {
placeholder: 'g',
replacer: 'n'
}
/* And goes on... */
];
// We loop through each object.
for (const obj of arr)
// We re-assign the value of the original variable to the modified string while also replacing each value accordingly by the defined properties.
msg = msg
.replace(
new RegExp(
obj.placeholder
.replace(/(\W)/g, '\\$1')
),
obj.replacer
);
// You can replace `msg.replaceAll(obj.placeholder, obj.replacer)` if you're using Node.js v15 and higher.
tim vs volt 
@near stratusthx
const arr = [{
placeholder: 'b',
replacer: 'm'
}, {
placeholder: 'g',
replacer: 'n'
}
/* And goes on... */
];```
thing is I don't define the arr, I get them from .map()
then include that in the code you show
intellij got yet another update
now it has a JPA entities manager
like, it's going beyond the limits
No stop
orphans only cause trouble 
π
Isn't replaceall since es12?
i actually love to static import enums directly
best moment of old vps
Thanks
Thanks for the explanations
Hi SirTimme
anything that is accessed through cache isn't guaranteed to be available
in your case, guild is not cached
so it returns nothing (aka undefined)
wdym
I mean what I mean smh
oh wait
Can anyone tell the usage of npm package youtube-notifications
hello 
let list = await filter.find();
if (!list) {
new filter({ filter: [] });
await filter.save();
list = await filter.find();
}
console.log(list.filter)
await list.filter.push('Hlo').save()```
```js
SCHEMA:
const mongoose = require('mongoose');
const config = require('../../config/config');
module.exports = mongoose.model(
'Filter',
new mongoose.Schema({
filter: {
type: Array,
default: []
}
})
);
Error : list.filter.push is not a function
I assume it allows you to get youtube notifactions idk
read their readme
ima assume filter isn't an array in this case then?
list.filter is probably not what you think it is
i didn't get it correctly
Que?
?
misty had a BR moment
find is empty cause it returns an array
How to solve it?
Well
Assuming find means it returns everything in that table list is an array of results no?
idk how mongoose works tbh
shhhhh
bronzil
Its legit in the first thing https://www.npmjs.com/package/youtube-notification
youtube-notification is a basic wrapper for Pubsubhubbub. It allows you to receive YouTube notifications when a channel uploads or modifies a video with a simple subscribe and unsubscribe system.
like
Yea so find returns an array
correct?
Thats how it is in a lot of wrappers and orms
did you called the schema in your file
dont use mongoose, thats the worst decision, I made in my life
Yup
I don't use mongoose
I use postgres with typeorm
await filter.find({})
It requires something
trollg
pogres
like what to find
lol
like
const logperson = await userdocumentSchema.find({
GuildID,
UserID
})
@flat copper
hello, can someone help me? my bot isnt responding to anything i do in dms, im using discord.js v12.5.4
any errors?
nope
yeah that I know but like how to addup things in it. I tried but it doesn't seems to work
it works on servers?
yes
does your code has something like if(!message.guild) return;?
its a mod mail bot
I am not entirely sure if this is the new stable or v12
but I think you need CHANNEL partial enabled
For dms to fire the message events
yes, but i have 2 different message events, 1 for server messages and 1 for dms
π€¦ββοΈ
easier to manage
But
If you only started working on this the other day, I'd recommend starting out with djs v13. You'd save yourself from doing it twice.
No
i no like v13
You'll end up using it anyway
i did have it on 1 message event but i thought thats what was giving me erorrs
Just switch to v 13 now
the v7 Gateway will be deprecated soon
yoiu will have to do it
V13 isn't much more different than V12 anyway.
Since they are enforcing message intent as a priv intent
ill be back then
soon*
can i have a link to what they changed?
You'll find something there
oh alr
message event becomes messageCreate but there are quite a few more changes. It's not that bad though.
alr
Also apparently you could always have done message.client
which I call bs

Me ranting now
I'm actually having fun switching all my commands to slash commands too though so it's not that bad. But I still don't like the way v13 sends embeds...
In an array too
Yep
Is ugly
I guess it makes sense
Allows you to send multiple embeds now without multiple sends or replys
Which is even more ugly
I'm still waiting for the API to accept image attachments in interaction replies...
That blows
I would say thank god
same
what to do when a slash command's interaction keeps failing after 30 minutes?
but i dont even use the dapi anymore
Well typically means its ID isn't the same as the one registered or you are failing to reply
I hope that slash commands are going to be capable of completely replacing normal text commands BEFORE they require the message content intent
Me too
well I want to delete it but I need the application ID for that, and I can't figure out how to get that when the interaction fails
i don't even use slash commands-
Slash commands are already pretty stable enough to do so
there are some things they can add to make it better
but for the most part its pretty good already
Because personally I have no issue with swapping over, I think itβs a better command option already, but just some things need to be changed
there are quite some things indeed to make it better
aiyo i find buttons the most appealing
I wasn't completely convinced originally. But they're pretty pog. I like them.
Yep
i love buttons :/
(please allow multi line slash command args for eval command)
aiyo
shift + enter be like
I haven't tried buttons yet
i wish slash commands allowed custom argument prefixes
I want them to add functions to check arg length, to have variable option choices and permission checking would also be nice
sigh
with creating a channel, would it have to be type: "GUILD_TEXT" and not type: "text"
wdym by this?
and multiple argument combos
I think so yes
for example
person starts typing /command and it shows the autocomplete for the command, then you start typing a string argument, then you type an argument prefix somewhere after the string, such as -- and it would show the available options to chose from like it already does
but i still do code discord.py primarily so-
I have !!something A B/C B where the arguments are either A B OR C B
nice
it'd be nice if you could have multiple command signatures on slashes
yeah
Yes that would be great
i have a command that accepts multiple combinations of date time location
for example
/command date
/command date, time
/command date, location
/command date, time, location
do yall think threads are kinda redundant?
oh btw about my slash command not working: another command does work, but I get some weird node errors
Yeah you gotta make all them optional
Just make time and location optional arguments?
as espeically how you can't turn threads off after turning them on-
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory what to do?
OOM
yes but they are not really arguments, they are like the primary argument
congratz, you managed to kill your ram
after those, i still have a dozen of --arguments which are optional
i got this error whilst trying to run v13?
const token = this.client.token ?? this.client.accessToken;
Friggin horoscopes 
oh no
Will restarting my pc fix it? Lol
imagine horo noscopes
Horror scopes
short term yes
:^)
but you still have a giant memory leak somewhere in ur code
it'll crash again eventually
also you don't need to restart pc, just shutdown the process
speaking of memory leaks
my first iteration of a custom discord websocket was using 200mb in external memory after a few minutes
xD
π³
well...
because of stupid buffer concatenation
finding memory leaks is one of the top 5 hardest debug tasks
i've since changed my approach and now it uses less than 1mb
oh god
memory leak is the same as the process using a lot of ram while it shouldn't?
yes
in languages that have manual memory management, such as C/C++, memory leaks are often caused by the programmer forgetting to delete something after creating it
Someone should fix Discord.js memory leak then /s
so it keeps creating new stuff but never deleting them
then I think it's the command that fails, because I just edited that and it contains a for loop I haven't really checked
already did
oh right
lmao
memory leaks in javascript are rare, because the language automatically deletes stuff for you
but because of that, its also much harder to find them if you somehow manage to create a leak
but it's very likely caused by stuff I just edited, or not?
no
depends
I mean, probably no
you can run the process with a profiler attached, but you'll need to learn how to READ profiler data
but how can it suddenly have a memory leak in code that already existed?
can you show the full memory error?
if we're assuming the code/commands aren't connected
yes sure
<--- JS stacktrace --->
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
1: 00007FF66F84058F napi_wrap+109311
2: 00007FF66F7E52B6 v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::NumberOfElementsOffset+33302
3: 00007FF66F7E6086 node::OnFatalError+294
4: 00007FF6700B150E v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF67009638D v8::SharedArrayBuffer::Externalize+781
6: 00007FF66FF4081C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1516
7: 00007FF66FF2B45B v8::internal::NativeContextInferrer::Infer+59243
8: 00007FF66FF1098F v8::internal::MarkingWorklists::SwitchToContextSlow+57327
9: 00007FF66FF245DB v8::internal::NativeContextInferrer::Infer+30955
10: 00007FF66FF1B6FD v8::internal::MarkCompactCollector::EnsureSweepingCompleted+6269
11: 00007FF66FF2382E v8::internal::NativeContextInferrer::Infer+27454
12: 00007FF66FF277BB v8::internal::NativeContextInferrer::Infer+43723
13: 00007FF66FF31012 v8::internal::ItemParallelJob::Task::RunInternal+18
14: 00007FF66FF30FA1 v8::internal::ItemParallelJob::Run+641
15: 00007FF66FF048A3 v8::internal::MarkingWorklists::SwitchToContextSlow+7939
16: 00007FF66FF1BBAC v8::internal::MarkCompactCollector::EnsureSweepingCompleted+7468
17: 00007FF66FF1A3F4 v8::internal::MarkCompactCollector::EnsureSweepingCompleted+1396
18: 00007FF66FF17F58 v8::internal::MarkingWorklists::SwitchToContextSlow+87480
19: 00007FF66FF465A1 v8::internal::Heap::LeftTrimFixedArray+929
20: 00007FF66FF48685 v8::internal::Heap::PageFlagsAreConsistent+789
21: 00007FF66FF3D931 v8::internal::Heap::CollectGarbage+2033
22: 00007FF66FF3BB35 v8::internal::Heap::AllocateExternalBackingStore+1317
23: 00007FF66FF5BF27 v8::internal::Factory::NewFillerObject+183
24: 00007FF66FC8BE3F v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1039
25: 00007FF670139EBD v8::internal::SetupIsolateDelegate::SetupHeap+463949
26: 0000013374C5FEFD```
maybe it occurs in a very specific scenario
which makes even hard to find the cause
I just figured out it's happening after I execute the failing slash command, that I just edited to interaction stuff
is there anything else in the logs?
there should be a part where is says how much memory it had when it failed
oh yes sorry, something with <--- Last few GCs --->
yes
yes
<--- Last few GCs --->
[13772:000001E3313461F0] 31564 ms: Scavenge (reduce) 3833.4 (3841.4) -> 3833.2 (3841.9) MB, 5.1 / 0.0 ms (average mu = 0.362, current mu = 0.323) allocation failure
[13772:000001E3313461F0] 31569 ms: Scavenge (reduce) 3834.1 (3838.9) -> 3833.8 (3840.4) MB, 4.5 / 0.0 ms (average mu = 0.362, current mu = 0.323) allocation failure
[13772:000001E3313461F0] 31575 ms: Scavenge (reduce) 3834.7 (3842.6) -> 3834.4 (3843.1) MB, 4.5 / 0.0 ms (average mu = 0.362, current mu = 0.323) allocation failure```
const {Collection} = require('discord.js);
const collection = new Collection():
module.exports = {
name: 'botinfo',
description: 'Show up my info!',
/**
* @param {import('discord.js').CommandInteraction} interaction Represent `CommandInteraction botinfo`
*/
async slashcommand(interaction) {...``` Putting new outside of `module` then calling it few time, and forgot to clear it will create few Collection in the cache. That what first I learn before
how big is your bot?
it climbed all the way up to 3.8gb
oh and when I replace my command with something simple, the command is working and no errors happen
it's my tester bot, I guess 3 guilds lol
that's a lot π±
this is about memory leaks right?
yes can cause it, but it be slow memory build up
okay
that should only create one collection
because the file is stored in the require cache
nah, just an example
I did before I think is MessageEmbed, and found it funnily my embed increase each time I call the command, lmao
you can always show the command so we can see if theres anything wrong with it
you're all making fun of me with my 3.8 gb ram 3 guilds bot lmao
yes
yes thanks for the offer, will now quickly check all for commands and else I will send it
okay it's logging a lot of 3's inside my console π
What exactly is the bot doing?
causing memory leaks
.... of course, but what are you trying to make it do.
jk
it is looping through emoji to add message buttons for each of them
for (let i = 0; Math.ceil(emoji.length / 5); i++) {
// ...
}```
well... here is the memory leak
I'm so smart
And what's inside the loop?
no it isn't about what is inside, I forgot the i <= in the for loop
Omega lmao
xD
You: "loop this, start at 0 and increment by 1 each step"
JS: "understood, what's the limit?"
You: "yes"
what was that for even?
lock, up, down, blue square, red square, blue circle, red circle
oh it's a command for the user to choose which logs he wants in his log channel
I'm converting it from emoji to buttons, because emoji are a lot of work with perm checking etc.
I coded it so that it doesn't give an error, even if the user removes permissions from the bot during the command
Won't it be much cleaner with selectmenu though?
so you suggest to make 7 select menus for each log type?
What?
I mean 7 in total
No like 7 options in one select menu
Yeah? But then, I can't see the whole stuff
7 select menus 
oh wait I'll screenshot the embed with emoji
each with a single option
lmfao
7 selection(s) for 1 selectmenu. kekw
anyways, today i made a guide to make an api, super happy of how it turned out 
π
Am I missing something?
this is it
michael jackson
exactly lol
oh that would be awesome, curious now
:/
Am I doing it wrong?
its fine i guess
Wdym
and it would make sense to use selection menus to be able to change 7 true/false settings?
because afaik you can only select 1 option in a select menu
can you also specify that x and y can't be selected together?
Pretty sure not using the available functions in v13, but it could be done
Just would take a little bit to make it
If you're asking if it's possible using the discord API only, no
^
so I should code that myself? I can't provide the API with what i want?
oh okay right
You can make some options disappear when others are enabled
yeah
some demo for manga search
This one is single button only
yup
that sounds pretty useful
Lemme make a little recording myself
thats a good use for it, might do the same thing in mine
Also, just found out today the text can go up to more than 20k+ length
yes that's ridiculous
Need to manually cut off the length
wat
I read 6 million chars or something
what text?
for slash commands
the option text
the string option?
hm
no just in general, the string options or anything else behind the </command>
jesus christ lmao
yep, forced to limit the char myself as now
no it should be much longer
kekw
huh it looks like they changed something
very useful
Should be this video, dont mind the mess in the chat above
oh you can do that? nice
nice, thanks
Much prettier than buttons or reactions
yes
How do you handle that atm?
Not sure... Time to try
can have 5 rows
oh nvm
the user has to type in the option to enable/disable
so can work around on that
Apparently text bots will be poofed soon
Atleast from what I have gathered
they raised the label from 50 to 100, maybe, jsut maybe
it doesnt even fit on screen lmao
Hey, a system like if a user has "this" in his statut, the bot add a supporter role, its authorized?
i dont see why not
in the bot's edit page
no option related to add owner
Hey.. so I have a friend who's bot is getting added in spam servers, like 20 spam servers a week.. does that violate anything?
AFAIK we got rid of adding owners.
oh?
At least in the edit fields.
can uses still add random people as owners?
xD
i remember some idiot added me as owner of his bot, then deleted the bot
Lmao.
Has to be spooky.
lol
?
It's verified, though.
then nothing will happen
Won't he get flagged even though he's verified?
nah
once a bot is verified, i dont think they care what you bot does
unless your bot is reported
and is infringing some law or privacy
Reported.. for what, exactly, and what do you mean infringing some law or privacy?
80 servers a month is nothing for verified bots
since verified bots usually have hundreds/thousands of servers
if the bot is seen posting illegal content or is caught storing people's data
doing things without permission
raiding
etc
Ahh.. yeah that's a violation, for sure.
My friend's bot was like in 120 servers and grows up to 600 suddenly.. that's like nothing, no suspicious activity? They are spam servers though, and confirmed, but he is tired of removing them, so I'm here to confirm if he should keep removing or just ditch doing so.
likely nothing will happen
Is there a case something would happen though? .. or is it just, NAH.
i cant think of anything that could happen only from that
Alright.. no worries, thanks for the confirmation. π
wait, I do know for a fact that if someone creates an alt and just adds the bot to the 20 servers he created, then that is not allowed, right? (for a verified bot)
It is
You might enforce otherwise since it's ur bot
But discord doesn't care at all once you're verified
oh tf
question : how to delete a team on topgg
you cant
my 200 line text, which I have written, Rip
message veld for special cases
whyy
moment of silence for Meister
nope
There page is telling this:
https://www.githubstatus.com/
Welcome to GitHub's home for real-time and historical data on system performance.
go back a page, could work
also stop working through github.com, do it locally lol
I can explain in pseudo code.
lol
Yes.. unfortunately I don't know your code so I'll have to explain in pseudo.
Do you know what pseudo is, first?
I was going to ping a mod. π
why is this website so darn slow
i transferred ownership to a team but its not showing up
in discord.js I used the code message.author.presence.status but I get error: Cannot read property 'status' of undefined
um in discord v13 did it change?
Do you have the guild presences intent enabled
looks like v13 removed User.presence
it's now GuildMember.presence
user with presences? cursed
That's how it was
theoretically, a User should only have 1 presence
but bots exist
yeah
/home/runner/Verified-Bot/node_modules/discord.js/src/rest/RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown interaction
at RequestHandler.execute (/home/runner/Verified-Bot/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/runner/Verified-Bot/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
at async SelectMenuInteraction.deferUpdate (/home/runner/Verified-Bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:183:5) {
method: 'post',
path: '/interactions/874688498135883836/aW50ZXJhY3Rpb246ODc0Njg4NDk4MTM1ODgzODM2OjZxdHg1R1RZWTM4NmJhUEU0R3c2dktjbmlmWFFHRk9GdmNGSldNcTgwUExPZ1VINXhDQ1AyS0M0QXJHWkQ5N0VPakZnRnQzYWlFTmxvT045TlhvUEh6SGRoTWJIVU1zOEVxSWJVdGhIaE8wUzhHRFBOb0txcG5PS1B0YWsxQTJD/callback',
code: 10062,
httpStatus: 404,
requestData: { json: { type: 6 }, files: [] }
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Verified-Bot@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Verified-Bot@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-08-10T16_19_49_287Z-debug.log
``` https://pastebin.com/fpMTT9ZP
like I said, after you .update, there is no need deferUpdate
also there no need to ping after how many hours
the whole drop down goes away after one click
interaction.update({ embeds: [mod], components: [] }) instead of making empty array, jsut remove the components part. you put empty array, of course it will remove the selectmenu
oh i'm a idiot thank u
How do I count the total members of all the guilds a bot is in?
client.guilds.cache.reduce((x, y) => x + y.memberCount, 1)
returns an invalid number I believe since it uses cache?
Wait for the client to enter the ready state
if it returns the initial value, then the cache had not been populated
also, use 0 as the initial value

Chile
does anyone know of a good free/affordable service for command logs and stuff
I used to have them sent to a channel but that's obviously not optimal for a big public bot
why would you need it its just waste of space in my opinion
use log files
Or a database
nah, use files
Shhh
lol
Im severely pissed off at myself, bc the code in my guide looks better than my actual code
log files and self-hosted sentry instance for error tracking
guys what does this cmake error mean
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
I agree with this... if you are running a big public bot, then it is ideal
do you have the gnu compiler shit
the what
gcc
install cygwin
how to make it so i can change nickname of every user using a command
like an anti hosting command (change nickname of every user having a ! in there?
ik i can use like message.guild.members.cache.filter(i => !i.user.bot).map(user => {}) but what do i put in the map?
and then is that it
should be working after that
alright
Hey there, could someone please help me out with my code
if(message.content.startsWith(`${prefix}react`)) {
let args = message.content.split(" ");
let messagesID = args.slice(2).join(" ");
let messagesIDArray = [];
messagesIDArray.push(messagesID);
messagesIDArray.map(message => message.channel.messages.fetch(message).react("β
"));
}```
It's my first time working with push() and arrays iterating 
The current error I'm getting is "Cannot read property 'messages' of undefined"
Please ping me when answering, thank you
what are you trying to do
I'll give the bot some messagesID and it should look for them in the channel and react to them with β
nvm i got it
look at your arrow function in the map method
you named the variable message
so it takes priority over the actual message variable you got in the event
so message is actually a string, not the message object
just rename it in the arrow function
also also
oh so should I name it differently
you have a mistake in the code
fetch is a promise, you need to async/await or .then()
otherwise you're calling react on Promise<Message> which will error
Then should this work correctly?
messagesIDArray.map(messageToFind => message.channel.messages.fetch(messageToFind).then(messageToFind.react("β
")));```
no
messageToFind is a string in that case
.then(foundMessage => foundMessage....) is what you're looking for
oh
also
a for loop seems to be a better suited case than a map function
map() is supposed to be used when you want to map X to Y
isn't it exactly what i want lmao
yes
then a for loop is better suited
for(const messageToFind of messagesIDArray)
{
//use messageToFind like you normally would
}
Omg it works... But only if I enter only one message ID
The bot is pushing() all of the messagesID as one single element in the array, not in ["separated", "spaces"]
How can I fix that?
alright so you should be able to just .split(" ") on messagesID
and that'll become your messagesIDArray
nevermind
i see that it's an array already
just don't join(" ") and rename messagesID to messagesIDArray
and that's it
remove the split
if(message.content.startsWith(`${prefix}react`)) {
let args = message.content.split(" ");
let messagesIDArray = args.slice(1);
messagesIDArray.push(messagesID);
messagesIDArray.map(messageToFind => message.channel.messages.fetch(messageToFind).then(foundMessage => foundMessage.react("β
")));
}``` This is how it'd look like then
remove the push and change the map to the for loop i showed you above and that's it
also
you should look into building a proper command handler
if else leads to messy code
not ideal
thanks for the suggestions & feedback, give me a min to fix the push and for loop stuff 
Hey, does anyone here know a little bit of javascript but doesnt know how to create a CLI tool?
I need someone to check if my guide actually lines up correctly and is readable...
uh can anyone tell me how can i make a good dehoist command? (change nickname of peple whose user name starts with a specific letter in an array of letters
@vivid fulcrum Omg bro thank you so much!!!!
Check the events upon guild joining and member updates and go from there.
Other question, is there a method to remove all reactions from a message?
what's the difference between defAvatar and avatar from the api?
Nvm I found it
Is it a good idea to create your own polyfill without checking if it breaks?
I've got an Array.prototype.last property from Dart and I want to use it in js because arr[arr.length - 1] sucks
@vivid fulcrum I tried to do the inverse with the removeAll() method but it doesn't seem to work
It tells that "foundMessage.removeAll is not a function"
if(message.content.startsWith(`${prefix}reactionsremove`)) {
let args = message.content.split(" ");
let messagesIDArray = args.slice(1);
message.delete();
for (const messageToFind of messagesIDArray) {
message.channel.messages.fetch(messageToFind).then(foundMessage => foundMessage.removeAll());
}
}```
I don't know what I'm droing wrong
im not sure if removeAll is a real thing
BRUH what the fuck
Why not just create a function to do it for you?
That's exactly what it is
But you're trying to mutate the prototype
I'm talking about a pure regular function
last(arr) vs arr.last
i should probably use the new es2021 array.prototype.at
arr.at(-1)
and it already has a polyfill
you could also extend the Array class
let tempClass = class extends Array {
get last() {
return this[this.length - 1];
}
}
[Array, tempClass] = [tempClass, Array]
the temp class is to prevent ref errors
the fuck
class extends Array
help pls
it will look in the original Array prototype instead of copying all methods
interaction.permissions is undefined
the last method disappears when redeclaring Array
Meaning it isn't what you think it is
double backticks don't render as a code block on mobile smh
how to fix?
Well what exactly is interaction in this case
DiscordAPIError: Invalid Form Body
embed.image.url: Could not interpret "{}" as string.
embeds[0].image.url: Could not interpret "{}" as string.
sends dsicord.js docsi want to make like only that role can use it no one else
What?
code idk why you are extending the array class like that but I might just be dumb

Handlebars seems to be parsing stuff wrong, I've got a helper, X, which returns a string, which is used for the class attribute of an element:
<p class={{X this}}></p>
If X returns multiple classes (ex. class1 class2) then handlebars parses the entire element as:
<p class="class1" class2> </p>
...which is obviously wrong. Any fixes for this?
Klay told me to extend the entire class instead of prototype
But why like that?
I dunno
I've never seen someone extend anything like that so idk what its really doing 
I didn't tell you that.
I told you to just use a function.
You could also use .at like you mentioned
i have a life
so js
Don't know what using ts has to do with having a life but okay
Or if you really feel like it, use Sindre Sorhus's negative array library (https://github.com/sindresorhus/negative-array/)
Or use macros like a cool kid π
lmao
Pain.
he's scared of our power
ikr
Weebs are one of the best programmers
Name one programmer who isn't secretly a weeb

β
True weebs code in JS (JapaneSe)
No
wait a second
JS is a distasteful language
that backfired horribly
Golang is my new fav
what's special in golang
@vivid fulcrum Nvm I got it, just had to put .reactions between foundMessage and .removeAll()
Its sexy
thats all that matters
:D
How do you define a getter without object declaration syntax or Object.__defineGetter__
Object.defineProperty
that doesn't have a way to set getters tho
it does?
gimme an example ||to copy paste||
Object.defineProperty(object, "name", {
get: () => "you are gay"
});
Don't question my judgement
object.name without paranthesis will now return you are gay amirite
Poggers
yes
Its used alot in big companies
So if you are thinking of jobs, golang is a good contestant
Google especially
Google made it iirc, so ofc they use it
golang is meh when you know there are some programming languages which are just better by design
Yea
how about learning some lisp
golang is good at what it does
It does its purpose well
GoLang was created to fix a specific problem google was having iirc
for that I'd use rust
So for what it was designed, sure ok its good enough
They were running into issues with their C programs compiling to slow
But like, other langs better
if (!Array.prototype.last) {
Object.defineProperty(Array.prototype, "last", {
get: function() {
return this[this.length - 1];
}
});
}
i hope this works
it won't cause you have a syntax error
except that
Got it
you need to attach it to the prototype
not the Array object itself
Looks hot ig
But js better 
I thought you coded in assembly? 
Im out 
Shift + click?
kthxbai
^
explains the random emotes
Shift click those
i suffer on mobile
So I was testing a bot and I made a test embed to test the bot
And I copy pasted alot that embed
use a constant variable oh my god
It was the default github readme
Nono it was a snippet bot
So I was testing alot the snippet save feature
Im trying to create a channel with role overwrites, but discord.js always throws the error "MISSING_PERMISSIONS" even tho it has perms, why?
like github gist?
Do you have perms in that channel to overwrite or is the role you are overwriting above you?
ty
Well, the roles are above the bot.
yw
Maybe thatβs why?
Probably
This is a ss of how it works
You can't edit a role above you
No you cant upload files
It was a short project made for fun, like most projects I have made
I was thinking of making smth like this
There is only like two that I have dedicated more than 1 day of my time to
The source is on my github if you would like to see it!
Lol
I used to work on a discord interactions client for deno
It had a lotta spaghetti code
Especially the websocket
yuck
I deleted the repo
Lmfao, I privated alot of my repos
I'm proud of my bad code
Mine was shameful

100% of people I have showed it to has said ew
i write perfect code eventually
@earnest phoenix does kofi send any authorization or something
like, something I can use to validate origin
the example response json doesn't help much
you didn't use the webhook?
No, I just know it exists and that you can
meh
I don't receive money often enough to care about a webhook kekw
i disabled the mention thingy. i had my first scammer scammin on my discord today
oof
async something()
{
await ...
}
async somethingElse(param)
{
const anything = await ...
return anything;
}
async somethingElseElse()
{
const promise = await somethingElse(param);
something()
// some code relying on something()
await something()
}
Does something() need to be awaited, too if I'm relying on the result in the code after?
await will stop the execution right there and wait for it to complete
without it, it'll keep going regardless of the function being complete or not
yeah as expected, alright, ty
0 as a bigint
confused noises
lel
bigint is js's way of representing arbitrary sized integers
the syntax is to post-fix numbers with n
i got this error whilst trying to run discord.js v13?
const token = this.client.token ?? this.client.accessToken;
update your node.js
L for long
yes, expect js' bigint can hold WAY bigger numbers compared to java's long
any 64 bit value
@solemn latch
but bigint is slower by alot too
still the same error, what version??
latest
so, npx node@latest?
well yeah, because its arbitrary, not fixed
nothing is faster than fixed sized numbers
install node.js the proper way
download from the website and install, if you're on windows
use nvm if you're on linux
im using repl cuz my friend wanted me to
Registering slash commands for a guild requires the command scope.
Does registering global commands requires this, too?
Just to make sure before rolling them outβ¦
Iβm gonna guess no.
nvm it doesnβtβ¦
repl.it is complicated because it doesnt officially support changing node versions
they are still using node 12 by default lol
but there are some ways to change it
the easiest way would be to just fork this repo
and move your code over there
you wont be able to use the package manager, you'll have to install everything through the shell
Oof replit ftw π
Time to go work, rent a root server and setup your own environment 
Mhmm
lmao

Huh?
Big brain plays man
My bot's hosting doesn't cost that much
Dw about it
Wouldnβt that require being able to run the bot in the first place?
def not a scam scheme
Well, use an old pc
until you can get enough moneh
I see Iβm handling things wrong.
Gonna close my business and add a premium subscription to make cashβ¦
signal: killed
operation: failed
we'll get 'em next time
Im telling ya make em 40$ and they will buy it 100%

Damn and I was stupid to work 7 days a week.
Yea man
In all seriousness though
I strive to one day meet the goal of being my own boss and giving myself my paycheck

seriousness? A word that should be banned of this channel
So true
Wow Tim uses replit? Damn. You've gone down in my esteem π
Ikr
Well thatβs a really hard way, trust me.
Maybe depends a little on the branch youβre in but itβs no fun.
Being self-employed is hella stressful.
i use it for tests and simple things
Imagine handling other employees, too
otherwise you have to configure LE or cloudflare
Yup
Yeah I used to run a company with 20 employees with my ex. It is a big responsibility.
I truly just wanna build a team of 4 and work on some cool projects and dick around

I don't take a lot of things seriously in life
Aye it has its ups and downs.
Had 6 employees myself 3 years ago and Iβm again down to 2.
Jobs come and jobs goβ¦
Mhmm
Problem is finding the employees
Yeah and keeping them
I run my own agency now and only use subcontractors. No monthly payroll to manage.
Most cases you can't even promise em pay
Lost a big job and was forced to get rid of 4 very reliable people which is horrible
That absolutely sucks
Yeah but thatβs our economy
Must be nice making money
Somebody cheaper often gets the job even if the quality is worse
I got 72 cents to my name
Thatβs how things work
Man so do I π Just because you're working doesn't mean you earn a decent living. You still have rent to pay and overheads.
Especially today if anyone else being cheaper usually gets the deal
I personally don't care about earning a lot of money as long as I get to do what I love and can pay for the essentials im set
Thatβs a good attitude
My company is basically dead since covid started. I was specialised in marketing for events companies (mainly corporate). No events with covid. No events = no clients = no income. My Discord bot has kept my running costs covered. Without it the company would be shut down. My second job pays for my living costs.
A year or more and if covid wasn't a thing, I'd have been 100% self-employed
It sucks to have to start over ngl
Things were starting to go very well
Man you're 16. You got time π
Thatβs something you can never plan unfortunately even if you should keep money in your business to compensate things like that
True but it sucks none the less
Oh I did. Luckily. The savings ran out after 12 months.
Yeah understandable
Now it's more a question of how to pay the accountant π
Iβm luckily since Iβm working in the logistics & transportation branch
Work is always a lot
Yeah I've learnt to diversify the hard way
Simple date command for JavaScript
var date = Date();
var year = date.substr(11, 4);
var month = date.substr(4, 3);
var day = date.substr(0, 4);
var daynum = date.substr(8, 2)
if (month == "Oct") { month = "10"; }
if (month == "Jan") { month = "1"; }
if (month == "Feb") { month = "2"; }
if (month == "Mar") { month = "3"; }
if (month == "Apr") { month = "4"; }
if (month == "May") { month = "5"; }
if (month == "Jun") { month = "6"; }
if (month == "Jul") { month = "7"; }
if (month == "Aug") { month = "8"; }
if (month == "Sep") { month = "9"; }
if (month == "Nov") { month = "11"; }
if (month == "Dec") { month = "12"; }
if (day = "Sun") { day = "Sunday, "; }
else if (day = "Sat") { day = "Saturday, "; }
else if (day = "Mon") { day = "Monday, "; }
else if (day = "Tue") { day = "Tuesday, "; }
else if (day = "Wed") { day = "Wednesday, "; }
else if (day = "Thu") { day = "Thursday, "; }
else if (day = "Fri") { day = "Friday, "; }
setResponse(day + daynum + "/" + month + "/"
Oh I had to, too
Wouldnβt need to get rid of 4 people as mentioned if I would have been prepared better
Lol
on v13 send('..') work ?
Ever heard of switch/case?
jesus
No. I havent.
I have another SAAS business idea I've been mulling over for the last few years based off a system I made for my ex's event planning company. I'm going to rebuild the whole thing from the ground up and sell it as a subscription. I figure it's better to rely on subscriptions to cover running costs and contracts to make real profit.
I do t code regularly. I also barely code on je
Would look 10x better
you can send strings with old way
Js*
sounds awesome
still works?
yeah
strings yes, other things no
okay thx
shitcode
heckcode
God thanks PHP gave us strtotime to convert any legitimate time string to a timestampβ¦
Oh weβre speaking about JS?
Then fucking do it yourself!!1!
(or use a lib of somebody else did it but it wonβt be maintained and loose itβs functionality one day)
Can I intrest you in a unicorn company idea that def isn't a scam

lel
Let Tim pay a subscriptionβ¦
Heβs rich now. Trust me.
I swear if that fucking auto correct shit doesnβt stop bullying me Iβm gonna deactivate it and open the doors to hell.
trash OS
Man I feel dead inside now, I have been trying to make a custom anti nuke system
And I just
I can't figure out a efficient way to do it
lmao
Without like making a whole database with 100 entries a guild to log everything while reading and writing like 500000 things a message
I feel ded
If server owners set their perms properly nuking wouldn't be a problem.
That you can totally have since I don't even mess with the dapi anymore
Hmm tell me more, tell me more
Are you going to sell it for a million dollars?

Imma tag a mod to come here and ban the scammer π
Basically it is an idea I branched off of another bot I was making
Yes! Away with him.
lmao that irony
Shhhhh
Alright leaving the highway
Ofc ofc its a unicorn company idea
See ya
Bye man
Bye
β€οΈ
So mac may I intrest you in an idea
Still, I know that is true, But I have just been fascinated by the idea to make a good efficient anti nuke from scratch



