#development
1 messages ยท Page 1186 of 1
Hey guys I write my file like 10 times an hour and now all the data is messed up please help?
@golden condor I wrote to my jsondb 50+ times a min
this is 5h of uptime in the host
Before it broke
PFFFT
@faint prism sent the class to ur dm
175 Billion tuples
I saw. Give me a bit
in 5 h
I'll just press Alt + F4
k
Y'all should too
imagine using threading to extract data from a db
!Discord is meh
.-.
true
the opposite
Guys pls help why it no work? Json be not respond? Pls I write it every time someone do send message and I do not know the cache?
discord ain't meh
Hi guys let me ask a question
you missed my flex earlier didnt u code?
how do you remotely dent hardware
Is it looks like good?
Hi guys let me ask a question
@dull badger just ask it no need to tell us you wanna ask

this is what was causing that server to use 25%
Is it looks like good?
@dull badger you've been told earlier by a mod not to ask for idea here
discord.js server is cool with that tho
197 database calls per second
just let that sink
per SECOND
25% cpu usage
its quite the task to bring 2 Xeons to use that
my bot is always above 60% cpu usage even tho it is offline (yeah)
the expressjs server alone eats half the cpu
shit host
i am getting a 401 discord api error while changing the channel of a webhook
anyone knows why
401 (UNAUTHORIZED) The Authorization header was missing or invalid.
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
i dont think u can do that
im 50% sure you cant edit webhooks once they are sent
bruuuuuuhhhh
no, it sends new ones
hi i nedd bot for my yotube channel ?
nope
once its sent you cant edit it
It's the same webhook with changed name and avatar
you can edit the webhook contents
^
thats when you send in the payload
you cannot edit a sent webhook
this is just the payload for the new one you'll send
yea
which technically is kinda wasteful
thats exactly what i am doing
im assuming you getting a bad webhook
say that webhook is on #general then you try access channel #development
with the webhook that is tied to #general
thats my only assumption
does heroku support discordjs databases?
thats not a webhook getting edited
thats the same webhook with different payloads sent
like
u are saying the same thing but twisted
i dont mean like editing a webhook msg
there is a difference
it's not our job to help man/woman
even the name and avatar is part of the payload
On each request to a webhook, a different avatar and name are provided to Discord API
to change the actual webhook channel i dont think you can use the payload
you need to create a webhook to that channel i assume
i dont recall seeing a channel in the webhook payload
@slender thistle yea then it can also provide a different channel to the discord api no?
Mhm, webhooks are attached to channels
say that webhook is on #general then you try access channel #development
this
You need to create a separate one in another channel and send requests to it
what are some good discordjs databases?
gonna be a pain 
wot
mongodb
you mean js databases?
better-sqlite3
use anything except 2 things, quick db and json db
some are good in specific tasks
quick.db if u real lazy ๐คท
use anything except 2 things, quick db and json db
alr bet
lmao
some are good in specific tasks
i just need a database for server specific settings
sqlite will do
^
alr thanks guys

that requires a good knowledge of sql tho
if u dont have that
my choice would be mongodb
is mongo faster than postgres?
I heard PostgreSQL is more performant compared to mongo
you'll switch right away
yea
lemme initiate a session rq
i need help
dontasktoask
I can't access the Zira bot website
is that your bot?
@slender thistle do ur thing
-wrongserver @raw canopy
@raw canopy
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
good shiv
lol

Hi....
pgadmin is just...... 
compass does the exact same thing, but in its own way.. if that makes sense, theres no difference in the things u can do in the ui
How to invite a bot to my server?
which database is easy to comprehend? for d.js btw
i think mongodb is easy, never used any other databases so idk
well there was that guy who made a database out of discord text channels
highly against tos i assume
well there was that guy who made a database out of discord text channels
@sudden geyser did WHAT?
but if you want sql I'd recommend sqlite
using cdn as database
https://discord.com/oauth2/authorize?client_id=<That bot's id>&scope=bot&permissions=0 @neon pelican
lmao
Jesus where the world has come, teaching people how to invite bots
you wont be able to have more than 100 channels (users) if ur storing them
im pretty sure it is
lmfao im dead
using their cdn as storage
if you want something plain and simple + the oop way I see people using quick.db
i recall one guy that got bent over on DAPI cuz he had a server using 4TB of storage
I've never used it myself
lies
ive personally seen it
ok
not talking about windows
Bye guys Sorry to interrupt
thw windows setup is impossible
I like this server bye
Bye guys Sorry to interrupt
@neon pelican don't tell us if you're apologizing to interrupt
most people, people i know, use windows
Yeah
wait
by that i meant what's the point of saying "Sorry to interrupt" if you are being sorry to interrupt just don't tell us you're disappearing into the darkness
ur just overcomplicating things man
you described my code
???
its overcomplicated
100 Guilds per user account
1000 Relationships (Pending friend requests, friend suggestions, blocked users and total friends)
50 Pins per channel
250 Roles per guild
500 Channels per guild
1000 Invites per guild
50 Channels per category
20 Reactions per message
to be precise
categories are channels wyf
Categories are channels
oh, i thought it was 100
and not a single text channel ๐
guys is there like a quick.db tutorial kinda thing
idk
The example should reasonably be good enough, even if it's harder than watching a video or something.
In Discord.js, can I add the client (which is a Discord.Client) into module exports without issue?
ty
yes
Yes
You can export anything
In Discord.js, can I add the
client(which is aDiscord.Client) into module exports without issue?
@finite plover yes, but you can just access it bymessage.client, if you pass the message into module exports.
Oh OK.
@hazy sparrow : guys is there like a quick.db tutorial kinda thing
also @hazy sparrow : i am bad at understanding written words

what
people these days only want video tutorials lul
me: i hate quick.db
also me: made an announcement two weeks ago i am changing the bot database from quick.db to mongoose and then never interacted with the code again cuz im lazy
New dumb question, how do you create a text channel (in a specific category)?
What library are you using
Use <Guild>.channels.create(). The first argument is the name of the channel and the second is the options. In the options object, give it a key of parent and a value that can be resolved into a category channel (https://discord.js.org/#/docs/main/stable/class/GuildChannelManager?scrollTo=create).
That awesome explanation Lite
Get the current time (variable 1), send an API request, get the time after the API request (after it's been resolved) and save that to variable 2. Minus the time it took in milliseconds
u get the client's websocket ping
ws ping is not the same to my knowledge
Get the current time (variable 1), send an API request, get the time after the API request (after it's been resolved) and save that to variable 2. Minus the time it took in milliseconds
whenever i tried this it sent back 19214ms or negative ping
You're explanations are killing me Lite THEY'RE TOO AWESONE
thats why i rely on websocket ping
whenever i tried this it sent back 19214ms or negative ping
@dense vessel f
websocket ping is the latency of the websocket connection, which is where discord sends events to you
rest ping is the latency of the rest api which is where you send requests to discord, ie send messages
what's a websocket? An electric socket for the internet?
Nistooks calculating rest ping can be as simple as this: ```js
// JavaScript
let start = Date.now()
sendMessage(...).then(() => {
let time = Date.now() - start // in ms
})```
npm i -g windows-build-tools
@restive furnace is that for quick.db?
When creating a channel (Discord.js) can I specify which category I want it in?
ayy @quartz kindle long time no see lol
@hazy sparrow do you even know coding
a websocket is a special type of connection that is kept always open, as opposed to regular http/https connections that are always closed once they are finished
@finite plover yeah I showed you up here: https://canary.discordapp.com/channels/264445053596991498/272764566411149314/747815729889280010
Does mongoose have a way to encrypt databases with my specificied key?
hi bow lul
Oh oops.
how the heck do I "break" the inline for d.js MessageEmbed
I'm trying to have an embed like this:
Field1 Field2
Field3 Field4
the first two have to be inline
You can't really have it in that 2x2 pattern as it's a limitation on how Discord renders it to the user, but you could do:
a b
c
d
if you're fine with that
ah ok
The last argument when you use .addField (or an object key for .addFields) is inline which is if the field will be inlined. So you can set that to false if you want the field to be on its own line but you can't do the 2x2 pattern like I said (from what I tested in the past).
anyone know C#?
if so can you answer this question:
How many times must a variable be declared?
TypeError: on_guild_channel_update() takes 1 positional argument but 2 were given
anyone know this error?
i dont know C# but there is no such thing as a number of times it must be declared in any programming language
all variables only need to be declared once, then you just need to make sure the variable is defined in the correct scope
idk its on my C# quiz and its puzzling to me
then the answer should be 1 lol
if its a constant yes
Starman is typing...
And as for a dynamic variable, that's not declaring it, is it?
That'd be changing a variable's value or re-assigning
ghosting or whatever it was called exists btw
idk the details of how c# implements those things
First time hearing about that term
anyone know C#?
if so can you answer this question:
How many times must a variable be declared?
@fervent goblet I know C#
But idk what you mean by that question
You can declare a variable once within a scope.
You can set it's value as many times as you want.
Outside the scope, it no longer exists.
{ // Start scope
var myVariable; // Declared
myVariable = aThing; // Setting the value for variable
myVariable = anotherThing; // Overwriting the value for variable
} // End sope
// myVariable no longer exists
the correct answer was once
they said must
is there a way to cache messages sent to a new channel that was created after the bot started up with discord.js-light 3.2.2? i've tried caching the channel, but that doesn't seem to cache any messages
starman, probably better to ask in tim's server
๐ ill ask there then if the question gets lost in this channel without an answer
Okay, so I apparently don't remember how to do this, but how do I set a user display name in an embed?
async def on_guild_channel_update(member):
channel = discord.utils.get(member.guild.text_channels, name='arch-logs')
embed = discord.Embed(
colour = discord.Colour.blue()
)
embed.set_author(name=f"Channel Edited", icon_url=f"{client.user.avatar_url}")
embed.add_field(name=f":archedit: Channel '{after}' has been edited", value=f"โโ", inline=False)
embed.set_footer(text=f"ID: {channel.id}")
embed.timestamp = datetime.datetime.utcnow()
await channel.send(embed=embed)```
should i not pass member?
@stable nimbus what lib?
Discord.js 12.2. Its on an added field.
still no before, after in the function parameters
ah so with the user object, you can just do user.username
Okay thanks.
still I don't know why you thought on_guild_channel_update accepted a Member object
oh wait
I don't know how I forgot it.
r u talking about their nick?
still I don't know why you thought
on_guild_channel_updateaccepted a Member object
@slender thistle lol
or just their username?
Just their displayname.
so dont pass anything?
still no
before, afterin the function parameters
does that mean the nickname too?
Display name:
If no nickname is set it defaults to username
thanks
because then you'll need the member object of that user
So since I don't have a nickname here if I ran a command it would pass as fuzzyfurry069, but if I had a nickname that would pass.
yeah i see
you need the member object of that user
then just do .displayName on that
I know that.
I've used it many a time.
But I have an addFiled() function where I need the display name.
yeah, you can just do: .addField(member.displayName, "some value here")
Yeah but of a mentioned user.\
after.guild
@stable nimbus you need to look at the mentions in the message
thanks so much lol
Which I have the user function set up.
also, how can i detect when a category is made?
message.channel.send(message.author.String());
why doesnt this work to ping someone?
or is it same as channe;
message.channel.send(message.author.String());why doesnt this work to ping someone?
@forest drift mention
you need to mention
can you send ur code, i don't really understand what u mean @stable nimbus
so
message.channel.send(mention.author.String());
also, how can i detect when a category is made?
@drifting wedge a category is a channel, useon_guild_channel_create
@stable nimbus can u show ur code tho
const embed = new MessageEmbed()
.setAuthor(message.member.displayName, message.author.displayAvatarURL())
.setTitle(`${emoji.a} The Breathalyzer! ${emoji.a}`)
.setColor(0xA1EE3)
.setDescription(`<@${message.author.id}> is checking <@${user.id}>'s BAC level!`)
.addField(`${user.displayName}'s BAC level: `, `${percent}%!`)
.setFooter(copyright.copyright);
message.delete();
message.channel.send(`Hey <@${message.author.id}>, <@${user.id}>!`, embed);```
Essentially, yes. A category is a channel that contains text/voice channels
@stable nimbus .displayName can only be done on a member
not on a user
so you need to fetch the member, and then you can do .displayName on them
When I do it on a member it breaks, I need to get the display name of somebody I mentioned.
Use isinstance(channel, discord.CategoryChannel) to check if created channel is a category
you can fetch the member with the user pretty easily
Thats not what I need ffs
what do you need then
Nevermind.
(you can't get people's nicknames from the user)
they are guild specific, which is why it is only obtainable from the member
perhaps i have misunderstood tho
Anyone else here having a sharded bot(discord.js) and uses pm2 and/or pm2 plus?
Because I just started sharding my bot, all good so far, however pm2 reports to me that the process only takes 42mb ram...
And it's only showing one process too... I am clueless at this point what's the issue
Yeah
You can use client.shard.broadcastEval("process.memoryUsage().rss") to get all the usage
that's all i can think of
message.channel.send(message.author.mention);
why when i use this does it could as "undefined"?
Ah no that's not the issue. My stats command works fine. It's just that pm2 says it's 42mb which is just wrong. And i use the pm2 web dashboard (pm2 plus) to monitor the server. So this being wrong is... bad for me xD
oh thanks
@blazing portal Ah I see
async def on_guild_role_update(before, after):
channel = discord.utils.get(after.guild.text_channels, name='arch-logs')
embed = discord.Embed(
colour = discord.Colour.blue()
)
embed.set_author(name=f"Role Updated", icon_url=f"{client.user.avatar_url}")
embed.add_field(name=f":archedit: Role '{after}' has been edited", value=f"{before} ยป {after}", inline=False)
embed.set_footer(text=f"ID: {channel.id}")
embed.timestamp = datetime.datetime.utcnow()
await channel.send(embed=embed)```
this is my role update logs thing
it sends like all roles update
its a bit wierd
no errors
using discord py
because message.author is a mention
@misty sigil that is if it's inside a template literal (it turns it into a string) or using message.author.toString()
otherwise it's an object
i mean iirc correctly it'll just send a .toString() of an object
yes if i recall correctly correctly
no, it doesnt
no
if (message.guild.channels.exists('id', 'channelid')) {
}
I'm sure this is wrong but wouldnt this detect a channel?
message.guild.channels.cache.has(channelid)
thanks
then last question, how do i detect if a role exists if i have its id already?
same but replace channels with roles
@misty sigil Just out of curiosity, pm2 is showing the correct ram and cpu usage for your bot right? and does it show each shard independently?
No
ah ok... trying to fool proof my bot so trolls dont break it
I just don't bother and use a netdata panel
I see... cheers
pm2 cant see child processes
unless you run all processes in cluster mode
but discord bots are not really compatible with cluster mode because they are not stateless (you can make it work but it takes some effort)
async def on_guild_role_update(before, after):
channel = discord.utils.get(after.guild.text_channels, name='arch-logs')
embed = discord.Embed(
colour = discord.Colour.blue()
)
embed.set_author(name=f"Role Updated", icon_url=f"{client.user.avatar_url}")
embed.add_field(name=f":archedit: Role '{after}' has been edited", value=f"{before} ยป {after}", inline=False)
embed.set_footer(text=f"ID: {channel.id}")
embed.timestamp = datetime.datetime.utcnow()
await channel.send(embed=embed)``` this sends all roles
not just updated roles
any idea why?
The console just keeps saying "client.channels.get" is not a function
client.channels.cache.get() for discord.js
ohhhhh so thats why u dont follow other guides...
other guides are outdated, your code is in v12
here is the official guide which isnt outdated: https://discordjs.guide/
yeah... a lot of StackOverflow have a comment with the v12, but some are still on v11
other guides are outdated, your code is in v12
here is the official guide which isnt outdated: https://discordjs.guide/
@sand condor i used that when starting
but discord bots are not really compatible with cluster mode because they are not stateless (you can make it work but it takes some effort)
@quartz kindle I guess before i dive deep into making it possible with pm2 then i will just take another way to monitor my bot. Thanks ๐
How does one update nodejs via the command line? Linux
I do, I am using the ShardingManager provided by Discord.js. But pm2 shows me the wrong ram and cpu usage
thats not internal sharding
what is then
oh right, i confused them. Is internal sharding better than traditional though?
depends on the situation
the only reason to use the sharding manager is if you have multiple cpu cores and your bot uses a lot of cpu
otherwise internal sharding is better in almost every way
so how do you do said internal sharding
const client = new Discord.Client({
shards:"auto"
})
is it that fucking simple
yup
well fuck me
same haha
Is internal sharding easy, is it just that ๐คจ
client.guilds.cache.size
with internal sharding there is only 1 bot process, the same way as not sharding at all. all shards use the same cache, there is no broadcastEval, no fetchClientValues, etc...
@misty sigil thanks
with internal sharding there is only 1 bot process, the same way as not sharding at all. all shards use the same cache, there is no broadcastEval, no fetchClientValues, etc...
@quartz kindle cooL lol
it uses less ram because you dont need a full process for each shard
the only downside is that it cannot use multiple cpus
can't use multiple cpus or cpu threads?
wait maybe it's because i had my head in the sharding stuff the past hours, but isn't discord.js using all available cpu threads by default? or am i confusing something here
cpu but virtual
it has nothing to do with discord.js
javascript is single threaded, each javascript process can only use 1 thread, which in turn means that each node.js process only uses 1 thread as well
in order to multi-thread javascript and node.js, you need to either spawn multiple node.js processes, or use node.js's worker threads
discord.js's sharding manager does that, it uses node.js's child_process.fork() by default, and you can also set it to use worker_threads instead
internal sharding doesnt use the sharding manager, there is only 1 single process, and all shards are connected and managed inside the same process
In Discord.js, how do I get a channel's parent? Would have thought it's a parameter of the Channel class but apparently not.
welp. thanks for the info tim
@blazing portal im not sure but you can try setting the sharding manager in worker mode, maybe it will show correct ram usage that way
new Discord.ShardingManager({mode:"worker"});
since workers share memory with the parent
what are the pros and cons of worker mode
in worker mode, each shard is a worker process instead of a child process
worker processes share memory with the parent process and fully depend on it to run
child processes on the other hand are independent, each has their own memory and engine
if the parent fails, all workers fail, but child processes dont necessarily fail
so if i have pm2 on it it's fine
so basically workers are more efficient but more dependent
child processes are designed to be independent
the operating system can see child processes independently, but it cant see worker processes afaik
Thanks very much ๐ Indeed when using worker mode it shows the correct ram and cpu usage.
cool
how do i set the status of a bot in my code
like you know how Luca's status say Watching Discord Bots
I want to set my bot's status to: Playing in 'x' number of server
servers*
Which framework?
framework already?
wdym @finite plover
how do i set the status of a bot in my code
like you know how Luca's status say Watching Discord Bots
I want to set my bot's status to: Playing in 'x' number of servers
let prefix = await db.get(`prefix_${message.guild.id}`)
if (!prefix === null) prefix = "ch-"
//let prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf-8"))
//if (!prefixes[message.guild.id]) {
//prefixes[message.guild.id] = {
//prefixes: config.prefix
//};
//}
//let prefix = prefixes[message.guild.id].prefixes;
//let prefix = message.content.substring(0, config.prefix.length);
//if (prefix != 'ch-') return;
let messageArray = message.content.split(" ")
let cmd = messageArray[0]
let args = messageArray.slice(1);
let commandfile = bot.commands.get(cmd.slice(prefix.length));
if (commandfile) commandfile.run(bot, message, args);
Im trying out ways to make a custom prefix but prefix.length is nil
@solemn leaf wut language r u using?
i dont know
dont use prefix === null
oh
how do i set the status of a bot in my code
like you know how Luca's status say Watching Discord Bots
I want to set my bot's status to: Playing in 'x' number of servers
@quartz kindle ?
setActivity
thanks
@modest smelt just run a loop for all the guilds your bot is in
and + membercount
turns out making a poll bot is a lot harder than initially thought haha
well probably because I have timers, queues, poll types, and quoted string parsing in it also
how do i set it to that
i know how to get the number of servers there are
but how do i put it as the status?
status of what
@modest smelt
let info = 0
let servercount = 0
bot.guilds.cache.forEach((guild) => {
info = info + guild.memberCount
servercount = servercount + 1
})
@solemn leaf first of all i code in py
the bots status is it's presence
how to put it as the status of the bot?
Use client.user.setPresence({ activity: { name: ${someVar} } });
in node.js that is
it will say playing your message
bad luck ๐
someone else who knows that archaic stuff might be able to help
you can also set the activity to a verb you prefer
await change_presence(*, activity=None, status=None, afk=False)```
is it possible with js to deafen the bot?
Use py await client.change_presence(activity=discord.Game(name='Hello World'))
yea
if so how
where are discords api server located?
@obtuse jolt if you mean voice
us-central: Chicago, Illinois
us-south: Dallas, Texas
us-east: New York City, New York
eu-central: Frankfurt, Germany
Russia is probably Moscow if not around random cities
CRAP I've been out smarted https://i.imgur.com/4IrUZt2.png
mongoose is already a wrapper tho
lol
so if your wrapping your head around a wrapper, I dunno what you can do
idk, you never told the problem
read a biggo tutorial for ten hours
yes
suggest
if that makes you understand then so be it
me always reads adware blogs
k
big brain to just boot up the docs
they're not npm so they're actually useful
npm docs are trash
no
how can i remove ssh keys from ubuntu so it asks for a password and not keys
You really shouldn't; keys are much more secure.
i know but they are annoying
You need to update /etc/sshd_config
no
@restive furnace they don't have a search button how can it get worse
ctrl + f
Change the variable PasswordAuthentication from no to yes
So I just started using mongoose and this is my current code:
var mongoose = require("mongoose");
mongoose.connect('mongodb://localhost/test', {useNewUrlParser: true});
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
console.log("Connection Successful!");
});
But when I run it in the repl.it shell it throws this error:
not gonna spend another ten hours trying to find the correct key combination to copy text from the shell so i'll take a screenshot
Can you even run a local dB on repl.it?
@thick gull that json.sqlite file i've got is quick.db so
mongodb's online service
:yay:
which is enough for a small discord bot storing strings
@thick gull what about a small discord bot storing a lot of objects under a kb in size each
my database is 60 kb in size
A
SQLite โ mongo
that's including all the weird question marks sqlite puts
what the hell autofill
i just use localhost so i dont have to worry about paying anything :p
I mean I canโt be bothered right now atleast because I donโt have a VPS
cant be bothered to do what lol
setup a proper db on my pc
borboss
:(
i am not going to say the name of the package
but
it exists
and if i do say it timo will spank the hell out of me
wrong link and haha joke
i think i can say the name
I tried to type from memory
where can i find docs for the mongodb node js driver I want to figure out how to add,delete and edit individual items in a collection
ahhhhh
so im trying to do a move command for a music bot, basically what i want to do is get the array with the songs and move the song at position args[0] to position args[1] in the array. what is the best method to do that? I tried js const o = serverQueue.songs[msg.args[0]] delete serverQueue.songs[msg.args[0]] serverQueue.songs.splice(msg.args[1], 0, o)but it doesnt work bc o seems to not exist
im always getting this error when i create a new .js file
Go to the file you created and check the export
i get this at the end of my array, and it seem to fuck the bot
See if you're exporting an object with a help key & value
That's just the look for inspecting variables
@sudden geyser bro. im creating file without any code and BOOM error!
I don't think that would actually mess with it. I see the issue now
@dull badger it's probably just an error you were just not expecting. Show the file you created
fixed duh
ur rude
@tight plinth https://modeus.is-inside.me/PCHZreWq.png
How can I get a file like my index with a discord.js v12 eval?
wat?
you want the contents of the file as text?
Yes
use fs.readFileSync
w!eval require("fs").readFileSync("./index.js")
Thanks
just be ware of tokens
Uh @quartz kindle
if you going to output those files somewhere
Thatโs normal?
readFileSync("./index.js","utf8")
does mongodb store collections as an array of objects
how do yoi fetch a collection from a db
im not dumb im just new
MongoDB or mongoose?
how do i install ffmpeg?
mongodb
And why fetch an entire collection?
lol
wow mongodb you must be smart then
would be too complicated for me...mongoose is so much simpler
mongodb isnt hard

wow mongodb you must be smart then
@midnight blaze no it's that mongodb has better docs than mongoose
And why fetch an entire collection?
@misty sigil idk why
db.db("X").collection("Y");
does this return collection Y from database X
no
db.db("X").collection("Y").find({}).toArray() would iirc
k
readFileSync("./index.js","utf8")
@quartz kindle but I get\nand all the+in the file too...
is your eval command using util.inspect?
what does a string constant mean
probably a string that doesnt change
can we read captchas with a Web Scraper ?
It's not an easy task
if it was, captchas would be meaningless. Why are you asking?
They are? Nowadays serious pages do not use captchas
google uses captcha
they use pictures which you have to click
they do not use simple captchas with text
Hi
that's still a captcha
ok so basically the primary objective of captchas is to keep bots out and they do a pretty good job at it
I mean, I guess you can, get the image and try to read it somehow... but the text is made so it's hard to read by an AI. Try to see if https://cloud.google.com/vision/docs/ocr will manage to read those characters
yeah but if it has a built-in way why not use it lul
thats really smart
wow
i wonder how they do that, anyone have any idea lul
the image text thingy
machine learning
oh
How do I show the amount of servers my bot is in as the status?
what lib
Does anyone know if theyres a tag like this in HTML? If so whats the tag name?-
<code>
epic thankyou!
what lib
Were you talking to me?
userid = 276497792526974996;
console.log(await client.users.fetch(userid));
returns
{id: '276497792526974996', bot: false, username: 'Two', discriminator: '4828', avatar: '579773f553694a3fa57bb79c66474084'}
but
userid = 276497792526974996;
console.log(await client.users.fetch(userid).username);
is not working..
you cant await a part of a promise iirc
^ yeah that
and also IDs are strings in javascript because they are too big to be a number. I am not sure how you get that result in the first example
undefined
i think i found a solution but it's kinda dumb lmao
hm let me try that
yep it works, thanks
i figured i can also put () around the await client.users.fetch()
nope nvm
oh wait i forgot await lmao
how do you async eval()
sTaCkoVeRfLoW https://stackoverflow.com/questions/56187117/await-is-only-valid-in-async-function-eval-in-async i need it to return something so this isnt helpful
`>invite to add me to your server`
^
TypeError: client.guilds.cache.size is not a function
Can you show us your source code and where the error is originating
I sent the source bin
ah
Are you forgetting your commas to separate each element in the array?
Also you don't need to require Client at the top of your file since you aren't making a new instance of it.
also
And you should set the time you change the status to something longer.
5000 is very close to the ratelimit
Like a minute or two
if not at/below the ratelimit
You're right
make it longer
And what's wrong with 5000?
the ratelimits
It's only a second over the ratelimit for status changes
close
It's very low for what you should reasonably set it to. Although Discord does not have its rate limits clearly defined rate limits are not something you should try to get close to, so I recommend a minute or two.
Okay I didn't think of that, thanks
This triggers me
There are now discord bots in PHP, backend server sided developement turned into discord bot making
neat
Discord bots were possible on PHP for a while lol
does anyone here can help
ask your question pls
yes i can haz help
``` if (message.content.startsWith(${prefix}lock)){
let args = message.content.substring(prefix.length).split(" ");
const channels = message.guild.channels.cache.filter(ch => ch.type !== 'category');
if (args[0] === 'lock') {
channels.forEach(channel => {
channel.updateOverwrite(message.guild.roles.everyone, {
SEND_MESSAGES: false
}).then(() => {
channel.setName(channel.name += `๐`)
})
})
return message.channel.send('locked all channels');
} else if (args[0] === 'lockoff') {
channels.forEach(channel => {
channel.updateOverwrite(message.guild.roles.everyone, {
SEND_MESSAGES: true
}).then(() => {
channel.setName(channel.name.replace(':lock:', ''))
}
)
})
return message.channel.send('unlocked all channels')
}
}```
i have this script works 100% but i dont want it to lock all channels i want it to lock specific channel
Ex: lock #development
what i replace forEach with?
nothing
forEach is for looping over many channels
if you want just one channel there is no need for looping
just updateOverwrite on the channel directly
if (message.content.startsWith(`${prefix}lock`)){
let args = message.content.substring(prefix.length).split(" ");
const filter = message.guild.channels.cache.find(ch => ch.type !== 'category');
if (args[0] === 'lock') {
filter(channel => {
channel.updateOverwrite(message.guild.roles.everyone, {
SEND_MESSAGES: false
}).then(() => {
channel.setName(channel.name += `๐`)
})
})
return message.channel.send('locked all channels');
} else if (args[0] === 'lockoff') {
channels.forEach(channel => {
channel.updateOverwrite(message.guild.roles.everyone, {
SEND_MESSAGES: true
}).then(() => {
channel.setName(channel.name.replace('๐', ''))
}
)
})
return message.channel.send('unlocked all channels')
}
}```
now?
am dum
google how .find works
also, you need to use args to know which channel you want
or even easier, use channel mentions
channel = message.mentions.channels.first()
channel.updateOverwrite(...)
then probably sit back and read your code, figure out what everything does, learn a bit more about the language and the library you're using and then finish your project
if (message.content.startsWith(`${prefix}lock`)){
let args = message.content.substring(prefix.length).split(" ");
channel = message.mentions.channels.first()
if(!channel[1]) return message.channel.send('Please include a name for the channel after the command')
const filter = message.guild.channels.cache.find(ch => ch.type !== 'category');
if (args[0] === 'lock') {
filter(channel => {
channel.updateOverwrite(message.guild.roles.everyone, {
SEND_MESSAGES: false
}).then(() => {
channel.setName(channel.name += `๐`)
})
})
return message.channel.send('locked all channels');
} else if (args[0] === 'lockoff') {
filter(channel => {
channel.updateOverwrite(message.guild.roles.everyone, {
SEND_MESSAGES: true
}).then(() => {
channel.setName(channel.name.replace('๐', ''))
}
)
})
return message.channel.send('unlocked all channels')
}
}```
@quartz kindle some progress?
dont forget the let
what i should replace with?
remove it
yes
big brain
``` if (message.content.startsWith(${prefix}lock)){
let args = message.content.substring(prefix.length).split(" ");
channel = message.mentions.channels.first()
if(!channel) return message.channel.send('Please include a name for the channel after the command')
const filter = message.guild.channels.cache.find(ch => ch.type !== 'category');
if (args[0] === 'lock') {
filter(channel => {
channel.updateOverwrite(message.guild.roles.everyone, {
SEND_MESSAGES: false
}).then(() => {
channel.setName(channel.name += `๐`)
})
})
return message.channel.send('locked all channels');
} else if (args[0] === 'lockoff') {
filter(channel => {
channel.updateOverwrite(message.guild.roles.everyone, {
SEND_MESSAGES: true
}).then(() => {
channel.setName(channel.name.replace('๐', ''))
}
)
})
return message.channel.send('unlocked all channels')
}
}
hmm
i said to remove filter lol
OOF
lmoa
when was the last time you changed the name?
channel names can only be changed 2 times every 10 minutes
ok
so
idc
about the name
Tim thank you very much i dont know i was going to do without u
my brother know about this things but he is watching ANIME
so i cant
lol
for a message delete event
what should i pass?
i want to get the person who deleted the message, the message, and who wrote it
umm need help with smthing if anyone could help it would be awsome
so I am trying to ad a background to my bot page
<body style="background-image:url('https://imgur.com/XI6CMFz');">
</body>```
but it not work
@drifting wedge you're looking for the on_message_delete event (discord.py you're using I think). You already have the message as the first parameter is the message that was deleted if it's in the cache. If you need every deleted message, use the on_raw_message_delete event instead.
If you want who deleted the message, you'll probably need to look in the audit logs. You can get the author of the message message.author I think.
- on_message_delete: https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message_delete
- on_raw_message_delete: https://discordpy.readthedocs.io/en/latest/api.html#discord.on_raw_message_delete
whats this error "raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed.fields.0.name: Must be 256 or fewer in length."
how can i distinguish between a member and a bot.
example this bot: ${message.guild.members.cache.filter(m => m.user.bot).size}
what should i do for just the member
message.guild.members.cache.filter(m => !m.user.bot).size possibly
@drifting wedge the embed name field must be 256 or fewer in length
daily reminder the above method only counts online members/bots
just in case you wonder why you get inaccurate numbers
^ unless you fetched them all
collection.filter returns a collection
so, wouldnโt it be .length ?
can i use 1 single webhook to multiple things?
yes
depends what webhook you mean actually
oh
something really f'ed up my atom
its like check marks
i really have no idea wtf is going on
Code where I put in 'ping' and message.channel.send('Pong!')
with the prefix ?
Anyone know how to fix this?
the client login is blurred out by the way
Explain it better?
Explain it better?
@torn ravine me:
its like instead of running the code
it shows like a green check mark
and the code doesnt run
if(command === 'ping'){
message.channel.send('Pong!');
} else if (command == 'youtube'){
message.channel.send(command with a link)
}
});
it to work
it should work?
did you run your program?
says its online
try changing command to message.content
the code looks correct tho
so js const command = message.content
you really think so tim?
also you should use a switch before you add more commands
if (message.content == `${prefix}youtube `) {
return message.channel.send("your_txt")
}
``` @unreal tapir
or you can change what you defined command as to message.content
fs.writeFile('file.txt', variable.1, (err) => {
if (err) throw err;
console.log('Sub count saved.');
});```
I used this, but somehow it doesnt work, any help?
wtaf what am i doing wrong
what do you wanna do with the text file
why not store it as variable.1 then

Help :KEKW:
same lol
@unreal tapir change what you defined command as to message.content
confused
const command = message.content
what?
by restarting the bot
by putting the files on the hosting
then you restart the bot
then the bot comes online
explain
do you not have hosting?
no
I highly suggest it
ill go to botghost

botghost isn't hosting
botghost is just a great way to leak your token imo
where do they even store your token
idk
where do they even store your token
@torn ravine in a sql injectable database
probably in a json database 
HAHAHHHHAhAHHAhaHahAHHA
bcuz theres no time for security when you've gotta run wix for bots
my nitro expires today 
oof
goodbye nerd
it just expired












