#development
1 messages · Page 1767 of 1
?
About me 
yes
This isn't a meme channel
you'd be surprised
people who think json is a database is not really a meme, its just missing knowledge or ignorance
Has anyone made an open source tcp clustering/sharding system for djs yet?
i just started seeing this in my logs. did something change that requires oauth now?
package.json engine thingy
discord.js has one
it comes with the lib...
its not "clustering"
in the sense of running multiple shards per process
but there are several, such as kurasuta, and more
here's the line throwing
I meant that it has over tcp broadcast and eval stuff
Would this be the place to look for any bot developers to help me out and develop something for me?
Your account needs to have 2fa
Nope
my account or the person running the commands account?
You can ask for code help tho
Bot owner account
I'm not a coder, looking for a developer 🤣
nice, thanks! i'll set that up now
You can look on fiverr
Not here
This channel is for developers to help developers
discord.js uses the cluster module, which uses IPC (I think you mean IPC, not TCP)
most existing solutions are based on ipc/child process
I meant TCP
but there are many tcp libs that you can use to make your own broadcasteval
So that it could run on different machines
I don't know if there's a lib which uses TCP
Ik
yes just use a tcp lib
I should rig kurasuta to work over tcp
When are you going to need something like that tho
your bot must be uge
IPC is faster than TCP... there's no really point in doing it unless your bot is gigantic and needs a ton of resources
Bro.... not for production....
I am not asking what I should use....
I am asking whether it exists
Increasing knowledge
And testing stuff
isnt a websocket faster than tpc/udp?
Is it?
idk, im asking
the answer looks to be: no
WebSockets performs quite well, with an average round trip time of about 20 microseconds (0.02 milliseconds), but straight up TCP still beats it handily, with an average round trip time of about 2 microseconds (0.002 milliseconds), an order of magnitude less.
websockets extend the HTTP protocol
so they're def slower
out of the three udp is the fastest
if you're ok with loss of data then go with udp
of course udc is faster
unix domain sockets / ipc > udp > tcp > websocket > http3 > http2 > http
what about letters and smoke signals?
Interesting to see that websockets are faster than http
both websockets and http are built on top of tcp
ws keeps the connection open, http doesnt
Udp if you want to lose packets in deep space
I mean if you receive packets of data very frequently then udp is the go-to
Anybody know how to get rid of this issue? It’s saying 0 for it when it’s in more than 0 obviously.
Ok, one second.
Thats why udp is used in multi-player gapmes
thats why people teleport in multiplayer games
🤣
of course its 0
your activities are defined outside
what even is udp used for?
ur bot isnt ready when it passes through that
games and real-time uni-directional data
for data-loss
Oh yeah, stupid mistake lol
but doesn't tcp do the same job but better?
its slower
I haven’t coded a bot in 2 years as I’ve had a break so I’m rusty
udp is fire and forget, it doesnt care if the other side received or not, used for stuff like audio/video streams, videogames player position, etc
tcp needs to check and double check every single packet if it was received successfully
@lyric mountainbasically this
Fixed
Its undefined
therefore can discord block for code?
(MINI jandev)
setInterval(() => {
var con = client.con
con.query(`SELECT * FROM statistics`, (err,statrow) => {
if(err) throw err;
statrow.forEach(function(row) {
const targetGuild = client.guilds.cache.get(row.sid)
if(targetGuild) {
var memberCountChannel = client.channels.cache.get(row.channel_id);
if(row.type === '1'){
channel_count = guild.members.cache.filter(member => member.user.bot).size
} else if (row.type === '2'){
channel_count = guild.members.cache.filter(member => !member.user.bot).size
} else if (row.type === '3'){
channel_count = guild.members.cache.filter(member => member.presence.status !== "offline" && !member.user.bot).size
} else if (row.type === '4'){
channel_count = guild.channels.cache.filter(m => m.type === `text`).size
} else if (row.type === '5'){
channel_count = guild.channels.cache.filter(m => m.type === `voice`).size
} else if (row.type === '6'){
channel_count = guild.channels.cache.size
} else if (row.type === '7'){
channel_count = guild.roles.cache.size
}
guild.channel
memberCountChannel.setName(row.channel_name + ' ' + channel_count)
console.log('Channel name: ' + row.channel_name + ' ' + channel_count)
}
})
})
}, 60000); //60 sec (1 perc)
and if I write to an event pl channel deleted member join ???
what?
member join event function timer 5 minutes
member leave event function timer 5 minutes
channel delete event function timer 5 minutes
channel Create event function timer 5 minutes
Can someone help me with this please? I'm kinda confused
https://starb.in/92AKHy.js
Does anybody has an Idea why its other formatted on top.gg? (it was fine until 2 weeks ago or something...) a few things are just not on top.gg but code is the same
Code: https://github.com/SimsumMC/communitybot/blob/main/README.md
I would say it says that the programm wanted to have a number but the database returned a string
Could you help me fix it?
// ANTISPAM
const spamMap = new Map();
const maxMessage = 3;
const timeDifference = 30000;
client.on('message', async (msg) => {
if(message.member.id != ayarlar.sahip) return;
if(spamMap.has(`${msg.guild.id}_${msg.member.id}`) && spamMap.get(`${msg.guild.id}_${msg.member.id}`).messageCount >= maxMessage) {
msg.reply("spam detected!")
spamMap.delete(`${msg.guild.id}_${msg.member.id}`)
} else if(spamMap.has(`${msg.guild.id}_${msg.member.id}`) && spamMap.get(`${msg.guild.id}_${msg.member.id}`).messageCount < maxMessage) {
var newMessageCount = spamMap.get(`${msg.guild.id}_${msg.member.id}`).messageCount + 1;
spamMap.set(`${msg.guild.id}_${msg.member.id}`, {
lastMessage: msg,
messageCount: newMessageCount
})
setTimeout(() => {
spamMap.delete(`${msg.guild.id}_${msg.member.id}`)
}, timeDifference)
} else {
spamMap.set(`${msg.guild.id}_${msg.member.id}`, {
lastMessage: msg,
messageCount: 1
})
setTimeout(() => {
spamMap.delete(`${msg.guild.id}_${msg.member.id}`)
}, timeDifference)
}
});
// ANTISPAM
@summer torrent
can you help me?
it's not working
whats wrong
i don't know
You can do that easliy yourself if you know what you coded and if you didn't copy it , just looks in which method do you call it and why do you want a number and why does the db return a string
this seems like a terrible way of doing it
the amount of timeouts you'll create with this wont scale at all
hi hi, is there a way i could detect when there is something new posted here http://www.profightdb.com/?filter_field=promotion&order=&type=&filter_promotions=2
Explore pro wrestling history from the WWE, AEW, NJPW, ROH, WCW, ECW & more - over 100,000 results
like new results
run a script every X minutes/hours to check it
or just run irl, like, for a whole mile. should work too

ezposed
also replying to here before my dms
you shameful capibara
I like capybaras
I had responded here before I saw any dms
what?
sarcasm is really hard to get via messages, huh
would i need a database for that? like how would i check if it has changed
it kinda is for a non english person ngl
out of both answers we gave, u look at my joke first
yeah cuz that confused me lmao
use this
would i need a database for that? like how would i check if it has changed
not necessairly, but would be good
having a database means u dont have to worry about your bot crashing and losing all memory
for something that simple i would recommend sqlite or something of the sort
i do not, no
np
Like others have said, you'll need to run a script to periodically check for new updates. The site does have an RSS feed, but it also states that it has no intentions on creating a public API to fetch the data.
why is their some weird line under the section during and after it slides out
app.get('/api/bots/:userID', async (req, res) => {
let userID = req.params.userID
let bots = await Bots.find({ owner: userID })
let newArray = []
bots.forEach(async b => {
let Bot = await bot.users.fetch(getID(b.botID))
newArray.push(bot)
})
res.send(newArray)
})```
Is there any error in this
it gave me an empty array
And i'm sure there is a data on the data base
I don't know about the Express or MongoDB part, but I know you're passing an async forEach and expecting to immediately return
yet async operations take some time to complete
For example:
let users = [];
for (const botID of bots) {
users.push(await bot.users.fetch(...));
}
res.send(users);
Notice you've unrolled the .forEach call for a regular for of loop instead.
if someone clicks the button once, how do i make it so it cant be clicked anymore?
both buttons ^
like if they click either one, make both buttons unclickable
hey does anyone know how i set an interval that will run after 30 days?
like i was thinking about using a normal setimeout but that won't have the capabilities to hold that amount of bits.
as we will be talking about milliards of ms
chances are your interval will never run
but anyway, the number is smaller than you think, it'll barely scratch the long capacity
remember epoch millis is the number of millis since 01/01/1970 and it does work nicely
30 days = 2592000000 millis
I like how I put 1+2+3 together and randomly made this:
if(!user === passive || true) return message.channel.send(`That user is in passive mode.`)
``` When I didn't even know what I was doing 🤣
*Random post.*
so you basically made if (true) //do something
Yup xD
I didn't even know that that would work, I was just at the time puttin symbols I had in mind in the code and when I tried robbing someone using the bot it worked xD
Maaaaan, that made my life way easier.
I didn't even know that that would work
it won't
this is not accepted as the settimeout intervals are 32 bit based right?
So it would throw an error maybe
settimeout is in millis
yeah
so it's very likely long/bigint
but as I said, chances are that interval will never ever run
if you're going beyond 1 day interval, you're better using crontab or another kind of date-based scheduler
hi
yeah i am already switching to node-cron, thanks kuuhaku
np
Can someone help me in #topgg-api maybe? 
edit the msg with the new set of buttons
Hi, any solution ?
ERROR Unhandled promise rejection: Cannot read property 'updateVoiceState' of undefined.
D.js 12.5.3
you didn't even show any code
pretty sure its voiceStateUpdate
the issue is on manager
I'm very confused at what that file is supposed to be
there's little to no info regarding what each thing is
my bot was approved finally :p
Congratz
thanks :)
in next.js does anyone know how to send a 200 response without a body?
how can i check if someone blocked the bot
try sending a message
there's not much you can do aside from that
well im trying to fix it so it doesnt crash when it sends a message
just trycatch it
You sure you don't want to send a 204 No Content?
Maybe? I have a few apis that ask for just a 200
Cloud functions seem to just use a fork of express so I might just do that
res.status(200).end() should work
Thank u thuththy bakaaaa
hey guys, could someone remind me where can i find and renew my top gg api key? i had poor practices and put it on my github repo but now im thinking of making it public so i want to renew it
bot edit page > webhooks
found it thanks a lot
@light pumice let's move our discussion to here
yeah, although there has to be something making it not work
it might be because you used <p> tags within the ifram
I think TopGG just doesn't like the stuff being inside the iFrame
usually you keep it as just raw text
That's what the support person told me to do
and the website should automatically format the text for you
in the event that the iframe does not work
all good, cheers
anyone know why buttons aren't working? (as in they dont show up, i know the way im sending it isnt efficent but i want to just make sure i get buttons working)
import Discord from 'discord.js';
import Buttons from 'discord-buttons';
// const topPlayers-Teams = require('../resources/modules/getTopData.module.ts');
exports.config = {
'name': 'leaderboard',
'description': 'Displays top Players and top Teams.',
'usage': 'leaderboard',
'aliases': ['topplayers', 'topteams'],
'alias_str': 'topplayers, topteams',
'category': 'Game'
}
exports.run = async (client: any, message: any) => {
let buttons: any = Buttons(client);
let button_plr: Buttons.MessageButton = new Buttons.MessageButton()
.setStyle('blurple')
.setLabel('Show Top Players')
.setID('top_plr')
let button_team: Buttons.MessageButton = new Buttons.MessageButton()
.setStyle('blurple')
.setLabel('Show Top Teams')
.setID('top_team')
message.channel.send({
buttons: [
button_plr, button_team
],
content: 'hello world'
});
}
ok
I don't really use discord.js, but I think it should be:
message.channel.send("hello world", {
buttons: [button_plr, button_team],
});
Looks like you aren't setting it up properly. From the README:
const discord = require('discord.js'); //Define the discord.js module
const client = new discord.Client(); //Creating discord.js client (constructor)
const disbut = require('discord-buttons')(client);
I wonder why discord-buttons decided not to make it a constructor
Idk. They even made it similar to the Embed Builder
could've just extended the client class
LMAO
I'd just install the button PR to the main lib
but I have my own lib with component support
making it a class would probably be pointless
doing that shit is dumb tho
The require(...)() pattern? That's normal.
That's not normal
how does that work for ts?
I'd say it is. It means you exported a function.
its not really a good thing to do
sounds like preference
yeah, I like my code to make sense and look clean
OH
I see
yeah no this is super stupid
interface exported {
new (...args: Array<any>) => ClassDef;
}
they are making it prone to newbie devs fucking shit up
someone is gonna accidentally put it in a command
and end up with the max listeners for 'INTERACTION_CREATE'
doubt that's the reason but more of a side effect
idk why they shoved components on interaction create
They're really pushing forward the idea that they want devs to use slash commands
Well, normal commands were all shoved down MESSAGE_CREATE lol.
slash commands are nice tho
A certified mod of the ddevs server said they were talking about making GUILD_MESSAGES a privileged intent
disgusting
I can't wait for an impressive lib to figure out how to make them typed super well
thats fair tbh
messages are user content and therefore probably should be privileged
plus slash commands are super user-friendly
this hurts me so much https://img.terano.dev/O2wm1Vf4
I done some types already, but haven't done unions to make the interfaces stricter. Perfection would be something like:
type Interaction = { type: COMPONENT_TYPE, ... } | { type: SLASH_COMMAND, ...};
Not really. Imagine if EVERY bot moved to slash commands. A ton of bots could be in a singular guild. A user can be in 100 guilds max. I heard somewhere they already capped or are capping guilds to 100 bots. That's 1000 bots. If all 1000 bots register global commands...
while we're at it let's remove all these traditional things like event emitters and use cooler models like reactive
yay!
axios 
it would be nice to see it more of a options.X being typed as the correct type
this seems really cool tbh
Will never be a mainstream client, but if you like functional / reactive programming is it nice 🙂
yea but it looks like it works well for what its meant to do
not like djs where its a jack of all trades but best at none
everyone here sleeping on functional & reactive
if you're confident in it, could pr to discord docs to add to list of clients
Hah, I looked through the djs source code and was kinda horrified at how complex it is.
yea its super over-engineered
nah it's just about right
Well, you got to send all the first-time programmers somewhere right?
Probably relies on all the caching to work 🤷
I mean they both use prototype stuff to work
I'm working on making a Discord.js-like cacheless wrapper around updated versions of modular libs :)
https://github.com/AmandaDiscord/ThunderStorm
working on an update currently to make folder structure and class names similar to Discord.js
the library which you only upload the dist to?
just so it's not included in install
All those classes for embeds etc. don't really make sense in typescript, at least to my eyes.
Plain objects + type safety goes a long way.
hmmm
I see what you mean
imo it looks nicer tho
alright I must sleep
good night peoples
You have to understand that TypeScript isn't meant to be similar to clangs or other strictly typed languages as it still compiles down to JavaScript which is not type safe at all and shouldn't have other language conformities shoved onto it
Yes, if your type is any in Typescript, then you are open to errors still.
But otherwise, even if it compiles to Javascript, the type safety still applies.
That's a large assumption as the npm registry doesn't just consist of type safe libraries. Type safe devs so to speak are at the mercy of other devs that don't practice type safety
The end user might also not practice type safety
the run time also isn't type safe
arbitrary statements can be made to easily break this
Not too sure what you are trying to say, but if the interface is wrong - at run-time or compile-time - then it will break things.
I wouldn’t say typescript is type safe, more like type “safer”
Trying to force JS to be like another language just won't work out is what I'm trying to get at
functional languages are great and all, but JS isn't that
Oh, functional programming isn't really a language based thing though.
And javascript just so happens to be pretty good at it, with good anonymous function support, closures, passing functions as references etc.
The basis around functional is mutating the state of something through other functions and returning similar or different values. JS isn't optimized for that
If anything, OOP is kind of a hack in Javascript. Classes were added not that long ago.
Classes have always been in JS. later ES revisions actually added the eye candy which is current class syntax
Even if it's not the language's native paradigm, it doesn't mean it can't be used efficiently. I'm designing an immutable database yet still using Postgres.
You could use it like it. I just don't think you should be using JS like that considering other languages exist for that
and would get better performance if it was optimized for that syntax
Prototype chains are not really classes. They can be used in a similar way, sure.
const app = express();
app.get('/register', async (req, res) => {
return console.log(req.body)
})
fetching http://localhost:3000/register?email=124&password=xyz
(I have no experience with this stuff) I don't know what I am doing wrong but req.body is {}
You'd be looking for the query string. Not body. Body is non standard for get requests anyways
so req.query?
ah yes it did work thank you
How do slash commands work in discord js? Is there any example?
im pretty sure there's tutorials somewhere
atm you kinda need a bit of a workaround but they are adding slash commands support in v13
packages probably ^
and v13 will only come out once specific pull requests are merged
lol
which can take a while
Till now, you have to work with interaction and raw api Which isn't documented and marked private in their code.
Or use any third party libraries.
Till now that's the best you get
@elfin vale
Till now I guess this is the best example I can give without using any third party libraries
BotClient.on('ready', () => {
BotClient.api.applications(BotClient.user.id).guilds("YOUR_GUILD_ID").commands.post({
data: {
name: "aaa",
description: "Get a random AAA",
options: [{
name: "big_aaa",
description: "Get a big AAA",
type: 1,
required: false
}, {
name: "smol_aaa",
description: "Get a smol aaa",
type: 1,
required: false
}]
}
}).then(console.log).catch(console.log);
});
BotClient.ws.on('INTERACTION_CREATE', async (interaction) => {
BotClient.api.interactions(interaction.id, interaction.token).callback.post({data: {
type: 4,
data: {
content: 'AAA'
}
}}).catch(console.log);
});
ok. ty!
also look at this
useful too
also if you really want to add slash commands just use the master branch as it has like built in support without you having to do this code
its just easier to use in general
Link sends a Link
for nested functions like this
function A() {
function B() {}
}
A()
Does the function B gets redeclared everytime we call the function A?
quick question, does the discord api allow for making the audit logs show the user who executed the command rather than the bot?
like for example, the user runs a ban command, the audit log would show that the user were the one banning rather than the bot
i have a event client.on("messageReactionAdd" with control conditions if I try to send a message to the user if(condition) return user.send("") it gives me an error on the bot prefix variable
this is line 102 let prefixnowget1 = await dbo.collection("info").findOne({ guildid: ${msg.guild.id} })
this is the code https://sourceb.in/P1E5MMnQ92
Can a discord bot support a webgl game? 
this
What do you mean by 2 host server things?
yes
i saw a guy running a Gameboy emulator inside a embed i guess its possible
its possible, larger bots like Dyno, Mee6 does this
but its quite complicated
I'm thinking of making a rpg game with webgl, no idea of how to embed it onto discord lmao
Yes. But javascript engines are pretty smart and will probably re-use it.
you probably have to stream it
I'll have to research a lot lol
like you have to render it on your server and use some sort of stream
Mhm, get your point
when someone can do this in minecraft you will figure out how to do it in discord
Haha, well the thing is gba has a node sdk
You could probably render an image on the server, and tell the embed to update the image every x amount of time? Will need more research, because that would be a last resort 🙂
So it isn't hard to actually embed it onto discord
there are API limitations
and this will get you ratelimited really fast
Probably will get you rate limited yeah
this is why streaming it is probably the better way
What is the rate limit on message updates? Do they have a seperate bucket?
Too many requests, since we are changing frames every ms or so
Oh if you are aiming for more than 1fps, then this wouldn't work lol.
u sure?
Yeah
Can you embed a twitch stream or something?
Twitch has its own discord integration, that lets you stream a twitch live stream link on discord
Hello, I am doing a role reaction and I am using MYSQL to manage my data.
When I add a reaction role to a message, the bot checks before if on the configured message id there is not already the chosen emote registered.
So I want to add an emote that it is not saved for this message, but my bot returns a sentence saying that there is the emote in the database (after checking it is not).
Currently I am trying to add the emote 🙏, so I have this:
const getEmote = Discord.Util.parseEmoji(emote);
const convertEmote = parse(getEmote.name, {
assetType: "png"
});
options.database.query(`SELECT * FROM reactionRole WHERE guild_id = '${message.guild.id}' AND channel = '${channel}' AND message = '${messageID}' AND emote = '${convertEmote[0].text}'`, function(err, resultCheck){
if(resultCheck.length) return message.channel.send(options.emojis.no + message.language.get("REACTIONROLE_ADD_ALREADY")
.replace("{emote}", convertEmote[0].text)
.replace("{channel}", `<#${channel}>`)
.replace("{messageID}", messageID));```
For information, I use the parse function of a module to retrieve each valid emote (that's for another thing) but I log what it returned and its return the emote that I want to add and that 'it is not in the database.
The channel and messageID variable are retrieved from a table: this is the identifier of the channel and of the message on which the bot must add the reaction role.
So I don't understand, on some emote (which is not in the database) it works, ie it adds well since it cannot find the emote. Now, on some, when there is none in the database, it says that there is already the emote in it when no .. How can I do that? Thanks to the person who will help me
there are probably ways to embed streams, like ive mentioned earlyer someone made a Gameboy emulator with a discord bot
saving emotes in mysql overall is funky, iirc you need to change the charset
yes but you still have to stream it somehow to discord
the backend stuff is not the hard one i would say
the frontend is annoying
ok
did you use utf8mb4 charset for the database where you store stuff?
this is ; utf8mb4_general_ci
sounds right then
did you checked with stuff like mysql workbench if its correctly stored?
its utf8mb4 charset
yes
also the emotes doesnt show up as ? in the column?
then i guess something fucks around with your query
did you tried to test it by forcing an emoji?
also only unicode emoji can work
i will check with an emoji bug
Ok i’v found
the emote 🙏 returned a blank case in mysql
yes bcs its probably not unicode
What type of characters should I use to add all the emojis I want?
utf8mb4_bin ?
or other
https://unicode.org/emoji/charts/full-emoji-list.html these emojis will work
if you want all of them you have to use the string discord uses
Mh ok thx bro 😎
wait folded hands is unicode
but just use the string discord uses, will give you way less headache
excuse me bro @lusty quest
i test somes emojis in mysql
and all returned blank case
then the way you store them doesnt work
so i think I have to change the type of characters
just use the strings like i suggested, bcs you have to expect that the enduser are dumb AF and cant figure out what a unicode emoji is
this?
let embed = new Discord.RichEmbed()
^
ReferenceError: Discord is not defined```
i defined discord but this still happens
thats V11 code
const exampleEmbed = new Discord.MessageEmbed()thats for V12
it still happens
it says discord is not defined
so i wouldnt say that would matter
how did you define discord?
yea thats wrong
and defined discord in index.js
define Discord directly in your command file
you need something from the module, not from the client class
nobody can help me ?
ill try defining it in the file
and ?
id value is null
i know
make sure that its defined
wait
does console.log(msg.guild.id) return a id
the id is saved in database
that and a search query
wait
your entire query is weird
why is it in ${}?
${} is for parsing the stuff into a string
but you need to give them a value
then
let prefixnowget1 = await dbo.collection("info").findOne({ "guildid": msg.guild.id })
does it work?
Hmm, looking at your code, you shouldn't be creating a MongoClient for every message reaction 🙂
mongodb client already takes care of pooling for you, one is enough
if I remove it from that file then it doesn't work anymore
Change:
module.exports= async (client) => {
To something like:
module.exports= async (client, db) => {
Then pass the mongo client instance from your command handler or something.
I said it doesn't work
you're not even using the db parameter lol
const db = await MongoClient.connect(``, { useNewUrlParser: true, useUnifiedTopology: true })
const dbo = db.db('simply-ticket');
Yes,
it's called sharding
f autocorrect
clustering would be the proper therm, sharding is just splitting down the bot into mutiple processes
they're pretty similar
like sharding partitioning clustering blah blah blah ......
You'll only need them when the bot is like in 25000+ guilds I guess
2500 not 25000
heh
Hn
Sharding is just opening more than one websocket connection 🙂 You can have multiple shards in one process.
is sharding like 2 clients signed into one bot account
in d.js it uses worker nodes to run it on mutiple processes
also having it running on mutiple processes makes sense at a certain point
I think it has internal sharding as well, but I don't use d.js.
this
That is actually reasonably accurate 🙂
State your issue right away
don't ask to ask
wht you mean
you can get 2500 with internal sharding I guess
you can get up to 2500 with 1 shard
for 25000 you need separate machine
internal sharding gets you multiple shards
not necessarily, depends on your bot and your machine
you dont need necessary a new machine for 25000 guilds
plenty of bots with 100k+ run on a single machine
thats like 10 shards
yes
But at 2500 you have to start sharding
Unless the bot can't access more guolds
internal sharding does that for you
That Machine:
69 Gig Ram
16 core processor 420GHz
GPU: RTX 9096ti
yes that's what I was saying
that can easily run a million guilds
i though you said "up to 2500" with internal sharding
my bad
Brain said: you'll need 2500 guilds when you should use separate machine
I said 2500 is what's internal sharding should cover
i mean
technically the term "sharding" means having multiple websocket connections, and officially, discord requires sharding at 2500, so brain was not wrong
"sharding" doesnt necessarily mean multi-machine
It all started here
when the discord.js v13?
"We do an extensive amount of trolling"
they're adding so much bullshit to their codebase its getting harder and harder to work with
i think v13 will be the last djs-light version
To be fair they also have to contend with discord itself fucking with the API constantly on no set schedule and adding features consistently at random, often with no warning.
they dont really care about the timing of discord updates since they themselves take 2 years to actually release them
but yeah the changes to the api itself often fuck up the direction they want to take the lib
yeah I remember that v12 took 2 years do'nt worry
Does any JS lib already have interactions and buttons though? That's the good question
Does it now? @opal plank does detritus have / commands and buttons released on a stable version?
maybe not in a stable version, but djs doesnt even have it on master, its still a pending PR
how to solve --> npm ci
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/runner/test/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/runner/test/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-05-31T10_07_29_043Z-debug.log
exit status 254
Repl.it: Package operation failed.
imo the biggest issue with discord.js is that they didnt think it was enough to be simply a "wrapper", they basically became an entire trancoding/translation unit for the discord api
kinda like an API ORM
on repl.it you dont use npm, you install packages using the add package button
what is internal/fs/utils.js:269
throw err;
^
Error: ENOENT: no such file or directory, open '/home/runner/test/index.js'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at Object.<anonymous> (/run_dir/interp.js:195:19)
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)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/runner/test/index.js'
}
now its missing an index.js
oh i will change server.js into index.js
https://srcb.in/f2bIFQJTY6
Hi everyone, this is my command handler, how can I addapt it for dividethe commands in folders?
discod.js
For this very reason I ended using code generation for client methods and types etc.
They should just provide an openapi spec or something :(
fs.readdir
only this?
const command_files=fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
Here fs.readdir instead of fs.readdirSync?
no, you have to use both
i mean
you have to use readdir in combination with readfile
as many readdirs as you have folders
doesnt matter if readdir or readdirSync
fs.readdirSync(folder).forEach(subfolder => fs.readdirSync(folder/subfolder).forEach(file => {}))
Error: Cannot find module './handler/console'
Require stack:
- /home/runner/res/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at /home/runner/res/index.js:15:46
at Array.forEach (<anonymous>)
at /home/runner/res/index.js:15:33
at Script.runInContext (vm.js:130:18)
at Object.<anonymous> (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)Hint: hit control+c anytime to enter REPL.
we're using third party libs
like
https://www.npmjs.com/package/discord-buttons
(tbh this is the only lib I found. The others are useless or copies)
That package is just bloated
what's bloted ?
anyway It works I guess
But discord-buttons literally uses discord.js (and fails at that too)
Just use raw API requests 
yeah It's like an extension until v13 comes up
in 2 years
If I want to listen to gateway events directly, do I refer to events in https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events in all caps snake case form?
Says like v13 will ever come out
yes
So MEMBER_UPDATE is wrong 
I tried that with slash commands and you know what ?
It's fuggin hard
Its not hard if you know what you're doing
ye its GUILD_MEMBER_UPDATE
All this time my shit didn't work and I wasn't even aware LMAO
rip
F
Client.api.interactions(interaction.id, interaction.token).callback.post({data: {}})
Yeah very easy
buttons are way easier than slash commands
Very very easy
oh someone got the docs for buttons ?
the official api docs ?
Google is shitting on me somehow
They're called message components in Discord docs
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
fek
oopsies
...
lmfao

you can use npm in the shell but repl would be like "fuck you" and reinstall every single package the next time you run your repl
Wish components allowed you to set any color as style tho

theres a feature request for that on their github
lol
discord-api-docs?
i've never seen it before hahah
found another one, just spam the attach file button
You're probably making it attach the buttons on the response as well
wait, you can add buttons on messages now?
yes
RIP pagination embeds with reactions
yes, for d.js you need some external package until they add it to d.js
Or just... Use raw API requests in d.js with <Client>.api
the handler had a lot of bugs forr large bots
but the buttons look clunky imo rn
wait 69 years before discord.js brings this feature
Hey guys, I needed some inputs, I am implementing a banking system and was wondering the best way to implement simple/compound interest on the deposited amount
Library Discord.js
Database MongoDB atlas
They look really nice for that
math?
i can hear the bs discord users complaining it should be removed
I literally see no reason why buttons should be removed, there are 7 reasons why buttons are better than reactions
Reasons why buttons are better than reactions:
1- No spamming API to add reactions one by one
2- Can be disabled
3- No permissions required
4- Can have different styles
5- Supports labels
6- Supports up to 25 buttons which reactions doesn't
7- Buttons can use emojis from any guild even if they're not in that guild
my bot's help command has 66 pages
can have different styles ?
most people dont care they just hate updates and changes
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
does it still need external emoji permission for 7-?
Does buttons support animated emojis now?
only 4 styles + 1 link
They don't need that permission
and emojis
ask in the feature request issue
I don't think they are doing that for accessability reasons
you're putting text on a color
white text on a yellow button is hard to read
obviously there's a simple solution, just add text color as an option
not sure if they'd do that though
¯\_(ツ)_/¯
that's the dev's problem not discord's
true
rickroll idea: white text on white color and tell the user to double click the button on mobile
Now that I think about it
How about White text on white background on light theme ?
jenious
smort
i love how they still havent fixed $browser, $device and $os in the identify payload. It's still your library name
Why this doesnt work?
https://srcb.in/9xqDjryjAY
what is this
yoo thats pog looking
if react can detect class prop, why tf doesn't it change it to className on it's own?
it is an error
did you try reading the error
yes
update discord.js to the latest version of 12.x , that error is caused by stage channels.
I have to handle time ;-; so i am wondering if I should add the time stamp to a collection, database or something else
Currently I was thinking to add a timestamp on deposit, and calculate interest when they try to withdraw or check their current value.
Is there a better way to do it? what is less costly?
I'm trying to do a new command handler, but idk what i did wrong, in the sourcebin there is my code and the heroku error
https://srcb.in/YoZp1Z7O7P
language : discord.js
Anyone know rabbitmq?
ok, waitaminute, explain points 6 and 7 again
25 buttons?? that's a fkin 5x5 grid
wtf tim
I doubt anyone needs 25 buttons on one message anyway
Minesweeper
also this
7- Buttons can use emojis from any guild even if they're not in that guild
how?
damn, that's a big limit
They can actually do that, the only thing you need is the custom emoji's ID
I imagine chip or rythm will add a fkin remixer table with them
time to use them to exploit and get all existing emotes in discord by brute-force

is buttons available in the master branch?
im waiting for v13 to include buttons instead of using a package
Smh, I use the raw API requests
Is it useful writing unit tests for discord bots?
useful, sure
but very tasking
and almost impossible
mocking the API is extremely difficult
test in prod ftw
and then delete all channels in dapi
🤣

for a while now, yeah
not only that, cake already added the dropdown support
But is it in a stable release?
or some dev branch?
those 2 are in main branch, this action menu is in dev
Ah so released yesterday, right?
the buttons and slash commands
no, they have been out for quite some time
You're definitely much, much better than an entire team of devs doing d.js then 
im trying to find the specif link, cuz i definitively was bragging about it at once point
djs got lost in their own design
almost every third commit follows different paradigms
@umbral zealot found it
that's why prs go through thousands of revisions before actually getting merged tbh
31 january
thats when cake started adding slash commands
d.js still doesnt have it on stable right?

nope they just had a functional PR like a few days back. It's as if they waited for the buttons to actually be live to start coding.
as docs werent enough
so they basically pushed a feature out 5 months into the future cuz they were waiting for an unconfirmed feature?
buttons were only announced for us 2 months ago
Not sure - I mean, we all knew buttons were coming, they literally had a release date planned, and they were documented. I know.
and only opened to private test a month ago
and even then, they warned it might not be final
People were doing buttons with raw API requests within like 5 minutes of release, and d.js is like "yo guys they just came out give us time to make the PR!"
it seems a really dumb idea to push slash commands based on something so unstable
heres the better thing, they had access to it at the same time i did
and they still havent done it
yeah I'm aware.
v12 took 2 years, I'm not expecting v13 in a timely manner.
Hell, v12 took 2 years and they didnt even have new features to contend with, really.
for example, im about to request access to dropdowns so i can try them out. mark my words, djs wont even touch it within the next 3 months
I should start making a detritus guide, videos, and push the entire AIG community to use it. 
that would be greatly appreciated tbh
you ready for 2000+ users? lol
cake is now work on the docs btw
docs aren't guides though
you might need to heavily rely on me, dan or evan to answer detritus related questions
though if you're used to digging through code, you wont have much need in all honesty
as tim said
detritus is TOO organized
so its easy to find stuff in the code
considering I had started working on my own lib at one point, digging through the source and docs shouldn't be much of a problem
then you absolutely fine
i can still answer any low/intermediate questions just fine from the back of my head, but when it gets to very specifics, i might need to ask cake or evan
add 3 blank pages saying "Erwin wus here"
nobody will ever know
lel
Would it be wrong to actually call d.js bad by now?

like we have an alternative
we do
DETRITUS

Was thinking about Eris tbh
detritus, eris, discord-rose, djs-light, make-ur-own-lib
Eeeeeeh I don't want to say it's bad, in that it's functional. The issue isn't the library itself, in my humble opinion.
klasa/klasa-core but idk if they still active
make-your-own-lib sounds good
nah that's dead.
Probably. You saying it's more of a devs issue?
I look forward on it. anidiots.guide teach me quite a lot
oh my, already got customers?
Js and stuff
It has been a dev issue since I started. Always a team problem.
Heh
Abal left the team, Hydra was left standing there and isn't... driven enough to lead a proper team.
mostly stand there and look pretty
And I'm not saying he's not knowledgeable or smart, because.. he is both those things. That's not where he's lacking.
tbh i understand him
i feel the same way about many things i do
it starts being too much of a chore when a lot of people start using it
it becomes a responsibility you were not prepared for when you started
and that turns you off
yeah but he has a full team of devs behind him that are helping with stuff, so... why is nothing getting done? Mostly, I'd say, because there's way too much interpersonal drama involved.
must be nice to wake up to 31 github issues with people asking why my bot no online? i put bot.login() but no work, hilp
When you have a team half-made of people that call each other's code "shit", what are you gonna do?
actually, let me check their github issue page
I had a look through the eris source code the other day and it didn't seem great. Actually felt similar to d.js in a lot of ways. Less bloated for sure.
okay now this is just sad
didnt it start as a fork of djs?
Because Abal made discord.js (was a big part of the team?) originally (version 6 was his last version I think?) and then.. as far as I can tell, there was a disagreement on the direction to take, abal went "meh fuck it", created Eris, and discord.js kept on being maintained by hydrabolt. So yeah... they're similar in their origin.
I started doing bots right after abal left, just before eris came out.
Oh yeah, the code style is similar in its roots. Make sense.
Yeah
@quartz kindle should make a new library for us
i still want to make my own lib but meh its too tiring
i have tons of ideas for it tho
Just work with ERwin then. lol
Like ERwin will ever stop advertising Detritus
ERwin tells u to come to Detritus
Start with the gateway, it's the rest API implementation that gets tiring lol. So many endpoints, surprising tricky rate limiting to implement etc.
detritus documentation make me bleed my eyes
Looking to it
i have a working gateway code i made like 2 years ago, but its kinda abandoned lul
would be better if someone helped him with pr's
and yeah the rest api is a mess
cake went a step further, he uses the WHOLE api on rest, not only bot's
I remember trying to parse incoming payloads. and then the issue was that the payloads from discord were fucking shit.
so theoretically i think you can even load a user on detritus
like user api?
yeah, he has everything in detritus
author_id here and userid here and author.user.id there or whatever the hell it was.
lel
If I were to make a discord lib I'd use an already existing gateaway / http implementation. Nothing stops you from using detritus-client and detritus-socket and writing your own top-level interfaces around those
i guess, except if you want to implement some low-level changes
i dont like detritus's zlib implementation tbh
think it can be improved?
yes
^ ^,
cough cough fast-zlib cough cough
here
yes
eh i dont like arguing with other people's way of doing things
just suggest checking fast-zlib
No optimizations for B in js. Doesnt it get cached?
Anyone compared zlib with ETF extensively?
otherwise i'll take credit for the suggestion
not yet, i've been meaning to for a while
feel free to lmao
welp, my internet points now
already an updated version
so you're on 12.5.3 then?
@quartz kindle gib fast zlib link plez
can you show the code that's triggering this?
google npm
lel
yes
Alright, show the code that's triggering this error.
hi
can the bot send error message to the chat when it doesnt have some permission
thats too much big code with sub directories

Are you saying you have no idea what specific code is triggering this error?
im nob in big code
yes
coz not my own some one give me to repair it
but i didnt find the source or error
ok
Why were you given this to fix if you have no idea how to debug code or read error messages?
bot.on('message', async message => {
let prefix;
try {
let fetched = await db.fetch(prefix_${message.guild.id});
if (fetched == null) {
prefix = PREFIX
} else {
prefix = fetched
}
} catch (e) {
console.log(e)
};
from 116 to 125
Well, uhm... ok, so, message.guild will be undefined in DMs.
wdym
you're trying to get something from the dB using message.guild.id but it's undefined. so it says it cannot read property id of message.guild that's undefined because it's a DM.
Uhm... learn javascript, if you want to pretend you can fix someone's bot?
Or tell the person that asked you to fix this that you don't know how to fix it because you do'nt understand the code.
why my bot was declined?
i cant cause of my laptop
you can't tell the person that you don't know how to code... because you're on a laptop?
But you're talking to me now... 
lol i know how to code but i think something is missing he didnt send me everything 
I think it's pretty clear if you're confused about my above answer, you don't... know how to code. Not enough to be fixing people's bots, that's for sure.
i am saying that some error because of my laptop
No... the error isn't relevant to the PC you're running this on.
This error is about the fact that message.guild is undefined, which happens in DMs.
may be
jokes on you, I code on a laptop
jokes on u, me too
Joke's on you, I build entire websites for work using laptops.
const Discord = module.require("discord.js");
module.exports = {
name: "unlock",
aliases: ['sblocca'],
permissions: ['MANAGE_CHANNELS'],
description: "Locks a Channel",
async execute(client, message, args, Discord, cmd){
let channel = message.channel;
message.channel.overwritePermissions([
{
id: message.guild.id,
null : ['SEND_MESSAGES'],
},
],);
const embed = new Discord.MessageEmbed()
.setTitle("Aggiornamento del Canale")
.setDescription(🔓 ${message.channel} è stato sbloccato da <@${message.author.id}>)
.setColor("GREEN");
await message.channel.send(embed);
message.delete();
}
}
yes it send evryting on inbox
idk y this command reset the channel rules
and you call yourself a MERN stack developer 😛
only thing i call myself is : "idiot"
and alcoholic
null : ['SEND_MESSAGES'], ? why null ?
i even dont check the whole code :/
he just said to repair it
Yeah ok so repair it? The error you sent was pretty clear and I already told you why it happened, so, fix it.
well my fix thingy is if its dm just send a response
Good luck :)
because it deny the possibility to write
Since when are null and "deny" the same word, though
im always against allowing bots to dm or be dm'd unless its privacy stuff
yeah
like password gens?
or reports, shit like that
idk-
what should I do?
i personally dislike the thought of bots dm'ing people
Check the docs, there's a pretty clear example: https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=overwritePermissions
Yeah the new ephemeral messages are great for this
why you guys are approving data grabber bot
What are you talking about
who?
thats an option too
yikes
that bot isn't on top.gg
I think you're maybe confusing the company called "Discord" with the company called "top.gg" . They're not the same thing.
As made pretty obvious by their different name and domains.
no i thought you aproved it too on top.gg lol i didnt even check it there :/
k nvm
The checkmark is verification by discord, it has absolutely nothing to do with top.gg
ok thank you 😦 i will report it
Now we only need a "checkbox" interaction
makes me wonder how that bot even verified by asking for servers
but my commands works, the problem is that in chat with only 2 roles, after the end of the lockdown everyone can see and write inside
at least i can sleep well know knowing discord has the owner's id's/passport with those scam bots

yeah... but... ... the problem is... null isn't deny... we've said it pretty clearly now.
what should I write?^
check the docs, there is a pretty clear example.
compare what's in the docs and what you wrote
deny is not null. replace. the. word.
I'm trying to find an example code for slash command in detritus?
How do I get started?
cake should have a slashclient soon, he was talking about it a few times
oop
for now its prob a good idea to use the raw event
or just wait
when it would be out?
good question
ik 😅
I dunno, and I also dunno why cake wouldn't make that a pr which anyone can see and contribute to
pffffft slash commands aren't out yet? I thought Detritus was feature-complete 😛
I'm going to eat him
you can reply() directly to the interaction
just like he has commandClient, he's building a whole wrapper for slashClients
or so it would seem
Yeah but I assume you'll have to create your own handler which goes through all the files and adds each command
yeah, but that is very basic thing, I wish detritus would implement it. We just need to give the commands folder path
Anyone here try to make a bot using discordgo?
like i said, detritus already has support for it, just doesnt have a commandClient for slash commands yet
ah I see
Go submit a PR then :)
no point if they're already working on it
That’s not the point. I believe they’re making a reference to the fact that they said it would be “easy”. If it’s so easy, where’s your PR? Kinda thing








