#development
1 messages · Page 1915 of 1
translate it
interaction error
Interactions will always fail if you don't respond to the webhooks
If you don't respond to the button in your code, it will always fail
Technically by responding with a 2xx status code
But I guess you ask for a djs solution... ?
yep..
well, that goes without saying.. but I don't work with another APIs by request technologies
Hmm actually a good question how to respond via djs
Probably need to use the client.api directly
what if you create a stub that will respond to everything with code 200, and the handler will remain in djs
I create..
The webhook's coming from Discord to djs, it just needs a response you would usually return by replying to the interaction
you can simply respond with a message update that doesnt change anything lol
i mean, usually people want to see an acknowlegment
Oh that works?
so at least edit the message with something like an OK
Thought djs would may throw an emtpy message update error
you need to send content, yes, but the content doesnt need to be different from the original
But the message will show (edited) right?
Can't you just ack the webhook without sending/updating the message?
You should be able to add the whole message payload, yeah
interraction.message.edit({embeds:[interraction.message.embeds], components:[interraction.message.components]})
Technically, yes, but test your upper version first
I think you can provide the whole message payload, too
I used
interraction.message.edit('123')
interaction.message.edit(interraction.message)?
node_modules\discord.js\src\structures\MessagePayload.js:136
throw new RangeError('MESSAGE_NONCE_TYPE');
^RangeError [MESSAGE_NONCE_TYPE]: Message nonce must be an integer or a string.
Ok well then it doesn't
text is "interaction error"
Then you will have to define each option yourself
interraction.message.edit({embeds:[interraction.message.embeds], components:[interraction.message.components]})
But
interraction.message.embeds
should already be an array
No need to wrap another array around it
Same goes for components
It's already an array
still interaction error
Just on mobile?
Shouldn't happen if you successfully respond
Probably just a Discord issue then, I remember got interaction errors, too especially on mobile even if the response worked
on PC
solution is...
interraction.deferUpdate();
just call this and "interaction error" vanish
idk. it is sloves my problem
you we're correct, thank you lmao
or just provide the url
tf is that
unmute your stacktraces then send it here
it's a skill issue
Not worth it
Why would you read the same file multiple times?
Read it once, then split the created vars content or check if it starts with xxx
they are reading it once though
^
Enlighten me, I see two
Ah
const about = fs.readFileSync(`./commands/${file}`, "utf-8").split(';')[1];
const isAdmin = fs.readFileSync(`./commands/${file}`, "utf-8").startsWith("//s");
He means that
lol
Hmm that’s what I thought, too
Since he doesn’t specify the length he’s reading the whole file
exporting an object with a property that defines permissions of that command
parsing comments in a js file to determine permissions of the command
Yeah I’m aware but still 2 file reads
wait what
Imma reading the file once then work with my vars
reading the file as text to parse that stuff? lmaoo
"codereviews"
tl;dr people scream at your shitty code
eh?
code review is actually really good
I'm willing to bet money that it's 10x less toxic than stack overflow
Anything in the net gets toxic, it just takes its time
people who are pretentious and annoying don't tend to put themselves in a vulnerable position by sharing their code and asking for feedback
voluntary code review tends to be pretty positive in my experience
well true but it's useful
is it actually useful?
Yeah you are right in that case
So I write some code for school, I want it to be of the best standards and etc. I could learn all the documentation for a language and be able to understand do I use camel case or snake case. Or I could just go post my code on there and have a response of what's wrong with it and how it could be made better
When I was a beginner at Python I was using nested if statements and etc yk the bad methods. Someone rewrote my code to go use a dictionary and reduced the amount of lines it consumed by like 60
smaller doesn't always mean better
@job.command()
async def apply(self,ctx,*,selection:str):
a = banned(ctx.author.id,self.bot.blacklisted)
if a is True:
return await ctx.send("You are blacklisted from using this command.")
db = client.bot
posts = db.user
for x in posts.find({"guildid":f"{ctx.guild.id}","id":f"{ctx.author.id}"},{ "_id": 0,"job":1,"level":1}):
level = int(x["level"])
if selection.lower() == "garbage collector" and level >= 0:
posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Garbage Collector","income":50}})#save
elif selection.lower() == "cleaner" and level >= 7:
posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Cleaner","income":70}})#save
elif selection.lower() == "car washer" and level >= 16:
posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Car Washer","income":105}})#save
elif selection.lower() == "maid" and level >= 27:
posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Maid","income":145}})#save
elif selection.lower() == "receptionist" and level >= 36:
posts.update_one({"id":f"{ctx.author.id}","guildid":f"{ctx.guild.id}"}, {"$set": { "job": "Receptionist","income":185}})#save
else:
return await ctx.send(f"You are currently {level}, please go to school using ?learn")
await ctx.send(f"You are now working as a {selection.lower()}")
I wrote this code in 2019
As you see I have that massive if statemnt
@job.command()
async def apply(self,ctx,*,selection:str):
a = banned(ctx.author.id,self.bot.blacklisted)
if a is True:
return await ctx.send("You are blacklisted from using this command.")
db = client.bot
posts = db.user
for job_name, level_min, income in (
('Garbage Collector', 0, 50),
( 'Cleaner', 7, 70),
( 'Car Washer', 16, 105),
( 'Maid', 27, 145),
( 'Receptionist', 36, 185)
):
if selection.lower() == job_name.lower() and level >= level_min:
data = {
"id": f"{ctx.author.id}",
"guildid": f"{ctx.guild.id}"
}
set_stuff = {
"$set": {
"job": job_name,
"income": income
}
}
posts.update_one(data, set_stuff)
break
else:
return await ctx.send(f"You are currently {level}, please go to school using ?learn")
await ctx.send(f"You are now working as a {selection.lower()}")
As you see you would rather prefer the second one as it's much more cleaner and less messy. You could actually read it
I rather go bully someone on stackoverflow because of things like bad answers
But on code review there isn't such a thing as a bad answer as you are just giving your opinion
Unless you write
This code is shit, my grandma can run faster than this
@rustic nova there ya go
What
bot.user is null
has anyone used catalyst? it looks it's trying to destroy js so it's bad like java
that looks like a bogged down springboot
but in javascript
but doesn't js already have express?
they are sping booters. i need to convince them to learn javascript
they just want to use the legacy java paradigm in js
a catalyst is a substance which speeds up a reaction
a cyclist is a substance that moves via a chain reaction that produces mechanical energy
donezo
why am i suddenly getting this
my api worked fine the other day
wait shit
i think i see the error
yep fixed, i did ,, at one point
oh dear
yeah...
@rustic nova the issue with 30% of people that post on stackoverflow
So for a slash cmd (discord.js) how would I made a input that searches for a user in the server, and after that, what would I use to get the user ID of the mentioned user?
f
it's async, not await
pls help
can't code
i'm sending API requests in Node.js but its returning nothing
will grab code
api its grabbing data from is returning the data in json format
app.get('/api', async (req, res) => {
const userid = req.query.userid;
const apikey = req.query.apikey;
await axios.get('http://api.blacklister.xyz/check/' + userid, {
headers: {
'Authorization': apikey
}})
.then(function (response) {
res.send(response);
})
})``` but express doesn't return anything
why are you sending the whole response object
idk
send the data response.data
Was about to ask that
Use an if statement with the logical AND operator
🤔 why
because yes
@quartz kindle just got confirmation from a few friends that hetzner works with voice again
They just never announced it~
did you test it?
I few friends who have voice features did and yea, got it working on a test bot running on my hetzner dedi
so have a feeling they sorted it and kept it on the dl
well, not all of their ips were affected
considering the last announcement was 2018
its very possible your friend got lucky
im pretty sure someone yesterday tested it and it was not working
Idk but it seems a lot of people don't have issues from what I can tell
I’m gonna test it tomorrow as well on 3 different system and IP ranges and will report back.
A voice connection is just enough?
ye, join voice
also depends on the voice region
only some regions are affected as well
Yee testing the EU dedis and the US cloud
you can set voice region per channel
@quartz kindle omg new pfp?
good night
hour
How to make bot respond to itself?
My code:
@bot.command()
async def addrole(ctx, member : discord.Member, role : discord.Role):
await member.add_roles(role)
embed = discord.Embed(description= f"✅ Added {member.mention} **{role} Role**", color=discord.Color.green())
await ctx.channel.send(embed=embed)```
It only respond to discord users but it doesn't respond to itself when I use `.say !addrole @Swan Htet Kyaw#0001 Role`. 😅 I want to make bot reply to itself
It depends on how you coded your message event. Just gotta remove the line where you return if the message author is the bot. But why do you even want to do this? This feature can easily be abused and can get your bot ratelimited
If I have the ID's of channels (ignore the scuffed names lol):
var channel1ID = message.guild.channels.cache.find(c => c.name === "Game " + game + " Team 1").id;
var channel2ID = message.guild.channels.cache.find(c => c.name === "Game " + game + " Team 2").id;
How would I delete the channels? I know I can delete the current voice channel the user is in, but I want to delete channels based on their ID.
interaction.member.voice.channel.delete();
nvm im stupid idk why i was using .id
How to make selection Role dropdown menus in discord.py?
Current code:
@bot.command()
async def roles(ctx):
await ctx.send(
"Select Roles",
components = [
Select(
placeholder = "Select something!",
options = [
SelectOption(label = "Member Role", value = "Member"),
SelectOption(label = "Pokemon Master", value = "Pokemon Master")
]
)
]
)
interaction = await bot.wait_for("select_option", timeout=None)
member = interaction.author
role = discord.utils.get(member.guild.roles, name=f'{interaction.values[0]}')
await member.add_roles(role)
await interaction.send(f"Member role has been added!")
Is there other way to do that?
I just started with select menus and buttons
html question:
are <nav> elements only supposed to be used inside <header>?
no
what is the proper semantic use
pretty much this
How to make selection Role dropdown menus in discord.py?
Current code:
@bot.command()
async def roles(ctx):
await ctx.send(
"Select Roles",
components = [
Select(
placeholder = "Select something!",
options = [
SelectOption(label = "Member Role", value = "Member"),
SelectOption(label = "Pokemon Master", value = "Pokemon Master")
]
)
]
)
interaction = await bot.wait_for("select_option", timeout=None)
member = interaction.author
role = discord.utils.get(member.guild.roles, name=f'{interaction.values[0]}')
await member.add_roles(role)
await interaction.send(f"Member role has been added!")
Code help? I want to make selection menus for role selection
Example:
Please send fucking help. This shit is so painful.
https://github.com/AmandaDiscord/ThunderStorm/pull/2
Everything related to maintaining Discord libs fucking sucks
5-6 hours of work 
plenty more work to do
You knew what was coming, Sir!

from discord.ext import commands
import music
cogs = [music]
client = commands.Bot(command_prefix='~', intents = discord.Intents.all())
for i in range(len(cogs)):
cogs[i].setup(client```
idk what the error is
alright
You first have to start by picking a programming language
then learning the programming language first
then go on learning the librarys
but where?
documents
I'd recommend pythoin
okay
i just clicked python.org
where do i find progamming languages
i found it
The words python and recommend in one sentence should be a banable offense

Damn you got me 
_sentence is offline due technical difficulties _
omg you leaked your env variables !1! 
with total of 15 minutes javascript tutorials 
wait, honestly wish you could do that
you probably can
that's what they did
wait
Oh
lmfao
there has to be a better way
like yea exporting an object
but like of parsing comments
but y tho that's not what comments are for
use NLP to figure out if the file claims to have an admin only command in its comments




I want to optimize the execution times of my methods and so far they take 600ms, of which 480ms are due to calling a method of a coworker 
hahah
(only available in embeds)
yeah
Which is, guess in an embed

Also fields don’t have a description, just a name and value 


and to save storage the comments are in base65535
I got 2.5k error as this
@earnest phoenix your token is leaked
Not
reset it and don't start the bot
I regenerated
And still error is going
which djs version is it?
Latest
13.3.1
the error looks similar like node-fetch ones,but i have noidea how you can resolve it,maybe you can ask at djs support server
maybe you can try switching to detritus
They are dumbasses saying only thanks for you your token
I hope you are joking
not that
typical discord.js user behavior
@earnest phoenix
Dont have time to change all codes
rip,i am sure tim knows the solution
It happened after i updated to djs v13.3.1
Use inline fields
Oh wait, u want it to be displayed like dank memer?
Use description

.setTitle(`${user.username}'s balance`)
.setDescription (`**Wallet**: ${wallet}`)
It does
check if you have an extra space at the end of your key
its coming from a webhook, check if the parameters are correct when you create the webhook
how to make slash command embeds
hmm just interaction.reply(embeds)
@dense flame
thanks
Bot was online and responding messages
It fixed when i reset token a few times
But cant be sure because it happened by itself
Damn its being again
How can you remove a specific element gotten from array.find
ex: ```js
var item = array.find(your shit here)
item.(what here???)
I found a solution
but filter returns a new array, it doesnt manipulate the array its getting called on
fair enough
in case you need to use the item you're filtering before you remove it from the array, array.find is "referentially stable" meaning you can do comparisons between 2 objects
const array = [{}, {}, {}]
const thing = array.find(somePredicate)
const newArray = array.filter(elem => elem !== thing)
and it'll remove that object you found

its so dumb
i ran the VS Performance Profiler and the left column is the execution time of my program (in ms) with a coworkers method and the right column is without
how are we supposed to know if it's valid-
I regenerated token copied pasted to token env in replit envs and i runned to bot and it worked and after some while it started to erroring
So itsnt about token string or command
Djs node fetch is shit
Thats all
Or djs 13 cant run with node 17
But they only wasting my time instead of helping
Thats why i am out of rage
well, as he said, the token is not valid
check if the token you see in the error is the same token you have in your env
const index = array.findIndex(your shit here);
array.splice(index, 1);
My deleteguild event sends that the bot left a undefined why that?
broken guilds
I added
if(!guild) {
return;
}
What is this?
Ok i will try it
!guild || !guild.available
yea worked ty bro
.....
If my token is invalid HOW THİS FUCKİN BOT IS WORKİNG
did you check what i said?
Yes
and?
And i dont think my ctrl + c and ctrl + v is broken
thats not what im saying
are you sure the token that your error is showing is exactly the same as your token?
because your code could somehow be breaking the token
making it not valid
the the code where you create your webhooks
Line 37
where did you get the webhook token from?
From my secret zone channel's integrations
you copied the webhook url right?
what page
When you googled url you get a page
??
that has nothing to do with google lol
but anyway, you can simply take the token from the url itself, its the same thing
so guysss my site is acting kinda weird, sometimes it hits me with this
https://discord.com/api/webhooks/906212400607412224/VUTm6OVd8l6SXO0OAKOFwEFW6S6TIeAFmRNmgdzd4KKsvEmSy4kKCczRreFINNZ2RY_V
^ this is the token
it's localhost
Yes i know
Take away s from https
This way comes more easy
anyway
check your env file or whatever
and make sure the webhook token there is correct
legend 😂
Yes there isnt
I am sure
Look there isnt
hidden space at the end in my env
what about hidden newline
Whats it
-b-
K1wtj0X9vS0nGLi
\n
20
oki
tim looks like he's doing a bit of trolling and I can't unsee it
Rate my yandere dev skills
uhh isn't the user level card supposed to show the user pfp too?
so how can you just send an imgur link
throw new TypeError('CLIENT_MISSING_INTENTS');
^
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
?
const Discord = require('discord.js')
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
its not for usercard
The FLAGS are ints and I'm pretty sure ClientOptions.intents only accepts an int or an Array of strings. Not an Array of ints. But that may be incorrect.
/ 10
@opaque acorn
it checks rank and level from esportal
Max level is 20 there
ok
Nah, it's correct
Discord.js is weird
Probably just passing them to the wrong client?"
my yandere dev code does this
im trying to upgrade to v13
uses api to check those stats and have some image stuff
is hard
Hi, how can I make it so that it's NOT case sensitive?
if (message.author.id === "ID") {
for(var i = 0; i < message.embeds.length; i++) {
if(message.embeds[i].title.includes(`trigger text`)) {
message.delete();
}
}
}``` Currently, the bot reads the embed, but only deletes the message if the title hasn't been written with caps. I'd like to make it delete the message if the title includes the trigger text, whether it's been written with caps or not
did you save the file? the code is correct
it isnt
autosave
show full error
discord.js
title.toLowerCase()
I tried that but it didn't seem to work
Will try again though
show what you tried
if(message.embeds[i].title.toLoweCase().includes(`trigger text`)) {
toLowe?
throw new TypeError('CLIENT_MISSING_INTENTS');
^
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (/app/node_modules/discord.js/src/client/Client.js:544:13)
at new Client (/app/node_modules/discord.js/src/client/Client.js:73:10)
at Object.<anonymous> (/app/events/guild/message.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at load_dir (/app/handlers/event_handler.js:10:21) {
[Symbol(code)]: 'CLIENT_MISSING_INTENTS'
}
whats message.js
and why are you creating a client there
weird that it didn't display any error in the console
maybe the error was catched and never logged
Probably just passing them to the wrong client?"
a
b
xd
weeb
shady ads
const { client } = require('/app/index.js') ?
But... why....

CP ?
the files will never finish loading because they are all waiting for the other to load in a circle
heretic
You should require a module that multiple modules require and export an Object from that file and then Object.assign necessary properties to that file
I’m just looking out for my files’ rights 🤬
They need to be happy files
thanks
Keep in mind happy little accidents can always happen
if you need to access client you can easily do it through every single discord.js object, for example message.client
The more circular dependencies, the happier your files will be :)
you dont ever need to export client
I export it anyways because I need references outside of events
not over there but on this link https://discordbots.org/api/docs#mybots
The site has moved to https://docs.top.gg/
but i am using top.gg vote mandatory command this error
UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
at IncomingMessage.<anonymous> (C:\Users\MSI\Desktop\sekunda my bot\node_modules\dblapi.js\src\index.js:118:25)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1317:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(node:10180) 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:10180) [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.
(node:10180) UnhandledPromiseRejectionWarning:
Well the question was:
how do i find out my bot's token on top.gg
You need to provide your token in the header of your request
Explained on the first page
also
dblapi.js is deprecated
I asked for the token because that command wanted it.
nice thank
👍
What do you mean by command?
What are you trying to do? A command for voters only?
anyone needs to vote on top.gg to use a command
You send a request to the topgg API then, saving all voters in your database or setup webhooks, receiving "live" if somebody votes which you need to store in your database as well.
If somebody runs your command, then access your database to check if he has voted.
And consider caching the voters after fetch your database.
example : https://discordbots.org/api/docs#mybots it said top.gg bot token here but they removed it
Your taken can be found here as I mentioned before
Edit your bot, left menu, Webhooks
Visit topgg, login, edit your bot, left menu, Webhooks -> Token
every 60 seconds in Africa humanity loses 69 trillion social credits
ok
imagine living in a country with social credits lmao
imagine living in a tech support country


Dont worry i will fix it at sometime and use looping
bruhhh
all things are ok but a user is having trouble with his profile
and maybe another user but i don't kniow
his profile doesn't refresh
with quick.db
any other quick.db-like dbs? i'm having problems
ok
[].push({
arg.name: gotArg.value
)};
```Hey, the thing above doesn't work for some reason. I've tried everything I could but I cannot find a solution. Anyone got any ideas?
You are missing a )
No actually you've swapped the places of the ) and }
it should be })
Also why not just
[{ arg.name: gotArg.value }]
Doesn't work?
Holy sh-
Uh oh
My connection is not private, cool
Gotta get a new certificate :(
just send the image here
certificate invalid lul
alr
yeah sorry lol
I'll try. Thanks.
TIM, that's you? 😂
Oh lmao I completely glossed over the property name
Holy shit it worked!
I didn't even know. 
Thanks!!
its always been me lol
Your PFP changed since I usually know it's you from your PFP. 😂
Yup, but different PFP. 
I finally finished learning Regular Expressions.
Now, soon, debugging. 👏
Basics. 
you never finish learning regex
.. and will never. 
:^)
I learnt what I had to learn in regexes.
When will someone make a readable regex
31 lessons of Regexes, damn.
On the bright side, you now know 0.00056% of regex 
Hmmm that's actually not a bad idea, I could make a typescript transformer which makes regex more readable somehow
So you would get the exact same performance from regex
make a lang that compiles to regex
Actually not a bad idea
Or regex to human readable code
That would help anyone who doesn’t understand regex
(vise versa)
that already exists
there are a few websites that break down regex step by step with explanations of each block
Nah that’s absolutely not what I mean
regex to lolcode?
I will explain what I mean tomorrow when I’m back at PC
let string = 'h a m o o d i h a j j i r i';
let removeSpaces = /\S+/g;
const result = string.match(removeSpaces);
let name = "";
result.map(x => name += x);
let capitaliseH = /[h]/g;
name = name.replace(capitaliseH, 'H')
console.log(name); // HamoodiHajjiri
Look at this, bruh.
machine learning
var regex = RegexBuilder()
.addCaptureGrouo()
.contains("[a-zA-Z]")
.minLength(4)
.maxLength(8)
.isGlobal(true)
```@quartz kindle

Converting to an actual regex
Still close to regex but that’s much more readable
regex builder is actually great only if there was an online version that straight up gives you the resulting regex
Imagine that class with its tons of methods covering as much as possible

Might actually be a good idea for a library
_can smell all the donations already _
Tim you wanna team up?
You code it and I’m doing the marketing.
You will get 10% of all donations.
<html><small><small><small><verysmall>if they ever reach 10000/month
give me a 5% cut and I'll plan the optimal architecture
Get off my profit! You can get 5% of Tims
const fetchedLogs = await member.guild.fetchAuditLogs({
limit: 1,
type: 'MEMBER_KICK',
});
// Since there's only 1 audit log entry in this collection, grab the first one
const kickLog = fetchedLogs.entries.first();
const { executor, target } = kickLog;
let RemoveEmbed;
if (kickLog && target.id == member.id) {
<kickembed>
} else {
<leaveembed>
}
Can u show the code
Wait
const fetchedLogs = await member.guild.fetchAuditLogs({
limit: 1,
type: 'MEMBER_KICK',
});
// Since there's only 1 audit log entry in this collection, grab the first one
const kickLog = fetchedLogs.entries.first();
const { executor, target } = kickLog;
let RemoveEmbed;
if (kickLog && target.id == member.id) {
<kickembed>
} else {
<leaveembed>
}
U wanna maki antikick with mongoose?
Antikick?
This code is for when member leaves check if it kicked and sends the kick embed and it’s not send it as leave embed
let Audit = await member.guild.fetchAuditLogs({
type:"MEMBER_KICK"
})
let logs = await Audit.entries.first();
let {executor,target} = logs;
C:\Users\WolfWolfy\Downloads\Wolfy-master\Wolfy-master\events\GuildMemberRemove.js:37
const { executor, target } = kickLog;
^
TypeError: Cannot destructure property 'executor' of 'kickLog' as it is undefined.
at Object.execute (C:\Users\WolfWolfy\Downloads\Wolfy-master\Wolfy-master\events\GuildMemberRemove.js:37:17)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
What was the problem?
I know, the error is saying this 😂
U can use this
client.on('guildMemberRemove', async member => {
const fetchedLogs = await member.guild.fetchAuditLogs({
limit: 1,
type: 'MEMBER_KICK',
});
// Since we only have 1 audit log entry in this collection, we can simply grab the first one
const kickLog = fetchedLogs.entries.first();
// Let's perform a sanity check here and make sure we got *something*
if (!kickLog) return console.log(`${member.user.tag} left the guild, most likely of their own will.`);
// We now grab the user object of the person who kicked our member
// Let us also grab the target of this action to double check things
const { executor, target } = kickLog;
// And now we can update our output with a bit more information
// We will also run a check to make sure the log we got was for the same kicked member
if (target.id === member.id) {
console.log(`${member.user.tag} left the guild`);
} else {
console.log(`${member.user.tag} left the guild, audit log fetch was inconclusive.`);
}
});
But I don’t know the reason it’s sometimes working
Use this its working
Oh okay ty
If u wann aknow who kick u can use this
client.on('guildMemberRemove', async member => {
const fetchedLogs = await member.guild.fetchAuditLogs({
limit: 1,
type: 'MEMBER_KICK',
});
// Since we only have 1 audit log entry in this collection, we can simply grab the first one
const kickLog = fetchedLogs.entries.first();
// Let's perform a sanity check here and make sure we got *something*
if (!kickLog) return console.log(`${member.user.tag} left the guild, most likely of their own will.`);
// We now grab the user object of the person who kicked our member
// Let us also grab the target of this action to double check things
const { executor, target } = kickLog;
if (kickLog.createdAt < member.joinedAt) {
return console.log(`${member.user.tag} left the guild, most likely of their own will.`);
}
// And now we can update our output with a bit more information
// We will also run a check to make sure the log we got was for the same kicked member
if (target.id === member.id) {
console.log(`${member.user.tag} left the guild; kicked by ${executor.tag}?`);
} else {
console.log(`${member.user.tag} left the guild, audit log fetch was inconclusive.`);
}
});
can anyone explain me the discord intents? my bot got 75+ servers so i'm making the form but at last it says to pick intents. I set my bot's presence and there i use the server size and user size and i read that other things like getting ID is not necessary for intents
i want to be sure that server & user size use intent?
hi
so i have ngninx set up
i had a friend do it for me
and idk how i can add another instance
i made the sites enabled thing and reloaded it but its still not workiung
any ideas?
You messed up the config then
umm
the other ones work?
like i completely copied the file
and just edited the domains and localhost port
Does the domain even has your webservers IP as target?
yeah
Changed when?
Check the dns records
but like this happened for many domains ive tried
yeah
like even old ones
already pointed to webserver
Hmm unfortunately I’m not fluent with the NGINX syntax if that’s really an issue of the webserver
hmm
lik
like
the domains my friend set up work
like if i edit THAT one for that specific domain
it works
but not for new ones
@boreal iron
Anyone know how to get VSC to stop using ~ for auto imports and use relative pathing instead? Not sure why it suddenly changed to this whole ~ thing, but it breaks and it's annoying to replace that line every time
What doesn’t work as supposed to again?
adding new files
like of different domains
if i do stuff with the 2 domains its configured with (my friend did) it works
but if i add any new one
that one just doesnt work
wait
@boreal iron it gives a too many redirections error
wait
wrong one
oops
listen 80;
listen [::]:80;
server_name mydomain.com www.mydomain.com;
return 302 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
server_name mydomain.com www.mydomain.com;
add_header X-XSS-Protection "1; mode=block";
location / {
include proxy_params;
proxy_pass http://localhost:3401;
}
}```
here
@boreal iron
in the actual file it is my real domain btw
Why do you proxy the domain to another webserver?
yeah
Ok got it
i might have an idea why its not workiong
Tbh even if I’m not into NGINX too well the config looks about fine
Guess it’s your app
hmm
i mean yeah
i think its the app too
but then why doesnt it work when i try it with other things?
I wonder there’s no reverse proxy config
If you don’t use a proxy instead just assign a documentroot even without files in there, then there shouldn’t be any redirection error anymore
Which would prove it’s your app
Neither I 
Lemme take a look
i dont need to add the config for nginx anywhere else right?
server_name testsite.com;
root /var/www/testsite.com;
location / {
try_files $uri /index.html;
}
i can try making the app like extremely simple
Adjust the paths
Check if that causes a redirection error
or listen?
Yeah it’s inside
No inside your SSL one
yeye ok
The first one only redirects http to https
Replace the proxy config with the lines I wrote except server name
You have that already of course
in root i put the file path?
Yeah some path including an index html/php whatever
Just to test
Oh I see it’s far more easier
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/example.com;
index index.html;
server_name example.com;
}```
Just copy the two lines root and index to test the redirection replacing your proxy config
if you're just serving static files you might as well go with something like netlify or cloudflare pages
its an app, not static
are you putting nginx in front of the app webserver just for static files?
I mean serving specifically static files from nginx is actually a good idea
but usually if you have something like a node webserver you'd simply proxy_pass the connection through to your app instead
i dont know nginx at all
what's your backend
you got gunicorn in front of that?
ok yeah so just proxy_pass the connection to it
uhh
i have no idea how to do any of this lmao
i just reuse the template my friend made
you're binding hypercorn to a unix socket right
how are you running your app?
hypercorn
ok but like how are you getting it to run, what's the command?
hypercorn --workers 3 --bind localhost:3401 -m 007 asgi:app
oh over a port ok
basically you just do
upstream quart {
server http://localhost:3401;
}
server {
server_name yourname.com;
# stuff here
location / {
proxy_pass http://quart;
}
}
to send incoming connections that match your domain into your app
you might also want to add some headers before you send the connection to your backend
uh aight
@woeful pike ```server {
listen 80;
listen [::]:80;
server_name domain.com www.domain.com;
return 302 https://$server_name$request_uri;
}
server {
server_name domain.com;
stuff here
location / {
proxy_pass http://localhost:3401;
}
}
I hope that https redirect is autogenerated by certbot
don't worry about the top stuff
yeye
is that correct tho?
its nginx: [warn] conflicting server name "nerded.io" on 0.0.0.0:80, ignored
sorry for being dumb lol
you can delete the first server declaration. If you haven't even set up your server you shouldn't be dealing with https redirects
im literally like stupid af when it comes to linux lo
the server itself is done
like the app
i just need to RUN it
wdym? you can curl http://localhost:3401 on your host machine when you have hypercorn running, no?
how do i check the discordjs version?
the nginx part is just to expose the local server to the world
to be honest you probably don't even need nginx for this
Oh I see you found somebody dealing with NGINX
but it just makes things easier to work with
you can't run your app with hypercorn?
The issue was in your app, right?
you just need one server declaration with server_name and a proxy_pass directive that points to hypercorn
Yeah but like I assumed the config wasn’t the issue it was ok
you can set up https on top of that once you get that working
or just use cloudflare and forget about it
how do i check the discordjs version?
yeah
but HOW
ill try
I literally showed you
i think i might now
know
yeah
yeah yeah
i just rememberd
hold on]
server_name domain.com;
# stuff here
location / {
proxy_pass http://localhost:3401;
}
}``` this should work?
if nginx -t checks out and you've run nginx reload yes
it gives this
nginx: [warn] conflicting server name "nerded.io" on 0.0.0.0:80, ignored
its fine right?
you have 2 servers with the same name
i dont
oh
might be on top?
the https stuff?
there
commented it out
LETS GO
IT WORKS
I LOVE YOu
{
let m = "./cards"
for (const key in m){
console.log(m[key])
}
}
```tried getting the images instead of colors...
ALLL
yeah any fix lmao
ay nice
now go download https://certbot.eff.org/
He already has other SSL setups
or just turn on the cloudflare orange cloud
how would i actually go into a folder and loop through the images?
oh does he? ok
He said he copied the config file of one of his other domains working well
And it included the SSL host and redirection
Somebody did it for him
Yeah nothing to say against that
I do as well
What I meant was if somebody set it up for him certbot may is already configured
But that redirection error he had can’t be caused by a missing SSL cert, if so NGINX should have logged something I guess
At least Apache would do
I’m not really into NGINX unfortunately
And I’m also driving 
Like always
i've been using acme.sh instead
because they had ECDH certs before certbot got them
oh 👀
actually not sure if certbot even supports them yet
also, acme.sh doesnt use letsencrypt by default
they use zerossl
not sure whats the reasoning or which one is better than the other tho
certbot has got actually really good, also supporting Windows now and it works well
Also the fact you can configure like anything yourself, set pre hooks and after, passing the environment vars to your code etc. is nice
No plugins ever needed
If you like to do things on ur own
ye
pretty sure acme also does all that
also, the entire acme.sh is a single 7.5k line sh file with zero dependencies
pretty crazy
I have an embed, but want to add a mention in the Embed title. However, the mention is displayed as a string. How would I fix this?
const pendingEmbed = new Discord.MessageEmbed()
.setColor('#10D365')
.setTitle(`<@` + message.author.id + `> ` + '\'s Party: ')
.setDescription('• ' + parties[i][1])
.setTimestamp()
message.channel.send({ ephemeral: true, embeds: [pendingEmbed] });
just do message.author.mention instead
pretty sure title doesnt support mention
or do js .setTitle(message.author.name + '\'s Party: ')
Why not use both and use some custom TLS authority 
I still don't know what the point of paying for TLS anymore is

I mean cloudflare is adding support to use other authorities outside of just themselves which is neet
Although If i remember the tests were just either them or LE
aight thx
whats the difference between LE and other authorities anyway?
arent they all pretty much the same?
other than some of them being valid for 1 year
Well LE is most likely accepted anywhere
most of them are
Most yeah but not all
i mean, whatever the authority is, all the browser needs to do is contact the authority servers, whatever they may be, no?
Some apps even require to import LE root cert to accept it manually
apparently zerossl has better compatibility than LE
Jokes on me, never heard of zerossl
they also require you to have their CAA in your DNS
Huh signed by another authority Wut
What then, is cross-signing? Cross-signing is simply when multiple valid paths exist between a root certificate and a node certificate. This can be advantageous for a number of reasons. Sometimes, a certificate in the chain expires. While it would be nice if every piece of software was frequently updated and shipped an up-to-date copy of the root CA store, this is not the case in the real world. Many devices, for a number of reasons, are not subject to regular updates. Strategically cross-signing intermediate certificates from an older (therefore more likely to be present on the larger subset of devices in the wild) root certificate, “buys some time”. Hopefully by the time the older-still root certificate expires, the device will have been replaced. We can dream, right? Cross-signature is also useful when CAs need to perform maintenance. When vulnerabilities in the SHA-1 hashing algorithm were found, CAs issued new intermediate certificates which were able to cross-sign for yet more intermediates lower down in the chain. This allows, at least in theory, trust to continue seamlessly. In reality, this switcharoo working in practice is highly dependent on both software implementation and administrator configuration.
The main determining factor for whether a platform can validate Let’s Encrypt certificates is whether that platform trusts ISRG’s “ISRG Root X1” certificate. Prior to September 2021, some platforms could validate our certificates even though they don’t include ISRG Root X1, because they trusted IdenTrust’s “DST Root CA X3” certificate. From October 2021 onwards, only those platforms that trust ISRG Root X1 will validate Let’s Encrypt certificates (with the exception of Android).
Yeah looks amazing on mobile especially if you’re driving
xD
from what i understand, cross signing means the cert can be validated by multiple root certs
Didn’t know that exists tho
zerossl uses UserTrust RSA and AAA root certs
letsencrypt uses ISRG root cert
until october 2021 they also used DST root CA x3
but now they no longer do, its ISRG only
Yeah since ISRG is LE basically
yeah
they are basically self contained now, and for this reason a bit less compatible with older systems
Yeah true
zerossl maintains strong compatibility with older systems by using these other well established root certs
ISRG Root X2 (new ECDSA root) - coming soon
they still dont have ECDSA support
.>
Good to know that’s a thing
Not working with older systems anymore but you never know
ye
honestly it doesnt even matter
lots of other shit will break before they even try using your websites on those systems
ECDSA is hot tho
Some of my software doesn’t support that anyways
rip
I remember when Hetzner launched their new DNS console and people couldn’t add TXT records anymore using AES2048 bit keys or more due their length
lel
At least they finally got a DNS API
Oh they also got a robot and cloud server API if you didn’t know that
Pretty good for getting the status or automating failover etc
If you even need that
If it’s a promise then it needs to be awaited
the only failover i was interested in was dns A record failover with multiple vps's
but im not gonna go into that rn anyway
i've never had any issues whatsoever with any of my vps's
thats not good is it 
so its a pretty far fetched worry
you are being hax00red
Hmm if you don’t wanna pay for it but need a bit redundancy I can actually add an record if you need to
lol what
nah i dont even have the infrastucture to do it
My system is online for so many years
ah i fixed it
@boreal ironever user hetzner's load balancer? how does it work?
it was on a check firewall option on Krystal Hosting panel 
do they like give you a root IP and some rules to proxy to multiple addresses?
Oh you mean something different then, thought you mean you just need a redundant DNS record
Nah don’t got that many requests
Simply click on it and configure it without clicking order
Should be self explaining I think
not sure i'd want to date someone who spends 24 hours on the road
Shut up, 1 hour is WC and another one is cooking NOT BURNING
i meant like, if i have 2 vps's on two different IPs, a way to make the DNS record failover to the second vps if the first one is not responsive
the A record, that directs the domain to the ip
Brb need to restart discord
i know you can do that with SRV records, but not with A records afaik
Chats fucked up
i burned another thing today
.>
it wasnt that bad of a burn as the other one tho
most of it was still in good shape
Oh I’m not sure about that but if the requests timed out and another one is incoming it should automatically being redirected to your second VPS
If you choose round robin
Just black not deep black

The load balancer may recognize the status code and will in case of a timeout automatically send requests to your 2nd target
But I haven’t tested this yet
That’s a good question for the forum
damn it’s getting cold outside
fucking global warming
meanwhile world leaders use 400 private jets to attend climate change conference
Yeah
But it’s been used in a good manner
You can’t compare that with your evil manner to fly into a different country once in your life
Finally you got it
Anyways maybe I can test the load balancer at the weekend
Shutting down one DNS server
If I got some time
You better don’t use a JSON database in the first place
People don’t actually like to support that "bad practice "
is the file being written multiple times at once?
are you running that code multiple times in a short time?
file writes are not atomic, multiple writers will interfere with each other
Is there even a blocking FS feature?
there are two ways to make the writes work atomically:
- use writeFileSync instead of writeFile (only works if you're using a single process)
- write to a temporary file with a random name, then rename the file
depends on your needs
i use sqlite (better-sqlite3)
sqlite will do
the only thing sqlite would not be good for is if you need hundreds of writes per second from multiple processes at once
Or if the whole data set is getting damn large
i know the feel
Stop watching YouTube and 9gag
A timeout wouldn’t change much
Calling the function 3 times for example would result in 3 timeouts ending at the same time
If a write process ever takes a little longer your whole system is fucked up
Hello, does anyone know of any good API's to get images from.







