#development
1 messages · Page 1648 of 1
don't u use git?
Just remove your package-lock.json and node-modules folder and run npm i
and don't modify package.json like that ever again
Soz.
npm i only?
Yeah
I don't.
then do
you're walking in a VERY narrow path
a single error and poof, bot's gone
message.channel.messages.fetch({ limit: number }).then(messages => {
const userMessages = messages.filter(m => m.author.id === member.id)``` is there a way of fetching only the usersmessages?
no afaik
well if number is 3 why is userMessages returning 1?
because you filtered those 3 messages
and got a single one that matches your filter condition
how can i find 3 messages just from user?
keep fetching until your total filtered collection/array gets the desired count
basic loops
you can also straight up fetch 100 messages to lay off the requests
the endpoint allows 100 messages per request
that was a very fast never mind
😂
no
Just wondering, but do you have a github
no
professional, eh?
so it includes: source code, documentation, unit tests, license, training and 24/7 support?
suddenly it doesn't feels so professional eh?
minimum wage = minimum effort
no 
if you want quality, go to a qualified person
just kidding
oop
hey cry how are ya
imagine saying you'll make professional stuff
feeling ded and bored
then delivering a templated code without any doc 

Same... lets @vivid fulcrum together
hi, im trying to make a bot list and im using the oauth 2 code from the discord.js docs. However, it doesn't work and always goes to the else statement
those are not the djs docs, https://discord.js.org
then its the "guide"
yep
im not actually using djs i was just using the guide for oauth2
but the code doesnt work

How can I create a readable stream from an image that is not on the hard drive?
in which language
Js
Not really, I generated it through another package and now to send it through a PATCH request to the API it needs to be in a readable stream, so downloading and uploading every file isn't an efficient way to do things
discord-image-generation
I read that there was a way to do that, from buffer to stream but I dont find it
why do i feel like that's some garbage package
anyway
give me a sec to look over
that package... already returns the buffer?
Yeah, the problem is this:
Im using axios to do the request, and the two params im using are the url itself and the readstream. It works great with local files, but when I try to fs.createReadStream(file) it throws the following error
When the file is the output, which logged is a buffer
a readable stream is just an interface which makes it efficient to deal with a large amount of data
did you try just sending the buffer
one sec
also i suggest using node-fetch over axios
Yeah, I just managed to edit a slash command some hours ago, i'll change soon tho
Yeah
I looked that up and thats smth related to the buffer
https://stackoverflow.com/questions/13230487/converting-a-buffer-into-a-readablestream-in-node-js Try this I guess
kinda weird that axios doesn't allow you to send a buffer
dm help me
Why, so you can suck the help out of someone in private without being seen as a help vampire? lol.
what is the error on my discord bot please help me
install quick.db
I install guick.db but it gives the same problem again
help
well it's clear the quick.db install didn't work then
idk man ive never used quick.db
What error do you get when installing quick.db?
1 munites wait
Oh hold up. This is glitch. Glitch is not appropriate for bot installations. DO NOT USE GLITCH (especially not with a bot that has a database in sqlite!!!)
Oh hold up. This is glitch. Glitch is not appropriate for bot installations. DO NOT USE GLITCH (especially not with a bot that has a database in sqlite!!!)
glitch with quick.db is asking for your bot to die quickly out of memory
I remember what to use
glitch with quick.db is asking for your bot to die from a half dozen reasons, or your bot's data to be stolen by anyone, or both.
what
Glitch is not appropriate, and it's basically against the terms of service to use a bot on it (it's definitely against the terms of service to keep it alive)
I only know of its tos for using pinging services for bots
yes which is what most people use to keep their bots online.
Will you help me with my problem ?
We cannot.
I don't really understand the need to abuse systems
no no
a cheap vps is like 1 usd, or even google cloud or aws which is free for a year
and if glitch finds out your project gets deleted, but they let you install your code
I am not abusing
are you using glitch?
You are if you're hosting a bot.
yes
Because it's not against the ToS to actually host a discord.js app. It's against the ToS to keep it alive without paying them their dues.
yea
Then yes you are basically abusing if you want to develop a bot there. Do not use glitch to host bots. You can use repl.it, and there it has a database system you can use, but you should not be using quick.db on there either.
I just asked the reason for this error and you extended the subject so much you would just be helpful.
Neither glitch nor repl.it are appropriate locations to host any application that uses sqlite storage
yea quick.db takes up memory quickly, either use repls database or use mongo
The error is due to glitch not being appropriate to host sqlite databases
actually it doesn't, quick.db isn't cached, it uses no more memory than sqlite3 itself.
or just marginally so
how do i fix it
Move to a different hosting service.
e.g
I've mentioned it 3 times at this point
it should be pretty clear to you
If you bothered listening.
lol
Hmmm
man just use heroku if you're that desperate
it has no database unless you add a credit card
add a credit card (it wont charge you) and you also get access to mongo DB
oh hi guys.. if anyone remembers over the weekend I was trying to make a way to send script to client without user being able to see that script?
no it's not impossible
it was working since sunday and I just smoothed it out.. made my release.. since sending the repo would be advertising i'd send the example link
there are some limitations(even though it works)
- it doesn't work on some browsers apparently(i also heard that it definitely works on edge)
- you need to allow popup
https://hidejs-example.paultaylor2.repl.co/
use server sight/side?
well hosting is always from a server.. but what this does specifically(when u click the link) u should see an alert(the script to load that alert is hidden from the user to find it)
found it
i remember the whole "that's impossible" talk and that's y i simply placed the link
no u found a script that loads the hidden script
mb i realise that wasnt pointed towards me
it shows your popup code
else{toRun=false;while(true){let i="Required modules that MUST be in their DEFAULT form are compromised";try{alert(i)}catch(err){}}}
}//basically, the window would halt all further processes(through infinite loop) if error occurs during this load process
catch(err){toRun=false;while(true){
let i="Unexpected Error.. Either you didn't allow popups, the dev had a non existing value for requiredModules, OR, required modules were compromised";
try{alert(i)}catch(err){}}
}
})()```
that aint it xD
oh
how to make multi activity for the bot
setInterval
have an array of statuses
and change it every minute or however you wish
idk the ratelimits
so i recommend a min
ok lemme tell you what the hidden code in that example is so that you can find it(if u can tehehhehe ;])
if i did it my bot ll get declined?
wym
try{alert('HIDDEN SCRIPT >:D\nAt...\n/')}catch(err){}
const activities_list = [
"f",
`d`,
"c",
"b",
"aa",
];
const type_list = [
"WATCHING",
"WATCHING",
"WATCHING",
"WATCHING",
"WATCHING"
];
setInterval(() => {
const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
client.user.setActivity(activities_list[index], {type: type_list[index]});
}, 40000);
})```
it updates every 40 seconds
40000 is the ms
= 40 seconds
i do not think that has an affect in verification, no
type_list isn't really necessary unless you want to use different types
yeah it was an example
oh wait it was an example
its a bad practice to execute automatic; functions/ events on a certain time. The ratelimt is 15s so, make it to 1m
btw wanna see the repository?
you have to want it else it's advertising
pls say yes xDD
- 0 then when have 10 minutes

if it isnt prviate
ah ;""if it isnt prviate"
that's an example.. but.. hmm... still do u wanna see?
it wasnt that.. the github repo.. the hidejs example is an example of something i call HideJS
hm.. i should change the repl one to the newest version
anyway.. this was a fun week
lol
holy
Use code tags... god damn
suggested edit to just put ``` before and after that code
sorry
oh
whats the problem
it must say pruning is off or on
it exports message pruning {result}
naaa please xDD
Can anyone please tell me wtf this error means
0|Bot | 21: 0x1021517 v8::internal::DescriptorArray::CopyUpTo(v8::internal::Isolate*, v8::internal::Handle<v8::internal::DescriptorArray>, int, int) [node /root/MM/index.js]
0|Bot | 22: 0x100cf14 v8::internal::Map::EnsureDescriptorSlack(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Map>, int) [node /root/MM/index.js]
0|Bot | 23: 0x100fceb v8::internal::Map::ShareDescriptor(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::DescriptorArray>, v8::internal::Descriptor*) [node /root/MM/index.js]
0|Bot | 24: 0x10101f9 v8::internal::Map::CopyAddDescriptor(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Map>, v8::internal::Descriptor*, v8::internal::TransitionFlag) [node /root/MM/index.js]
0|Bot | 25: 0x10102d8 v8::internal::Map::CopyWithField(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::FieldType>, v8::internal::PropertyAttributes, v8::internal::PropertyConstness, v8::internal::Representation, v8::internal::TransitionFlag) [node /root/MM/index.js]
0|Bot | 26: 0x101228b v8::internal::Map::TransitionToDataProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::PropertyConstness, v8::internal::StoreOrigin) [node /root/MM/index.js]
0|Bot | 27: 0x1002a37 v8::internal::LookupIterator::PrepareTransitionToDataProperty(v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::StoreOrigin) [node /root/MM/index.js]
looks weird
Agree
here's the full thing if u need it
Looks like some node weirdness
I agree
that doesn't look too full
I don’t think you should see that
try --lines 25 or something
Deel je code makkelijk met anderen via Hastebin.NL, een snelle en makkelijk te gebruiken online code editor.
Looks light it might be an error from a native dep or Node just got quirky
you’ve used too much heap bro
heap?
JavaScript heap out of memory innit
memory
But the bot only uses 100mb/1gb
0|Bot |
0|Bot | [11248:0x4aaea80] 133228079 ms: Mark-sweep 485.5 (502.6) -> 481.7 (501.9) MB, 621.7 / 0.1 ms (average mu = 0.819, current mu = 0.757) allocation failure scavenge might not succeed
0|Bot | [11248:0x4aaea80] 133229128 ms: Mark-sweep 485.0 (502.7) -> 483.3 (502.7) MB, 631.1 / 0.0 ms (average mu = 0.700, current mu = 0.398) allocation failure scavenge might not succeed```
this says otherwise
is it ok if my question is not discord bot based but general python based?
yes
yes, read the channel topic, they clarified it
it used to have "(bot)" which confused people
So im making a simple typing race game in python and im packaging it/compiling it using pyinstaller. It wont run and when i click it it opens a window which says traceback waning and instantly closes
I believe its missing packages/cannot find the required dependincies
but i did move the .lock and .toml files into the same directory
I did the coding in repl and packaging on my pc
for?
music bot
Awesome bot. Best giveaway bot 
i thought you got solve for my problem 🥲
I see you figured out constructors almost
Hi so um I am currently trying to make a stock market thing to where you can view the stock of a company (fake companies) and I dont know how to randomise + and - so im confused at that part
almost
my code so far: ```js
let stock = args[0]
if (isNaN(args[0])) return message.channel.send("Please put a number that works!")
if(stock === "1") {
let price1 = Math.floor(Math.random() * 5)
let total = 1000000 +- price1
let embed = new Discoed.MessageEmbed()
.setTitle('test1 Stock Value:')
.setDescription(`Current Value ${total} per unit \n increase/decrease: ${price1}`)
message.channel.send(embed)
almost
can someone help me solve this error?
the code:
let text = args.join(" ");
if(!text) {
const embed = new Discord.MessageEmbed()
.setTitle('Wrong form of use:')
.addFields(
{name: "The problem:", value: "teste", inline: false},
{name: "Exemple:", value: "teste", inline: false},
)
.setColor();
message.channel.send(embed)
};
the problem:
I think I should use "catch (error)"
hmm I say u did ur args wrong
but ill check
try args[0].join(" ");
I'll redo the code
already tried, the error still continues
hm
args.slice(0).join(" ")
try
ok
u could use that too
the last one i sent btw allows you to type with space 4 example = hi am bot
the error still continues
yes
help pls
You could have a chance that the number (positive) is *-1
I changed up the top of my client.js from Collect, Client, Collection. To what you see now.
This is for my GiveawayBot
i only use const Discord = require('discord.js'); i think simpler
How to get npx nodemon
npm install nodemon
cause I got Node.js but it still not working
nodemon isn't necessary to run a bot
kk
It's just a facilitator to automatically reboot the bot on change
so your saying it isn't neccesaary
It's not, no.
kk
@umbral zealot help me with this problem please
I can't help you with that.
OK thank you for the attention
?
oh
so like chose one of those numbers
Idk what you are exactly trying to do... Maybe you so something like.
Generate random number max 10
Generate your other number
If first number is less than 5 *-1 to make it negative else just use the positive #
Less complicated than it looks lol
@umbral zealot I got my npx nodemon to work
Good for you, I guess?
DELETE_MESSAGES is not a valid permission.
MANAGE_MESSAGES is the one.
why would you need that...
idk
lmao
Why would you need asynckit
A giveaway bot is an extremely simple affair, it's a couple of commands and a database, it doesn't need all the fluff you seem to be researching

yeah
your making it more complicated than it needs to be
WELL anytime I try to start the bot it says
well clearly it's missing a module you didn't install or doesn't exist.
heres the module
idk
don't use parallel.js it's not useful for you.
you shouldn't be messing with things you have absolutely no understanding of and aren't useful.
k now anyway to start the bot tho?
remove your reference to parallel.js
how tho?
by removing that line that refers to it
whatever you added recently that caused this error, remove it
that would be either ms or discord.js
could you show us your current file structure and code
anyone here who is experienced in powershell scripting?
Best to just ask your question and maybe someone can answer it ^_^
whoa there hold up
kk
why is there no node_modules folder here, did you even install anything?
... ns....
one sec

is there an easy way to access certain settings in inetcpl.cpl with powershell and change the settings?
that does nothing except open vscode
running the bot should be done with node . not code .
or npm start
It is node
so, noone here who worked with powershell scripting
or node file.js
npm is preinstalled on node
Yep
npm install ms
npm i ms
don't kid with this guy he's bound to not understand sarcasm
true
bruh
kk now tell meh what is this
I just figured something out
what?
No worries did that
Ok so can you show us your current index.js file?
could you also just copy/paste the code isntead of screenshots, it's a lot easier to read
const Client = require('./structures/Client');
new Client().start(require('./config.json').Token, ./commands);
```js
your code here
```
Anyways I can't possibly see how this would give you that error, it doesn't make sense.
const Client = require('./structures/Client');
new Client().start(require('./config.json').Token, `./commands`);
that really wouldn't give that error, it doesn't make sense.
I have other code tho
in your index.js?
no shit, of course you do
but the error stack specifically says the problem is in index.js
I see
const { Collection, Client, MessageEmbed } = require('discord.js');
class GiveawayClient extends Client{
constructor() {
super();
this.giveaways = new Collection();
this.commands = new Collection();
this.ms = require('ms');
this.fs = require ('fs');
this.path = require('path')
this.discord =require('discord.js');
}
commandHandler(path) {
this.fs.readdirSync(this.path.join(__dirname, `..`, path)).map((f)=> {
let File= require(this.path.join(__dirname, `..`, path, f));
this.commands.set(File.nam, File)
})
};
start(token, path) {
this.commandHandler(path);
this.login(token);
this.on('ready', () => {
console.log(`${this.user.usrname} is now online!`);
});
this.on('message', async(message) => {
if (message.author.bot || !message.guild || !message.contect.toLowerCase().startsWith(`g!`)) return;
const args = message.contect.slice(`g!`.lenght).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if(this.commands.has(cmd)) this.commands.get(cmd).run(this, message, args).catch(console.error);
});
}
embed(data, message) {
return new MessageEmbed(data).setFooter(message.author.tag, message.author.displayAvatarURL({ dnyamic = true }))
}
}
module.exports
I don't understand specifically why it doesn't point to that file
but...
message.author.displayAvatarURL({ dnyamic = true }))
This is exactly what produces this error
objects don't use =
You could have... uhm... https://www.google.com/search?q=invalid+shorthand+property+initializer
I'm running the code again
(node:5060) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at GiveawayClient.login (C:\Users\ravi_\Desktop\Discord Bots\GiveawayBot\node_modules\discord.js\src\client\Client.js:206:52)
at GiveawayClient.start (C:\Users\ravi_\Desktop\Discord Bots\GiveawayBot\structures\Client.js:20:14)
at Object.<anonymous> (C:\Users\ravi_\Desktop\Discord Bots\GiveawayBot\index.js:2:14)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
(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(). To terminate the node process on unhandled promise rejection,
use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:5060) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
your discord bot token was incorrect
Make sure it's correctly written in your config.json as "Token": "the token here",
Remember javascript is case sensitive. Very important.
kk
It was token
undefined is now online!
Send meh the place to invite my bot
@umbral zealot
"places to invite my bot"? I don't understand
Uhh
Ye
The invite u mean
Yes
this should guide you through it
hmph. Ignore the screenshots though, the images are wrong. One more thing to go worry about. Gitbook is really failing me there.
Great. don't link it here, that's advertisement.
got it
forsome reason i keep loosing coins
Its online but does nothing
vs this 2 hours later
i use quick.db
idk why it randomly changes my balance
ykw
ill just change to mongo
mongo is 100% better
const Client = require('../structures/Client');
const { Message } = require('discord.js');
module.exports = {
name: `ping`,
/** *
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async(client, message, args) => {
const msg = await message.channel.send(`Pinging...`);
await msg.edit(client.embed({
title: `Pong`,
description: `Websocket ping is ${client.ws.ping}MS\nMessage edit ping is ${msg.createdAt}MS!`
}))
}
}
where do you login to your pot?
I tried doing a ping cmd but it isn't working
where does it look that this is a msg?
youre not properly looking if the cmd is run
is there a way to make MAP a certain type?
huh?
you have to check if your command is being executed
ah wait
nevermind
i thought this was your index
other tha that idk
than*
class Giveaway {
constructor(client, options) {
client.giveaways.set(options.id, options);
}
}
My Giveaway.js
what do i do for this step with mongo
Add your Current IP if you want that ip to be your main
or add a Differnt IP if idk your on vacation doing this
what does allow access from anywhere mean doe
oh
wait
this is for access
i thought it was for connection
nvm
lol
this.mongoose.connect(``)
Use this if you click Attach to Application @sterile lantern
Change up stuff for name and password
np
let Discord;
let Database;
if (typeof window !== "undefined") {
Discord = DiscordJS;
Database = EasyDatabase;
} else {
Discord = require("discord.js");
Database = require("easy-json-database");
}
const delay = (ms) => new Promise((resolve) => setTimeout(() => resolve(), ms));
const s4d = {
Discord,
client: null,
tokenInvalid: false,
reply: null,
joiningMember: null,
database: new Database("./db.json"),
checkMessageExists() {
if (!s4d.client) throw new Error('You cannot perform message operations without a Discord.js client')
if (!s4d.client.readyTimestamp) throw new Error('You cannot perform message operations while the bot is not connected to the Discord API')
}
};
s4d.client = new s4d.Discord.Client({
fetchAllMembers: true
});
s4d.client.on('raw', async (packet) => {
if (['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) {
const guild = s4d.client.guilds.cache.get(packet.d.guild_id);
if (!guild) return;
const member = guild.members.cache.get(packet.d.user_id) || guild.members.fetch(d.user_id).catch(() => {});
if (!member) return;
const channel = s4d.client.channels.cache.get(packet.d.channel_id);
if (!channel) return;
const message = channel.messages.cache.get(packet.d.message_id) || await channel.messages.fetch(packet.d.message_id).catch(() => {});
if (!message) return;
s4d.client.emit(packet.t, guild, channel, message, member, packet.d.emoji.name);
}
});
s4d.client.login('The token').catch((e) => {
s4d.tokenInvalid = true;
s4d.tokenError = e;
});
s4d.client.on('ready', async () => {
s4d.client.user.setActivity(String((s4d.client.guilds.cache.size)));
});
s4d;
Where should I put this code?
hey can someone help me?
im getting a string from
var fs = require('fs');
var data = fs.readFileSync('banned.txt', 'utf8', function(err, banlog) {
if (err) throw err;
});
but it wont work with
if(message.author.id === data)
yes it does log and it is there
i just dont know why it work work
did you try to console.log(data) and see what you get?
I'm guessing it's not just one ID
@umbral zealot
So it's not one ID then
It sounds like you're trying to use a txt file as a database. Don't. Get a real database instead.
this
Doesn't matter, it probably has a space before or after, or a line return, or something.
It's pointless to help you fix something that's extremely bad to do as a programmer
don't store data you're changing inside a txt file. TXT and JSON are not proper databases, they're not to be used in this manner.
Try to use data.trim() even if Hindsight is absolutely right
while that might work for a single ID, I'm guessing that's not the point so I don't see how it's useful to mention it 😕
works
Yeah I know. At the end of the day these tips are always good and right but I bet lots of amateur coders will still use their own weird solution instead of learning advanced basics.
It means you do not have access rights to the git repository you're trying to pull from.
As we've had discussions in the past I know you're a very experienced developer and as such, you should know what's bad practice and know better than to even hint at how to execute bad practice. Using txt/json is harder than using simple key/value databases, and it's a horrible thing to do, so as experienced developers it's up to us to coax people in the right direction, not load the shotgun by which they will shoot themselves in the foot.
The whole "I know you're not supposed to be shooting people but here let me show you how to load this gun, but you really shouldn't shoot it, but let me show you how to aim it, but please don't shoot anyone, and here's the trigger but, again, don't shoot anyone!" spiel is so... annoying.
maybe you are actually logged in but literally don't have rights to that repository?
That error seems to say otherwise
Personally I'd suggest this package it's pretty simply to use https://www.npmjs.com/package/better-sqlite3 if ur doing anything database related.
I only get this when I forget to start my pageant with my SSH keys but of course that error happens in many different situations where you're not authorized properly
As far as "simple databases" go I actually often point people to nedb, or my own enmap (which wraps around better-sqlite3 anyway)
But nedb is dead simple for simple key/value storage.
dam nedb is basically sql for dummies i like this
it's not sql, that's the reason it's so easy 😄
Yeah I fully agree with that but it won’t change the fact that people will probably ask over and over again about the same issue ignoring any tips just to solve their issue.
Even if I don’t support this kind of bad practice, too I’m unable to change the people and their decisions or force them to do things as they should be done.
But don’t get me wrong.
It’s sometimes easier to ignore the ignorance of somebody to learn something new.
well consider me a dummy

Everyone is on different levels its how the world works.
whats the best sql database package and non sql ?
So tell them, over and over again, not to do it, and present better alternatives. We should express a common front against bad practices, instead of undermining each other by helping beginners load the gun they're aiming at their feet.
You mean, like NoSQL databases? There are many, from Mongo to Rethink. But there isn't a "Best", they each have their own upsides and downsides, places where they might be more appropriate. A blanket "this one is the best" is never true when it comes to technology.
which would be best for a beginner?
for sql databases
There isn't really any specific one that's best for beginners, not in "real" databases.
You can use enmap or quick.db if you want something that's easy for beginners, though.
yeah ive used quick.db
Well I’m not saying you’re wrong but... yeah actually that should be the way.
I do remember when I’ve started ~14y ago. There was no Discord or so much forums and activities like today. You had to try over and over again until something worked since docs are really confusing sometimes as beginner. Time has changed a lot.
Awesome, so we can agree to not ever help someone try to use txt or json as a database, then? Not even a little? 😛

Because we know better 🙂
it rlly is
Due the fact I’m driving I couldn’t reply with such an amount of text like you anyways. But since you throwed that topic on me I must reply.
It sometimes feel like there’s a crying child and you have to do something instead of ignoring it, you know 👀
put a gag on it

Sure but we're not dealing with babies and their 5/10/15minute tricks. We're dealing with teenagers that should know the meaning of "no" and require our guidance as adults.
I’ve actually no clue what that means
lmao that’s a good one
let Discord;
let Database;
if (typeof window !== "undefined") {
Discord = DiscordJS;
Database = EasyDatabase;
} else {
Discord = require("discord.js");
Database = require("easy-json-database");
}
const delay = (ms) => new Promise((resolve) => setTimeout(() => resolve(), ms));
const s4d = {
Discord,
client: null,
tokenInvalid: false,
reply: null,
joiningMember: null,
database: new Database("./db.json"),
checkMessageExists() {
if (!s4d.client) throw new Error('You cannot perform message operations without a Discord.js client')
if (!s4d.client.readyTimestamp) throw new Error('You cannot perform message operations while the bot is not connected to the Discord API')
}
};
s4d.client = new s4d.Discord.Client({
fetchAllMembers: true
});
s4d.client.on('raw', async (packet) => {
if (['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) {
const guild = s4d.client.guilds.cache.get(packet.d.guild_id);
if (!guild) return;
const member = guild.members.cache.get(packet.d.user_id) || guild.members.fetch(d.user_id).catch(() => {});
if (!member) return;
const channel = s4d.client.channels.cache.get(packet.d.channel_id);
if (!channel) return;
const message = channel.messages.cache.get(packet.d.message_id) || await channel.messages.fetch(packet.d.message_id).catch(() => {});
if (!message) return;
s4d.client.emit(packet.t, guild, channel, message, member, packet.d.emoji.name);
}
});
s4d.client.login('The token').catch((e) => {
s4d.tokenInvalid = true;
s4d.tokenError = e;
});
s4d.client.on('ready', async () => {
s4d.client.user.setActivity(String((s4d.client.guilds.cache.size)));
});
s4d;
You've been on Reddit, you know what a Karen is, don't let kids become karens.
Tell meh where to put this
?
Anyways I’m trying to be a better daddy lol
You, friend, need to stop shoveling code into your bot and you need to go learn javascript.
I don’t even have Reddit
thx
Or should I say im not using it, whatever is the right one
ik javascript tho but I haven't learnt this tho
no, no no you do'nt know enough
go through a course. It's clear you don't understand enough JS to do any of this.
kk
nvm
node version manager
Shh
secure hocket hell
lmao

I see you’re imagining your code again
Which leaves a lot of time left to troll 
yes
i got rid of both yarn and pnpm
reorganized all my projects with regular npm
but setup a shitty mirroring system to autobackup without node_modules
no
no
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
bruh
Doesn’t matter at the end I guess
Reinstalling packages is easier then recoding a lost project
and thats not even a complete list
thats just the "official" list
there are a lot more non-official discord libraries for many more languages
oh kk
i had all my projects inside my google drive folder
which doesnt ignore node_modules
you can imagine the mess
lmao
one npm install and google drive sync is trying to upload 100k files
Yeah, horrible to watch the transfer times
i ended up using a shitty app called FreeFileSync lul
to autosync my projects folder with the google drive folder without node_modules
I guess to do real backups I would probably zip the whole directory and back it up after
ye but then you cant easily do realtime backups/sync
Yeah that’s always an issue.
I’m managing tons of dedicated servers and cloud servers and have a lot of trouble to backup services I can’t turn off or or such services using databases I can’t
I’m always risking a bit of data loss
Dowlanding vscode and node takes time
I’m not speaking about backups for node projects but generally about backups for apps, databases and stored data which is continuously being written/read
for that kind of data the only proper way would be raid mirroring
can I use vscode to code on any coding language?
Yes, it's an editor that supports many programming languages.
im tryna randomize if it should be adding a number or subtracting
kk
50/50
These servers are all running raids of course. I wonder which provider nowadays offers servers without raids.
Just 2 of my servers have additional SSDs installed without a raid due the fact of hardware limitations. These two store my lookup database with ~800GB. That’s "impossible" to backup anyway but that’s not an issue due the fact it only contains generated data.
But even for all other servers backups are important no matter their SSDs are raids.
Even with a RAID10 if I would store personal data only, which is not the case, I would still do backups to external DCs or areas/regions.
But since you’re probably speaking about backing up a small server or just a few node projects etc. that might has gone a bit offtopic.
Oh nvm, you said raid mirroring 
Stop abusing my name!
lol I've seen that help menu so many times it's not funny anymore.
bruh
I don’t get how it "glitches out"?
I guess the glitch is that it's literally showing the botghost help command.
BotGhost is to bot making as what Lego is to building toys.
Yeah that’s what I expected it to be I got from the context. Shame on him I guess 👀
At the end one bot more which gets declined

That is the most beautiful Giveaway Bot help command I've ever seen. /s
Nah its for my first bot not the Giveaway one
If somebody’s arguing like that I always feel 10 years older than I’m actually are.
Yep how to make you only have to use +commands once to make it work not twice
uhhhhh
Well, we'd have to see the code for your +commands command to know what's going on
is it the only command that does that?
Ye I realised something
Yep
Well I realized that I added something extra in the code that didn't work out and dam it was fixed
hey
what does this mean?
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.
umm
its written there
Invalid bitfield flag or number.
Hey! I'm creating a Discord.js bot with a sharder and I want to share a variable between the sharder file and the main file (because I have a command handler and I want each process to share the same Collection for the sake of saving memory). I also have some other variables that I share between each file and I usually achieve this with process. However, since shards use different processes, I can't share these variables. How can I share my collections and other variables between each shard?
Not many (only about a few hundred), but I'm future-proofing it; I've already gotten a way for the sharder to work but I'm rewriting my bot and I want to share variables and collections in the case of it growing to a point of needing another shard
But that's besides the point
lol
@opal plank helo sir, big fan of detritus, this chap wants some help, if you may =)
he shall reply in some time
what does that mean tho?
btw, what is the name of your bot?
I got this
show the code
module.exports = {
name: 'say',
execute(client, message, args) {
if (!message.guild.me.hasPermission("DELETE_MESSAGES")) return message.channel.send("Bot needs permissions to delete messages!")
let sy = args.join(' ')
if(!sy)return message.channel.send("Please put something after ``say``.")
message.delete()
message.channel.send(sy)
console.log("Say command had been ran..")
}
}```
say
say
yes
yep
See https://discord.com/developers/docs/topics/permissions for more details
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
how do you get docs so fast?
hi i have a next.js app and i want to run npm start when it runs node .
like for example
i have djs's docs already open lol
oh eh, hmm, is it possible?
tell tell
"scripts": {
"start": "[next.js start command here]; node ."
}
for example if i was opening an electron app with a script
"scripts": {
"start": "electron main.js; node ."
}
hi anyone here know next.js well?
what happens in it?
(node:62364) UnhandledPromiseRejectionWarning: Error: > Couldn't find a pages directory. Please create one under the project root
@round cove how to edit my bot after submiting ?
on your bots page, click "edit"
can you change my nick?
nope
how to make our bot paid ?
code grant
i dont how to code that
Boost the server, gives you the ability to change your nick
no more boost needed fully
if you would understand the context, then you would know that your ping where not needed
i created two bot and added two in top.gg and one of my bot is now in discord archeive's dashboard #1 ! what is that ?
what
bot.login()
when I do that it gives the same error
show code
const Discord = require('discord.js');
const bot = new Discord.Client();
const prefix = "!"
const TOKEN = process.env.TOKEN;
client.on('ready', () => {
console.log('Bot is ready'); bot.on('ready', () => {
console.info(`Logged in as ${bot.user.tag}!`);
const args =
msg.content.split(/ +/); const command = args.shift().toLowerCase();
console.info(`Called command:
${command}`);
if (!bot.commands.has(command)) return;
try {bot.commands.get(command).execute(msg, args);
} catch (error) {
console.error(error); msg.reply('there was an error trying to execute that command!');
}
});
bot.login(TOKEN);
my token is in a .env file
for security
its seperate but its also connected
@rigid sandal you have to add that code in message event
not ready
ready event doesn't give the message object
ready is the message it says when my bot is online
no
this user is ready
yes
it occurs when the bot is ready... not when a message is sent
you need event
oh bot.on (ready)?
I am a web developer
here you are using client... there you are using bot
learn nodejs
and i was actually learning something new
start with a tutorial
https://discordjs.guide will help
its discordjs.guide
nvm
not discord.guide
it will help you understand how discord.js works
also https://discord.js.org docs will help
@fickle magnet do you mind if i redirect you to the Javacord discord?
as they can help you better
sure
https://discord.gg/0qJ2jjyneLEgG7y3
Feel free to ask there
they also have examples on how to work with it
ty
When it comes to private Discord bots, is it worth creating public documentation about their features and such for the sake of transparency? A server that I'm an admin of has a private bot that is currently developed in Python by 1 person on our staff team. We aren't planning to turn the bot into a public one that anyone can use outside of the server anytime soon. I hope this is the right place to ask this...
Okay. The bot already has a help command.
It really depends. If the bot needs a detailed documentation apart from a help command, sure. If it doesn't, why bother?
Transparency is a resolved issue if you have a detailed help command, so
<link rel="icon" href="https://cutiecat6778.github.io/cdn/universe_logo.png" />
ehm ... i dunno what is happening
the icon is not working
not working
did you use the API?
yes
it could be a privacy breach, since you can send informations without the consent of the owner of the server.
...that information is public
it aint defined
the server is fine, you probably try to display an object that is empty or something
Should I make the check of if(guild.name === undefined) return; ?
and the guild.memberCount?
Alrighty.
aha okay!
sa
how did you get the stuff?
why?
the event won't emit without info
What do you mean?
Erwin: anotHer ReasOn to SwitCh To DetriTuS
it never happened to me
from where did you get the informations? like did you get the guild object from a event?
Yes.
strange, did you have partials enabled?
yea just follow Erwins cult will be better
indeed, just give detritus a try.
const inviteCode = client.guilds.cache.get('819508298016882699').channels.cache.get('819508299014602764').createInvite()
When ever I keep doing this I keep getting invited to a random server
🤔 is it the server with that id
so the guild id you provide is not the one of the server you want?
you can get a channel direcvtly btw
also createInvite is a promise iirc
if you using discord.js, it should automatically cache all caches
if you REALLY wanna make sure
then fetch/get if not available
i tried getting it directly from the channel but the same thing happened
,
is there a documentation on that? ._.
thanks! much appreciated!
np
Could someone help me testing something? Im working on a web dashboard. I need to test the server fetching but i need someone to help me cuz i cant do it solo
first to send something can help me :p
sad cricket noise .....
My Unban Command Doesn't Send The Unban Message Any Pointers To Why As Far As Im Aware i have It Correctly Coded
exports.run = async (client, message, args) => {
if(!message.member.hasPermission("BAN_MEMBERS")) {
return message.channel.send(`**${message.author.username}**, You do not have permissions to unban someone`)
}
if(!message.guild.me.hasPermission("BAN_MEMBERS")) {
return message.channel.send(`**${message.author.username}**, I do not have permissions to unban someone`)
}
let userID = args[0]
message.guild.fetchBans().then(bans=> {
if(bans.size == 0) return
let bUser = bans.find(b => b.user.id == userID)
if(!bUser) return
message.guild.members.unban(bUser.user)
if(unban)
return message.channel.send(`**${message.author.username}**, I unbanned the target user`)
})
};
is there any documentation for how to set up a mongodb?
theres this for Node.js itself https://docs.mongodb.com/drivers/node/
is there a way to remove a bot from servers it is currently joined in without having access to that server with my non-bot account?
no
damn
hi
you'll have to use the bot's token and leave the guilds that way
how is this done?
discord.js
you want to leave every guild?
just some guilds that i have the ID of
specific ones
just want to know if it is possible
bot.guilds.cache.get(id).leave()
.catch(err => {
console.log(`there was an error leaving the guild: \n ${err.message}`);
don't spoonfeed them
ahahaha
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=guilds
will get you the GuildManager object
https://discord.js.org/#/docs/main/stable/class/GuildManager?scrollTo=cache
will get you the guild cache
https://discord.js.org/#/docs/collection/master/class/Collection?scrollTo=get
to get the Guild object from the id
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=leave
to leave the guild
considering you got spoonfed, doesn't matter
dm me if you can use proxies or threads on discord py, help me in dms ill send u nitro ig
proxies are generally useless
ratelimits are per token
not per ip
wdum
You shouldn't use threads.
And proxies are useless for discord
Unless you're asking for nitro gen in which case it's a big nope
he meant he want to reward the one who helps him with a free nitro gift
what should I do when my bot is being verified, does it tell the user when they click the invite link/does it affect verification of my top.gg if they can t add my bot at the time
with its growth rates the 5 day discord verification time will probs affect some people trying to add the bot
I got that part.
But usually people who ask for proxies use them to bypass ratelimits on non-bot endpoints
Like bruteforcing nitro gift codes
No?
Note the "usually"
Proxies in general are useless for discord API endpoints since ratelimits are per token
I believe there's a proxy kwarg in the client constructor but that predates bot accounts themselves. iirc they're deprecated in 1.7 and gone in 2.0
Anyone wants to help?
Yes but i dont want to use alts
Why not?
I want someone to create a server. Invite the bot, invite me and then check if the dashboard locates the server cuz i dont have perms
Bc then my notification settings etc are gone again
This is one of the few legitimate purposes of an alt
Private browsing. Cookies won't interfere.
I thought it was always illegal
No?
lets use my phone then xd
Alts aren't against anything
forgot i even had my phone lol
Ohh yeh im stupid
this is the first time i woke up with so much.. look at that score :DDDD
wait is their a specific documentation for setting up mongodb in discord.js
use built in OS module
then?
well there you have it though
just dont loop it
i update it every couple secnods
what?
you're using a package
then you need to check the pakcage
i said os
not node-os-utils
it shouldnt
@hoary hill
looks abosultely fine
My bot has several answers available and is supposed to randomly answer with one of them. What would be the best way to save them? As a JSON file?
sure
would you read the json file everytime the command is used? because i thought id be better to "preload" the json file and keep the object in memory to minimize the IO-Operations. Or is this a bad idea?
Pre-loading it is fine. Just make sure you have plenty of memory for that
if you're using nodejs it'll keep required files in memory
im coding in java with jda 
its not only a nodejs thing
im saving the jsonarray in a map and read this if needed
file reads are way slower compared to directly in memory saved
yea this should be perfect
tbh i im quite new to use maps but a friends keep suggesting i should use them and yeah they are really cool 
OOF
xd
does anyone know how to make a rlly good filter like censor bots?
This is sick! This must be a new update.
Yes it is
how to start a discord.py bot?
help pls
Who wants a bit of help with their discord bots I can help with discord.py
use AI
I can help with the coding
@earnest phoenix seems like @sour flame needs some, i guess
yes pls
I need to know how to start my economy bot
I dmed you
on discord.py with vscode
i smell pull stack developers
me 😳
What kind
just no music bots pls
Are you actually trying to help people or spoonfeed them?
Guys, I have a .db file that weighs 160MB and I need to transfer it all to a MySQL, but I don't know the best way... Could someone help me?
I have googled and tested several programs and none of them converted everything I wanted.
let channel = message.mentions.channels.first();
``` it says channels is undefined
did u mention a channel in the message
no but it should throw an error if i don't
no it would be undefined
thats weird
oh
where does it say its undefined then?
log the channel
aight let me log it real quick
ok
Cannot read property 'channels' of undefined
its mentions then





