#development
1 messages · Page 1923 of 1
my feet don't stink so rude

also its not a fetish of mine thats weird
Prove it
Alright time for some sleep
Sleep well
Feet save and hidden from you!

nighty shiv
Totally not
sleep well
likewise my fren
Shhh it’s not about how old you are but how old you feel
Man then I should be getting my pensions
I'm a damn retiree
So long as it's not Pascal...
At least no feet fetish
You do! We know it! Stop resisting!

what am I being arrested or smth
Yes jail for you, now!
Together with shiv and a Java developer
Hardest sentence you can get

shiv I enjoy
and java dev eh
they are toleratable
now if you put me next to php or js
i'd hate it
*has thrown his phone away
lol
well I got bot idea ima work on
idk how ima bring it into light but who knows
time to read discordgo wiki
don't use bdfd
ahhh ok
simplest solution tbh
then what do i useee
a programming language
let votes = await axios.get("https://top.gg/api/bots/" + client.user.id + "/votes", { headers: { 'Authorization': config.topgg.token } });
I get and erro
cannot read property Id of undefined
@vivid sage can u help
:/
wut
wow
the second } doesn't seem to belong... unless you did ( instead of {
wait nv,
nvm
It's not a syntax error, from the looks of it
I'm bad at codingggg
probably
What's your server file look like
I don't see any exporting of your client there
No...
Then
add:
exports.client = client
export your client from that file if you're trying to import it in a different file
to your servers file
Leme try
kinda like I have here:
const client = new discord.Client({
"restRequestTimeout": time.mid,
"shards": "auto",
"messageEditHistoryMaxSize": 0,
"messageCacheLifetime": 30,
"messageSweepInterval": 90,
"messageCacheMaxSize": 0
});
const auth = require("./core/auth");
// ---------------
// Event Listener
// ---------------
const events = require("./events");
events.listen(client);
exports.client = client;```
so I should have
exports.client = client```
Below the const client = new discord.client ?
the events.listen(client) is if you have designated client events somewhere in your files
but yes
I hope you guys know that client exists on a lot of discord.js classes
such as message.client
people are dumb retards to think I am inspect elementing it when I was literally testing my chrome extension
they keep dming me
@commands.command(name='select-test')
async def select_test(self, ctx):
await ctx.send("We are testing selects!",
components=
[Select(placeholder="Choose what you want to see!",
options=[
SelectOption(
label="Option 1",
value="option1",
description="See option 1",
emoji="😄"
),
SelectOption(
label="Option 2",
value="option2",
description="See option 2",
emoji="😄"
),
])]
)
e1 = discord.Embed(title="embed1", description="a really exciting embed")
e2 = discord.Embed(title="embed2", description="a really exciting embed")
while True:
try:
event = await self.bot.wait_for("select_option", check=None)
label = event.component[0].label
if label == "Option 1":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e1
)
elif label == "Option 2":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e2
)
except discord.NotFound:
print("error.")```
Getting interaction failed on select menu
Any help would be much appreciated
Hey can u help me in this
app.get('/tv/1', (req, res) => {
//var li = req.params.li;
var data={};
data.titles = [];
data.links = [];
axios.get(`https://www.topcartoons.tv/cartoon/beast-awake-bottomless-lake`).then(urlResponse =>{
const $ = cheerio.load(urlResponse.data);
$('div.entry-title').each((i,element) =>{
const link = $(element).find('a').attr('src')
data.links.push(link.trim());
const title = $(element).find('h3.title').text()
data.titles.push(title.trim());
});
})
.then(() => {
res.send(data);
})
})
i am getting error in console
what error
thats py and you are giving an js code
🥲
hi guys my bot has occur this error how do i solve this
wait and fix your code
I should have mentioned it... It's fine.... Thanks for trying tho
Thanks!!!
I think this is where it's failing
event = await self.bot.wait_for("select_option", check=None)```
why is guild.channels.fetch not a function?
a thx i will try
yeah works thxx
its
😉
does message.guild.channels.fetch work?
cuz its from message.guild?
You wouldn’t need to fetch channels if you have the guild object
Just do message.guild.channels.find
@wheat mesa @acoustic cave it gives cannot Read property of null
What’s your code
then u dont get every channel. if there are certains not in the cache
It doesn’t have to be cached if you have the guild object
You’re not getting it from the cache, you’re getting it from the object
Lol
ai yeah ty
i went as the guide said but it says my bot is offline in my server and it doesen't reply to my ping
which Guide? language?
js and an idiots guide
any console errors?
no i just copied the code of ping pong and replaced the console log string to token as said
wait sorry its client login
yea changed that string to the token
make sure u have put client.login(your token here)
then run the code your bot should come online
how do you run a code on atom?
not working still 😦
const { Client, Intents } = require("discord.js");
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
});
client.on("ready", () => {
console.log("I am ready!");
});
client.on("messageCreate", (message) => {
if (message.content.startsWith("ping")) {
message.channel.send("pong!");
}
});
client.login("");
oh wait
messageCreate?
yeah discordjs deprecated the "message" event
finally
First time I've seen them deprecate instead of immediately remove like they've done always
if they deprecated things it would be a lot easier to update
because 1 your bot would still run 2 you can find what's deprecated and fix it easily
compatibility table looking terrible for a feature every website has
but no they just give you a giant change log to navigate through and say "here are the changes"
when I updated from v11 to v12 (this was before detritus) I had 100 errors because I used v12 has client.channels.get while v12 has managers with client.channels.*cache*.get
why not just do
client.channels.get = function (...args) {
console.warn("client.channels.get is deprecated, use client.channels.cache.get instead")
return this.cache.get(...args);
}
Show ss
Ahh
no one understands why djs does what they do
its better to not question it for the sake of not losing your brain cells
the only thing detritus sucks at is documentation
tho that's probably typedoc's fault
typedoc just sucks
without a parser or whatever
it redirects you to / on 404
sometimes it redirects when you click a search result
how tf is that a non existent page
ahem
those are your docs
is the db on localhost?
if it's not mongo(ose) idk what's the problem
maybe the db never saved to disk so it gets cleared on restart
it's a function so yeah

Your life isn't your's If you always care what others think.
umm this is not the inspirational quotes channel
@earnest phoenix Then what channel is this?
programming and writing code
@earnest phoenix See if I can get into the project.
get into what?
Then can I be a part of the project?
i need someone with brain cells for my "project"
Maybe I can help her out a little bit.
wtf
I'm doing a lockdown command, but when I turn it off, the channel permissions changes and everyone can see it
same for lock and unlock command
Just don't ask... assume he knows what to do and give him full access
hello guys, quick question. How can I pass f.e. req.body.id from the main function/route to my middleware? Because I can't access it from the middleware and I can't send it as a parameter because it's before req gets defined.
hmmm...middleware?
are you dealing with a Promise? if so, await it to extract result
nah
pretty sure the req would be an object property that the promise resolves to

what??
let res = await <Promise>
I have f.e. this at the beggining of my middleware:
const validPerm = (perms) => {
return (res, req, next) => {
console.log(req.body.token);
And req.body.token doesn't work because it doesn't know req
because at the start of the route thing itself app.all("/api/post/role", validPerm(2), function (req, res) { req gets defined later
errr...why u have an arrow function returning an arrow function?
an arrow function is like a normal function, in ur case perms is whatever is passed to it
so when you do (perms) => { (res, req, next) => { ... } } res, req and next are whatever is passed to em
in this case, nothing
for example
res before req
That'd done so you can pass options to the middleware
show the whole thing
me?
const validPerm = (perms) => {
return (req, res, next) => {
console.log(req.body.token);
const token = req.body.token
if(token.length > 80) {
next()
}
}
}
lenght
?
yes okay that's just the typing error...
app.all("/api/post/role", validPerm(2), function (req, res) {
ok so, remove next, and it might work now that you've flipped the params
at this point, res was the actual req
now it's right
but you need next if it's true
yes changed it 🤭
does it work now?
it was just a flipped param, code913 was the one who first pointed it
^^ thank you all for you help and time
yw
yro'ue welcome
So let's say I have this, previously I had it to just check a role if it had it would kick, but on another server which I am a mod on, how would I just change it so it would work as a permission?
I know I have it probably written wrong but I only wanted to look something similar as the finished product
this is called POG where I live
but well, Member has permissions property, you can use it to check
Pog as in
or as in something different
pog as in "Projeto Orientado a Gambiarra"
basically, doing things in a weird and improvised way
as long as it works it's good for me
I wouldn't bet on it
It worked previously when I only had it for a specific role on my main
it doesn't work now because I change that highlighted area because that's what I want to change...
yes, the way you wrote it will probably work
but please at least remove that setTimeout
I don't see why you have it at first place
Because it doesn't send a message into dms?
Once the command was written, the person gets kicked and that's it
ever heard of await/then?
all it takes is a 1001ms delay to kill ur code
which, considering discord, is not that impossible to happen
this is a REALLY bad thing to do
that rule is a sin against programming
I didn't come here to get made fun of for what I have written, I am still very new to this, I only do this in my free time.
I just wanted to know to what should I change the highlighted area to
Hey! How would i reply with attachments in discord.js v13? :)
I aint making fun of you
I'm pointing code flaws which WILL get you in trouble later on
especially now that node terminates the process on uncatched exceptions
I don't even understand the question
Xetera?
talking about barnis's question
Ik
Yikes
I wanted to change that section into another thing which would look for a specific permission
async await 😩
I imagine you need a database to store what permissions you're looking for
you're looking to only be able to kick people with a specific permission that changes from server to server right?
I only want the command to work for people who have a KICK_MEMBERS permission thru roles
does the yellow highlighted part from your last message not work?
<GuildMember>.permissions.has(<Permission>)?
Yes because I probably just made it up that would look something similar
oh
The newer picture I sent does work on my server
because it is "attached" to a role
what's wrong now
Users don't have permissions
Members do
message.author is a user
Author is a User object
mhm
message.author points to the User- fuck offflaze
message.member is a Member object
Also, how come you misspelled that but the error's spelling is just fine
We all do
I wish I do the same
It happens
so basically I only need to change author to member?
Yes
Give it a try
if only you were using a language that showed you whether or not message.member includes the permissions field
That’s a simple error
'KICK_MEMBERS'
Does djs not have a permissions enum?
Imo I think the enum is a lot better to use
I like how it just suicides with a .44 magnum each time i run that command
catch errors
a feeling we can all relate to right now
Could’ve used it in dms
well, currently your code is a russian roulette tbh
sometimes it'll crash
sometimes it'll work
Since in that case message.member would be undefined
Oh nvm I know why it wouldn't work
I just missed a ) on ban command
perfect
Welp now it does work, massive thank you for everyone who helped
How would i reply to a command with an attachment? I tried interaction.reply({ attachments: [attachment] }); since the embeds are sent that way, but it doesnt work :/ Any help is appreciated! :)
feels like math class once again where everyone is just screaming
ill try
before you go, I ask a last time to use await instead of setTimeout
It should work, unless they haven't updated it to use form data if there's attachments
Haven’t used djs in a long time so I’m not sure
tysm ❤️
👍
aaand he ignored, nice
nah
could've pinged me ya know
then explain me what's different about await and setTimeout in dms so it doesn't flood here
it won't be a flood really, it's very basic
Why kick later when you can kick straight away?
dm messages
in ur case, u want to send a message THEN kick, all u need to do is wait previous action to finish
send, kick, whatever are async actions
that means they're processed in parallel to current execution
guyz where do i report for problems ?
If you use settimeout then there’s a chance that discord takes a long time to respond and it could error
With the site?
so it could finish before or after you reach the kick action
cg vote didnt wrk for me thats why
all u need to do is await <action>
k thx
that guarantees the code will wait for the action to finish before moving on
(And make your function async)
ye, that too
now I literally have no fucking clue what to change and what to do
Async just allows you to use await afaik
it does things probably
Ahhhhhh let's just confuse the heck out of them
And allows you to await the call of the function
basically flag it as "don't process in main thread"
No point in using async if you don’t need it
js doesn't have actual threads, it probably wouldn't matter
i think brain become mush
but dont flag it without necessity
wait, I'll show u
Basically you just need to await the sending of the message
Nothing the problem now Wass, kuuhaku is trying to explain to me that I should use await instead of setTimeout
And then kick the user
so this small part
await waits for the line to be executed before going on
Can y'all stop talking over each other first
You're doing the opposite of helping
It would still work, he’s adding await to the send line, not the kick
Ah sorry I was looking at kick method, not send
But I don't see a point in confusing them
I’ll let someone else explain this without interrupting this time, sorry
Like this or an extra line?
why would you do await user.send?
Trust the process
Because you want to send a DM before kicking them (you can't send DMs on a user after they are kicked unless you share same servers)

It literally now sends that message, deletes the bread.kick command and kicks the person...
the kicking is after it is send
If you don't await it, it can go in any order
and the kick has 1s delay
That's 1s
Is that not the intended behavior?
It literally works like that right now Waffle
😂
IT LITERALLY WORKS LIKE THAT RIGHT NOW
ok
I know
But as Kuuhaku said your code was a Russian roulette before the await
If discord took longer than 1000ms to send your message to the user (a very real possibility) then your code would error
Because after 1000ms you would kick the user and then it would message the user which wouldn’t be possible at that point
just use a .then
xd
oh so basically now it's guaranteed to stop for a bit before doing the next bit?
That explanation I just sent was more clear than any of you have said
im sorry but my brain is now complete mush
I did say that I believe 
u need to put some .catch() in your code
like if someone dm is closed, you cant send him the message.
Then u get a err
😂
"Hey, await this! Await that! Oh, catch the error too? Nah."
"no"
why the fuck use a await
just use a .catch and a .then
😂
I don’t believe that this is helping
.catch("these hands")
Look, spaghettis are great but not when it's in your code
yeah fuck this im going for a piss
Then it’s just a hearty meal
there, finished my example
I should make a detritus example repo
note how A got printed after B even though it's earlier on the code
@earnest phoenix I would suggest reading up on JS promises
Like, take a small step back and just read up on them
Take it a bit slower
I'll probably never to that but cheers might have to
I highly doubt your bot is only using 16mb of ram 
Takes more than that to even run a gateway connection
(On node at least)
basically this is what happens when you use a promise, a new branch is created so you don't have a sequence anymore
I feel like you’re not measuring the right statistic
Because that doesn’t seem right
Especially on djs
Well that’s why
Use rss
oh you will, async operations will be very common when making a bot
it's a fundamental feature that's used in pretty much anything
notably channel.send
i literally only wanted it to send BREAD PICTURES but somehow came across with making other stuff...
Like my heapUsed is 50mb rn but the rss is 130mb
Although I’m not sure why my ram usage is so high
pre-allocated space maybe?
I do cache channels which I don’t need to do so I should probably get rid of that
but only like 400-500 channels cached
I don’t use channels in the cache
The only cache I use is my own prefix cache
That’s a problem to solve later though
a crab
With slashcommands (interaction.), is it possible to send a message without replying?
Sure
ye, you can get the channel where the event happened
interaction has the property channel
You can simply use it send a message
interaction.channel.send()
You can still mention the interaction.user.id
ah
If you like to
ty
you have to get the image url and download it with requests or another http lib
How do you send like this ?

Hm try
👍
const message = "webi wabo";
console.log("%c " + message, "color: blue");
bruh
i am server owner and it says i dont have permission to ban :(
const noPermEmbed = new MessageEmbed()
.setTitle(`Error! You don\'t have permission to use this command!`)
.setColor("RED")
interaction.reply({ embeds: [noPermEmbed] });
return;
}```
That checks all roles for if they have ADMINISTRATOR. Owners don't explicitly have ADMINISTRATOR perms and only have it implicitly. You have to check if guild.ownerId === interaction.member.id
anyone know nextjs?
how would i scrape the nft's from this site? (their market volume). I tried network tab, tried inspect element etc, but it seems unscrapable.
https://www.flownft.co/market
The best place to analyze, track and discover NFTs. Real time digital asset tracking to help you to navigate NFT markets with transparency and confidence.
seems to be this one
https://nonfungible.com/api/v4/market/history?filter=%5B%7B%22id%22%3A%22blockTimestamp%22%2C%22value%22%3A%5B%222021-11-09T18%3A48%3A10.230Z%22%5D%7D%5D&internal=true&length=10&sort=%5B%7B%22id%22%3A%22usdPrice%22%2C%22desc%22%3Atrue%7D%5D
you would have to scrape the HTML and use regular expressions
hmmm wait really
that actually worked.
does the link autoamtically change info? Or does the link change each day?
with other words, if i would request a get request to that link you sent, would that output the right info each day (so it doesn't stay static as the link has changed or anything)
i've never heard the word nfts until the discord controversy
then everyone starts using it
its like that with every word i dont know
A group (Jack Harlow, Pete Davidson, Chris Redd) performs a rap explaining cryptocurrency.
Saturday Night Live. Stream now on Peacock: https://pck.tv/3uQxh4q
Subscribe to SNL: https://goo.gl/tUsXwM
Stream Current Full Episodes: http://www.nbc.com/saturday-night-live
WATCH PAST SNL SEASONS
Google Play - http://bit.ly/SNLGooglePlay
iTunes - ht...
i also just discovered i tbh
NFT = No FeeT

Back to feet fetish discussion?
one last qeustion before i fuck off:
let result = body
how do i convert the body buffer into an array?
I tried using [...body] but it still logged the buffer
yeah but now you fucking pay for an image that you can view on google
even w/o paying for it
it keeps fuckin returnin me a buffer
I know i can use toString, but is there a way to make it an array?
Like should i manually push it to an arary?
I mean, why make it an array?
it's meaningless unless converted to the original format
as i need to get the info from it
success":true,"data":{"sales":[{"name":"goatz","sales":[{"blockchain":"ethereum","transactionHash":"0x3fd23f939a512e8de3444fe5d441e3a60c9c5c6d277ed65475d5e31c33913b4c","blockNumber":13600544,"blockTimestamp":"2021-11-12T09:32:34.000Z","assetId":"1837","project":"boredapeclub","nftAddress":"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d","nftTicker":"BAYC","marketAddress":"0x0159c7f6cc9e28fdb1b6b127a371d5118af931b5","usdPrice":1573335.09,"tokenAddress":"0x0000000000000000000000000000000000000000","tokenTicker":"ETH","totalPrice":"333000000000000000000","totalDecimalPrice":333,"feeUSDPrice":78666.75449999998,"feeTotalPrice":"16650000000000000000","feeTotalDecimalPrice":16.65,"feeCollectors":it's in such form. So i don't want to stringify it as i need it in an array to get those info's .
you need to json parse it
json parse supports buffers
JSON.parse(body)
although converting it to string yourself is actually slightly faster
aha. Tim always knows the anwers. Thank you!
JSON.parse(body.toString())
the buffer array doesn't represent individual fields
it represents the characters themselves
I’m trying to delete a message that was sent, but if a message gets deleted the bot crashes since the message returns undefined. However, adding:
if (!message) doesn’t fix the issue. How would I check if the message I’m trying to delete is undefined or not?
Should work fine, are you sure you’re passing in the right message? Have you named some other variable message as well?
Yes. And I haven’t
There’s only 1 variable name msg
Can you send your code from before that?
Log message again
Why would message be undefined in the first place 
Even after deletion, message would not be undefined. You should check if the message has been deleted before trying to delete it
Alr. Would it help if I made message a constant?
Well, I guess you can by making a new variable
Yea that’s what I mean idk
Huh message logs fine
Because it isn’t going to be undefined
Alr I’ll send the rrror msg rq
Brb
send the server count with the shard id
Is there a way to solve the interaction failed issue cuz of ratelimits
Command
I typed the command, and no response.
i see
The issue:
python moment
lmao
parentheses
i get that all the time
I'm so sorry to bother lmao
ellipses is ...
thats the word
I need a nap-
English is cringe
I feel like a dumbass
Yo @spark flint need MORE assistance..
So I am trying to make a clear command.
It wouldn't work, and the errors were:
You have to provide a limit
Afaik you can only do up to 100 messages at a time with the API
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
How do I make my bots status streaming?
Still need help?
async def clear(ctx, limit:int)
Make sure limit is defined
hey
When I make a random number
and want it to repeat smth like.. idk
lets say O
and I got 15
how do I place O 15 times ?
ping in replies
Anyone know why my friend is getting this error ? Cannot connect to host discord.com:443 ssl:default [None] discord.py
Why not though? Here’s the full error
File "/home/pi/.local/lib/python3.7/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [None]
Maybe ask them to check their wifi?
port 443 opened up?
?
?
Loops
Just use loops if you want to get a message a certain amount of times
nah nah im not doing it with discord.js
I am doing an API and am trying to replace a NUMBER witha STRING
Oh okay
kinda forgot javascript in past few months..
Rip
In js?
yep
<string>.repeat(count)
You can just .repeat
thanks
Like this
that's after 15m
If u look in the error its wanting to post some think and it cant.
Do u want to change the post?
why do node docs tell you to asynchronously import("crypto") in esm instead of import { stuff } from "crypto"?
If it's in python and has to be done in a command
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix=",")
@bot.command()
async def stream(ctx, *, message_to_stream):
stream = discord.Streaming(
name=message_to_stream,
url=stream_url,
)
await bot.change_presence(activity=stream)
bot.run("YOUR-BOT-TOKEN") ```
If it has to be done when the bot starts
import discord
bot = discord.Client()
@bot.event
async def on_ready():
stream = discord.Streaming(
name=message_to_stream,
url=stream_url,
)
await bot.change_presence(activity=stream)
bot.run("YOUR-BOT-TOKEN")```
Host Issues
🥄
^
Aren't rate limits for interaction per interaction and not some global route? 
You might be having some serious issues
const channel = interaction.guild.channel.cache.get(target.id);
what should I use? fetch instead of cache?
/home/runner/jhgfrftgyhvfbqheinjsbdiquhiznjd/node_modules/discord.js/src/rest/RequestHandler.js:93
throw new HTTPError(error.message, error.constructor.name, error.status, request.method, request.path);
^
HTTPError [AbortError]: The user aborted a request.
at RequestHandler.execute (/home/runner/jhgfryioqsminfbqheinjsbdiquhiznjd/node_modules/discord.js/src/rest/RequestHandler.js:93:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/runner/jhgfrftgnfbqheinjsbdiquhiznjd/node_modules/discord.js/src/rest/RequestHandler.js:39:14) {
code: 500,
method: 'patch',
path: '/channels/864910356584202270/messages/910487644369190912'
}
help me pls
Well now amount isn't defined.
ima cnp it
@client.command()
async def clear(ctx, limit:int):
await ctx.channel.purge(limit-amount)
why amount
Okay..
just await ctx.channel.purge(limit)
alr
@spark flint
hi
ah
ok
Dude I'm really sorry
fetch() will always check the cache in the first place if you don’t use the force option.
It doesn’t matter at this point.
The difference is fetch() does return a promise.
But a wise man said djs caches everything so channels should be cached anyways.
Which means get() is alright.
But I forgot how to do the admin thing.
make it admin only?
if message.author.top_role.permissions.administrator
no
Oh?
@commands.has_permissions(administrator=True)
How would I do it then?
add that under @client.command()
Okay
Then you just need to add error handling
Error handling?
if user doesn't have permissions then return an error
no
@clean.error
async def command_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
await ctx.send("You cant do that!")```
thats all i'll give
Where shall I put that though
anywhere in the code
oh yeah i hate that
So this is all new to me.
Yeah lol if you wanted to do !help admin it'd show the !help list.
Just a mess
And just a very basic, beginner, easy way of coding.
yep
Undefined name clean
import clean nvm
God dammit.
@spark flint
Traceback (most recent call last):
File "main.py", line 110, in <module>
@clean.error
AttributeError: module 'clean' has no attribute 'error'
I got an error,
do you have a module called clean?
yes I do
thats why
alr lemme just code something
Should I not have clean in there?
I am really sorry to bother, sometimes I tend to be annoying.
put that instead
nah nah its fine
nope
Okay
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
await ctx.send("You cant do that!")
else:
print(error)```

epic
mood
I kinda want to try and make it say "number of messages purged has been cleared."
I know how to do that
I think
await ctx.send(f'{limit} messages have been cleared.')
then add ```py
await ctx.reply(f"{limit} messages has been cleared``")
I know bro.
yep
Thanks though.
atleast I got it
without assistance
Yet I put two awaits..
Is that okay?
should work
function executeScript(tabId) {
chrome.tabs.executeScript({
target: { tabId },
files: ["script.js"],
});
}
My code for Mozilla Firefox extension
this works flawlessly in chrome
I get this error
Perhaps it works well in chrome because it looks like it’s using a chrome api of some sort...
anyone guide me how to shard using mangodb ??
I had to change it to
function executeScript(tabId) {
chrome.tabs.executeScript({
tabId: tabId ,
file: "script.js",
});
}
hmm
just print the bot cache
[[object Object], [object Object], [object Object], [object Object], [object Object], [object Object], [object Object]]
ya me dumb

its ok
u can't really retrieve the space used by a collection at all due to runtime optimizations
I mean, you can estimate, but not get the absolute value
different stuff
yos yos
a thing u can do is, right after u start the bot save current used rss to a global var
then when retrieving used space subtract that value as an offset
the resulting value will be the total used space - initial usage
do that right after starting tho, not on ready event
np
just log the heapUsed
90% of that will be the bot cache, unless you store other things
removing the initial load will get u closer to actual size
also ain't it better to use rss instead of heapUsed?
Sure it's just an object, not more

where are u calling that require?
ah, didn't see that
messages to brazil... ping 200k ms
Hey! I wanna make a mute command for my bot, but i cannot figure out how i get/fetch/map/whatever all the roles a member has. Does any of you know how? :)
What I usually do is make an array of strings, push to that array based on conditions, and then join that array by newlines in the final embed
so that means i can do interaction.member.roles?
you might need to fetch before depending on whether the lib does that for u or not
but that'd be a simple .fetch after roles
returns undefined
TypeError: interaction.member.roles.fetch is not a function
i have checked the docs, all i find is rolemanager
uhm
e
Returns the longest array/object i've ever seen.
Guess you never saw the data being provided with the ready event
ok
bot2.shard.fetchClientValues('guilds.cache.size')
.then(results => {
message.author.send(`guilds: ${results.reduce((acc, guildCount) => acc + guildCount, 0)`)
})
i have that code but it only shows some of the servers the bot is watching, not all
how many are there in total? how many does it show?
well its not that much of a different but still its annoying me,
its in 710 and it shows 706
how do you know its 710?
if you are looking at the count on the invite page, thats broken
its caching deleted bot farm servers
Hi, my testing bot generates all kinds of errors but some of them cause the bot to restart. Is there a way to catch these errors without specifically doing try-catch for every function? I mean like in a general way
the invite page uses an approximate number, not a real number
then how can i know in how many it actually is?
pretty sure 706 is the correct number
yep
mine says 154 on invite page but is actually in 151
its because discord deleted 3 of the bot farms it was in
mine shows 9540 in the invite page
but its in 9536 servers
the bigger the bot, the more approximate it will be
for example, for a very big bot it may show 1245000 in the invite page
thats way too rounded to be true
function executeScript(tabId) {
chrome.tabs.executeScript({
tabId: parseInt(tabId) ,
file: "script.js",
});
}
why?
Literally in the docs
this is what it shows up for dyno lol, no way that number is true, its a super approximation
yup
any clue?
thats not what it says in the docs
"figure it out"
lol
its too obv
wait what
wait
holy shit
it should be ```js
function executeScript(tabId) {
chrome.tabs.executeScript(parseInt(tabId),{
file: "script.js",
});
}
function executeScript(tabId) {
chrome.tabs.executeScript(parseInt(tabId),{
file: "script.js",
});
}
```*
yup
why am I so dumb, I have been literally trying to figure this out for last 3 hours

you're too used to discord.js that simply accepts everything the user throws at it
sad reality
https://javascript.info imma read this, do you have any other tutorial suggestion?
it explains all deeply
Ay, can anyone provide me with the shorter version of setTimeout()?
I know that you const it somewhere and then can use it without having to use brackets
Something like
const timeout = blubdoesthefish
randomBracket {
// sum code herr
timeout(1000)
// morr code herr w/ 1 sec timeout
}```
There is no shorter version of setTimeout without aliasing it to return a Promise so you can await it.
function timeout(delay) {
return new Promise(res => setTimeout(res, delay));
}
Thanks
Unless you are on Node 16+, you can just require setTimeout from timers/promises and use await setTimeout(delay);
they promised the setTimeout?
const { Client, Message, MessageEmbed } = require("discord.js");
const Schema = require("../models/reaction-roles");
module.exports = {
name: "panel",
description: "Reaction-Role Panel",
category: "Config",
UserPerm: "ADMINISTRATOR",
async execute(message, args) {
const channel = message.mentions.channels.first() || message.channel;
Schema.findOne({ Guild: message.guild.id }, async (err, data) => {
if (!data) return message.channel.send('no data use -rr-add')
const mapped = Object.keys(data.Roles)
.map((value, index) => {
const role = message.guild.roles.cache.get(data.Roles[value][0]);
return `${index + 1}) ${data.Roles[value][1].raw} - ${role}`;
})
.join("\n\n");
channel.send(new MessageEmbed().setDescription(mapped)).then(msg => {
data.Message = msg.id;
data.save();
const reactions = Object.values(data.Roles).map(val => val[1].id); //?? val[1].raw);
reactions.map(emoji => msg.react(emoji));
});
});
},
};```
anyone?
for some reason all of a sudden in visual studio code when i try to push via gui i get this
remote: No anonymous write access.
all of a sudden too i made no changes how do i go about fixing it?
Can I set a thumbnail for an embed using a file in the project? Ex.
.setThumbnaul(“../caution_gif.gif”)
Thanks!
if (!data[member.user.id]) {
data[member.user.id] = {
"id": member.user.id,
"xp": parseInt(number)
}
} else {
data[member.user.id].xp = data[member.user.id].xp + parseInt(number)
}
JSONSAVE()```
at the end of some command it gives this (>):
```json
>"499595256270946326": {
> "id": {
> "id": "499595256270946326",
> "xp": 950
> },
> "xp": 950
>},
> "910554564275613717": {
> "id": {
> "id": "910554564275613717",
> "xp": 800
> },
> "xp": 800
>},
"282859044593598464": {
"id": "282859044593598464",
"xp": 600600
},
> "557628352828014614": {
> "id": {
> "id": "557628352828014614",
> "xp": 952
> },
> "xp": 952
>},```
What's a alternative method to get a element by id in puppeteer?
But there is a a element with that id
aren't u supposed to omit #?
ah
Are you sure there's an element with that id?
and are you sure the page is fully loaded
Both a yes @pale vessel
Try using eval to click on the button then
Can you give a snippet?
though page.click should work fine...
page.evaluate(() => document.getElementById("menu-berichten-new").click());
``#appbar div:nth-child(2) tried this also
ima try thanks
Cannot read properties of null
doesn't sound like the error is coming from the snippet I sent you
how are you so sure the page is fully loaded
can you share more of your code
these are the elements im trying to click
ill just send everything lol
at line 83
async function proceedFunction() {
console.log("Completed Login")
await page.click('dna-avatar')
await page.waitFor(200)
await page.click('.ng-star-inserted')
await page.waitFor(5000);
if (!page.$('#help-menu')) {
console.error("Wrong page? Please monitor at next start")
} else {
await page.waitFor(5000);
//page.evaluate(() => document.getElementById("menu-berichten-new").click());
}
}```
i think this is better lol
its commented rn
and no error!
when its commented*
That's super weird because you don't have properties anywhere in your code, which means the error is coming from puppeteer
wait , do you get Trying to correct page in your console?
you need to await that goto as well
Nope
Try console.log(await page.content()) and check if the selector is inside the HTML
saw that yuh
ight
appreciate the help guys/girls/any other gender
It isn't...
Inspect says something different lol
cant share it cause it contains private info
Hmm
It's on the wrong page or something
It's on a page before what it supposed to be
Also, doesn't page.$(...) return a promise?
It does
You should await it
Where is that
:/
sry
ill just replace all
fixed that
It's on the wrong page somehow
It doesn't say its on the wrong
But the console says it is
i think i fixed it
So basicly this site opens a new tab
With where it's supposed to be
lemme make a screenie
left is where its focused
and right is where i am
yess!
it worked
Thanks guys/girls/any other gender
Really appreciate it

