#development
1 messages Ā· Page 1863 of 1
your idea is quite good tbh, terrible for performance but good for small code size
here's an improved version
Array(10).fill().reduce((a,c) => [...a, a.at(-1) + a.at(-2)], [0,1,1]);
lol wut
the question i will ask is a bit amateurish but i really need help
Why this error
I'm trying to loop through a MySQL database and get rows.elo, but when I try to add the data to an array (for testing purposes), some pieces of the data return undefined. How would I check whether the data is undefined?
Code:
let some;
for (var i = 0; i < rows.length; i++) {
if (typeof rows[i] != 'undefined') {
console.log(rows[i]);
some.push(parseInt(rows[i].elo));
}
}
Error:
C:\path\node_modules\mysql\lib\protocol\Parser.js:437
throw err; // Rethrow non-MySQL errors
^
TypeError: Cannot read property 'push' of undefined
at Query.<anonymous> (C:\error\index.js:540:10)
Line 540 is some.push(parseInt(rows[i].elo));
I'm not sure if I understand your question correctly, but some wasn't assigned a value so it defaults to undefined
If "some pieces of the data" is what some is, why not also check if some === undefined
ah. alr thx
yeah because permissions is an object
uh what
oh yeah
BigInt
It's a different number type
String(permissions)
Can anyone help me making a warn command in my discord.py bot
It's in top.gg but I haven't have a good warn command
Discord.py is dead
Me Cry
lol
or just
you don't need a variable
tostring the raw bitfield
just put it in the ${}
permissions.bitfield.toString()
I sometimes wonder if Tim has memorized the entire docs
Gg
no i regularly open them again
i usually have them always open in another tab
just installed IntelliJ idea on a school computer
They block all exe downloads but they forgot to block .zip downloads
Surprised it actually worked
You could use a usb or portable software
My school computers use Windows XP so IntelliJ is unlikely to work
Hacking out of notepad lol
Uh
you tried to require a module and node.js couldn't find it
Its in discord.js
ah, interesting
maybe update discord.js, uninstall & install
It fixed itself after i downgraded it to 13.0.1
shrug
BaseCommandInteraction was added to index.js 8 days ago
so it likely only works in v13.2.0-dev
wtf is the difference between CommandInteraction and BaseCommandInteraction
can't see a difference in the docs
ContextMenuInteraction and CommandInteraction extend BaseCommandInteraction
can someone pls help me with discord oauth2? i dont understand how to do it at all! Btw its a web app with svelte.js
@near stratus how can increase memory heroku? for free service
nothing is for free except the death
Hmm... Even then you have capital gains tax on inheritance and a funeral needs to be paid for.
lol right but that's something your descendants have to deal with, I guess you don't bother anymore if you're dead
but who knows š¤·āāļø
how do i check what perms do a user has in my server
throw new HTTPError(res.statusText, res.constructor.name, res.status, request);
^
Response: Internal Server Error
??
I want to Minu vote. But now it's not available why?
What exactly are you doing tf
anyone here that has telepathic capabilities can predict what api they're requesting from and what they're doing?
How are the Role create / update / remove events called?
question is very vague
dont know whether i should go indepth how the nodejs event listener works or 
discordjs
The bot have permissions
E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\rest\RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Permissions
at RequestHandler.execute (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async GuildMemberRoleManager.add (E:\C) Developing\Wolfy Djs-13\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:113:7) {
method: 'put',
path: '/guilds/769724063018647582/members/829819269806030879/roles/882325084654665798',
code: 50013,
httpStatus: 403,
requestData: { json: undefined, files: [] }
}
What are you trying to do?
I know why couse the role bot trying to give is higher how can i return this error ?
You can catch the error and log it or send a message saying the reason it's occuring
Okay
@earnest phoenix
if(client.roles.highest.position <= Level_To_Reach.highest.position) return
This will work ?
Hello. I'm making a bot that it has its own api to store users' xp, but I think making a request to store xp and knowing if a person can level up every time a new message is very costly. Is there anything I can do to get around this problem?
youll want to have a cache layer
um how do I load my commands made in a different file to index.js
For the love of god try it and see
Didn't work
maybe cache it then update after a while
are slash commands always going to use <@!> format for @ mentions?
how can i enter in this mod pls help me guys š¦
?
like how i can talk with the bot
what bot?
never mind i did it
Is this a description or are these command options?
Canāt really see it tho.
Description will not parse anything special, like mentions, new lines etc.
Or markdown and so on
Itās really just a short description without special formatting
it's the command options
Oh nvm then itās probably not implemented yet to resolve the member
Since this a static text I would guess it wonāt change anyways but who knows, means it might always show this format
is your latency under 100?
so its over 100ms?
hmm, not sure why it wouldnt send then, console.log inside the if statement to double check i guess
whats client.ws.ping log?
so it logs a number?
š
then whats it log as?
is bot your logged in instance?
the bot needs to actually be running on the instance you check the ping on
is there a nonhacky way to change the avatar and background image for our bots per guild?
isnt that like a nitro feature or something?
Am I stupid or did the mongoose lib change something? http://img.extreme-is.me/YQhVpw8cptdBZHBY
Do you want the cold, hard truth?
||MongoDB sucks||
Alright imma go to sleep now
Thanks Tim
i just searched in the mongoose github for "usenewurlparser"
Seems like a versioning issue then
are you using mongoose 6?
I c
Also, the useUnifiedTopology and useNewUrlParser options are gone. These options only existed in Mongoose 5.x and MongoDB Node driver 3.x to opt in to new internal implementations. As of Mongoose 6 these options are gone because the new internal implementations are the default, and the legacy implementations are gone. If you used useUnifiedTopology: true and useNewUrlParser: true in Mongoose 5, you should have no problems removing them when upgrading to Mongoose 6.
mongoose does suck
apparently it may have some memory leaks too
the devs dont really work on it too much
issues go unanswered
also i always fail to know the difference between hardware threads and kernel threads
are hardware threads something managed by the cpu or something
yea its a feature for some processors
like CPU's cores, which do threading on hardware level
but a single core can do a software threading (but ofc performance is different)
though I see terms thrown around on manufacturer websites such as "32 threads" when there's only a least amount of cores
apparently a single core cpu also has those types of threads
there's different versions depend on the CPU company
but a single core can virtually do multiple threading
check this for more info
so basically there is no realistic difference between kernel implemented threads and hardware threads
since they both switch between tasks to give them cpu time
is it possible for bots to dm other bots?
yep
Ok so I have a proposition.
I want to build something for making bot verification faster so people dont sit in queue for ages. The biggest thing that's holding us back from doing that is that we don't want to make selfbots because that's a nono and most people have bot messages ignored by default for good reasons so that's not something that can work without exceptions.
What if we built a framework for testing bots using other bots so that process can be completely automated and infinitely faster? Instead of creating individual libraries for every single language, we make a single "contract" file very similar to contract based testing https://docs.pact.io/ that can be consumed by a bot to test the behavior of another bot. This is a TON of work to implement just to get a front seat in top.gg verification and I'd never do it for that reason alone. BUT this can actually be used by other bots to write tests for themselves. It's a win win and encourages devs to write tests for their bots.
I'd like to make this open source so people can use and modify it as they need. Any thoughts?
Fast and reliable testing for your APIs and microservices during development. Safety during deployment.
Actually sounds really good, the only problem being that many bots donāt respond to other bot messages
yes so we would need to add an exception for that
you can define a test bot id and let that one through
Maybe you could have that faster verification as an optional thing, and users just have to make sure that their bot will respond to your botās messages
Yeah
the faster verification is just a side effect for implementing contract testing in your bot that top.gg can consume
letting some bots messages through is kind of cringe but I think it's acceptable for something as useful as testing
hardeware threads are seen in the operating system as cpus, and treats them as regular cpus
like how you see 16 cores in your task manager, if your cpu is 8 core 16 thread
software threads are just a program like any other, competing for those cores
like how you see 34 lines for chrome.exe in your task manager
so essentially they're just virtual cpus where the execution of tasks is handled the cpu itself?
ye
the cpu can concurrently execute two tasks on each hardware core
so it advetises itself to the operating system as having 2 cpus per core
I don't get that part. I thought one core can only execute one thing at once?
not anymore
Hyper-threading is a process by which a CPU divides up its physical cores into virtual cores that are treated as if they are actually physical cores by the operating system.
it takes advantage of superscalar architecture, in which multiple instructions operate on separate data in parallel
interesting
this is also worth a read
Simultaneous multithreading (SMT) is a technique for improving the overall efficiency of superscalar CPUs with hardware multithreading. SMT permits multiple independent threads of execution to better utilize the resources provided by modern processor architectures.
as basically "HyperThreading" is intel's version of SMT
The number of concurrent threads is decided by the chip designers. Two concurrent threads per CPU core are common, but some processors support up to eight concurrent threads per core.
@woeful pike https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Access-Deprecation-for-Verified-Bots
I wonder how you wanna deal with slash commands as I assume more and more bots will use it.
Maybe the flood of bots using slash commands isnāt happening right now but it will get popular in the future.
yeah I forgot about slash commands lol I didn't realize it was going to be forced for every bot
I guess a Discord account used for this case as "self-bot" just sending commands to bots on your test server wonāt be a good idea tho, too?
(regarding ToS)

I guess automating the process will most likely get impossible with the current possibilities
damn it was such a cool idea too
slash commands are so stupid it's like opening a gui for a simple cli command
I mean Iāve got no clue how your verification process works but joining the verification center, hammering some commands by a reviewer and then use a dbl bot command for example to set the bot as verified isnāt a "fast-enough" solution, too?
(might already work like this idk)
It's not fast enough since the testing part is... painful at times
And the most time consuming of them all obviously
yeah the idea would be a really cool alternative but that's never going to work now thanks to shitty slash commands
this is why I don't make discord bots 
Arenāt the reviewers just hammering the same commands over and over again and also trying to find commands which might violate your rules or Discordās TOS like suicide commands etc.?
yes, and it can't be automated without breaking discord's tos which we obviously don't want to do
They actually test the bots on top of searching for the bad ones
here's a better idea, pick 5 bots from queue that have the same prefix and test them all at once
inb4 all bots have the same prefix: the slash
queue destroyed in 10 seconds
i dont see any alternative besides increasing the number of people reviewing bots
since discord is apparently cracking down on all sorts of automation
Isnāt the amount of bot approvals going down anyways, since there are literally already a 1000 bots for any use case anyways?
I mean the amount of bot reviewers has increased a lot too since I remember times waiting months for an approval.
inb4 retroactive disapproval for similar bots 
yeah but you know the programmer brain, always trying to automate things and putting people out of their jobs
tfw your whole job is figuring out how to take other people's jobs
Helo tim
do the funny meme and make a "user account" but throw it through the "magic" of "ai" to make it appear as a "standard user" [:
damn I'm actually really bummed out now I was super excited about this
rip
Well the idea isnāt bad at all and it would probably be lot of work to develop such a system which makes it interesting regarding its complexity but yeah looks like slash commands have ruined it

you'd also have to figure out a way to fake fingerprints which is annoying and not worth
Wat r yall talkin bout
/dev/random /s
Mmm
that might have some issues as people make help commands in different languages e.g Turkish, Romanian
not what's inside it but the work help
At least this issue isnāt an issue anymore with slash commands
like 30% of the bots I test use slash commands
I guess the guidelines of an obvious point of entry like a help command isnāt up to date anymore
a lot of bot's don't use the slash command part
iirc localisation is a thing that will happen soonā¢ļø according to discord overlord. same with the autocomplete option
if discord let bots use slash commands this idea would be super rad I'd even be down to work on it on the weekends
Not yet because people might not know yet or will wait until itās being forced
I am a py dev and it's not on there yet kinda happy as it will be a pain
if it's under 100 servers a bot dosen't need approval for the intent
why does the bot need to be in over 100 servers
Most bots are only in 50 servers max
isn't this more on the other bot not being able to receive the message content to parse the chat command?
yeah
on discord.py?
Which will infect force them to switch to slash commands anyway
Danny stepped down
it wouldn't make sense for a bot to aim to stay under 100 servers and list themselves on the site
who's gonna add slash commands to discord.py now?
im not certain but i think i was over 100 back when I got my bot on topgg (was dbl back then)
it doesn't matter if the bot itself is over 100 commands since they'll all want to use interactions to grow
yeah
Probably counts for most of the people out there but thereāre also special bots like mine for example aiming at a very small amount of people
But I somehow still put it on topgg since I found out itās literally the only bot (out of 2) on the site being able to do what it can and gaming communities out there actually searching for bots like it on for example platforms like topgg
speaking of this though, i think this is a pipe dream, considering that nsfw slash commands aren't added and was brought up in march
and that would just be a property associated with the command itself
But it doesnāt change the dilemma with slash commands anyways even if they come with a few advantages as well
maybe there's an undocumented api that allows bots to submit slash commands? 
yeah, the implementation is a little bit undercooked. at least from the dev side.
couldn't you wireshark/chrome dev tools the request from a user account?
yeah but I'm not gonna do that now
At least restricting slash commands to webhooks, too would be good
But how would it select the right bot sending a slash command if tons of bots have the same commands?
Right now you have to use the UI to choose the right bot for
That's probs handled under the request with the app id
Doesnāt make sense if you speak about to trigger a slash command just by sending it into the chat
At the end slash commands have been thrown in and nobody actually seem to think about enough
I'm talking about the request if bot a and bot b both had /ping and discord decided to auto target bot a, the request would just be something like https://discord.com/api/v9/interactions/{bot.a.id}/commands/{command.id}/request
ok even if there's a hidden interactions api that a bot can use, the response comes in from a websocket message which is encrypted and I can't be bothered to look into it

You need to see things optimistic even Iām far away from being an optimist.
Imagine you had this idea earlier and would have thrown lots of hours into a solution and discord would force the slash commands after.
š¤ wouldn't it go to discord and you could receive it like a normal message considering the testing bot would be in a single server/very few servers right? That way the discord bot component itself deals with "decrypting" the response?
wait, do mongoose model functions now have a .on() property when something is indexed š
It might be the best way to invest into more reviewers at all but go on motivating the staff.
Not only granting access to specific resources and privileges as well as roles etc. maybe also implementing a payment system for being active.
Combining all your resources together and collecting the amount of reviewed bots per reviewer could be a way to use an automated payment system for example like PayPal to reward reviewers if they reviewed XX bots/months.
Now this is poggers š
Unfamiliar with webscaleā¢ļø db but what would the use case be for listening to that?
Here
That might be a motivation to them to review more bots and getting the queue handled even faster.
Doesnāt need to be much but something you "can" earn or something you be rewarded for will motivate people push up things, Iām sure.
const model = mongoose.model('model_name', modelSchema)
model.on('index', i => {
console.log(i)
})
This is what it seems to be
So it pretty much just "if use index key on this model" then blah
Ohhh, that type of indexing
I thought it meant something similar to pkeys in relational dbs
yeah no l;ol
I don't get this
So if you did the request for the slash command it would send the response back to discord right?
At that point wouldn't you just listen for it like a normal message?
I don't think they come back as normal messages
also assuming I can send slash commands from bots in the first place which I'm 95% sure I can't
either way if the solution isn't going to be elegant I'm not interested because writing discord bots already sucks as it is
Help
True, also just quickly tested unless discord.net is doing funky stuff to make interfacing the same, webhooks are the same as normal messages
Could anybody help me?
Wdym
Wat
npm i express
Where?
Ok
bro
?
You're welcome š
go to discord.gg/discord-developers if you want help with verification
anyone facing any problems with t heir bots?
Nope
ooh, mine keep disconnecting or replying really late
Yea
I couldn't keep up with hosting cost
lol
let me rephrase it: Anyone facing connection issues with their bots? (I am currently using discord.py)
Oh sad.dpy user
Any examples you can provide?
getting timeout on sending messages
š¤
uhh
the image aint loading when i use tags in html
<li>Get stuff done <span><i class="fas fa-trash"></i></span></i></li>
It says done but i cant use the command
That's not an image smh
the variable db is declared for a second time on line 31
i'm trying to use all those names which are given on websitres
what?
I changed that
It says done
But i still cant?
If I set a cookie to https only will javascript fetching NOT send the cookie with the request, at least on a different domain?
https only means client-side JS will NOT be able to read the cookie
so how do i pass user data to nextjs without revealing the user token?
getServerSideProps?
mmm there's nothing wrong with storing user tokens in the cookies, as long as secure and httpOnly are set to true
well the react app won't be able to use the token for anything because it's httpOnly

why do i keep forgetting i have ssr
your react app is going to make HTTP requests to the server to get the information
or you can SSR it, too
ssr safer
It's pretty much the same thing since you're still going to be using cookies
I need help
and a User(msg.author) does not contain a roles property
const Discord = require("discord.js")
const conf = require("../config.json")
exports.run = function(message, client, args) {
if(!message.author.roles.cache.has(conf.registerHammer)) return message.channel.send(conf.yetki)
let isim = args[1]
let yaÅ = args[2]
let kullanıcı = message.mentions.users.first()
if(!args[0]) return (`${message.author}, Bir kiÅiyi etiketlemelisin.`)
if(!isim) return (`${message.author}, Ćyenin ismini belirtmelisin.`)
if(!yaÅ) return (`${message.author}, Ćyenin yaÅını belirtmelisin.`)
if(!kullanıcı) return (`${message.author}, Bu kiÅiyi sunucuda bulamıyorum.`)
if(kullanıcı.bot) return (`${message.author}, Botları kayıt edemem.`)
message.guild.members.cache.get(kullanıcı.id).setNickname(`${conf.tag} ${isim} ${conf.ara} ${yaÅ}`)
message.guild.members.cache.get(kullanıcı.id).roles.add(conf.erkek)
message.guild.members.cache.get(kullanıcı.id).roles.remove(conf.kayıtsız)
const embed = new Discord.MessageEmbed()
.setFooter(conf.footer)
.setColor(conf.embedR)
.setDescription(`
⢠${kullanıcı} adlı kiÅinin kaydı baÅarıyla yapıldı.
⢠İsim YaŠ⢠**${isim} ${conf.ara} ${yaÅ}**
⢠VerdiÄim Rol ⢠<@&${conf.erkek}>
⢠AldıÄım Rol ⢠<@&${conf.kayitsiz}>
`)
const embed2 = new Discord.MessageEmbed()
.setFooter(conf.footer)
.setColor(conf.embedR)
.setDescription(`
⢠${conf.sunucuisim} adlı sunucuya kaydın baÅarıyla yapıldı.
⢠İsim YaŠ⢠**${isim} ${conf.ara} ${yaÅ}**
⢠VerdiÄim Rol ⢠<@&${conf.erkek}>
⢠AldıÄım Rol ⢠<@&${conf.kayitsiz}>
`)
message.guild.members.cache.get(kullanıcı.id).send(embed2)
client.channels.cache.get(conf.kayitLog).send(embed)
}
exports.conf = {
aliases: ['erkek','erkek-kayıt'],
permLevel: 0
};
exports.help = {
name: 'e',
description: 'Erkek kayıt',
usage: 'erkek'
};```
what should I do?
Yeah
š¤Ø
as slay correctly stated message.author returns an user object, which does not have a roles property
message.member.roles
Thank you so much <3
^^
I followed a tutorial and is this code wrong? because this isnt working for me https://pastebin.com/f6cPsx2g
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
What's not working exactly?
hey guys any javascript developer who know how to connect to mongodb and get how much documents are in the collection?
Which driver are you using?
@small tangle
Debug and check what message is
No, in my server.
how will I do?
1st step would be console.log i guess
If the object was an actual message it would've said Can't read property 'roles' of null
bot, duh
And applications.commands if you use interactions / slash commands
ok
You don't even need bot if you don't plan on using guild related information
Only applications.commands
Sure
I wanna know how you tested your bot without knowing how to make an invite link... š
idk but hes in my server
Hmm does anyone know if there's a way to detect when any npm package is updated? š¤
how do i check if threads r enabled in a guild?
if im not wrong, it should be enabled for all already?
How to do this?
"discord.js"
Yeah
Ok thx
Why it still says these?
Because youāre defining your object as discord then trying to use it as Discord
I highly recommend learning js before making a bot
Also your error is because your nodejs isnāt up to date
that and you need to actually put the bots token in the space where it says "this client token"
Thatās not his issue
His issue is that heās on replit which uses nodejs v14 by default
He needs nodejs v16
How to update?
How?
i thought the the latest version of d.js only needed nodev13?
Needs v16
Then your discord bot is using djs v12 or lower
it is
when i get a new hdd for my server ima reinstall another os from scratch
and thus wil have everything else upto date
step 1 of upgrading to discord.js 13: install gentoo
This ^
step 2 make sure you dont have a will to live anymore
Can one combine multiple animations in one CSS ruleset?
my friend's server isnt?
That's discord official announcement, idk if they changed something or didn't fully enable it for some cases
maybe try check the USE PUBLIC THREAD flag for @everyone role permission
*v12
Even their fucking intellisense doesn't recognise ?. or tsx
Lmao
And on mobile you get random this shit will error 69% scanned
This is precisely why you shouldnāt use replit for discord bots
to install 16.8
i have two repls for my bot kek

how do i run node 16 on my windows 7
Upgrade to windows 10
u p g r a d e
I'll just install Linux
google is your best friend
look at the date of the article
filter use time
Look at the date of Windows 7 
nov 5 was when node was at v12 which was the last version that supported windows 7
bro
been there, I wish I knew better back then
lost everything
it says missing DLL stuff which I'm pretty sure has nothing to do with windows and cannot be fixed with a single hack
ask me i was stuck in recovery for 72 hours
download a sketchy dll from dll-files dot com
that's fun
ooh nice 1 mbps only
downloading files at a peak of 1mbps on an internet connection that supports 300mbps is fun
i'm not using windows myself, but i think it's possible to install node16, i don't think its good idea to change a whole OS just for a single software xD unless it's so important for you
lol I have half a megabyte speed
why do people assume nobody ever uses google
Especially if you're planning on hosting your bot on your PC instead of replit...
also i love linux
lmao yes
same
the beta version at least

i didn't use windows for some years since i installed my first linux
I'm happy with my kubuntu
who needs a vps for the beta version it's only in one server and private
Oh if it's for testing that's ok
How to know unapproved bot?
Did you know Azure is run by Linux
What is Azure
r threads automatically cached?
Microsoft's VPS that hosts stuff on windows
One message removed from a suspended account.
Windows server is run by Linux lmfao
One message removed from a suspended account.
huh
One message removed from a suspended account.
One message removed from a suspended account.
linus tech tips lied
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
What if... hear me out... Windows, a Linux distro?
but i don't like windows 
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
we poggin bro
because it's very hard to fuck up unlike Linux where rm -rf /?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
they added protections
One message removed from a suspended account.
what can i do while my ubuntu is downloading
imagine not using winget
imagine not using windows 7
when I was in 8th grade I tried installing androidx86 I just wiped my win7 partition. I had to borrow the laptop from my mom's colleague to download win7 iso
ooga booga edition ā¢ļø
android
on a pc
i thought it was cool back then
outside an emulator
stinking apple user
Error:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/runner/day/node_modules/node-fetch/src/index.js
require() of ES modules is not supported.
require() of /home/runner/day/node_modules/node-fetch/src/index.js from /home/runner/day/commands/anime.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/runner/day/node_modules/node-fetch/package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1015:13)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/day/commands/anime.js:5:15)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)``` ```js
code:
const { MessageEmbed } = require("discord.js");
const superagent = require('superagent')
const akaneko = require('akaneko');
const fetch = require('node-fetch');
const { discord } = require("discord.js");
module.exports = {
name: "anime",
aliases: ["weeb"],
description: ("Vote"),
async execute(message, args) {
let commands = message.client.commands.array();
const images = ['https://tenor.com/view/anime-gif-10117765','https://tenor.com/view/anime-anime-girl-girl-cat-gif-18514354','https://tenor.com/view/anime-gif-11006663','https://tenor.com/view/love-you-happy-anime-the-helpful-fox-senko-san-gif-14521920','https://tenor.com/view/sasuke-thinking-anime-naruto-gif-13593873','https://tenor.com/view/cute-anime-dancing-silly-happy-excited-gif-13462237','https://tenor.com/view/anime-anime-glasses-stare-glasses-gif-15313333','https://tenor.com/view/blush-anime-shy-cute-girl-gif-16149781','https://tenor.com/view/anime-laughing-gun-bang-gif-16899324','https://tenor.com/view/anime-pillow-gif-14847650','https://tenor.com/view/yawn-tired-anime-manga-japanese-manga-gif-9525859','https://tenor.com/view/bokuno-hero-academia-izuku-midoriya-deku-happy-gif-12815749','https://tenor.com/view/smug-anime-face-gif-6194051','https://tenor.com/view/chuunibyou-anime-kawaii-yes-gif-8215787','https://tenor.com/view/windy-texting-lonely-anime-boy-night-gif-14590288','https://tenor.com/view/anime-kafuu-chino-okuda-yousuke-swinging-white-fox-gif-10654450','https://tenor.com/view/smile-naruto-shippuuden-anime-happy-gif-8073510','https://tenor.com/view/sad-alone-anime-gif-9941414','https://tenor.com/view/anime-dancing-brushing-teeth-fun-gif-9167366','https://tenor.com/view/love-anime-kiss-hot-damn-gif-9838409'];
const image = images[Math.floor(Math.random() * images.length)];
let embed = new MessageEmbed()
.setTitle("Enjoy >-<")
.setColor("RANDOM")
.setImage(image)
.setFooter(":p sussy baka")
embed.setTimestamp();
return message.channel.send(embed).catch(console.error);
}
}```
how about put "type": "commonjs" in your package.json
you shouldn't have to change your node to module support because of a library
what version are you using
@split hazel it like v12 i think and it works on others and not this
it says v12 on the console
I am lord cringe of the universe
const zero = build(0);
const one = build(1);
const two = build(2);
const three = build(3);
const four = build(4);
const five = build(5);
const six = build(6);
const seven = build(7);
const eight = build(8);
const nine = build(9);
anyone?
Watch the package-lock file for changes?
any npm package in the entire registry
I don't think there is a way to do that without checking every single package every few hours
and what are you doing that requires tracking every package lol
There's a "Recently updated packages" section in the npm docs but I don't want to scrape it, but I can't find any official API sooo that may be the only option
Why would there be a problem with scraping it
You can temporarily copy the page to a file on your server and scrape that so if the app blows up it won't affect npm
Since it's looking for updated packages it needs to make a request very often, also the results on the page don't seem very accurate...
time to reboot my pc
apparently they have webhooks, but not for the entire thing at once, you have to specify package names, scopes or authors
package: *
sigh, welp
subscribe to github premium today
hi
anyone can explain me why when i execute the command "cambiar" it change the nickname to "Apodo Moderadoundefined"?
const { MessageEmbed } = require('discord.js');
module.exports = {
config: {
name: `cambiar`,
aliases: [`c`]
},
run: async (bot, message, args) => {
message.delete()
const persona = message.mentions.members.first()
function randomid() {
var x = Math.floor((Math.random() * 99999999999) + 1);
document.getElementById("demo").innerHTML = x;
if(!message.member.hasPermission(`MANAGE_NICKNAMES`)) return message.reply(`No tienes permisos!`)
if(!persona) return message.channel.send("Menciona a alguien para cambiar su apodo")
persona.setNickname('Apodo Moderado' + x)
}
message.channel.send(`**${persona.user.tag}** ahora se llama **${persona.nickname}**`)
}
}
Because x is undefined
var x = Math.floor((Math.random() * 99999999999) + 1);
You defined it in a function, a function in which you never called
Ah ok ik
plus its a global var, in this case its unlikely to cause an issue, but best to make it a const.
thanks for the advice
Use let or const depending on the circumstances
but internet explorer don't have es6 ya know
Doesnāt like code being executed in the IE 
const err = new discord.MessageEmbed()
.setDescription(` I couldn't lock ${channel}!`)
message.channel.send({ embeds: [err] })
It spamming with embeds for every embed a channel how to but all in one ?
did you have a stroke
who ?
can u send a bigger portion of the code
since i think this will send a single embed, but your probably using loop or somethin
to loop over all channels?
theres like anyone know an example for css and html example for use on top?
how is multuple embeds allowed for a bot user
it was allowed a few api versions ago
can you explain in more detail?
v6.9
example for css and html that i can use on top.gg?
it's allowed
not in a single message
only webhooks can use up to ten embeds in the same message
try it and see if it works
sigh, in the latest update, it's allowed u can try it
i tried it already in my bot š
in latest djs version they changed the format for a reason š
from channel.send({embed:..}) to embeds:[]
so u can attach multiple embeds in single msg
v13 supports up to 10 embeds
works on both
see this is what bad docs does to you kids
you miss out on a lot of new stuff
i want to make my bot open source, what license do i choose so that anyone viewing the repositry can copy it or something like this
MIT or smth that requires attribution
ok thx 
I would use this site to get exactly what you want.
https://choosealicense.com/licenses/
Non-judgmental guidance on choosing a license for your open source project
See attachment
Supports 10 embeds
most libs didnt even change anything to support this though, it was just discord adding support for it
not something they needed to document
Anyways the docs isn't bad,just don't blame it
i think code uses py
thats js
Py should support it too,with raw api request
How to set timeout for each message ?
yes
you want it for example send them all but with delay of 1 second between each message?
let's assume, all messages embeds are stored in an array messages
assuming the function that your code within is async one
for(let msg of messages)
{
await new Promise(r=>setTimeout(r,1000)) // to force it to wait 1s
await channel.send(embeds:[msg]).catch(console.error)
}
something like that
ok
const url = (res[0].match(/\d{17,19}/)||[])[0];
const id = res[1];
const embed = new MessageEmbed()
.setAuthor(message.author.username, message.author.displayAvatarURL())
.setTitle(` Successfully deleted **${count}** messages from this channel!`)
.setColor('DARK_GREEN')
.setDescription([
`[\`š View\`](${url ? `https://txt.discord.website/?txt=${url}/${id}/bulkdlt-${_id}`:''})`,
`[\`š© Download\`](${res[0]})`
].join('\u2000\u2000ā¢\u2000\u2000'))
message.channel.send({ embeds: [embed]})
Why the links not working ?
in what way are they not working?
I can't click them!
Not link words like
They are not blue
You know
u sure it's valid link?
can you console.log what inside setDescription
How ?
const id=..
const desc=[
`[\`š View\`](${url ? `https://txt.discord.website/?txt=${url}/${id}/bulkdlt-${_id}`:''})`,
`[\`š© Download\`](${res[0]})`
].join('\u2000\u2000ā¢\u2000\u2000')
console.log({desc})
...
.setColor('DARK_GREEN')
.setDescription(desc)
Nvm i fixed it
can type: 1 slash commands be invoked by a DM to the bot?
nm, it looks like it can if the command is registered globally
https://img.marcorennmaus.de/M4DVfCwE
@proven lantern dont ghost-ping the role thanks
sorry, what should i ping for spam reports?
a mod
š
is there some way to test a DM slash command without registering the command globally? i want to test it before registering it globally
why not use a test bot?
that will work.
thanks
is it possible to set the description of a guild via the discord UI? i dont see the option anywhere
https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
Yeah
thanks!
Hey umm
Anyone know how I can link PayPal and discord?
But how do I detect if someone actually made some donation or not. Currently I integrated PayPal sdk, to verify if it was a success or not.
https://developer.paypal.com/docs/api-basics/notifications/webhooks/
^ webhook for receiving when someone donated
probably
if you are accepting donations through paypal you should have a business account
It can be upgraded easily and tested as well using PayPal's sandbox environment.
what happened to DonateBot btw
url: 'https://top.gg/api/bots/756928506327466085/stats',
status: 504,
statusText: 'Gateway Time-out',
hehe and I was the guy arguing yesterday I wouldn't experience any issues posting the bot stats
and there we go...
It's just funny sometimes
504's happen sometimes with the api
always good to check for status code issues with any external api
yee ik, just stated yesterday I never had issues before
after saying this, something must have happen
yeah I'm doing this of course, just shared the log as it has been logged correctly
Currently my bot shows how many guilds it's connected to (voice channels) and how many are playing music with its stats command, I'm planning to buy another server to split load but I'm uncertain on how I could still get that metric for all of them rather than having to get metrics individually. My idea was to have a "heartbeat" where it periodically sends how many it has active now and then just tot them up but I was curious if anyone had any other ideas on how to do that.
id do exactly that, just provide the shard id in each request, should be rather straight forward code wise.
yeah
Probably being dumb, but I have an issue with some MySQL stuff. Essentially, I want to check if an user exists in a database. If they do, insert them. Otherwise, say they already exist and remove their role and give them a new one. However, I get an error when executing this code:
https://sourceb.in/54QsxUTv7Q
con.query(`SELECT EXISTS(SELECT * FROM rbridge WHERE id = '${id}')`, (err, rows) => {
if (err) throw err;
let sql;
if (rows.length < 1) {
sql = `INSERT INTO rbridge (id, elo, name) VALUES ('${id}', '1000', '${name}')`;
console.log("Inserting " + id + "...");
} else {
message.member.roles.add(role);
message.member.roles.remove("878277437962739713");
message.member.setNickname('[1000] ' + name);
message.reply("You're already registered!");
}
con.query(sql);
})
}
Take the first query out of the SELECT EXISTS
i did. i get the same error
What's the error?
line 660 is con.query(sql);
asdf i gtg btw sry ill check this back in a few hours
Oh
Move con.query(sql) up into the if statement
If you trigger the else then the query is empty
So the query should be made inside the if statement
(ping so you can find this easily when you get back)
how do i find a guild by using its id with djs v13?
client.guilds.cache.get("ID")
i am trying to do this but it dosent not work for me.
You could also use .fetch(...)
thats the correct way
Which will send an HTTP request if it wasn't found in the cache
i have,
if (!guild) return console.log("No guild")
and it is showing no guild in console
const guild = client.guilds.cache.get("ID")
Is the ID actually a guild ID?
yes
Is your bot in that guild?
Is that literally what you have written or do you do something like
const guild = client.guilds.cache.get("264445053596991498")```
i have,
const guild = client.guilds.cache.get("853698843018002443")
Is your client actually called client and not bot?
yup
You'll have to show us more code then because something's not in the right place
i have this as my function,
async function modmail(client, options = []) {
let { MessageButton, MessageActionRow } = require('discord.js')
const guild = client.guilds.cache.get("853698843018002443")
if (!guild) return console.log("No guild")
client.on("messageCreate", (message) => {
if (message.channel.type === "DM") {
console.log("Sent In Dms")
}
})
}
module.exports = modmail;```
you need to make sure your client is ready first
could i just put it inside the ready event then?
modmail function,
Is this in your index file?
ayo everyone! this is a general question about JavaScript/TypeScript's ES ecosystem, not a discord bot question, per se.
i'm creating a library in ES-based ts that supports both ES6< and CommonJS. how can i avoid having to make it so users have to require the default property of an ES6 export? i can't exactly export directly and i need to have my class as a variable since i'm also exporting the library as a global for browser environments. using both module export declarations and ES module expressions work, however require'ing the module.export into a project won't display JSDoc information as i want it to. how can i set up interop properly to make both ecosystems (ES and CommonJS) work?
i'm guessing this is a new thing now
you're the second complaint i've seen today about it
actually not exactly
idk i havent touched node in a while i only really touch c++ now
fair enough, this has always been a thing with ES modules with CommonJS
because like if you just use export default then you will always get it as the .default instead of just module.exports or whatever equivalent
idk how to do proper interop without the .default property tho
and yes hello hi fellow nokwok user
can we use button-role instead of react-role to advoid bot reacting?
whats your current exports code?
you likely have to mix several types of exports together
for example ```ts
export class MyClass {}
export default MyClass
export = MyClass
well
this is my current export code
export default ExchangeRate; // ES6< module export expression
global.NodeExr = ExchangeRate; // Browser global declaration
i'm exporting a global (types already defined) and an ES6 module, all i need is to export CommonJS
it's a class
yes you should
okay
let me go ahead and attempt also exporting to module.exports alongside the export, however i'm not sure if that'll work because it would just rewrite correct?
if you're using pure ts, you cant use module.exports i believe
unless you're writing js + .d.ts
dude can anyone help me with some css shit
this is my main site, button works perfectly
that's great to hear brother
other site, same code, button doesn't show text
i have interop enabled so i can use both require and import
if thats what u mean
i mean exporting with module.exports instead of export
anyone else here thinking github pages is a bit dumb
ive tried so hard to get on with it
its meh
i prefer digitalocean apps
you can, it works, however JSDoc just fails
save to repository, automatically updates your site
but its like.... remember when someone made a filesystem driver where it stored its files in gmail? gh pages reminds me of that
git repos are NOT convenient storage for websites
well if it fails then it doesnt really work lel
it works for one of my bot sites, its static so
well it works but jsdoc doesn't show up in vscode
yeah my site is static too, but it updates on a cron
did you try export = tho?
and the git history grows... very quickly
yeah it's telling me that i cant use it in ES modules or summa
shit like this is why i dont use ts
im thinking of moving my docs pages back to my hosting
i use an api hooked up to my sitre
yeah same
but im working on a node library and this is probably the best place to use ts
then i dont have to do silly shit like push it to a git commit to deploy it, then deal with githubs strange caching and delays
i recommend digitalocean apps for static hosting
I just host it on Vercel
digitalocean updates the site and its cache automatically within 2 mins
i have several libs and none of them use ts xD
netlify is good too
^
i already got tons of hosting
you get the same intellisense as ts
i just thought it made sense to centralise a github project and host its site on gh too
but nope it sucks
yee but i sort of already did all the work for this one so i might just follow through, plus this is my first project
i have a reseller plan and i have to say, itsamazing
it can be more petty than helpful at times
require isnt failing so i might just export it using just module.exports and maybe that might work
agreed
i have a dedicated server, one more static site wont hurt it
that's why i just didn't touch it at all before now
i host on vercel yet i have like three dedis
what do you put on them?
tbf i have the dedis running in a docker swarm running my api so
although from what i remember, having both export class and export default should work
a lot of stuff like backups and ddos prot
can you show the generated js code?
of you use export class MyClass + export default MyClass
big bot?
export default exports as exports.default
no bots at all, i stopped coding discord bots primarily (i only manage one massive-resource-heavy bot now)
just use vercel or netlify, its a lot better than trying to wrestle with pages or your own thing
https://github.com/brainboxdotcc/DPP/actions/runs/1192180171
this was a pain in the ass to get working
@quartz kindle it's transpiled to this:
exports.ExchangeRate = ExchangeRate;
global.NodeExr = ExchangeRate; // Browser global declaration
github actions is continuous integration, not related to hosting
yea ik
try this
i thought u were using actions in conjunction with pages or whatnot
alrighty
so i send a push, or someone submits a PR, it tries to build it for linux across 2 compilers, OSX, and windows x64, then as well as confirming good/bad build it outputs zips/debs of the build
anyone here know how to use gradient buttons properly lmao
nah ive considered actions for page deploy
but examples i found have the same problem of quickly building up a huge commit history
someone hosted a discord bot there
lmao
yeah you could
Ahh okay that is extremely efficient, I do the same but instead of my actions being run on Actions I just push a POST request to my internal GitLab cluster which does all of the heavy CI lifting
although afaik github actions has a time limit on all processes
if its not against githubs TOS i was going to do D++ unit tests in actions, with a token in the secrets
like 4 hours o something
nice, gitlab cluster sounds expensive @green vale
it's not expensive at all
my next todo is to figure out how to build an arm7 deb for raspberry pi
it's just my three dedis and a bunch of vpses hooked together with docker containers running gitlab's ci runner
somene got the lib to build on an rpi 4 and confirms that it runs awesome there. like ten megs of ram for a bot YES PLEASE
lol
i made my gitlab github hack thingy before i figured out that Actions had its' own BYOR/BYOD thing
i just use djs for coding bots, i cba making a bot for python or java or whatnot
so im gonna make that its unique selling point so to speak and "corner the market" on compact bots running on pi
lel
it works, but the reason i avoid it is i really dislike js lol
these days if i learn a new language (like C# or Rust) i just make an overkill hello world program (or in the case of C# i just used Unity)
that and it doesnt scale well
js was my first programming language, been working with it for like 5-6 years now?
yeah it doesnt scale well
if i had to scale my bot then i would use js workers if i had to use js
otherwise i'd just use JDA or something
discord.js doesnt scale well
im used to running 112k guilds in 2gb ram
js can scale well if you know what you're doing
not as well as a low level lang of course, but decently well
not 112k guilds in 32gb ram lol or whatever djs would like to use im sure
djs is cache-heavy
a lot of the cache can be turned off though yes?
using something like djs lite
yes but even so, discord.js caching is very inefficient by design
the beautiful thing about compiled low level languages like C++ and rust is that you can just leave the caches on, and it still doesnt eat much ram
that's true, i might try my hand at workers one of these days to see if i can scale that way
im working on my own js lib
i might learn Go but apparently that's a sin
still doesnt have caching tho
every time someone learns Go, a Rustacean loses a finger
but runs 10k guilds on 20-30mb including node.js itself
š
yeah i'm sort of learning Rust now?
that is decent
wait
am i reading that RIGHT??
i mean, its just the websockets, no caching yet
my bot with like 200 guilds takes like 512mb
better look at htop
my htop is ... well.... lemme show you š
mine in 119 uses 300mb ish
i have 18 clusters, each of those screen is a cluster and the green are ofc threads
the amount of processes in there deadass made me choke
a cluster hosts about 9k guilds and uses between 150 and 250mb ram
just looked and i pay £3.14 for a 2gb ram vps with 25gb storage, 3tb bandwidth
my bot is more resource heavy but
fair enough
so i could get ram usage down a lot if i ran less clusters, but less clusters means less fault tolerance
thats with all caches on right?
i run my own infra off of OVH and stuff (and not just using rented VPSes) because i run a massive ddos prot network for mc and stuff
user cache is off, or it'd use about 8gb in total across all the clusters
ah
i have over 12 million visible users now
plus it'd hurt startup times lol
as i'd have to members-chunk 12 million records
oh nice
discord.js v12 uses 600mb on 9k guilds
discord.js v13 uses 900mb on 9k guilds
all caches on
but im confident a well designed js cache can stay below 300mb
its a challenge
i'm buying my own server for £15 with 8gb ram, intel xeon xxxx-ican't rememeber the exact
im gonna give it a try
because js memory management is just "smoke em if you got em"
if i was doing that i'd pre-allocate an array, and have a bitmap of whats free and what isnt
as a file server to start with then i'll figure out what to do with it
i have those two options as well
only without suck
not a bad idea tbh
the issue with going non-js caching on a js lib is that you have to serialize every operation
which puts a dent on performance
i uh
let me check what my dedi has
well my main
alr
Ā£15 for a dedi? thats really cheap
wheres it hosted, someones shed?
no

my garage
woah what do you use for file hosting
youve basically got roughly same setup as me
thats cool
which ovh dc you in?
oh and before you come and curse me off for using python it's not flask it's just a short name
i'm in ERI1, London
i heard you should host at RBX if you like hot swap 
custom cdn thing makde in JS
oh nice
im at a german one
jesus
i use projectsend at the moment
which LIM dc? LIM1 or LIM3?
as in i downloaded today
i picked the german one as was the only one that had dual NVME in stock during the silicon shorage
shorage/shortage
ouch
fairs, you should just use flameshot and then copy to clipboard
either one, windows or linux
calling c++ functions from node has a bit of overhead depending on the amount and size of data
all synchronous overhead
i would just try my hardest to avoid any C++ in my Node code
OVH
im at Limburg (LIM1) - Germany
for example I tried a large array of numbers from js to c++ and the conversion from js types to c++ types is very slow
before this i had one at poland warsaw
ahh, ik that LIM3 is shitty and we had a tonne of issues with hosting in LIM3
it was fast enough network wise, but it had HDDs
LIM1 is good
i used ovh to buy a domain and then it took 3 days for them to update dns
like jesus
WAW is a really really good DC
i made a working static site generator tonight and im legit so proud of myself lol
only use ovh to buy servers
my advice
i get all my domains at the cheapest reseller now, i do a search
use smth like namecheap or porkbun for domains
i use namecheap
for all
fairs
then as soon as i can, at first renewal i transfer them to cloudflare