#development
1 messages · Page 1543 of 1
mongodb is pretty much just maps/collections.
if you understand or learn how to use maps, mongodb should be relativly straight forward.
MongoDB is pretty sold for a discord bot
Can you guys send the documents or the some tutorials or maybe help me!
?
how do you mean?
you dont need clustering until you have a ton of users
you are a djs user right?
From looking slightly at their code, yes
Mhm

What?...
@solemn latch should I screen share?
i dont see why you would need to.
you should take the time to read the docs, it can take some time.
Ima be totally honest the Docs are very confusing they really don’t explain me anything
how much of the docs did you read?
Just this, since this is the only one you sent
just the getting started page is about an hour long read.
How can I even code on mongoDB?
im in the middle of learning mongodb, started this week. after reading the getting stated page i had multiple questions i had to research.
its not something you just read one page and understand.
Did you even read the first paragraph of the website
^
you need to actually read it.
at the very least these sections. https://woo.pics/images/4c0f6fa787.png
as in the web shell thingy?
you probably shouldnt be making clusters, you should focus on reading for now
the docs has a mongo shell built in, you can practice and learn with that
Yes, I did it by mistake now how do I delete them?
Literally started using the database
Creates clusters
How do i delete them?
I didn’t
I just came on the page and then it said that
So I thought it was something else
Now tell me
Lol
I'm pretty sure they have all documentation for everything about the database, such as simply deleting those
Lol..

there is literally a delete button in the cloud version for clusters
there is literally a delete button in the cloud version for clusters
lol why did it send my message twice. sry bout that. I hate using discord on mobile
iirc, the getting started guide goes over all that.
Hm, I guess I don’t want a data base since it’s almost impossible to use it on iOS
imagine not reporting it to https://dis.gd/contact aswell as not reporting it through the report button on top.gg
What kind of database is impossible to use on X operating system?
sorry bro i can't use sql im on windows
Anyone who has in mind to start creating a new bot? I have several ideas that could be good. Focused on economy-rpg
Wait, isn't iOS specifically iphone OS?
Started good, ended catastrophically
why?
Bro tip: create a prototype, saying "i have an idea" is a bad omen
Without a working prototype (or even a concept) the project will either fail or noone will want to work with you on it
Otherwise just order it from someone
I have no idea how to create bots, I only have some ideas, but not how to program them.
World is full of ideas unfortunately
Not ez to put them to work
Projects where one thinks and the other programs 90% of the times becomes a boss-employee relationship
And the pj dies within 1 or 2 months
Not to say you'd have about 20% share on the pj
Yeet
Obviously I am not talking about being, ''the owner of anyone's life'', you are taking it out of context and exaggerating it. I'm simply looking for someone who will listen to my ideas, and if he is interested in carrying them out, doing it his way and I would be happy to help with the logic or mechanics of the game.
If did mean "owner of life", it just becomes a unbearable relationship
Where one says what to do, and the other put it to work
You see, sometimes a simple idea is excruciatingly painful to program
It is discarded and another alternative is sought, and if it is impossible, nothing happens. 🙂
It always start like this unfortunately
Unless both understand programming, it'll become a constant fight
It's pretty funny to see how non-programmers look at projects. This one guy wanted to pay me $50 for a bot with 67 commands.
Lul
That's $0.7/h if each command takes an hour to do. And that's being very generous
^^
A thing I always though was simple is AI in games
He didn't even list the commands, just said "some moderation, some fun"
That until I had to make one myself
I mean u should have a premade one
Now I will never see bots in games the same way as before
if just doing a handful of mod commands, i could see $1-$3 per command.
U don't need hours to make one
That if u use generics
some commands are not things you just make
Most of the time it's custom-made bots
I always cringe when people say "can't you just make a program that does that?" for everything.
ai systems, complex multiplayer games
One of my friends asked me if I could "hack V-bucks" for him in fortnite
I get that all the time
I have a trading card game that I made for discord, a thing I'm currently trying to implement is "play vs bot"
Man
I've never seem a concept SO F HARD to understand as much as AI
Maths
meth
pukes
Yes I agree with what you say, but user suggestions made by users are for something, to improve the bot. That thanks to them also and I repeat again, obviously, the work of the programmer, continues to improve and does not die after 1 month of use.
Yeah we can't change that AI requires alot of Math knowledge
When they say you need to be good at maths to be a programmer, AI is what they mean
or game deving
Yea, or that
At least we know for sure AI isn't gonna take over the world
Yep, I currently do that for my bot
you're going to find yourself using trig a lot in game deving
Unless you use something like game maker studio
However, would you accept to be owner of 0% of the bot?
Because, yk, suggestions don't give ownership of even 1% of the project
If u are aiming for Machine Learning or AI you gonna need some good Math knowledge
They are suggestions after all
Otherwise u just need logic
Lol, imagine suggesting a feature and then claiming ownership of said feature when it is implemented
My currently issue is knowing how the AI would know what cards to play
Or what cards are high priority
Doesn't that happen all the time
That's gonna take its time
Being the owner of 0% or 1%, I don't care about that, I don't get credit for contributing ideas, the credit goes to the programmer. As long as I have some of the characteristics (or similar) I will be very grateful.
I want to implement some sort of AI for my undertale battle system
Hope it's not too hard
AI is always hard 
I think there are some packages that can help u but AI aint easy
Crap 
AI stands for Always Impossible
Accurate
U should know what u are doing and not only Stack Overflow
There's a reason not everything has AI
Makes sense
But yeah AI will become a big thing sooner or later
User generated content 
Random number generator == AI 

One day I'll implement PvE in my game and boy, imagine the pleasure when the time comes
The feeling when you finish a big hard project is unspeakable
true, throwback to developing minecraft server plugins for a pixelmon server
The feeling of compiling it and sending it over discord to the owner 
And then they come back and say "hey can you make it work like this instead?" and that feature requires you to rewrite the entire thing because they didn't say they wanted it like that from the beggining
That moment when the soul leaves the body in shining glory but is pulled back by someone not being satisfied enough
I mean yeah, why request a feature in detail when you can vaguely describe it, leave it to the developer to figure it out and then tell them how it's actually supposed to be?
Programmers should've come with intellisense from birth to be able to predict user requests
Yes, underline everything with yellow text and say "Warning, this might not be exactly what your customer wants"
I'm trying to get some members of the guild using the member.fetch function, but it seems to be fetching all the members in the guild and not just the members i want. const members = await msg.guild.members.fetch({users:team.playerIds}); console.log("team.playerIds"); console.log(team.playerIds); console.log("members"); console.log(members);
dang
Thanks!
pastebin please
Ok
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Help
The Whole Code Looks Correct
But This Error
Anyone?
Shit im just teen and dont have ids or drivers license at all i need to get my bot to verification is there any ways?
Can i use school id?
Damn but can i use other’s documents? Like my parents have it
Oh aight ima ask later
are there any like, custom component compiled html? nothing like react or anything like that, i want to have the ability to make custom components that in the end turn into full custom elements and just write it as html to a file
no, html
i.e. bootstrap
yeah sort of
i'd recommend next.js
it's a react framework which enables server-side rendering
so i dont want ssr is the thing
your pages get statically rendered to html
i want to turn it into an html frile
One of the key features of the Web Components standard is the ability to create custom elements that encapsulate your functionality on an HTML page, rather than having to make do with a long, nested batch of elements that together provide a custom page feature. This article introduces the use of the Custom Elements API.
there's this
there's no way to achieve what you want with just html
i think react-dom has a renderToString method too
i'm fairly certain that the components won't behave properly
you'll just have the skeleton and the look of the component
since it lacks the whole react logic
next.js 
how would i use this?
not sure, never bothered to try it out
i think you pass a component and it returns the html string
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Help
The Code Looks Perfect
But I Have This Error
which line?
idk
I Just Want to Fix It
Can You Take A Look At The Code
And See Whats Wrong?
can you send the whole error
by "full error" he means the stack trace
that isnt the whole error
0-0
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it's whatever you're passing to ms
I wonder if it's some keyboard that capitalizes every word you type
I often see some dudes typing like this
Whoa What Are You Talking About

Don't Worry I Am Just A VB Developer
this also seems to not work well since it tries to generate an entire website
oh yeah it doesn't work for partial stuff
but it's really cool for whole websites and apps
ive already made my whole website is the thing
i just want to replace my current regexp .replace stuff with actually built and proper components
o
Does anyone know why message.channel.bulkDelete(10) would not work? I am using discord.js
I am getting this error:
(node:22646) UnhandledPromiseRejectionWarning: TypeError: Object.entries(...).filter(...).flatMap is not a function
Is your node updated?
ill try that
Try at least Node v12
that might be the issue, I am on v10 still
I'm 99% sure that's the issue.
V10?
The flatMap function was introduced in v12
I'm sure flatMap() and flat() were added in v11
It probably was, but odd numbers of Node.js don't really count since they're not LTS.
That's odd
pls
Oh, no. Not Ram!
Ram is superior to Rem.
I c
Clearly the right opinion
So true!
i'm waiting for the guy who's gonna say "who's rem?" and think he's a comedic genius
Ever get that feeling of deja vu
does anyone know how to make a api for my discord bot to show the server count, and user count. to put it on my website
?
How can I load an .env file, without using any package? Like directly from the script
then will it be available in process.env?
I don't think so
You could also use a json file, csv file, newline file, etc
Files are files anyway
oh yea
Just load it on start and save its values to some global variable
And remember not to add it to git
if it's a simple one it could be as short as string.split("\n").reduce((x, y) => (y = y.split("="), x[y.shift()] = y.join("="), x), {});
hello how can i use the jarvis bot ?
Wait
That’s a bot
Go to their support server
When we do npm start does the process.env.NODE_ENV is auto set to "development"?? Or does it depend on the type of project.
okie
help i am not able to find their support server
What is the bot Id?
Can't click it
Lol
719237134405337139
Right
not the place to advertise it
hey i found the server
gone, reduced to atoms
Ok
make your function async
How
add "async" to the function
yeah
ok ill try
wait
in that case you don't even need async/await
just remove the await and that's all
u sure?
yeah
Ok ill try both methods
brb
ill say if it works
First Method Works!
Thanks!
np
is there a way to compile to earlier ecma versions in webpack? like for compatibility and whatever
gameRouter.use('/:id', getGame, activeGameRouter);
gameRouter.get('/new', (request, response) => {});
For express: How do I make /new to be not use /:id and handled differently??
put /new above /:id
ontop of both
use babel
mmm another compiler pog lmao
For some reason the following script is not working. My react-app do get start but the dotenv/config is not getting pre-required.
"start": "react-scripts -r dotenv/config dotenv_config_path=./private/.env start"
Pretty sure create-react-app loads .env files by default
Anyone know of an API that displays random anime kissing gifs?
i know one but its banned from DBL
https://rapidapi.com/search/anime maybe you find one here
Any you recommend? Most of these are just anime search engines
idk im not into this stuff
weeb.sh is what we use 
Idk if they have a "Kiss" thing since that could be monkas for a lot of APIs. We use pretty basic stuff for the gifs. https://scs.twilightgamez.net/8s7aJ.png
it only loads the one which are prefixed with REACT_APP_
weeb.sh is probably the best option for anime images, but you'll have to apply and applications can take a while to be responded to. Some alternatives are https://some-random-api.ml or https://nekos.life
nekos.life can return NSFW images, though. Even on endpoints labeled as SFW, so be careful.
nekos.life iirc is banned from DBL
yea bcs of the nsfw endpoint
gn @swift umbra
When we do all: unset on button, does it also unset the click event??
And there is a property called Upvoter in that schema
I want MongoDB to change that Upvoter Value to "no" for each document
Is it possible?
so you want to query all your documents?
updateMany({Upvoter: "no"}) iirc this could work
updateMany({}, {$set: {Upvoter: "no"}})
so you have the model?
Yes
use model.updateMany()
then?
Wait so is this how?
const model = require ('models/users/schema.js')
model.updateMany()
And then use this
But for using $ I will have to use jQuery right?
can we use jQuery with nodejs?
Oh ok
Sorry I wasn't aware of that
@pale vessel but don't I need to like for loop it on getting it for Each user and then set value to no
Or only this much should work
updateMany is just a fuckton of updateOne
I don't need to enter any user id or anything anywhere?
Oh alright
Here the empty {} simply says "no filter"
Aka "affect every document"
There's no such thing as stupid question
{Upvoter: null}
Alright thanks
Also
How can I get my bot's tag changes?
Changed?
Like any illegal way because legally not possible
hey i am trying to randomly ping a member in my server
const userList = message.guild.members.cache.array();
var randomNumber = Math.round(Math.random() * userList.length)
console.log(randomNumber)
var pingPerson = userList[randomNumber]
message.channel.send("<@" + pingPerson.id + ">")
``` this is what i have achieved so far
Uncaught TypeError: Cannot read property 'id' of undefined
now it returns me this.
is it maybe because there are only 3 members in my test server?
so it rounds up, to 4.
You can just do message.guild.members.cache.random() which does the same thing you're doing but internally.
If you don't want to use the builtin method then use Math.floor instead of round
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
can you tell why this is not working
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "rank" is not found
@pale vessel
@commands.command()
async def rank(self,message,ctx, user:discord.User = None):
if user is None:
db = sqlite3.connect('main.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT user_id,exp, lvl FOR levels WHERE guild_id = '{ctx.message.author.guild.id}' amd user_id = '{ctx.message.author.id}'")
result = cursor.fetchone()
if result is None:
await ctx.send(f"{user.mention} is not yet ranked!")
else:
await ctx.send(f'{user.mention} is currently level {str(result[2])} and has {str(result[1])} XP')
cursor.close()
db.close()
elif user is None:
db = sqlite3.connect('main.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT user_id,exp, lvl FOR levels WHERE guild_id = '{ctx.message.author.guild.id}' amd user_id = '{ctx.message.author.id}'")
result = cursor.fetchone()
if result is None:
await ctx.send(f"{user.mention} is not yet ranked!")
else:
await ctx.send(f'{user.mention} is currently level {str(result[2])} and has {str(result[1])} XP')
cursor.close()
db.close()```
can anyone help
?
hey
let name = (Math.random*22)
let channel = message.guild.createChannel(name, 'text')
setTimeout(() => {
channel.delete()
}, 60000);
``` why is this returning me an error: message.guild.createChannel is not a function
nvm its solved
bruh
@commands.command()
async def rank(self,message,ctx, user:discord.User = None):
if user is None:
db = sqlite3.connect('main.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT user_id,exp, lvl FOR levels WHERE guild_id = '{ctx.message.author.guild.id}' amd user_id = '{ctx.message.author.id}'")
result = cursor.fetchone()
if result is None:
await ctx.send(f"{user.mention} is not yet ranked!")
else:
await ctx.send(f'{user.mention} is currently level {str(result[2])} and has {str(result[1])} XP')
cursor.close()
db.close()
elif user is None:
db = sqlite3.connect('main.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT user_id,exp, lvl FOR levels WHERE guild_id = '{ctx.message.author.guild.id}' amd user_id = '{ctx.message.author.id}'")
result = cursor.fetchone()
if result is None:
await ctx.send(f"{user.mention} is not yet ranked!")
else:
await ctx.send(f'{user.mention} is currently level {str(result[2])} and has {str(result[1])} XP')
cursor.close()
db.close()```
can anyone help?
What on earth are you doing...
why do you name your Context message, why do you have an elif that does the exact same thing as the prior if
how do i control Recon Bot 75
k
what is the name of a member in this server
that has a golden apple as profile pic
ah it's PG!
I want my bot to send message in each server in first channel it finds where it has perm
could you send me your npm package?
the randomizer
sure
does anyone know how to make this python code neater
print('Please choose from the menu.')
print('============================')
print('1: Convert between UK (GBP) and EUR')
print('2: Convert between UK (GBP) and Canada')
print('3: Convert between UK (GBP) and USD')
print('4: Convert between UK (GBP) and China')
print('5: Quit')
print('============================')
menu = int(input('Enter your Choice: '))
while menu >=1 and menu <=4:
if menu == 1:
menu = int(input('Enter the amount in pounds: '))
men1 = menu
men1 = menu * 112/100
print('\t','£', menu,'is', men1, 'euro')
elif menu == 2:
menu = int(input('Enter the amount in pounds: '))
men1 = menu
men1 = menu * 174/100
print('\t','£', menu, 'is', men1, 'cad')
elif menu == 3:
menu = int(input('Enter the amount in pounds: '))
men1 = menu
men1 = menu * 136/100
print('\t','£', menu, 'is', men1, 'dollar')
elif menu == 4:
menu = int(input('Enter the amount in pounds: '))
men1 = menu
men1 = menu * 886/100
print('\t','$', menu, 'is', men1, 'yuan')
if menu == 5:
print('Thanks for using the program')```
what you want make?
as it shows that for it being converted
currency converter
Use one int(input('Enter the amount in pounds: ')) before the ifs
What do you want as your output?
where menu is
If you are using Python3.6+, you can use f-string for the output. For example, f'£{menu} is {men1} dollars.'
try
This
That seems very over-complicated
Nerf can i ask you
'sup
im not using python 3.6+
try to use what i gave you
it doesnt let me download it
Yeah I'm calling bs on the fact that the teachers won't think that you cheated
is that for ur schooL?
Then use .format
how
*in case you decided to copy the code Mar0 sent
emmm
Yeah, it's simple enough. You could just use only one input function within the while loop itself
Hydro Try tkinter
Basically leaving the ifs only for the calculations and output
Again, tkinter is a very strong over-complication of a simple task
I very highly doubt that they'll actually approve this without questioning the guy
print('Please choose from the menu.')
print('============================')
print('1: Convert between UK (GBP) and EUR')
print('2: Convert between UK (GBP) and Canada')
print('3: Convert between UK (GBP) and USD')
print('4: Convert between UK (GBP) and China')
print('5: Quit')
print('============================')
menu = int(input('Enter your Choice: '))
while menu >=1 and menu <=4:
if menu == 1:
menu = int(input('Enter the amount in pounds: '))
men1 = menu
men1 = menu * 112/100
print('\t','£', menu,'is', men1, 'euro')
elif menu == 2:
menu = int(input('Enter the amount in pounds: '))
men1 = menu
men1 = menu * 174/100
print('\t','£', menu, 'is', men1, 'cad')
elif menu == 3:
menu = int(input('Enter the amount in pounds: '))
men1 = menu
men1 = menu * 136/100
print('\t','£', menu, 'is', men1, 'dollar')
elif menu == 4:
menu = int(input('Enter the amount in pounds: '))
men1 = menu
men1 = menu * 886/100
print('\t','$', menu, 'is', men1, 'yuan')
if menu == 5:
print('Thanks for using the program')```
all i want to change is to make this neater
So you wanted to prettify the output...
yea
'£{} is {} dollar'.format(menu, men1)
Adjust the string to each option
and... you have $menu output for menu == 4
oh wow thanks
I don't think anyone really cares about this to actually make the code better both/either in terms of appearance and optimization tbh
it's a learning opportunity though
Mmm, true
let antibots = JSON.parse(fs.readFileSync('./antibots.json', 'utf8')); client.on('message', message => { if (message.content.startsWith(prefix + "antibots on")) { if (!message.channel.guild) return message.reply('**This Command Only For Servers**'); if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send('**Sorry But You Dont Have Permission**ADMINISTRATOR'); antibots[message.guild.id] = { onoff: 'On', } message.channel.send(✅ The AntiBots Is 𝐎𝐍 !`)
fs.writeFile("./antibots.json", JSON.stringify(antibots), (err) => {
if (err) console.error(err)
.catch(err => {
console.error(err);
});
});
}})
client.on('message', message => {
if (message.content.startsWith(prefix + "antibots off")) {
if (!message.channel.guild) return message.reply('This Command Only For Servers');
if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send('Sorry But You Dont Have PermissionADMINISTRATOR');
antibots[message.guild.id] = {
onoff: 'Off',
}
message.channel.send(**⛔ The AntiBots Is __𝐎𝐅𝐅__ !**)
fs.writeFile("./antibots.json", JSON.stringify(antibots), (err) => {
if (err) console.error(err)
.catch(err => {
console.error(err);
});
});
}})
client.on("guildMemberAdd", member => {
if (!antibots[member.guild.id]) antibots[member.guild.id] = {
onoff: 'Off'
}
if (antibots[member.guild.id].onoff === 'Off') return;
if (member.user.bot) return member.kick()
})fs.writeFile("./antibots.json", JSON.stringify(antibots), (err) => {
if (err) console.error(err)
.catch(err => {
console.error(err);
});})`
Help ples
i made this For auto kick Bot if he join
on console no problem
but when i use it
didnt work
hey how do i randomly choose 10 members in the discord server and change theirnickname?
and after a certain amount of time reset.
print('Please choose from the Job List to get a quote.')
print('============================')
print('1: Engineer')
print('2: Developer')
print('3: Analyst')
print('4: None Of The Above')
print('============================')
Job = int(input('Enter your Choice from 1-4: '))
while Job >=1 and Job <=4:
if Job == 1:
print('The engineer has been, and is, a maker of history.')
elif Job == 2:
print('Logical thinking, passion and perseverance is the paint on your palette.')
elif Job == 3:
print('Seeing what other people can’t see gives you great vision.')
elif Job == 4:
print('I am sorry. We could not find a quote for your job.')```
does anyone know why this loops
(it doesnt say it once, instead it repeats it a lot)
Emm idk but that code make u change member nick with cmd
client.on('message', message => { if (message.content.includes('changeNick')) { client.setNickname({nick: message.content.replace('changeNick ', '')}); } });
because once you input something that's in range of 1 to 4 inclusive, it keeps looping and you don't change the value of Job either during that loop, so it's an infinite loop
<Guild>.members.cache.random(amount)
how would i make it only prints the output once?
Don't use a while?
you can make a while True and having the input inside that loop, break it in some condition.
The way you did the previous program could work
Huh btw why does mine do that?
if you want to listen to more than one inputs
otherwise what shiv said
so how would i remove while
unindent things inside that while block 1 level
@earnest phoenix
var mode = string.Empty;
if (this.ViewData["Gamemode"] != null)
mode = $"{this.ViewData["Gamemode"]}";
guess which part of this is unnecessary
lmao what's this 

ASP.NET website
When did my dumb ass think I didn't need to format the string
or, rather, needed to
oh Gamemode is a string?
this.ViewData["Gamemode"] is basically string?
var mode = string.Empty;
if (this.ViewData["Gamemode"] != null)
mode = this.ViewData["Gamemode"].ToString();
Looks much better

so you're basically casting a string to a string 
why not ternary
Tim don't judge my C# code from September
lmao
I'm really not sure wtf any of this is
how would i do that on trinket
by removing spaces?
Do you know what indents are?
Shift+Tab?
I forgot what a ternary operator looks like
how it works, rather
condition ? true : false?
if it were Python
Idk if that can be called ternary xd
technically
@earnest phoenix Need help with HttpClient here. My current way about going auth is the following:
if (this._client.DefaultRequestHeaders.Contains("Authorization"))
this._client.DefaultRequestHeaders.Remove("Authorization");
this._client.DefaultRequestHeaders.Add(
"Authorization",
$"{credentials.token_type} {credentials.access_token}"
);
executed on each request, and I think it's a very bad way to go about sending requests with an Auth token that's updated every like 2 days
Got any idea how I could optimize this to look/work better? I'm shit outta clue with C# 😂
how do i do that when someone add my bot, to a server, it will auto send a message in the server
You'll have to rely on channel names or randomly sending a message somewhere
what library?
discord.js
ty
Could I use a setter for credentials.access_token where I update the request headers?
... apparently not?
What
Well
Do somebody knows how to move emojis from one server to another at once?
I mean with a bot or something
you want to code it or are you looking for a bot that does it for you?
im not aware of any bots that does that, but you could code something quite simple.
fetch guild/emojis/list , then simply iterate them with request() to download the image onto a buffer, and upload on target guild. Be mindful of rate limits
and im unsure if you can batch emoji uploads
@drowsy raven
and the way i explained is quite crude too, its not accounting for slots available or any of that
no problemo
you dont even need to download the images
oh, then even better
lmao
its coming closer and closer
anything that works lmao
Guys HEl ples
`client.on("guildCreate", otdel => {
let tnxrom = otdel.channels.cache.filter(c => c.type === "text").random();const embed = new Discord.MessageEmbed() .setTtile(`**Hello**`) .setThumnail(client.user.avatarURL) .setFooter(`**${client.user.tag}**`) .setTimestamp() .setColor("RANDOM") .addField("**Thank You For Adding My On UR Server**") .addField(`My Prefix IS ${prefix}**`) .addField(`**IF You NEed Help ${prefix}help**`) .addField(`**Support Server SOON**`) tnxrom.send(embed);});`
i made this If he join any server
and should be good enough for several thousands of servers
any downsides apart from being possibly single threaded?
what needs to be updated in code to do that? just client options?
ye
hmmmmmmmmmm
hmmmmmmmmmmmmmm
no manager or any of that?
nope
try it
lets me spin it up on my local
what is the issue?
Guys i made this code for bot if he jjoin any server send Message on random channel embed But didnt work and no error on console
help please`client.on("guildCreate", otdel => {
let tnxrom = otdel.channels.cache.filter(c => c.type === "text").random();const embed = new Discord.MessageEmbed() .setTtile(`**Hello**`) .setThumnail(client.user.avatarURL) .setFooter(`**${client.user.tag}**`) .setTimestamp() .setColor("RANDOM") .addField("**Thank You For Adding My On UR Server**") .addField(`My Prefix IS ${prefix}**`) .addField(`**IF You NEed Help ${prefix}help**`) .addField(`**Support Server SOON**`) tnxrom.send(embed);});`
he didnt put any error
can you console.log(tnxrom)
That should either error out or work, there's not much room for inbetween in programming
Also please use codeblocks instead of quotes when doing code 😛
Sorry But i dont undrestand
wait this is it?
can you try console.log(otdel) ?
if you want to test the actual sharding, do shards:[0,1] for example, for 2 shards
this is kind of what i was trying to accomplish with sharding
wait can you do sharding in the client constructor?
having the client like usual, but merge all events from the other shards
yes, internat sharding
it's basically making multiple connections to the gateway on the same process.
oh, how can you do that?
but this is all still into a single thread
yo guys
which should work fine
why i have this error
yeah
at Function.fetchRecommendedShards (/home/container/node_modules/discord.js/src/util/Util.js:240:23)
at ShardingManager.spawn (/home/container/node_modules/discord.js/src/sharding/ShardingManager.js:173:27)
at Object.<anonymous> (/home/container/shard.js:7:9)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
(node:24) 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:24) [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.```
code part i have
token*
but after a while the goal is to cluster it, but still have a single main client
Did you modify the client.token variable?
you tried to do something before the client logged in
or that
im just trying to start bot
show code
wait, i will try my 2 bot token
thats error in discord.js module ._.
its your implementation, 99% sure
const manager = new ShardingManager('./index.js', {
token: process.env.DISCORD_TOKEN,
totalShards: parseInt(process.env.SHARD_COUNT) || 'auto'
})
manager.spawn()
manager.on('shardCreate', shard => console.log(`Launching shard ${shard.id}`))
i have env file
/home/container/shard.js:7:9
it cant spawn bot, ye
the token is undefined, either you misstyped the DISCORD_TOKEN bit or process.env is undefined
DISCORD_TOKEN=here is my token
where do you load the file?
in .env file
please do what i said
idk how to console.log it in const
console.log(process.env.DISCORD_TOKEN)
I do
i think it doesnt works
good code 101 @quartz kindle
lmao
what client option is it for the sharding?
shards:
when i try again he put my on log infos server he join
some one help my please
ok, lets try it
so you do just put 'auto' in there?
correct
ok thanks
no preblomo
El Problemo
El broccoli
El Mosco
uhhh
It's time to use the HttpClient from my Timer object returned from a startup method
wdym by this
Because I don't know any other way to fucking do this
i dont think array.random() is a thing, unless d.js adds it
collection.random() is a thing
oh, its in collection
let allowedRole = message.guild.roles.cache.find("PRIO TICKETS", "PRIO TICKETS");
Whats wrong with this code?
I Googled but all it said was "wrong format"
Will .find(r => r.name === ""PRIO TICKETS"") work
find takes a function ^
I wonder
My bad, tysm
but
that explains the error
oh
if nothing logged, then it logged undefined
thats problem in .env file ye?
correct, either the way you wrote it, or the env itself
ty guys i fix it
where are you running your bot?
on hosting
doesnt repl have some weird shit?
because node.js does not use env files by default
it was either repl or glitch that had some weird env path
cuz it would only pick .env
hosts like glitch and repl have automatic env file loading
not something.env
node.js does not
also that
try logging env itself
then console.log(process.env)
lol
1 nanosecond too slow
hue
do you have the dotenv package?
client.on('message',function(message) {
if(message.content.startsWith(prefix + "guilds")) {
message.channel.send(Guilds: \`${client.guilds.size}```);
}
});
is that correct for count how much Bot on server??
why i need it
To load your .env file
not anymore, that was for discord.js v11
its worked without this
on what host?
with latest versions you need to use client.guilds.cache.size
also no need to use the function keyword, what you're doing is an anon function, might as well use fat arrow
why you need it?
To tell if its because of the host
just show what process.env logs
if (message.member.roles.has(allowedRole.id)) {
Same "not a function" error
rtoles
Run this in your terminal: npm install dotenv and at the top of the file put this
require('dotenv').config()```and see if it works @silent cloud
that will load the .env file to your process
roles.cache.has?
Do i need the has part still?
Do you?
likely yes, idk if you have roles cached or not
by default everything is cached
thats based on intents too iirc
hm
if found
i have it
just try it
Alr
i have it already
ok
oh ty
Also are you using a seperate message event for every command? @earnest phoenix
this brings me flashbacks
DISCORD_TOKEN: 'null'

hm
yep
You shouldn't do that, they can all be contained inside one
TypeError: message.member.roles.cache is not a function
Uh?
Uses more memory and is much less efficient
hold on
message.members.roles.cache.has not message.members.roles.cache

https://github.com/corynth/lavalink, my custom repo, but it has the filters version
Guys why i dont get any answer from top gg i put my bot like 1 and half day and no answer
why?
you gotta be patient, it takes a while to verify it
ok
what to do...
np
What is in your .env file (remove tokens and stuff)
keep in mind that env syntax is K=V with no spaces
^
if you need a space put it in double quotes
DISCORD_TOKEN=TOKEN_IN_HERE
e.g PREFIX="pog "
DEVELOPER_ROLE=
LOGGING_CHANNEL_ID=
DISCORD_TOKEN=
EMBED_COLOR=#FFC0CB
LAVALINK_NODES=
MONGODB_URI=
SPOTIFY_CLIENT_ID=
SPOTIFY_CLIENT_SECRET=
TWITCH_CLIENT_ID=
YOUTUBE_API_KEY=
CROWDIN_API_KEY=
CROWDIN_PROJECT_ID=
GENIUS_API=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GMAPS_KEY=
DARKSKY_KEY=
STEAM_API_KEY=
STEAM_LADDER_API_KEY=
TUMBLR_API_KEY=
DBL_WEBHOOK_SECRET=
LASTFM_KEY=
KSOFT_KEY=
PORT=
JWT_SECRET=
CLIENT_ID=
EMOJI_GUILDS=
CLIENT_SECRET=
REDIRECT_URI=
DASHBOARD_URL=
RIOT_API_KEY=
RUBYGEMS_API_KEY=
OSU_API_KEY=
OSU_CLIENT_ID=
OSU_CLIENT_SECRET=
OWLBOT_KEY=
LANGUAGELAYER_API_KEY=
DEBUG=```
brug
in double quotes?
^
.env syntax isnt your basic pussy js syntax
double quotes?
DISCORD_TOKEN="Token here"
what is this, im bad in english
w ha t
This @silent cloud
pain
ummm
- do not:
- '
+ do:
+ "```
thats my old .env file
DISCORD_TOKEN="TOKEN HERE"

and old
possibly why DISCORD_TOKEN is null
it worked
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "emojis",
description: "View all emojis in the guild",
run: async (bot, message, args) => {
let Emojis = "";
let EmojisAnimated = "";
let EmojiCount = 0;
let Animated = 0;
let OverallEmojis = 0;
function Emoji(id) {
return bot.emojis.cache.get(id).toString();
}
message.guild.emojis.cache.forEach((emoji) => {
OverallEmojis++;
if (emoji.animated) {
Animated++;
EmojisAnimated += Emoji(emoji.id);
} else {
EmojiCount++;
Emojis += Emoji(emoji.id);
}
});
let Embed1 = new MessageEmbed()
.setTitle(`Emojis in ${message.guild.name}.`)
.setDescription(
`**There are [${OverallEmojis}] in this server**\n\n **Animated [${Animated}]**:\n${EmojisAnimated}`
)
.setColor(`#ff0000`);
let Embed2 = new MessageEmbed()
.setTitle(`Emojis in ${message.guild.name}.`)
.setDescription(
`**Standard [${EmojiCount}]**:\n${Emojis}`
)
.setColor(`#ff0000`);
let Embed = new MessageEmbed()
.setTitle(`Emojis in ${message.guild.name}.`)
.setDescription(
`**There are [${OverallEmojis}] in this server**\n\n **Animated [${Animated}]**:\n${EmojisAnimated}\n\n**Standard [${EmojiCount}]**:\n${Emojis}`
)
.setColor(`#ff0000`);
if (Embed.length > 1000) return message.channel.send(Embed1 + Embed2)
message.channel.send(Embed);
},
};
erwin please dont kill us
thats old .env file, thats worked
You can't send two embeds in one message
do you need parseint and isnan
...
You have to have two separate messages for two embeds
yeah, parseInt() tells me if its nan or not
i had the problem with isNaN before with that
yea
it was some weird quirk with what i was sending as resolveable
how to fix it?
codeing
i know how isNaN works, its something i was doing that needed parseInt before
yes?
ah gotcha
i tried it did not work
that slave project i did have some really over engineered code
if (/* condition */) {
message.channel.send(Embed1);
message.channel.send(Embed2);
return;
}```
ok
hey
replace /* condition */ with the if condition
"" doesnt helped
where is your .env in relation to your main file?
@silent cloud
why TOKEN
you said you changed it to that
TOKEN was in my old bot
now it DISCORD_TOKEN
im so lazy to change it in all of my new bot
had once the issue that even tho everything where valid it wont load the .env bcs it where in the wrong path
I'm confused, I think you've either not defined DISCORD_TOKEN or you need to load it with dotenv
client.on("message", (message) => {
if (message.channel.type === "dm") {
if (message.author.id === client.user.id) return;
let yumz = new Discord.RichEmbed()
.setTimestamp()
.setTitle("Message Send To bot")
.addField(Sended by:, <@${message.author.id}>)
.setColor("RANDOM")
.setThumbnail(message.author.displayAvatarURL)
.addField(Message: , \n\n\``${message.content}```) .setFooter(Maro Codes`)
client.users.get("697562988915327016").send(yumz)
}
});
help Guys i made this for if any one send message to Bot i got it in my dm
What problem?
wait gave console error
you used your user id
im loading it using dotenv
697562988915327016 is your id
let yumz = new Discord.RichEmbed()
^
TypeError: Discord.RichEmbed is not a constructor
at Client.<anonymous> (/home/runner/LuminousGrouchyMigration/index.js:254:32)
at Client.emit (events.js:327:22)
at Client.EventEmitter.emit (domain.js:483:12)
at MessageCreateAction.handle (/home/runner/LuminousGrouchyMigration/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/runner/LuminousGrouchyMigration/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/runner/LuminousGrouchyMigration/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/runner/LuminousGrouchyMigration/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/runner/LuminousGrouchyMigration/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/runner/LuminousGrouchyMigration/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (events.js:315:20
what error
yea
Discord.MessageEmbed() is the new embed in v12
its MessageEmbed
like i said it depends where the dotenv is located. for my website i have 2 folders frontend and backend, first i had the .env in the path /backend/src where the main file is also located, i had to move it up one folder in order to be able to load stuff
this is why I construct my own embeds 🤡
let me get the thing rq
should i change
let yumz = new Discord.RichEmbed()
to
Discord.MessageEmbed()
no
yes
^^
okay wait
It's a simpler way of doing things
like this ?
that linter is tilting me
wait whats the difference between var and raw
var is assigning an object before sending it(so you can manipulate it as needed), the raw is sending it directly onto the function send()
oh so that actually affects performance
it worked thx alot
yea makes sense
Uhhh on same code on logs say
client.users.get("697562988915327016").send(yumz)
^
TypeError: client.users.get is not a function
cache
users.cache
client.users.cache.get
members.cache
guilds.cache
roles.cache
everything cache now
channels.cache
literallly everything
EVERY
SINGLE
THING
fuck d.js for doing that
Calma
error lens is nice

very nice
this works for all languages, though
and you don't have to have the problems tab open

what should i change? On this
client.users.get("697562988915327016").send(yumz)
you mean the terminal?
we told you
,
change it to
client.users.cache.get("697562988915327016").send(yumz)
also thats bound to fail eventually
no the problems tab which tells you the issues
so.... the.... terminal?
or
uhh




