#development
1 messages · Page 673 of 1
okay
here look at this
okay
why are you using json as a database in the first place
it gives me this
cause first time making bot
thats not an excuse but ok
yes
ouch
what app is that even
Terminus
r u seriously coding on iOS
aww man
Terminus is just for checking logs
coding on ios is rather fun
It is but idk any coding apps that will allow me to access the server SFTP
i did it yay
hello .... I'm looking for some tournament bot
#general if it isn't coding related
And check out DBL
Website you'll find something like it maybe
you cant see if they voted for other bots besides yours
but what you can do is track votes in a database and have each bot access each other's databases, or have a single database shared by all bots
I think what he is saying ia
you can only access votes for the dbl token you provide
If you make two bots and want to see if the other bot got voted on store those votes from that one bot and have the other bot read those votes
But I could be wrong
👀
another option is to use multiple tokens to get votes for all your bots
so only one bot?
when you said "bots" i assumed multiple lol
Webhooks is an option
then yeah, use the dbl api
Or the hasVoted method in DBL api
okay my bots not online for some reason
you're being too vague
what have you done - what have you tried - which lib are you using
well this is what i have donr till now
firestore?
Firebase is good
Firebase is good and free plus fast
the free plan doesnt offer too much
or you can configure it to block access
Yup
no
what database are you using
I figured out this when my token was leaking many time
@mossy vine you really dont wanna know
json?
ah nice
Even if u work on lock mode
I am smart```

can someone help me out??
Add token in json file
anyways, if you are interested in using Firebase i highly reccommend you check out the Fireship youtube channel
And all would be good
he makes a lot of great videos about Firebase
Just tell me disadvantages of quick.db
what?
yes but free plan doesnt offer too much
is the limit
Idk
I don't use it
thats insane i wont like ver complete that storage
Mobile
20k writer i dont htink will ever get complete
{
"rules": {
".read": "auth.uid === 'abcdef'",
".write": "auth.uid === 'abcdef'"
}
}```
this is enough to protect the firebase realtime db
if my bot even gets famous i obviously will get monei
replacing the hardcoded uid with something more secure
Hi Natan
@inner jewel how can i make rules that just my bot will able to access it?? am noob
Explain
change the uid to something secure
Natan u use firebase
Lol
and i can watch yt
Omg
Then watch it
lmao
Ooh Firebase
So when I hit submit I need the HTML to run a JS file to send over information via a WS server... The thing is, is that I THINK I need node for that. How can I do that?
Can anyone help me with a mongodb problem I'm still having
- It's not writing user data to the db
- It returns a cycling dependcie error
Code is very useful.
const { MessageEmbed } = require('discord.js')
const db = require('./db_connections.js')
module.exports = (client) => {
client.checkUserExist = async function (id, cb) {
try {
let data = await db.loadUserData(id)
if (!data) {
data = await db.writeUserData(id, {
id,
bal: client.settings.starting_balance,
xp: client.settings.startingXP,
xpMultiplier: 1,
coinMultiplier: 1
})
}
return cb ? void cb(null, data) : data
} catch (e) {
return cb ? void cb(e) : Promise.reject(e)
}
client.log('User entry created')
}
}
I was providing that now give ms a sec
Me*
writeUserData(id, obj, cb) {
if (typeof id !== "string")
throw new TypeError("ID must be a string")
console.log('Write User Data')
return this.db.collection("users").updateOne(
{id},
{ $set: obj },
{upsert: true},
cb
)
}
the stacktrace only seems to show mongo
But the error is occurring when writing user data
So I’m assuming it comes from that file
It’s the only file rn that deals with user data other then the file that creates the function to write user data
Okay
also, i dont see anything in the mongo docs suggesting updateOne accepts a callback in the 4th parameter
you should probably remove the callback all together
Okay
@quartz kindle it didn't log anything
Maybe I'm logging it wrong?
Or I've been looking at the wrong function for 2 weeks
🤦
welp, you can try logging the beginning of your checkuserexists function
loadUserData(id, cb) {
console.log('Its me boi')
return this.db.collection("users").findOne({id}, cb)
}
This is the real function that's causing problems
the second argument of findOne is an object of mongo options. you're giving it a cb containing a function
remove all your cb's, they are not needed anywhere
well you can promisify them
ok so if i were you i'd probably promisify them instead of using callbacks
If mongodb requires callback functions in the format of: (error, value) => {}, then you can do:
const { promisify } = require("util");
promisify(functionName)```
return new Promise((resolve,reject) => {
db.findOne({},function(err,results) {
if(!err) resolve(results);
})
})```
or the above, which is basically an automated version of the below
So basically using the above
I could do
const { promisify } = require("util");
const db = require('./db_connections.js')
let data = promisify(db.loadUserData(id))
Or something like that?
no, promisify takes a function, so it'll have to be promisify(db.loadUserData)(id)
Ahhh okay
And that'll return a Promise, so you can either use async/await or .then()
np
I'll see if that works
:3
2|clap | at loadUserData (/home/panda/Clap Bot/library/db_connections.js:33:17)
promisify(db.loadUserData)(id) wont work
Huh
you need to bind the function to the db
promisify(db.loadUserData.bind(db))(id) would
Ahh okay
So binding it allows it to access this?
Hmph cycle decencies error is still showing up
@inner jewel Do you know what could be the problem?
sql?
I know how to use it for the most part @topaz fjord
It's just unexpectedly being weird
what is it doing
Causing cycle dependency errors
i mean, 99% of the times the problem is giving mongo an object it doesnt know how to resolve
for example, objects containing functions or other non-primitives
I don’t think I’m doing any of that
so log your objects and make sure they only contain strings/numbers
Okay
or the specified type in the schemas
Can you run it with the bot?
it does a great job as long as you only need a single machine
I’m looking for a db you can run with the bot
yeah sqlite runs with the bot
Without having to use something like mongodb server
then sqlite is your choice
So learn sql first?
Okay
and sql is not hard, its kinda like html
Html was easy asf to understand
in complexity
Pretty simple let
Lel *
Though I don’t know everything about html I know the basics if not a bit more
as long as you protect against sql injections
well, prepared statements are pretty much the "normal" way to do things anyway, and they are injection-proof
I wish there was a way to reset your token if the bot sensed any kind of sql injection
nobody directly uses queries anymore
then they are stoopid
but anyway, in a discord bot, the only possible injection route would be through a command
Ye
so unless you're stupid and make a command directly feed an sql statement
the chances of something bad happening are basically 0
lmao
That’s how I am at times
anyway just use prepared statements, every single sql implementation should have them
any suggested guides to read?
a prepared statement is basically something like (example using better-sqlite3)```
query(SELECT ${variable} FROM table).run() //direct query
query(SELECT ? FROM table).run(variable) //prepared statement
Ahhh okay
you build a query using placeholders instead of data
So don’t do direct query
Okay
Thanks!
Hm I can’t find a tutorial @quartz kindle
Oh nvm
Oh nvm
I was looking at a tutorial the whole time
😂
Hmmm
where is your bot hosted?
Weird, all my bots use sqlite for prefixes
Chy4e
on my server
Yep
Sorry...
npm cant handle names with spaces? wut
trust me, I have seen this error many times
It can't cd into it
Just lemme, uhhh
Rename it
use a -
I'm making a website, but I don't want people to view-source: aka Ctrl-U. Is there a way to disable it? (ping me on answer)
no
Try installing it again
no to me?
yes
Yes, you can never disable it
there is no way to hide client-side code
You can only make the JavaScript unreadable ugly
why do you want to hide it tho?
Transmitting data 
bitcoin miner
Or some of those people who think their code is unbelievable hard and special, so everyone will steal it
https://obfuscator.io
You can use this to make it unreadable tho
JavaScript Obfuscator is a free online tool that obfuscates your source code, preventing it from being stolen and used without permission.

My biggest motivation for my bot rewrite is because it's bad code
I hope this isn’t bad
Nope
thi is normal
Okay
its compiling
Ahhhh okay
Just warnings, happens everytime
Btw, afaik npm can handle spaces, but the thingy compiling that stuff cant
Okay thought I was doing something wrong 
God the lag with that msg
Question
When using SQLite I only need to use message.guild.id once right?
Cause I can set it to something like guildID or whatever
anyone know how to fix this
@earnest phoenix yes, define files
Cause mongodb you had to keep doing message.guild.id
hmm what
To know which guild to pull data from the db
files is undefined
so how do i defie it i mean i have amny files
yes, you have to do that too, you have to select the guild you want by its id @lusty dew
how did you define files?
Oof
Idk how to get guild ID outside a message event
There is no folder events, so there are no files
@lusty dew well, in what event do you need it? I don't get what your problem is
thank you
And it doesn’t have a message event and I heard having two causes problems
Not really problems
i know
Having 2 is not a problem
i was so blind
btw, you can do
if (err) throw err;
inside the callback
To actually get an error
Hm so I can have two message events?
Hmph
You'll get a memory leak so fast
why would you need two message events for that?
Here we go again
I’m using SQLite
So to get data per guild
I need to access that data with the guild Id to get the right guilds data
yeah
And I’ve been told no way to get the current guild I’d without doing message.guild.id
yep
But my command handler and other things are in a separate file without the message event
wait, so you dont pass the message in your command handler?
I'm guessing you just pass args?
all your events should be in the main file
My command handler no
and your command handler should watch the event and pass the message to commands if the message matches a command
Three things inside the file
lol ok
Wym
where's your .on("message")
client.on('message', async (message) => {
if (message.author.bot) return;
const split = message.content.split(/\s+/g);
const args = split.slice(1);
client.checkUserExist(message)
if (client.isValidCommand(message) == false) return
if (client.commandExist(message) == false) return
client.commands[message.content.split(' ')[0].replace(client.settings.prefix, '')].run(message, args)
})
ok, so you run the command and provide message and args
Ye
Not the problem here
so what is the problem?
pass message to commandExists and isValidCommand
and inside those functions, call the database
But to do that need to use message.guild.id to get data for the right guild
Okay
I was hoping for a way to do them both at the same time
But separately is fine as well
Uhhh
or simply join those functions
anyway its a good idea to cache prefixes to avoid hitting the database on every single message
you can do that with a simple object or map
Oh?
cache = {};
.on("message" m => {
let prefix = cache[message.guild.id] || cache[message.guild.id] = functionToGetPrefixFromDatabase();
})```
How would I join the two funcs together?
basically that's a compact way to write ```
if(cache[message.guild.id]) {
prefix = cache[message.guild.id]
} else {
prefix = getPrefix();
cache[message.guild.id] = prefix || defaultPrefix;
}
I’m confused lol
well, you have two separate functions that return the same thing
so you can do both things under the same function
client.commandExistsAndIsValid = (message,args) => {
if (message.content.split(' ')[0].replace(client.settings.prefix, '').replace(/[<@!>]/g, '') == client.user.id) message.content = message.content.split(' ').splice(1).join(' ');
if (client.commands[message.content.split(' ')[0].replace(client.settings.prefix, '')]) {
if (arg.content.startsWith(client.settings.prefix) || arg.content.replace(/[<@!>]/g, '').startsWith(`${client.user.id}`)) {
return true;
} else {
return false;
}
} else {
return false;
}
};```
or something similar lol
Okay I’ll ping mention if I have any problems
if you want you can also throw the getting the prefix from the db in there too
you can also keep your cache in that file instead of the main file
yeah
@amber fractal just because I'm interested: why would two listeners cause a memory leak?
i dont think two listeners would
but he said so
but listening to the same event two times means executing two functions per event
but thats not a freacking memory leak
d.js by itself is a memory leak
thats correct, but events have nothing to do with d.js
im trolling at this point
3|clap | at Client.client.commandExistsAndIsValid (/home/panda/ClapBot/library/clap_functions.js:31:22)
if (args.content.startsWith(client.settings.prefix) || args.content.replace(/[<@!>]/g, '').startsWith(`${client.user.id}`))
is args an array
no its undefined
I used the prefix not the mention
Why is it returning undefined?
Cause I didn’t use mention?
no
log args and see what it is
undefined
Lol
if (client.commandExistsAndIsValid(message) == false) return;
you are not passing any second argument, so the second argument (args) is undefined
no numbers, so your argument is invalid
3|clap | at Client.client.commandExistsAndIsValid (/home/panda/ClapBot/library/clap_functions.js:30:28)
The fuck is Luca
Lol
luca is god
That’s no where in my code lmao
all hail luca
yes it is
it says clap_functions.js line 30
I don’t see Luca in my code at line 30
whats in line 30?
well, you didnt write out luca
if (client.commands[message.content.split(' ')[0].replace(client.settings.prefix, '')])
``` do you?
Cause if you do I’m extremely blind
well, you didnt write out luca
someObject['theProperty'] is the same as someObject.theProperty
your code is haunted
the only way i can see that happening would be if message.content.split(' ')[0].replace(client.settings.prefix, '') resolves to "Luca", but then anyway it would mean client.commands is undefined
client.commands is not defined, and you are trying to read luca from it, probably because 
sorry i just came to find out how to add the discord libs to visual studio. tired of coding blind.
3|clap | TypeError: Cannot read property 'startsWith' of undefined
3|clap | at Client.client.commandExistsAndIsValid (/home/panda/ClapBot/library/clap_functions.js:32:30)
Console logged args
Ye it happened on startup
Someone was probably talking about Luca
yeah then the message event fired before you did client.commands = {}
@trim wind well, it should, but it won't work across files
Why is args empty now
Hmph
This is weirddd
Trying to condense two functions down to one is causing more problems
@quartz kindle by the way my "numbers"
it rised about 100MB, then gone back down 50MB
so +50MB for that second message event
3|clap | TypeError: Cannot read property 'startsWith' of undefined
3|clap | at Client.client.commandExistsAndIsValid (/home/panda/ClapBot/library/clap_functions.js:32:30)
Console logged args

Pinging staff individually for such things is generally not a good idea
And tbh that looks like a message id
Not a client id
Double check that’s it’s your bot’s CLIENT ID on the discord Dev page for it
Lemme see if its correct
6096318198471721169
@earnest phoenix that's not a valid bot ID
A bit of a weird question, how do I get a permanent link to a raw GitHub file?
anyone know why id get Error [TOKEN_INVALID]: An invalid token was provided. when i just got a fresh bot token? (d.js)
are you 100% sure its the bot token and not the client secret
it happened to me a few times
A bit of a weird question, how do I get a permanent link to a raw GitHub file?
Anyone?
okay so if anyone has a bot running rn you probs shouldn't restart it
seems like there is a api issue preventing bots from logging in
is this how you make a list in json?
Looks correct
oh
formatting 100
then.. how do i get like the ytapi from it?
Import the json file
no shit
<json file name>.tokens.ytapi
hmm
Just require the .json file
it says this then discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: AttributeError: 'list' object has no attribute 'discordbotsorg'
Remove the array around the object
d.js
i have .forEach loop, how do i exit it? return doesn't do it
actually, when it caches error, it will spam messages instead of ending it with 1 return message
break doesn’t work inside of a .forEach unfortunately
afaik you just have to use a standard “for” loop
you could possibly work something funny with array.every and maintain similar syntax
I'm trying to do a survey on the best language to write a discord bot in, in your opinion, if you like it'd be great to get some answers: https://www.strawpoll.me/18468597
All my bot tokens just started refreshing themself non stop
Discord does not actually store any tokens in their database. Whenever you visit the page for your bot it will generate a new token for you to use. However, unless you press the "generate new token" button all of the tokens will be valid. It's completely normal and you need not be concerned.
^^ For anyone having problems connecting to the API rn.
@flint trellis discord.js?
Oh yeah nvm
lol
Discord.js isn't handling logging in properly thanks to the new API ban system
Gotta wait for a fix
fantastic
Might be a weird question, but how do I make my bot (js) check a link on virustotal when someone sends it and if it is deemed as malicious, remove it?
@flint trellis okay, thanks!
@mossy vine does it log in properly or is it currently still logged in
log in properly
all same library, but the test bot who is doing no api calls (because still in development) doesnt login
I think they just fucked up some authentication servers
because literally, my bot is on 5 guilds doing no api calls, and gets banned while my 2 bots with together 2.7K guilds are working fine
@mossy vine mine doesn't log in for some reason
half of d.js can't login their bots 
^
https://vinniehat.is-inside.me/KX4bnehb.png Yeah fuck... I ordered from them and I wanted a refund as support wasn't getting back to me and I also had ordered a 2nd one, (thinking the first order never went through) and so this happens...
weird
@mossy vine what version of d.js u using
And they deleted my account. lol
stable
I'm on 12-dev
Discord.js INVALID_TOKEN Error
The Discord.js developers are investigating.
It's not a problem with API tokens themselves because you can make requests via postman.
@tulip wave my friend having trouble logging in too
@earnest phoenix yeah it's a d.js issue
is it only affecting master? or stable too?
Still nobody can explain to me how my 600 Guilds bot can login, but my 5 Guilds bot can't 
Same library
@onyx summit is it d.js?
Yes
Stable or master
2.2
Nvm
k
is internal sharding actually good
that's the problem
i'm seeing mixed sides here
can i have some opinions/thoughts
I think its good
im told it's only good if your bot is between like 2.5-5k guilds then running it on one process becomes a challenge
cant verify this statement
so the problem was for master branch only
people on stable are perfectly fine
@onyx summit stop flexing, nobody cares
How is he flexing
5k guild is like 4 shards lol
You can do internal sharding on d.js as well
I'm not gonna have fun with sharding once I need it
so big question
is internal shardings performance around the same as just regular sharding
Discord.js v12 did not prefix the token with Bot in the auth header like it is supposed to
Discord must have started checking and enforcing this in their recent update for api abuse handling.
The commit fixing this issue just landed on the v12.0.0-dev branch, please update your dependencies.
Stable (v11) bots are not affected.
lol they enforce token prefix now?
it's different Vysion. You are in one process only so it will obviously be kind of less performant. But you don't have to go full overhead with IPC or whatnot
that's true
if everything is in one process, you get one cache
so it's much easier to deal with
1 process vs multiple child processes is dependent on what you're doing?
oh yeah definitely
no more dealing with a shardingmanager etc
obviously as you scale at one point you won't be able to keep up with internal sharding
but for 5k guild internal sharding is fine
I don't remember the stat but some bot in eris used internal sharding with a looot more than that
Okay am I completely retarded or isn't it npm update discordjs/discord.js
cant you just run npm install discordjs/discord.js
that would automatically update it to latest
Sigh
I don't know why but it's not doing what it's supposed to do
||probably just me being retarded||

well 503
not much you can do about that
I was really scared for a second
[discord.js][v12] UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.?
Discord.js v12 did not prefix the token with Bot in the auth header like it is supposed to
Discord must have started checking and enforcing this in their recent update for api abuse handling.
The commit fixing this issue just landed on the v12.0.0-dev branch, please update your dependencies.
Stable (v11) bots are not affected.
lol my djs package is locked at an earlier version
if i update it now it'll be fixed, just never noticed the error
i am waiting on lucas 😄
@tulip wave wym you're not gonna have fun with sharding? are you on master?
what if i wanted to replace everything that's /__.+__/ but i want to replace it with the content between the __'s. essentially getting rid of the __'s but only if there are two sets of __ with stuff in between (regex)
😫 ikr
Anyway I'm off to bed
tbh people make sharding sound difficult (it might be on other languages and stable), but yeah I was surprised when the other dev on my team shown me that in master
goodnight
master 😎
Anyway gn
goodnight
are you allowed to remove the Created by in your bot profile?
@coral trellis ^
Yeah should be alright
doesn't that return a new string
Java String replace() method with method signature and examples of concat, compare, touppercase, tolowercase, trim, length, equals, split, string replace in java etc.
ok i just have to put test = befor replacing
Hi
How do I check the count of all guilds my bot is on? I forgot since I haven't done that in a while lol
Discord.JS
client.guilds.size
Are u sure ur using the right token
do it after or in the ready event
^
Good evening, how can I remove in a array all items that I have several times and leave just one example : my array : "MyArray":"One", "Two", "Five", "One", "One", "T" and finally with my command i have : "MyArray":"One", "Two", "Five", "T"
@mossy vine this is better https://stackoverflow.com/questions/1960473/get-all-unique-values-in-a-javascript-array-remove-duplicates?noredirect=1&lq=1
@topaz fjord i just linked top google search result. took less than 30 seconds on a phone lol
just compare the lengths of the array before and after
or uh
🤔
thats better
length of pre filtered array
length of post filtered array
subtract post from pre
and you get how many you removed
Ok thx u i go test
😃
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
var unique = Dresseur.Sac.filter(onlyUnique);
var nombre = Dresseur.Sac.length - unique.length
Dresseur.Potion += nombre
message.channel.send("Nombre de Pokemon(s) supprimé(s) : " + nombre)
break;```
It work but when i save my BDD Dresseur.Sac.filter(onlyUnique) replace or i do make : `Dresseur.Sac = unique` ?
@topaz fjord sorry for ping 
Hmm, why would this code fail being run on server (cannot read fetchUser of undefined), but then work without an error when calling the function through a command prompt?
dailyReset: async function(bot) {
console.log("DAILY RESET!");
let player, name;
const players = mongoose.model("players", playerSchema);
await players.deleteMany({level: 1, exp: 0, rLevel: 0});
const popArray = await players.find();//.sort({ level: -1});
for(let i=0; i<popArray.length; i++) {
player = popArray[i];
name = await bot.fetchUser(player.flake, true);
player.name = name.username;
player.hasDAILY = false;
player.hvLimit = (player.inventory.CoffeeMug)?12:10;
player.expCap = 1200;
await player.save();
}
},
hm?
probably
I'm guessing not
I just hate pushing console checks to server but ill investigate ty
how do you find that out? It doesn't appear to be in the documentation in node folder
check the package.json
_id?
11.5.1
so its possible I'm testing my program on v11, and the server npm updated it to 12?
yes but its unlikely
it just sucks because this function is very important to the "tempo" of things
I guess I can just comment block the actual effect
until its displaying the right IDs
it says cant read fetchuser of undefined so the problem is with your bot object, not the d.js version
are you sure youre passing the correct property into that function
yeah, I thought of that
the only difference is
its called via setTimeout at "midnight" passing bot object, to a function which passes bot again
versus testing, it calls it directly from bot.on
as long as youre passing the correct object it shouldnt matter
c.midnightRecursive();
clearly I am passing the bot object correctly
any rookie could see that
because it's written right there
🔫
thanks for dumb thinking for me 😄
passing nothing into the function could probably explain why its undefined lol
ye np man stupid mistakes happen all the time
so i have this
const active = '<%= active %>';
$.each($('.item'), () => {
if (this.id == `active:${active}`) {
$(`#${this.id}`).addClass('active');
}
});``` but it doesn't add any class
Is that jQuery :(
yes it is
[2019-08-13 00:58:32] Uncaught Promise Error:
[2019-08-13 00:58:32] Error [TOKEN_INVALID]: An invalid token was provided.
[2019-08-13 00:58:32] at WebSocketManager.connect (/var/www/airi.moe/airi/node_modules/discord.js/src/client/websocket/WebSocketManager.js:132:26)
[2019-08-13 00:58:32] at AiriClient.login (/var/www/airi.moe/airi/node_modules/discord.js/src/client/Client.js:210:21)
[2019-08-13 00:58:32] at processTicksAndRejections (internal/process/task_queues.js:85:5)
?
So, what's the fix?
LOL how dumb
what the fuck
Technically Discord API wants bot tokens to be sent as "Bot <your-token>"
Discord.js was like nah kid and added it in for u
While other non-JS libraries like discord.go make you put it in manually
but in v12 apparently they forgot
sooooo what do i have to do, re-code the bot or just change something? I'm using Klasa
ooh klasa
To fix it, do this:js new Client(/* etc etc etc */).login(`Bot ${what-your-token-normally-was}`)
Oh yeah
that fixed it @opaque eagle tho my sharding broke
lol
yeet
so
it worked like 10 secs before and then dc had blackout and bam
bot awae
Hmm, @opaque eagle even though i'm using this now
new AiriClient(config).login(`Bot ${token}`);
It just threw me the same error again
Yea
Yeah that's what i did
still giving me same error though
kk i'll try
What
bots love mass DMing today dont they
copy and paste the text
Regarding Rate Limits
A new system has been deployed that auto ip-bans IP addresses that send the API too many invalid requests. Today, that is considered to be requests that result in a 401, 403 or 429 HTTP status code as a response. This is in response to some pathologically bad bots spamming our API with said invalid requests.
I've raised the threshold for this auto-ban to be pretty high, and only action on the most pathological cases. The current limit as of Aug 11, 9 am PDT is 25,000 requests per 10 minutes, or 41.6/sec for 10 minutes. The limit is planned to be lowered to 10,000/10 minutes in 30 days. The auto-ban lasts 1 hour. If you are auto-banned, there is no way for us to remove the ban, so you'll have to wait it out.
This means that you need to send 25,000 requests in 10 minutes that result in a 401, 403 or 429 in order to be auto-banned.
If your bot is running into issues, I'd consider adding logging to see exactly what you are spamming our API with that's caused you to get banned.
I've written a bit more about it here as well: https://www.reddit.com/r/discordapp/comments/couffh/is_discord_going_to_undo_the_recent_api_change/ewmd8f0?utm_source=share&utm_medium=web2x
776 votes and 91 comments so far on Reddit
Ok i got the fix for it @earnest phoenix
After you add the Bot <token> just update discordjs and then run the bot again with the new client login
lol
i'm getting another error
it's klasa though
weird
lmao im looking at the issues rn
why does discord right-align messages in that squiggly language
because that language reads from right to left
oh
nice
Use an NSFW api or scrape NSFW sites like PonyHub or r/nsfw
Me neither
t.t
Maybe take pictures of yourself and put them in a folder
no thanks
lol
someone know a warn bot ? please dm me if yes
@earnest phoenix ciao
Ok sorry
I know it’s not the best choice but I really gotta get some work done and my pc broke. Does anyone know any code editors for iOS
I’d use my phone but it got stolen today so oof
hey i have a problem with the discord.js@12.0.0--dev token thing
i prefixed it with bot
and it still doesnt work ,-,
Trouble connecting?
it says invalid token provided
Wait you’re talking about master right
wat
D.js master right
That isn’t how you do it at all
How do you have a developer role but don’t know how to login your bot
It’s the same either way?
lol?
You just put the token in
it worked perfectly before
That’s it
like dat?
@earnest phoenix iirc v12has an issue with the new api changes thats preventing bots from logging in
Can I invite my bot to this server?
@lusty dew @mossy vine now i get dis


@earnest phoenix You know you can just do client.login(token);
Yeah
What's the error?
Did you provide the correct token
Incorrect details.
go back to your original way of logging in. that is correct. it is d.js that is having issues with that
Or did you provide a client secret
@mossy vine since when was that original?
I never had to do that tf
yeet
@lusty dew original as in first way he did it
How is that normal?
i dont use v12, but from what i know, it did not prefix the token in hte header with Bot, so you had to specify it manually
You don’t anymore do you?
Can someone tell me what is “-“ in regex?
I am trying to remove - from strings js
Hello
sa
or a dirtier approach: js str.split("-").join("");
I know it’s not the best choice but I really gotta get some work done and my pc broke. Does anyone know any code editors for iOS
Coda?
maybe run code-server on ur VPS and connect to it
I’ll have to ask the server owner first lel
i wonder if you can create a kahoot or skribbl lobby through a bot
you could
i might actually try
kahoot yes, skribbl still yes but practically unusable
it's weird
i tried network inspecting skribbl once it's really weird
i was thinking of that one npm package that let u emulate chrome or smth
fixed already owo
@earnest phoenix huh
@earnest phoenix ur right i dont deserve bot dev role
Okay what does that have to do with pinned messages
Or why not just do npm i discordjs/discord.js
because usually it installs v 11.4.idk then
Huh
so i ran it and installed dc.js@11.5.1
It would install 12.0.0
it doesnt lmao
ok
It installed 12.0.0
npm doesnt jump versions to prevent breaking your code
if you have version 5.x.x of something installed, running the install command with never upgrade it to 6.x.x, it will always stay on 5
unless you completely uninstall the package, then it will get the actual latest version
at item.request.gen.end (/rbd/pnpm-volume/cec94d0a-3656-4969-903d-51a1b2f51f8f/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)6:27 PM
at then (/rbd/pnpm-volume/cec94d0a-3656-4969-903d-51a1b2f51f8f/node_modules/discord.js/node_modules/snekfetch/src/index.js:215:21)6:27 PM
at process._tickCallback (internal/process/next_tick.js:68:7)6:27 PM
(node:5060) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 10)6:27 PM
3 ; 126:28 PM
What does that Error mean
DiscordAPIError: Missing Permissions
client didnt become ready in time error. seems to be an issue with sharding.
first time trying to boot on discord.js master version and i get this.
i added client.on('debug', console.log) and now i get the following:
[WS => Shard 0] Didn't receive a heartbeat ack last time, assuming zombie connection. Destroying and reconnecting.
[WS => Shard 0] Clearing the heartbeat interval.```
when did you install master?
they had an emergency update to fix a connection issue like 1-2 days ago
Today
does it connect if you dont shard?
well it was installed around yesterday and updated using npm i discordjs/discord.js
and i'll try that
URL: wss://gateway.discord.gg
Recommended Shards: 3
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 978
[WS => Manager] Spawning shards: 0
[WS => Shard 0] Trying to connect to wss://gateway.discord.gg/, version 6
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] Opened a connection to the gateway successfully.
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] Identifying as a new session. Shard 0/1
[WS => Shard 0] WebSocket was closed.
Event Code: 4011
Clean: true
Reason: Sharding required.
[WS => Shard 0] Clearing the heartbeat interval.
[WS => Shard 0] SHARDING_REQUIRED
[WS => Manager] Manager was destroyed. Called by:
Error: MANAGER_DESTROYED```
@quartz kindle
@split hazel try with 2 shards
The NSFW bots are allowed?
mk i'll try 2 shards
same thing happened with 2
oh no
and i have some news
i set the timeout to 999999999 and shard 0 managed to login
wtf
you mean spawnTimeout in .spawn()?
did you set it to something low before? or was it the default 30 secs?
yes
shard 0 and 1 logged in but 2 seemed to be terminated, on those servers where its online, it doesnt respond
hold on some decided to try restart
on each shard the zombie connection log comes up and the shard restarts again
hey

crazy memory leak







